Replace sw::SIMD aliases of 4-wide vectors with rr::SIMD types
sw::SIMD::Float was an alias of rr::Float4, but is now rr::SIMD::Float.
Likewise for the Int and UInt counterparts. rr::Pointer4 has become
rr::SIMD::Pointer.
SIMD::Width was set to 4 for both backends so functionally nothing
changes and none of the asserts are triggered.
The new SIMD::Float4 type is equivalent to Vector4f except each
component is a SIMD vector. The latter is still used in places where
4-wide vectors are assumed, but should be eliminated in future changes.
Bug: b/214583550
Bug: b/236162233
Change-Id: Ib15ae2f9883b989b30de58fda16d7e24fdca4a1a
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/66752
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Pipeline/PixelProgram.cpp b/src/Pipeline/PixelProgram.cpp
index 3405458..6eb60b0 100644
--- a/src/Pipeline/PixelProgram.cpp
+++ b/src/Pipeline/PixelProgram.cpp
@@ -302,13 +302,14 @@
{
Pointer<Byte> buffer = cBuffer[index] + q * *Pointer<Int>(data + OFFSET(DrawData, colorSliceB[index]));
- Vector4f colorf = alphaBlend(index, buffer, c[index], x);
+ SIMD::Float4 colorf = alphaBlend(index, buffer, c[index], x);
+ ASSERT(SIMD::Width == 4);
Vector4s color;
- color.x = convertFixed16(colorf.x, true);
- color.y = convertFixed16(colorf.y, true);
- color.z = convertFixed16(colorf.z, true);
- color.w = convertFixed16(colorf.w, true);
+ color.x = convertFixed16(Extract128(colorf.x, 0), true);
+ color.y = convertFixed16(Extract128(colorf.y, 0), true);
+ color.z = convertFixed16(Extract128(colorf.z, 0), true);
+ color.w = convertFixed16(Extract128(colorf.w, 0), true);
writeColor(index, buffer, x, color, sMask[q], zMask[q], cMask[q]);
}
break;
@@ -348,7 +349,13 @@
{
Pointer<Byte> buffer = cBuffer[index] + q * *Pointer<Int>(data + OFFSET(DrawData, colorSliceB[index]));
- Vector4f color = alphaBlend(index, buffer, c[index], x);
+ SIMD::Float4 C = alphaBlend(index, buffer, c[index], x);
+ ASSERT(SIMD::Width == 4);
+ Vector4f color;
+ color.x = Extract128(C.x, 0);
+ color.y = Extract128(C.y, 0);
+ color.z = Extract128(C.z, 0);
+ color.w = Extract128(C.w, 0);
writeColor(index, buffer, x, color, sMask[q], zMask[q], cMask[q]);
}
break;
@@ -358,7 +365,7 @@
}
}
-void PixelProgram::clampColor(Vector4f color[MAX_COLOR_BUFFERS])
+void PixelProgram::clampColor(SIMD::Float4 color[MAX_COLOR_BUFFERS])
{
// "If the color attachment is fixed-point, the components of the source and destination values and blend factors
// are each clamped to [0,1] or [-1,1] respectively for an unsigned normalized or signed normalized color attachment