GLSL: Fix #741: rationalize per-block vs. per-member offset checking.

This commit is contained in:
John Kessenich 2017-02-28 14:10:00 -07:00
parent 69a2c69649
commit 5a042c0686
4 changed files with 20 additions and 15 deletions

View File

@ -47,12 +47,13 @@ ERROR: 0:142: 'r8_snorm' : does not apply to signed integer images
ERROR: 0:143: 'rgba32ui' : does not apply to signed integer images
ERROR: 0:144: 'r8ui' : does not apply to signed integer images
ERROR: 0:147: 'offset on block member' : not supported for this version or the enabled extensions
ERROR: 0:147: 'offset/align' : can only be used with std140 or std430 layout packing
ERROR: 0:157: 'textureQueryLevels' : no matching overloaded function found
ERROR: 0:157: 'assign' : cannot convert from 'const float' to 'temp int'
ERROR: 0:158: 'textureQueryLevels' : no matching overloaded function found
ERROR: 0:158: 'assign' : cannot convert from 'const float' to 'temp int'
WARNING: 0:161: '[]' : assuming array size of one for compile-time checking of binding numbers for implicitly-sized array
ERROR: 50 compilation errors. No code generated.
ERROR: 51 compilation errors. No code generated.
Shader version: 420

View File

@ -28,8 +28,9 @@ ERROR: 0:64: 'uniform buffer-member align' : not supported for this version or t
ERROR: 0:65: 'uniform buffer-member align' : not supported for this version or the enabled extensions
ERROR: 0:65: 'offset on block member' : not supported for this version or the enabled extensions
ERROR: 0:66: 'offset on block member' : not supported for this version or the enabled extensions
ERROR: 0:64: 'offset/align' : can only be used with std140 or std430 layout packing
ERROR: 0:65: 'align' : can only be used with std140 or std430 layout packing
ERROR: 0:64: 'align' : can only be used with std140 or std430 layout packing
ERROR: 0:65: 'offset/align' : can only be used with std140 or std430 layout packing
ERROR: 0:66: 'offset/align' : can only be used with std140 or std430 layout packing
ERROR: 0:71: 'offset on block member' : not supported for this version or the enabled extensions
ERROR: 0:74: 'gl_MaxTransformFeedbackBuffers' : required extension not requested: GL_ARB_enhanced_layouts
ERROR: 0:75: 'gl_MaxTransformFeedbackInterleavedComponents' : required extension not requested: GL_ARB_enhanced_layouts
@ -63,7 +64,7 @@ ERROR: 0:221: 'textureQueryLevels' : no matching overloaded function found
ERROR: 0:221: 'assign' : cannot convert from 'const float' to 'temp int'
ERROR: 0:222: 'textureQueryLevels' : no matching overloaded function found
ERROR: 0:222: 'assign' : cannot convert from 'const float' to 'temp int'
ERROR: 63 compilation errors. No code generated.
ERROR: 64 compilation errors. No code generated.
Shader version: 430

View File

@ -22,11 +22,11 @@ ERROR: 0:38: 'offset' : only applies to block members, not blocks
ERROR: 0:39: 'output block' : not supported in this stage: fragment
ERROR: 0:39: 'layout' : offset/align can only be used on a uniform or buffer
ERROR: 0:39: 'offset' : only applies to block members, not blocks
ERROR: 0:42: 'offset/align' : can only be used with std140 or std430 layout packing
ERROR: 0:43: 'offset/align' : can only be used with std140 or std430 layout packing
ERROR: 0:42: 'align' : can only be used with std140 or std430 layout packing
ERROR: 0:43: 'align' : can only be used with std140 or std430 layout packing
ERROR: 0:43: 'layout' : offset/align can only be used on a uniform or buffer
ERROR: 0:44: 'output block' : not supported in this stage: fragment
ERROR: 0:44: 'offset/align' : can only be used with std140 or std430 layout packing
ERROR: 0:44: 'align' : can only be used with std140 or std430 layout packing
ERROR: 0:44: 'layout' : offset/align can only be used on a uniform or buffer
ERROR: 0:46: 'offset' : cannot specify on a variable declaration
ERROR: 0:47: 'layout' : offset/align can only be used on a uniform or buffer
@ -37,8 +37,9 @@ ERROR: 0:52: 'layout' : offset/align can only be used on a uniform or buffer
ERROR: 0:54: 'layout' : matrix or packing qualifiers can only be used on a uniform or buffer
ERROR: 0:55: 'layout' : cannot specify packing on a variable declaration
ERROR: 0:57: 'align' : must be a power of 2
ERROR: 0:58: 'align' : can only be used with std140 or std430 layout packing
ERROR: 0:63: 'align' : can only be used with std140 or std430 layout packing
ERROR: 0:58: 'offset/align' : can only be used with std140 or std430 layout packing
ERROR: 0:62: 'offset/align' : can only be used with std140 or std430 layout packing
ERROR: 0:63: 'offset/align' : can only be used with std140 or std430 layout packing
ERROR: 0:62: 'layout' : offset/align can only be used on a uniform or buffer
ERROR: 0:63: 'layout' : offset/align can only be used on a uniform or buffer
ERROR: 0:84: 'align' : must be a power of 2
@ -48,7 +49,7 @@ ERROR: 0:103: 'align' : must be a power of 2
ERROR: 0:105: 'align' : must be a power of 2
ERROR: 0:102: 'offset' : cannot lie in previous members
ERROR: 0:104: 'offset' : must be a multiple of the member's alignment
ERROR: 48 compilation errors. No code generated.
ERROR: 49 compilation errors. No code generated.
Shader version: 440

View File

@ -5597,11 +5597,10 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
mergeObjectLayoutQualifiers(defaultQualification, currentBlockQualifier, true);
// "The offset qualifier can only be used on block members of blocks declared with std140 or std430 layouts."
// "The align qualifier can only be used on blocks or block members, and only for blocks declared with std140 or std430 layouts."
if (currentBlockQualifier.hasAlign() || currentBlockQualifier.hasAlign()) {
if (currentBlockQualifier.hasAlign()) {
if (defaultQualification.layoutPacking != ElpStd140 && defaultQualification.layoutPacking != ElpStd430) {
error(loc, "can only be used with std140 or std430 layout packing", "offset/align", "");
error(loc, "can only be used with std140 or std430 layout packing", "align", "");
defaultQualification.layoutAlign = -1;
}
}
@ -5643,9 +5642,12 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
}
} else
memberWithoutLocation = true;
if (memberQualifier.hasAlign()) {
// "The offset qualifier can only be used on block members of blocks declared with std140 or std430 layouts."
// "The align qualifier can only be used on blocks or block members, and only for blocks declared with std140 or std430 layouts."
if (memberQualifier.hasAlign() || memberQualifier.hasOffset()) {
if (defaultQualification.layoutPacking != ElpStd140 && defaultQualification.layoutPacking != ElpStd430)
error(memberLoc, "can only be used with std140 or std430 layout packing", "align", "");
error(memberLoc, "can only be used with std140 or std430 layout packing", "offset/align", "");
}
TQualifier newMemberQualification = defaultQualification;