Tweaks to make clang-format produce better code
This CL contains minor tweaks to the style of our code to make clang-format produce prettier code.
Bug: b/144825072
Change-Id: I821ecd3b9f408a4034992c2cc7ece2ef8552fe08
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/39314
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Device/QuadRasterizer.cpp b/src/Device/QuadRasterizer.cpp
index 10b9e73..5b5c499 100644
--- a/src/Device/QuadRasterizer.cpp
+++ b/src/Device/QuadRasterizer.cpp
@@ -53,7 +53,7 @@
primitive += sizeof(Primitive) * state.multiSample;
count--;
}
- Until(count == 0)
+ Until(count == 0);
if(state.occlusionEnabled)
{
@@ -226,7 +226,7 @@
y += 2 * clusterCount;
}
- Until(y >= yMax)
+ Until(y >= yMax);
}
Float4 QuadRasterizer::interpolate(Float4 &x, Float4 &D, Float4 &rhw, Pointer<Byte> planeEquation, bool flat, bool perspective, bool clamp)
diff --git a/src/Pipeline/SamplerCore.cpp b/src/Pipeline/SamplerCore.cpp
index 0178b84..86228a5 100644
--- a/src/Pipeline/SamplerCore.cpp
+++ b/src/Pipeline/SamplerCore.cpp
@@ -435,7 +435,7 @@
i++;
}
- Until(i >= a)
+ Until(i >= a);
if(hasUnsignedTextureComponent(0)) c.x = cSum.x; else c.x = AddSat(cSum.x, cSum.x);
if(hasUnsignedTextureComponent(1)) c.y = cSum.y; else c.y = AddSat(cSum.y, cSum.y);
@@ -868,7 +868,7 @@
i++;
}
- Until(i >= a)
+ Until(i >= a);
c.x = cSum.x;
c.y = cSum.y;
diff --git a/src/Pipeline/SetupRoutine.cpp b/src/Pipeline/SetupRoutine.cpp
index c9e643d..9288565 100644
--- a/src/Pipeline/SetupRoutine.cpp
+++ b/src/Pipeline/SetupRoutine.cpp
@@ -143,7 +143,7 @@
i++;
}
- Until(i >= n)
+ Until(i >= n);
}
// Vertical range
@@ -159,7 +159,7 @@
i++;
}
- Until(i >= n)
+ Until(i >= n);
constexpr int subPixB = vk::SUBPIXEL_PRECISION_BITS;
constexpr int subPixM = vk::SUBPIXEL_PRECISION_MASK;
@@ -207,7 +207,7 @@
i++;
}
- Until(i >= n)
+ Until(i >= n);
Pointer<Byte> leftEdge = Pointer<Byte>(primitive + OFFSET(Primitive,outline->left)) + q * sizeof(Primitive);
Pointer<Byte> rightEdge = Pointer<Byte>(primitive + OFFSET(Primitive,outline->right)) + q * sizeof(Primitive);
@@ -238,7 +238,7 @@
i++;
}
- Until(i >= n)
+ Until(i >= n);
}
if(state.multiSample == 1)
@@ -581,7 +581,7 @@
y++;
}
- Until(y >= y2)
+ Until(y >= y2);
}
}
}
diff --git a/src/Pipeline/ShaderCore.hpp b/src/Pipeline/ShaderCore.hpp
index 8ac2cc2..52522a5 100644
--- a/src/Pipeline/ShaderCore.hpp
+++ b/src/Pipeline/ShaderCore.hpp
@@ -497,10 +497,10 @@
{
static std::string fmt(const sw::Vector4f& v)
{
- return "[x: " + PrintValue::fmt(v.x) + ","
- " y: " + PrintValue::fmt(v.y) + ","
- " z: " + PrintValue::fmt(v.z) + ","
- " w: " + PrintValue::fmt(v.w) + "]";
+ return "[x: " + PrintValue::fmt(v.x) +
+ ", y: " + PrintValue::fmt(v.y) +
+ ", z: " + PrintValue::fmt(v.z) +
+ ", w: " + PrintValue::fmt(v.w) + "]";
}
static std::vector<rr::Value*> val(const sw::Vector4f& v)
@@ -512,10 +512,10 @@
{
static std::string fmt(const sw::Vector4s& v)
{
- return "[x: " + PrintValue::fmt(v.x) + ","
- " y: " + PrintValue::fmt(v.y) + ","
- " z: " + PrintValue::fmt(v.z) + ","
- " w: " + PrintValue::fmt(v.w) + "]";
+ return "[x: " + PrintValue::fmt(v.x) +
+ ", y: " + PrintValue::fmt(v.y) +
+ ", z: " + PrintValue::fmt(v.z) +
+ ", w: " + PrintValue::fmt(v.w) + "]";
}
static std::vector<rr::Value*> val(const sw::Vector4s& v)
diff --git a/src/Pipeline/VertexRoutine.cpp b/src/Pipeline/VertexRoutine.cpp
index 6fea0cb..8bf0218 100644
--- a/src/Pipeline/VertexRoutine.cpp
+++ b/src/Pipeline/VertexRoutine.cpp
@@ -79,7 +79,7 @@
batch = Pointer<UInt>(Pointer<Byte>(batch) + sizeof(uint32_t));
vertexCount--;
}
- Until(vertexCount == 0)
+ Until(vertexCount == 0);
Return();
}
diff --git a/src/Reactor/Reactor.hpp b/src/Reactor/Reactor.hpp
index f0b18b5..42cbb7c 100644
--- a/src/Reactor/Reactor.hpp
+++ b/src/Reactor/Reactor.hpp
@@ -3458,7 +3458,7 @@
BasicBlock *end__ = Nucleus::createBasicBlock(); \
Nucleus::createCondBr((cond).value, end__, body__); \
Nucleus::setInsertBlock(end__); \
-}
+} do {} while (false) // Require a semi-colon at the end of the Until()
enum {IF_BLOCK__, ELSE_CLAUSE__, ELSE_BLOCK__, IFELSE_NUM__};
diff --git a/src/Renderer/QuadRasterizer.cpp b/src/Renderer/QuadRasterizer.cpp
index a16c457..3f711c0 100644
--- a/src/Renderer/QuadRasterizer.cpp
+++ b/src/Renderer/QuadRasterizer.cpp
@@ -69,7 +69,7 @@
primitive += sizeof(Primitive) * state.multiSample;
count--;
}
- Until(count == 0)
+ Until(count == 0);
if(state.occlusionEnabled)
{
@@ -313,7 +313,7 @@
y += 2 * clusterCount;
}
- Until(y >= yMax)
+ Until(y >= yMax);
}
Float4 QuadRasterizer::interpolate(Float4 &x, Float4 &D, Float4 &rhw, Pointer<Byte> planeEquation, bool flat, bool perspective, bool clamp)
diff --git a/src/Shader/SamplerCore.cpp b/src/Shader/SamplerCore.cpp
index 5f9888c..5690cfa 100644
--- a/src/Shader/SamplerCore.cpp
+++ b/src/Shader/SamplerCore.cpp
@@ -714,7 +714,7 @@
i++;
}
- Until(i >= a)
+ Until(i >= a);
if(hasUnsignedTextureComponent(0)) c.x = cSum.x; else c.x = AddSat(cSum.x, cSum.x);
if(hasUnsignedTextureComponent(1)) c.y = cSum.y; else c.y = AddSat(cSum.y, cSum.y);
@@ -1184,7 +1184,7 @@
i++;
}
- Until(i >= a)
+ Until(i >= a);
c.x = cSum.x;
c.y = cSum.y;
diff --git a/src/Shader/SetupRoutine.cpp b/src/Shader/SetupRoutine.cpp
index 4f2955c..14d6b76 100644
--- a/src/Shader/SetupRoutine.cpp
+++ b/src/Shader/SetupRoutine.cpp
@@ -160,7 +160,7 @@
i++;
}
- Until(i >= n)
+ Until(i >= n);
}
// Vertical range
@@ -176,7 +176,7 @@
i++;
}
- Until(i >= n)
+ Until(i >= n);
if(state.multiSample > 1)
{
@@ -220,7 +220,7 @@
i++;
}
- Until(i >= n)
+ Until(i >= n);
Pointer<Byte> leftEdge = Pointer<Byte>(primitive + OFFSET(Primitive,outline->left)) + q * sizeof(Primitive);
Pointer<Byte> rightEdge = Pointer<Byte>(primitive + OFFSET(Primitive,outline->right)) + q * sizeof(Primitive);
@@ -251,7 +251,7 @@
i++;
}
- Until(i >= n)
+ Until(i >= n);
}
if(state.multiSample == 1)
@@ -620,7 +620,7 @@
y++;
}
- Until(y >= y2)
+ Until(y >= y2);
}
}
}
diff --git a/src/Shader/ShaderCore.hpp b/src/Shader/ShaderCore.hpp
index dca1003..fd1ccb7 100644
--- a/src/Shader/ShaderCore.hpp
+++ b/src/Shader/ShaderCore.hpp
@@ -388,10 +388,10 @@
{
static std::string fmt(const sw::Vector4f& v)
{
- return "[x: " + PrintValue::fmt(v.x) + ","
- " y: " + PrintValue::fmt(v.y) + ","
- " z: " + PrintValue::fmt(v.z) + ","
- " w: " + PrintValue::fmt(v.w) + "]";
+ return "[x: " + PrintValue::fmt(v.x) +
+ ", y: " + PrintValue::fmt(v.y) +
+ ", z: " + PrintValue::fmt(v.z) +
+ ", w: " + PrintValue::fmt(v.w) + "]";
}
static std::vector<rr::Value*> val(const sw::Vector4f& v)
@@ -403,10 +403,10 @@
{
static std::string fmt(const sw::Vector4s& v)
{
- return "[x: " + PrintValue::fmt(v.x) + ","
- " y: " + PrintValue::fmt(v.y) + ","
- " z: " + PrintValue::fmt(v.z) + ","
- " w: " + PrintValue::fmt(v.w) + "]";
+ return "[x: " + PrintValue::fmt(v.x) +
+ ", y: " + PrintValue::fmt(v.y) +
+ ", z: " + PrintValue::fmt(v.z) +
+ ", w: " + PrintValue::fmt(v.w) + "]";
}
static std::vector<rr::Value*> val(const sw::Vector4s& v)
diff --git a/src/Shader/VertexRoutine.cpp b/src/Shader/VertexRoutine.cpp
index 9b8d336..addaba7 100644
--- a/src/Shader/VertexRoutine.cpp
+++ b/src/Shader/VertexRoutine.cpp
@@ -90,7 +90,7 @@
batch += sizeof(unsigned int);
vertexCount--;
}
- Until(vertexCount == 0)
+ Until(vertexCount == 0);
Return();
}
diff --git a/src/Vulkan/VkPhysicalDevice.cpp b/src/Vulkan/VkPhysicalDevice.cpp
index 5dac6ff..92d6b9a 100644
--- a/src/Vulkan/VkPhysicalDevice.cpp
+++ b/src/Vulkan/VkPhysicalDevice.cpp
@@ -229,7 +229,7 @@
16384, // maxComputeSharedMemorySize
{ 65535, 65535, 65535 }, // maxComputeWorkGroupCount[3]
128, // maxComputeWorkGroupInvocations
- { 128, 128, 64, }, // maxComputeWorkGroupSize[3]
+ { 128, 128, 64 }, // maxComputeWorkGroupSize[3]
vk::SUBPIXEL_PRECISION_BITS, // subPixelPrecisionBits
4, // subTexelPrecisionBits
4, // mipmapPrecisionBits
@@ -853,10 +853,10 @@
{
// vk::MEMORY_TYPE_GENERIC_BIT
{
- VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
- VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
- VK_MEMORY_PROPERTY_HOST_COHERENT_BIT |
- VK_MEMORY_PROPERTY_HOST_CACHED_BIT, // propertyFlags
+ (VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
+ VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
+ VK_MEMORY_PROPERTY_HOST_COHERENT_BIT |
+ VK_MEMORY_PROPERTY_HOST_CACHED_BIT), // propertyFlags
0 // heapIndex
},
},