Report gl_MaxDrawBuffers as 1 when the MRT extension is disabled, and the…

Report gl_MaxDrawBuffers as 1 when the MRT extension is disabled, and the implementation value otherwise. TRAC #22888 Signed-off-by: Nicolas Capens Signed-off-by: Shannon Woods Author: Jamie Madill git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@2050 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent c0b653aa
...@@ -244,7 +244,7 @@ bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources& resources) ...@@ -244,7 +244,7 @@ bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources& resources)
TBuiltIns builtIns; TBuiltIns builtIns;
compileResources = resources; compileResources = resources;
builtIns.initialize(shaderType, shaderSpec, resources); builtIns.initialize(shaderType, shaderSpec, resources, extensionBehavior);
return InitializeSymbolTable(builtIns.getBuiltInStrings(), return InitializeSymbolTable(builtIns.getBuiltInStrings(),
shaderType, shaderSpec, resources, infoSink, symbolTable); shaderType, shaderSpec, resources, infoSink, symbolTable);
} }
......
...@@ -475,7 +475,7 @@ static TString DefaultPrecisionFragment() ...@@ -475,7 +475,7 @@ static TString DefaultPrecisionFragment()
// Implementation dependent built-in constants. // Implementation dependent built-in constants.
// //
//============================================================================ //============================================================================
static TString BuiltInConstants(ShShaderSpec spec, const ShBuiltInResources &resources) static TString BuiltInConstants(ShShaderSpec spec, const ShBuiltInResources &resources, const TExtensionBehavior& extensionBehavior)
{ {
TStringStream s; TStringStream s;
...@@ -489,13 +489,20 @@ static TString BuiltInConstants(ShShaderSpec spec, const ShBuiltInResources &res ...@@ -489,13 +489,20 @@ static TString BuiltInConstants(ShShaderSpec spec, const ShBuiltInResources &res
s << "const int gl_MaxFragmentUniformVectors = " << resources.MaxFragmentUniformVectors << ";"; s << "const int gl_MaxFragmentUniformVectors = " << resources.MaxFragmentUniformVectors << ";";
if (spec != SH_CSS_SHADERS_SPEC) if (spec != SH_CSS_SHADERS_SPEC)
s << "const int gl_MaxDrawBuffers = " << resources.MaxDrawBuffers << ";"; {
TExtensionBehavior::const_iterator iter = extensionBehavior.find("GL_EXT_draw_buffers");
const bool usingMRTExtension = (iter != extensionBehavior.end() && (iter->second == EBhEnable || iter->second == EBhRequire));
const int maxDrawBuffers = (usingMRTExtension ? resources.MaxDrawBuffers : 1);
s << "const int gl_MaxDrawBuffers = " << maxDrawBuffers << ";";
}
return s.str(); return s.str();
} }
void TBuiltIns::initialize(ShShaderType type, ShShaderSpec spec, void TBuiltIns::initialize(ShShaderType type, ShShaderSpec spec,
const ShBuiltInResources& resources) const ShBuiltInResources& resources,
const TExtensionBehavior& extensionBehavior)
{ {
switch (type) { switch (type) {
case SH_FRAGMENT_SHADER: case SH_FRAGMENT_SHADER:
...@@ -515,7 +522,7 @@ void TBuiltIns::initialize(ShShaderType type, ShShaderSpec spec, ...@@ -515,7 +522,7 @@ void TBuiltIns::initialize(ShShaderType type, ShShaderSpec spec,
default: assert(false && "Language not supported"); default: assert(false && "Language not supported");
} }
builtInStrings.push_back(BuiltInConstants(spec, resources)); builtInStrings.push_back(BuiltInConstants(spec, resources, extensionBehavior));
} }
void IdentifyBuiltIns(ShShaderType type, ShShaderSpec spec, void IdentifyBuiltIns(ShShaderType type, ShShaderSpec spec,
......
...@@ -18,7 +18,8 @@ public: ...@@ -18,7 +18,8 @@ public:
POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator) POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
void initialize(ShShaderType type, ShShaderSpec spec, void initialize(ShShaderType type, ShShaderSpec spec,
const ShBuiltInResources& resources); const ShBuiltInResources& resources,
const TExtensionBehavior& extensionBehavior);
const TBuiltInStrings& getBuiltInStrings() { return builtInStrings; } const TBuiltInStrings& getBuiltInStrings() { return builtInStrings; }
protected: protected:
......
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