Commit d1a5a893 by Ben Clayton

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/+/30457Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarBen Clayton <bclayton@google.com>
parent bec21fe9
......@@ -36,7 +36,7 @@ namespace sw
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 @@ namespace sw
If(A == 0.0f)
{
Return(false);
Return(0);
}
Int w0w1w2 = *Pointer<Int>(v0 + OFFSET(Vertex, builtins.position.w)) ^
......@@ -98,11 +98,11 @@ namespace sw
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 @@ namespace sw
// code below assumes yMin < yMax.
If(yMin >= yMax)
{
Return(false);
Return(0);
}
For(Int q = 0, q < state.multiSample, q++)
......@@ -254,7 +254,7 @@ namespace sw
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 @@ namespace sw
state.perspective, 0);
}
Return(true);
Return(1);
}
routine = function("SetupRoutine");
......
......@@ -37,7 +37,7 @@ namespace sw
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 @@ namespace sw
If(A == 0.0f)
{
Return(false);
Return(0);
}
Int w0w1w2 = *Pointer<Int>(v0 + pos * 16 + 12) ^
......@@ -101,11 +101,11 @@ namespace sw
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 @@ namespace sw
// code below assumes yMin < yMax.
If(yMin >= yMax)
{
Return(false);
Return(0);
}
For(Int q = 0, q < state.multiSample, q++)
......@@ -268,7 +268,7 @@ namespace sw
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 @@ namespace sw
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");
......
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