SetupRoutine: Do not use Bool as a function return type.
Subzero does not support Bools as return types.
We were getting away with this as Return() was silently converting this to an Int.
Just use an Int as the return type.
Bug: b/131914569
Change-Id: I3bff7304b219f66cee7605ddd3cf6a1a75a8612a
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/30457
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
diff --git a/src/Pipeline/SetupRoutine.cpp b/src/Pipeline/SetupRoutine.cpp
index 692cfc45..14fb4f5 100644
--- a/src/Pipeline/SetupRoutine.cpp
+++ b/src/Pipeline/SetupRoutine.cpp
@@ -36,7 +36,7 @@
void SetupRoutine::generate()
{
- Function<Bool(Pointer<Byte>, Pointer<Byte>, Pointer<Byte>, Pointer<Byte>)> function;
+ Function<Int(Pointer<Byte>, Pointer<Byte>, Pointer<Byte>, Pointer<Byte>)> function;
{
Pointer<Byte> primitive(function.Arg<0>());
Pointer<Byte> tri(function.Arg<1>());
@@ -85,7 +85,7 @@
If(A == 0.0f)
{
- Return(false);
+ Return(0);
}
Int w0w1w2 = *Pointer<Int>(v0 + OFFSET(Vertex, builtins.position.w)) ^
@@ -98,11 +98,11 @@
if(state.cullMode & VK_CULL_MODE_FRONT_BIT)
{
- If(frontFacing) Return(false);
+ If(frontFacing) Return(0);
}
if(state.cullMode & VK_CULL_MODE_BACK_BIT)
{
- If(!frontFacing) Return(false);
+ If(!frontFacing) Return(0);
}
d = IfThenElse(A > 0.0f, d, Int(0));
@@ -183,7 +183,7 @@
// code below assumes yMin < yMax.
If(yMin >= yMax)
{
- Return(false);
+ Return(0);
}
For(Int q = 0, q < state.multiSample, q++)
@@ -254,7 +254,7 @@
If(yMin == yMax)
{
- Return(false);
+ Return(0);
}
*Pointer<Short>(leftEdge + (yMin - 1) * sizeof(Primitive::Span)) = *Pointer<Short>(leftEdge + yMin * sizeof(Primitive::Span));
@@ -453,7 +453,7 @@
state.perspective, 0);
}
- Return(true);
+ Return(1);
}
routine = function("SetupRoutine");
diff --git a/src/Shader/SetupRoutine.cpp b/src/Shader/SetupRoutine.cpp
index 7ecfa3d..6024869 100644
--- a/src/Shader/SetupRoutine.cpp
+++ b/src/Shader/SetupRoutine.cpp
@@ -37,7 +37,7 @@
void SetupRoutine::generate()
{
- Function<Bool(Pointer<Byte>, Pointer<Byte>, Pointer<Byte>, Pointer<Byte>)> function;
+ Function<Int(Pointer<Byte>, Pointer<Byte>, Pointer<Byte>, Pointer<Byte>)> function;
{
Pointer<Byte> primitive(function.Arg<0>());
Pointer<Byte> tri(function.Arg<1>());
@@ -90,7 +90,7 @@
If(A == 0.0f)
{
- Return(false);
+ Return(0);
}
Int w0w1w2 = *Pointer<Int>(v0 + pos * 16 + 12) ^
@@ -101,11 +101,11 @@
if(state.cullMode == CULL_CLOCKWISE)
{
- If(A >= 0.0f) Return(false);
+ If(A >= 0.0f) Return(0);
}
else if(state.cullMode == CULL_COUNTERCLOCKWISE)
{
- If(A <= 0.0f) Return(false);
+ If(A <= 0.0f) Return(0);
}
d = IfThenElse(A < 0.0f, d, Int(0));
@@ -197,7 +197,7 @@
// code below assumes yMin < yMax.
If(yMin >= yMax)
{
- Return(false);
+ Return(0);
}
For(Int q = 0, q < state.multiSample, q++)
@@ -268,7 +268,7 @@
If(yMin == yMax)
{
- Return(false);
+ Return(0);
}
*Pointer<Short>(leftEdge + (yMin - 1) * sizeof(Primitive::Span)) = *Pointer<Short>(leftEdge + yMin * sizeof(Primitive::Span));
@@ -476,7 +476,7 @@
setupGradient(primitive, tri, w012, M, v0, v1, v2, OFFSET(Vertex,f), OFFSET(Primitive,f), state.fog.flat, false, state.perspective, false, 0);
}
- Return(true);
+ Return(1);
}
routine = function("SetupRoutine");