Replace static SIMD::Width asserts with dynamic ones
Static asserts which alert about code paths which do not support a
SIMD::Width other than 4 yet have been replaced with dynamic ones, since
this variable won't be constexpr in the future.
Bug: b/214588983
Change-Id: I7067465d2675d14930adcbd5f12e5df80821deeb
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/66810
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
diff --git a/src/Pipeline/SpirvShaderArithmetic.cpp b/src/Pipeline/SpirvShaderArithmetic.cpp
index 1f795ee..cc31ede 100644
--- a/src/Pipeline/SpirvShaderArithmetic.cpp
+++ b/src/Pipeline/SpirvShaderArithmetic.cpp
@@ -291,7 +291,7 @@
// Derivative instructions: FS invocations are laid out like so:
// 0 1
// 2 3
- static_assert(SIMD::Width == 4, "All cross-lane instructions will need care when using a different width");
+ ASSERT(SIMD::Width == 4); // All cross-lane instructions will need care when using a different width
dst.move(i, SIMD::Float(Extract(src.Float(i), 1) - Extract(src.Float(i), 0)));
break;
case spv::OpDPdy:
diff --git a/src/Pipeline/SpirvShaderGroup.cpp b/src/Pipeline/SpirvShaderGroup.cpp
index df2e1e7..19c2c05 100644
--- a/src/Pipeline/SpirvShaderGroup.cpp
+++ b/src/Pipeline/SpirvShaderGroup.cpp
@@ -78,7 +78,7 @@
SpirvShader::EmitResult SpirvShader::EmitGroupNonUniform(InsnIterator insn, EmitState *state) const
{
- static_assert(SIMD::Width == 4, "EmitGroupNonUniform makes many assumptions that the SIMD vector width is 4");
+ ASSERT(SIMD::Width == 4); // EmitGroupNonUniform makes many assumptions that the SIMD vector width is 4
auto &type = getType(Type::ID(insn.word(1)));
Object::ID resultId = insn.word(2);