Commit 1bc1b6a3 by Jamie Madill Committed by Shannon Woods

Only allow zero indexes for gl_FragData when the draw buffers extension is disabled.

TRAC #23509 Signed-off-by: Shannon Woods Signed-off-by: Nicolas Capens Authored-by: Jamie Madill
parent 57a04544
...@@ -892,6 +892,19 @@ bool TParseContext::supportsExtension(const char* extension) ...@@ -892,6 +892,19 @@ bool TParseContext::supportsExtension(const char* extension)
return (iter != extbehavior.end()); return (iter != extbehavior.end());
} }
bool TParseContext::isExtensionEnabled(const char* extension) const
{
const TExtensionBehavior& extbehavior = extensionBehavior();
auto iter = extbehavior.find(extension);
if (iter == extbehavior.end())
{
return false;
}
return (iter->second == EBhEnable || iter->second == EBhRequire);
}
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
// //
// Non-Errors. // Non-Errors.
...@@ -1513,6 +1526,12 @@ TIntermTyped* TParseContext::addIndexExpression(TIntermTyped *baseExpression, co ...@@ -1513,6 +1526,12 @@ TIntermTyped* TParseContext::addIndexExpression(TIntermTyped *baseExpression, co
recover(); recover();
index = baseExpression->getType().getArraySize() - 1; index = baseExpression->getType().getArraySize() - 1;
} }
else if (baseExpression->getQualifier() == EvqFragData && index > 0 && !isExtensionEnabled("GL_EXT_draw_buffers"))
{
error(location, "", "[", "array indexes for gl_FragData must be zero when GL_EXT_draw_buffers is disabled");
recover();
index = 0;
}
} }
else if ((baseExpression->isVector() || baseExpression->isMatrix()) && baseExpression->getType().getNominalSize() <= index) else if ((baseExpression->isVector() || baseExpression->isMatrix()) && baseExpression->getType().getNominalSize() <= index)
{ {
......
...@@ -101,6 +101,7 @@ struct TParseContext { ...@@ -101,6 +101,7 @@ struct TParseContext {
const TPragma& pragma() const { return directiveHandler.pragma(); } const TPragma& pragma() const { return directiveHandler.pragma(); }
const TExtensionBehavior& extensionBehavior() const { return directiveHandler.extensionBehavior(); } const TExtensionBehavior& extensionBehavior() const { return directiveHandler.extensionBehavior(); }
bool supportsExtension(const char* extension); bool supportsExtension(const char* extension);
bool isExtensionEnabled(const char* extension) const;
bool containsSampler(TType& type); bool containsSampler(TType& type);
bool areAllChildConst(TIntermAggregate* aggrNode); bool areAllChildConst(TIntermAggregate* aggrNode);
......
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