#include "Common/Timer.hpp"\r
#include "../common/debug.h"\r
\r
-bool localShaderConstants = false;\r
-\r
namespace gl\r
{\r
using namespace sw;\r
#include "Common/Timer.hpp"\r
#include "../common/debug.h"\r
\r
-bool localShaderConstants = false;\r
-\r
namespace es1\r
{\r
using namespace sw;\r
#include "Common/Timer.hpp"\r
#include "../common/debug.h"\r
\r
-bool localShaderConstants = false;\r
-\r
namespace es2\r
{\r
using namespace sw;\r
#include "Common/Timer.hpp"\r
#include "../common/debug.h"\r
\r
-bool localShaderConstants = false;\r
-\r
namespace es2\r
{\r
using namespace sw;\r
#include "Constants.hpp"
#include "Debug.hpp"
-extern bool localShaderConstants;
-
namespace sw
{
extern bool complementaryDepthBuffer;
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++)
{
return containsLeave;
}
+ bool Shader::containsDefineInstruction() const
+ {
+ return containsDefine;
+ }
+
bool Shader::usesSampler(int index) const
{
return (usedSamplers & (1 << index)) != 0;
containsLeave = false;
containsBreak = false;
containsContinue = false;
+ containsDefine = false;
// Determine global presence of branching instructions
for(unsigned int i = 0; i < instruction.size(); i++)
{
containsContinue = true;
}
+ case OPCODE_DEF:
+ case OPCODE_DEFB:
+ case OPCODE_DEFI:
+ containsDefine = true;
}
}
bool containsBreakInstruction() const;\r
bool containsContinueInstruction() const;\r
bool containsLeaveInstruction() const;\r
+ bool containsDefineInstruction() const;\r
bool usesSampler(int i) const;\r
\r
struct Semantic\r
bool containsBreak;\r
bool containsContinue;\r
bool containsLeave;\r
+ bool containsDefine;\r
};\r
}\r
\r
#include "SamplerCore.hpp"
#include "Debug.hpp"
-extern bool localShaderConstants;
-
namespace sw
{
VertexProgram::VertexProgram(const VertexProcessor::State &state, const VertexShader *shader) : VertexRoutine(state, shader)
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++)
{