Commit 71af5936 by Ben Clayton

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/+/39314Tested-by: 's avatarBen Clayton <bclayton@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 11dcf980
...@@ -53,7 +53,7 @@ void QuadRasterizer::generate() ...@@ -53,7 +53,7 @@ void QuadRasterizer::generate()
primitive += sizeof(Primitive) * state.multiSample; primitive += sizeof(Primitive) * state.multiSample;
count--; count--;
} }
Until(count == 0) Until(count == 0);
if(state.occlusionEnabled) if(state.occlusionEnabled)
{ {
...@@ -226,7 +226,7 @@ void QuadRasterizer::rasterize(Int &yMin, Int &yMax) ...@@ -226,7 +226,7 @@ void QuadRasterizer::rasterize(Int &yMin, Int &yMax)
y += 2 * clusterCount; 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) Float4 QuadRasterizer::interpolate(Float4 &x, Float4 &D, Float4 &rhw, Pointer<Byte> planeEquation, bool flat, bool perspective, bool clamp)
......
...@@ -435,7 +435,7 @@ Vector4s SamplerCore::sampleAniso(Pointer<Byte> &texture, Float4 &u, Float4 &v, ...@@ -435,7 +435,7 @@ Vector4s SamplerCore::sampleAniso(Pointer<Byte> &texture, Float4 &u, Float4 &v,
i++; i++;
} }
Until(i >= a) Until(i >= a);
if(hasUnsignedTextureComponent(0)) c.x = cSum.x; else c.x = AddSat(cSum.x, cSum.x); 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); if(hasUnsignedTextureComponent(1)) c.y = cSum.y; else c.y = AddSat(cSum.y, cSum.y);
...@@ -868,7 +868,7 @@ Vector4f SamplerCore::sampleFloatAniso(Pointer<Byte> &texture, Float4 &u, Float4 ...@@ -868,7 +868,7 @@ Vector4f SamplerCore::sampleFloatAniso(Pointer<Byte> &texture, Float4 &u, Float4
i++; i++;
} }
Until(i >= a) Until(i >= a);
c.x = cSum.x; c.x = cSum.x;
c.y = cSum.y; c.y = cSum.y;
......
...@@ -143,7 +143,7 @@ void SetupRoutine::generate() ...@@ -143,7 +143,7 @@ void SetupRoutine::generate()
i++; i++;
} }
Until(i >= n) Until(i >= n);
} }
// Vertical range // Vertical range
...@@ -159,7 +159,7 @@ void SetupRoutine::generate() ...@@ -159,7 +159,7 @@ void SetupRoutine::generate()
i++; i++;
} }
Until(i >= n) Until(i >= n);
constexpr int subPixB = vk::SUBPIXEL_PRECISION_BITS; constexpr int subPixB = vk::SUBPIXEL_PRECISION_BITS;
constexpr int subPixM = vk::SUBPIXEL_PRECISION_MASK; constexpr int subPixM = vk::SUBPIXEL_PRECISION_MASK;
...@@ -207,7 +207,7 @@ void SetupRoutine::generate() ...@@ -207,7 +207,7 @@ void SetupRoutine::generate()
i++; i++;
} }
Until(i >= n) Until(i >= n);
Pointer<Byte> leftEdge = Pointer<Byte>(primitive + OFFSET(Primitive,outline->left)) + q * sizeof(Primitive); 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); Pointer<Byte> rightEdge = Pointer<Byte>(primitive + OFFSET(Primitive,outline->right)) + q * sizeof(Primitive);
...@@ -238,7 +238,7 @@ void SetupRoutine::generate() ...@@ -238,7 +238,7 @@ void SetupRoutine::generate()
i++; i++;
} }
Until(i >= n) Until(i >= n);
} }
if(state.multiSample == 1) if(state.multiSample == 1)
...@@ -581,7 +581,7 @@ void SetupRoutine::edge(Pointer<Byte> &primitive, Pointer<Byte> &data, const Int ...@@ -581,7 +581,7 @@ void SetupRoutine::edge(Pointer<Byte> &primitive, Pointer<Byte> &data, const Int
y++; y++;
} }
Until(y >= y2) Until(y >= y2);
} }
} }
} }
......
...@@ -497,10 +497,10 @@ template <> struct PrintValue::Ty<sw::Vector4f> ...@@ -497,10 +497,10 @@ template <> struct PrintValue::Ty<sw::Vector4f>
{ {
static std::string fmt(const sw::Vector4f& v) static std::string fmt(const sw::Vector4f& v)
{ {
return "[x: " + PrintValue::fmt(v.x) + "," return "[x: " + PrintValue::fmt(v.x) +
" y: " + PrintValue::fmt(v.y) + "," ", y: " + PrintValue::fmt(v.y) +
" z: " + PrintValue::fmt(v.z) + "," ", z: " + PrintValue::fmt(v.z) +
" w: " + PrintValue::fmt(v.w) + "]"; ", w: " + PrintValue::fmt(v.w) + "]";
} }
static std::vector<rr::Value*> val(const sw::Vector4f& v) static std::vector<rr::Value*> val(const sw::Vector4f& v)
...@@ -512,10 +512,10 @@ template <> struct PrintValue::Ty<sw::Vector4s> ...@@ -512,10 +512,10 @@ template <> struct PrintValue::Ty<sw::Vector4s>
{ {
static std::string fmt(const sw::Vector4s& v) static std::string fmt(const sw::Vector4s& v)
{ {
return "[x: " + PrintValue::fmt(v.x) + "," return "[x: " + PrintValue::fmt(v.x) +
" y: " + PrintValue::fmt(v.y) + "," ", y: " + PrintValue::fmt(v.y) +
" z: " + PrintValue::fmt(v.z) + "," ", z: " + PrintValue::fmt(v.z) +
" w: " + PrintValue::fmt(v.w) + "]"; ", w: " + PrintValue::fmt(v.w) + "]";
} }
static std::vector<rr::Value*> val(const sw::Vector4s& v) static std::vector<rr::Value*> val(const sw::Vector4s& v)
......
...@@ -79,7 +79,7 @@ void VertexRoutine::generate() ...@@ -79,7 +79,7 @@ void VertexRoutine::generate()
batch = Pointer<UInt>(Pointer<Byte>(batch) + sizeof(uint32_t)); batch = Pointer<UInt>(Pointer<Byte>(batch) + sizeof(uint32_t));
vertexCount--; vertexCount--;
} }
Until(vertexCount == 0) Until(vertexCount == 0);
Return(); Return();
} }
......
...@@ -3458,7 +3458,7 @@ for(init; for__.setup() && for__.test(cond); inc, for__.end()) ...@@ -3458,7 +3458,7 @@ for(init; for__.setup() && for__.test(cond); inc, for__.end())
BasicBlock *end__ = Nucleus::createBasicBlock(); \ BasicBlock *end__ = Nucleus::createBasicBlock(); \
Nucleus::createCondBr((cond).value, end__, body__); \ Nucleus::createCondBr((cond).value, end__, body__); \
Nucleus::setInsertBlock(end__); \ 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__}; enum {IF_BLOCK__, ELSE_CLAUSE__, ELSE_BLOCK__, IFELSE_NUM__};
......
...@@ -69,7 +69,7 @@ namespace sw ...@@ -69,7 +69,7 @@ namespace sw
primitive += sizeof(Primitive) * state.multiSample; primitive += sizeof(Primitive) * state.multiSample;
count--; count--;
} }
Until(count == 0) Until(count == 0);
if(state.occlusionEnabled) if(state.occlusionEnabled)
{ {
...@@ -313,7 +313,7 @@ namespace sw ...@@ -313,7 +313,7 @@ namespace sw
y += 2 * clusterCount; 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) Float4 QuadRasterizer::interpolate(Float4 &x, Float4 &D, Float4 &rhw, Pointer<Byte> planeEquation, bool flat, bool perspective, bool clamp)
......
...@@ -714,7 +714,7 @@ namespace sw ...@@ -714,7 +714,7 @@ namespace sw
i++; i++;
} }
Until(i >= a) Until(i >= a);
if(hasUnsignedTextureComponent(0)) c.x = cSum.x; else c.x = AddSat(cSum.x, cSum.x); 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); if(hasUnsignedTextureComponent(1)) c.y = cSum.y; else c.y = AddSat(cSum.y, cSum.y);
...@@ -1184,7 +1184,7 @@ namespace sw ...@@ -1184,7 +1184,7 @@ namespace sw
i++; i++;
} }
Until(i >= a) Until(i >= a);
c.x = cSum.x; c.x = cSum.x;
c.y = cSum.y; c.y = cSum.y;
......
...@@ -160,7 +160,7 @@ namespace sw ...@@ -160,7 +160,7 @@ namespace sw
i++; i++;
} }
Until(i >= n) Until(i >= n);
} }
// Vertical range // Vertical range
...@@ -176,7 +176,7 @@ namespace sw ...@@ -176,7 +176,7 @@ namespace sw
i++; i++;
} }
Until(i >= n) Until(i >= n);
if(state.multiSample > 1) if(state.multiSample > 1)
{ {
...@@ -220,7 +220,7 @@ namespace sw ...@@ -220,7 +220,7 @@ namespace sw
i++; i++;
} }
Until(i >= n) Until(i >= n);
Pointer<Byte> leftEdge = Pointer<Byte>(primitive + OFFSET(Primitive,outline->left)) + q * sizeof(Primitive); 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); Pointer<Byte> rightEdge = Pointer<Byte>(primitive + OFFSET(Primitive,outline->right)) + q * sizeof(Primitive);
...@@ -251,7 +251,7 @@ namespace sw ...@@ -251,7 +251,7 @@ namespace sw
i++; i++;
} }
Until(i >= n) Until(i >= n);
} }
if(state.multiSample == 1) if(state.multiSample == 1)
...@@ -620,7 +620,7 @@ namespace sw ...@@ -620,7 +620,7 @@ namespace sw
y++; y++;
} }
Until(y >= y2) Until(y >= y2);
} }
} }
} }
......
...@@ -388,10 +388,10 @@ namespace rr { ...@@ -388,10 +388,10 @@ namespace rr {
{ {
static std::string fmt(const sw::Vector4f& v) static std::string fmt(const sw::Vector4f& v)
{ {
return "[x: " + PrintValue::fmt(v.x) + "," return "[x: " + PrintValue::fmt(v.x) +
" y: " + PrintValue::fmt(v.y) + "," ", y: " + PrintValue::fmt(v.y) +
" z: " + PrintValue::fmt(v.z) + "," ", z: " + PrintValue::fmt(v.z) +
" w: " + PrintValue::fmt(v.w) + "]"; ", w: " + PrintValue::fmt(v.w) + "]";
} }
static std::vector<rr::Value*> val(const sw::Vector4f& v) static std::vector<rr::Value*> val(const sw::Vector4f& v)
...@@ -403,10 +403,10 @@ namespace rr { ...@@ -403,10 +403,10 @@ namespace rr {
{ {
static std::string fmt(const sw::Vector4s& v) static std::string fmt(const sw::Vector4s& v)
{ {
return "[x: " + PrintValue::fmt(v.x) + "," return "[x: " + PrintValue::fmt(v.x) +
" y: " + PrintValue::fmt(v.y) + "," ", y: " + PrintValue::fmt(v.y) +
" z: " + PrintValue::fmt(v.z) + "," ", z: " + PrintValue::fmt(v.z) +
" w: " + PrintValue::fmt(v.w) + "]"; ", w: " + PrintValue::fmt(v.w) + "]";
} }
static std::vector<rr::Value*> val(const sw::Vector4s& v) static std::vector<rr::Value*> val(const sw::Vector4s& v)
......
...@@ -90,7 +90,7 @@ namespace sw ...@@ -90,7 +90,7 @@ namespace sw
batch += sizeof(unsigned int); batch += sizeof(unsigned int);
vertexCount--; vertexCount--;
} }
Until(vertexCount == 0) Until(vertexCount == 0);
Return(); Return();
} }
......
...@@ -229,7 +229,7 @@ const VkPhysicalDeviceLimits& PhysicalDevice::getLimits() const ...@@ -229,7 +229,7 @@ const VkPhysicalDeviceLimits& PhysicalDevice::getLimits() const
16384, // maxComputeSharedMemorySize 16384, // maxComputeSharedMemorySize
{ 65535, 65535, 65535 }, // maxComputeWorkGroupCount[3] { 65535, 65535, 65535 }, // maxComputeWorkGroupCount[3]
128, // maxComputeWorkGroupInvocations 128, // maxComputeWorkGroupInvocations
{ 128, 128, 64, }, // maxComputeWorkGroupSize[3] { 128, 128, 64 }, // maxComputeWorkGroupSize[3]
vk::SUBPIXEL_PRECISION_BITS, // subPixelPrecisionBits vk::SUBPIXEL_PRECISION_BITS, // subPixelPrecisionBits
4, // subTexelPrecisionBits 4, // subTexelPrecisionBits
4, // mipmapPrecisionBits 4, // mipmapPrecisionBits
...@@ -853,10 +853,10 @@ const VkPhysicalDeviceMemoryProperties& PhysicalDevice::getMemoryProperties() co ...@@ -853,10 +853,10 @@ const VkPhysicalDeviceMemoryProperties& PhysicalDevice::getMemoryProperties() co
{ {
// vk::MEMORY_TYPE_GENERIC_BIT // vk::MEMORY_TYPE_GENERIC_BIT
{ {
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | (VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT |
VK_MEMORY_PROPERTY_HOST_CACHED_BIT, // propertyFlags VK_MEMORY_PROPERTY_HOST_CACHED_BIT), // propertyFlags
0 // heapIndex 0 // heapIndex
}, },
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment