GL_ARB_enhanced_layouts, final. #extension tests, built-in constants, and bug fix for non-constant expression in layout(...=expr).
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@25220 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
@@ -9,5 +9,5 @@
|
||||
// source have to figure out how to create revision.h just to get a build
|
||||
// going. However, if it is not updated, it can be a version behind.
|
||||
|
||||
#define GLSLANG_REVISION "25092"
|
||||
#define GLSLANG_DATE "2014/01/28 14:13:59"
|
||||
#define GLSLANG_REVISION "25175"
|
||||
#define GLSLANG_DATE "2014/01/30 19:42:25"
|
||||
|
||||
@@ -1882,6 +1882,8 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
|
||||
s.append(builtInConstant);
|
||||
}
|
||||
} else {
|
||||
// non-ES profile
|
||||
|
||||
snprintf(builtInConstant, maxSize, "const int gl_MaxVertexAttribs = %d;", resources.maxVertexAttribs);
|
||||
s.append(builtInConstant);
|
||||
|
||||
@@ -2111,6 +2113,14 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
|
||||
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeAtomicCounterBuffers = %d;", resources.maxComputeAtomicCounterBuffers);
|
||||
s.append(builtInConstant);
|
||||
}
|
||||
|
||||
// enhanced layouts
|
||||
if (version >= 430) {
|
||||
snprintf(builtInConstant, maxSize, "const int gl_MaxTransformFeedbackBuffers = %d;", resources.maxTransformFeedbackBuffers);
|
||||
s.append(builtInConstant);
|
||||
snprintf(builtInConstant, maxSize, "const int gl_MaxTransformFeedbackInterleavedComponents = %d;", resources.maxTransformFeedbackInterleavedComponents);
|
||||
s.append(builtInConstant);
|
||||
}
|
||||
}
|
||||
|
||||
s.append("\n");
|
||||
@@ -2140,6 +2150,8 @@ void SpecialQualifier(const char* name, TStorageQualifier qualifier, TSymbolTabl
|
||||
// 1) Programmatically add symbols that could not be added by simple text strings above.
|
||||
// 2) Map built-in functions to operators, for those that will turn into an operation node
|
||||
// instead of remaining a function call.
|
||||
// 3) Tag extension-related symbols added to their base version with their extensions, so
|
||||
// that if an early version has the extension turned off, there is an error reported on use.
|
||||
//
|
||||
void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymbolTable& symbolTable)
|
||||
{
|
||||
@@ -2326,10 +2338,19 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
|
||||
//
|
||||
// Add context-dependent (resource-specific) built-ins not yet handled. These
|
||||
// would be ones that need to be programmatically added because they cannot
|
||||
// be added by simple text strings.
|
||||
// be added by simple text strings. For these, also
|
||||
// 1) Map built-in functions to operators, for those that will turn into an operation node
|
||||
// instead of remaining a function call.
|
||||
// 2) Tag extension-related symbols added to their base version with their extensions, so
|
||||
// that if an early version has the extension turned off, there is an error reported on use.
|
||||
//
|
||||
void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources)
|
||||
{
|
||||
if (version >= 430 && version < 440) {
|
||||
symbolTable.setVariableExtensions("gl_MaxTransformFeedbackBuffers", 1, &GL_ARB_enhanced_layouts);
|
||||
symbolTable.setVariableExtensions("gl_MaxTransformFeedbackInterleavedComponents", 1, &GL_ARB_enhanced_layouts);
|
||||
}
|
||||
|
||||
switch(language) {
|
||||
|
||||
case EShLangFragment:
|
||||
|
||||
@@ -2827,12 +2827,16 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
|
||||
|
||||
integerCheck(node, feature);
|
||||
const TIntermConstantUnion* constUnion = node->getAsConstantUnion();
|
||||
assert(constUnion);
|
||||
int value = node->getAsConstantUnion()->getConstArray()[0].getIConst();
|
||||
|
||||
if (! constUnion->isLiteral()) {
|
||||
requireProfile(loc, ECoreProfile | ECompatibilityProfile, nonLiteralFeature);
|
||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, GL_ARB_enhanced_layouts, nonLiteralFeature);
|
||||
int value;
|
||||
if (constUnion) {
|
||||
value = constUnion->getConstArray()[0].getIConst();
|
||||
if (! constUnion->isLiteral()) {
|
||||
requireProfile(loc, ECoreProfile | ECompatibilityProfile, nonLiteralFeature);
|
||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, GL_ARB_enhanced_layouts, nonLiteralFeature);
|
||||
}
|
||||
} else {
|
||||
// grammar should have give out the error message
|
||||
value = 0;
|
||||
}
|
||||
|
||||
if (value < 0) {
|
||||
@@ -2967,6 +2971,20 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
|
||||
}
|
||||
|
||||
// Merge any layout qualifier information from src into dst, leaving everything else in dst alone
|
||||
//
|
||||
// "More than one layout qualifier may appear in a single declaration.
|
||||
// Additionally, the same layout-qualifier-name can occur multiple times
|
||||
// within a layout qualifier or across multiple layout qualifiers in the
|
||||
// same declaration. When the same layout-qualifier-name occurs
|
||||
// multiple times, in a single declaration, the last occurrence overrides
|
||||
// the former occurrence(s). Further, if such a layout-qualifier-name
|
||||
// will effect subsequent declarations or other observable behavior, it
|
||||
// is only the last occurrence that will have any effect, behaving as if
|
||||
// the earlier occurrence(s) within the declaration are not present.
|
||||
// This is also true for overriding layout-qualifier-names, where one
|
||||
// overrides the other (e.g., row_major vs. column_major); only the last
|
||||
// occurrence has any effect."
|
||||
//
|
||||
void TParseContext::mergeObjectLayoutQualifiers(TSourceLoc loc, TQualifier& dst, const TQualifier& src, bool inheritOnly)
|
||||
{
|
||||
if (src.hasMatrix())
|
||||
|
||||
Reference in New Issue
Block a user