Remove shader call stack bounding
The root cause of a shader call stack overflow was fixed in
https://swiftshader-review.googlesource.com/c/SwiftShader/+/24628
All shaders should now be validated not to exceed our call stack size
before reaching this lowering stage of compilation. Thus the run-time
checks can be removed.
This partially reverts
https://swiftshader-review.googlesource.com/c/SwiftShader/+/23568
Bug b/123587120
Change-Id: I04fc2613da7526992dd52c323deca8d9ad2c30c0
Reviewed-on: https://swiftshader-review.googlesource.com/c/24648
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Shader/PixelProgram.cpp b/src/Shader/PixelProgram.cpp
index bc879a3..ca44d19 100644
--- a/src/Shader/PixelProgram.cpp
+++ b/src/Shader/PixelProgram.cpp
@@ -1419,7 +1419,7 @@
if(callRetBlock[labelIndex].size() > 1)
{
- callStack[Min(stackIndex++, Int(MAX_SHADER_CALL_STACK_SIZE))] = UInt(callSiteIndex);
+ callStack[stackIndex++] = UInt(callSiteIndex);
}
Int4 restoreLeave = enableLeave;
@@ -1459,7 +1459,7 @@
if(callRetBlock[labelIndex].size() > 1)
{
- callStack[Min(stackIndex++, Int(MAX_SHADER_CALL_STACK_SIZE))] = UInt(callSiteIndex);
+ callStack[stackIndex++] = UInt(callSiteIndex);
}
Int4 restoreLeave = enableLeave;
@@ -1488,7 +1488,7 @@
if(callRetBlock[labelIndex].size() > 1)
{
- callStack[Min(stackIndex++, Int(MAX_SHADER_CALL_STACK_SIZE))] = UInt(callSiteIndex);
+ callStack[stackIndex++] = UInt(callSiteIndex);
}
enableIndex++;
diff --git a/src/Shader/VertexProgram.cpp b/src/Shader/VertexProgram.cpp
index 05f8dfb..8bae9cf 100644
--- a/src/Shader/VertexProgram.cpp
+++ b/src/Shader/VertexProgram.cpp
@@ -1124,7 +1124,7 @@
if(callRetBlock[labelIndex].size() > 1)
{
- callStack[Min(stackIndex++, Int(MAX_SHADER_CALL_STACK_SIZE))] = UInt(callSiteIndex);
+ callStack[stackIndex++] = UInt(callSiteIndex);
}
Int4 restoreLeave = enableLeave;
@@ -1164,7 +1164,7 @@
if(callRetBlock[labelIndex].size() > 1)
{
- callStack[Min(stackIndex++, Int(MAX_SHADER_CALL_STACK_SIZE))] = UInt(callSiteIndex);
+ callStack[stackIndex++] = UInt(callSiteIndex);
}
Int4 restoreLeave = enableLeave;
@@ -1193,7 +1193,7 @@
if(callRetBlock[labelIndex].size() > 1)
{
- callStack[Min(stackIndex++, Int(MAX_SHADER_CALL_STACK_SIZE))] = UInt(callSiteIndex);
+ callStack[stackIndex++] = UInt(callSiteIndex);
}
enableIndex++;