Analyze the shader for define instructions.
This eliminates the need to specify if shaders can contain defined
constant values in the front-end using a global variable.
Change-Id: If7802a2743c0afa650a2631cd7945c8b3d7cf645
Reviewed-on: https://swiftshader-review.googlesource.com/3152
Reviewed-by: Greg Hartman <ghartman@google.com>
Tested-by: Greg Hartman <ghartman@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
diff --git a/src/Shader/VertexProgram.cpp b/src/Shader/VertexProgram.cpp
index a2b4537..acbdbcf 100644
--- a/src/Shader/VertexProgram.cpp
+++ b/src/Shader/VertexProgram.cpp
@@ -18,8 +18,6 @@
#include "SamplerCore.hpp"
#include "Debug.hpp"
-extern bool localShaderConstants;
-
namespace sw
{
VertexProgram::VertexProgram(const VertexProcessor::State &state, const VertexShader *shader) : VertexRoutine(state, shader)
@@ -731,7 +729,7 @@
c.z = c.z.zzzz;
c.w = c.w.wwww;
- if(localShaderConstants) // Constant may be known at compile time
+ if(shader->containsDefineInstruction()) // Constant may be known at compile time
{
for(size_t j = 0; j < shader->getLength(); j++)
{