mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-09 20:10:06 +00:00
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:
parent
39974acf93
commit
4094630ca3
@ -44,4 +44,101 @@ layout(location = 53) out float cg; // ERROR, collision at 31
|
||||
layout(location = 10) in vec4 alias1;
|
||||
layout(location = 10) in vec4 alias2; // okay for vertex input on desktop
|
||||
|
||||
out float gl_ClipDistance[17]; // ERROR, size too big
|
||||
out float gl_ClipDistance[17]; // ERROR, size too big
|
||||
|
||||
// enhanced_layouts (most tests are in 440.*)
|
||||
|
||||
layout(location = start*start - 2 - 4) in vec4 v6e; // ERROR
|
||||
|
||||
layout(location = 28) in inblock2e {
|
||||
layout(location = 25) float f2; // ERROR
|
||||
} ininst2e;
|
||||
|
||||
in ublock4e {
|
||||
layout(location = 50) float f1; // ERROR
|
||||
layout(location = 51) float f2; // ERROR
|
||||
} in4e;
|
||||
|
||||
layout(align=16, std140) uniform ubl4e { int a; } inst4e;// ERROR
|
||||
|
||||
layout(align=32) uniform ubl9e { // ERROR
|
||||
layout(offset=12, align=4) float f; // ERROR
|
||||
layout(offset=20) float g; // ERROR
|
||||
} inst9e;
|
||||
|
||||
layout(std140) uniform blocke {
|
||||
vec4 a;
|
||||
layout(offset = 32) vec3 b; // ERROR
|
||||
} spinste;
|
||||
|
||||
int aconste[gl_MaxTransformFeedbackBuffers]; // ERROR ??
|
||||
int bconste[gl_MaxTransformFeedbackInterleavedComponents]; // ERROR
|
||||
|
||||
out bblck2 {
|
||||
layout(xfb_offset=64) vec4 bbv; // ERROR
|
||||
} bbinst2;
|
||||
|
||||
layout(xfb_buffer = 3, xfb_stride = 64) out; // ERROR
|
||||
|
||||
layout(xfb_buffer=2, xfb_offset=48, xfb_stride=80) out vec4 bge; // ERROR
|
||||
layout( xfb_offset=32, xfb_stride=64) out vec4 bhe; // ERROR
|
||||
|
||||
layout(xfb_stride=80, xfb_buffer=2, xfb_offset=16) out bblck4e { // ERROR
|
||||
vec4 bbv1;
|
||||
vec4 bbv2;
|
||||
} bbinst4e;
|
||||
|
||||
out bblck5e {
|
||||
layout(xfb_offset=0) vec4 bbv1; // ERROR
|
||||
layout(xfb_stride=64, xfb_buffer=3, xfb_offset=48) vec4 bbv2; // ERROR
|
||||
} bbinst5e;
|
||||
|
||||
#extension GL_ARB_enhanced_layouts : enable
|
||||
|
||||
layout(align=16, std140) uniform ubl4 { int a; } inst4;
|
||||
layout(std430) uniform;
|
||||
|
||||
layout(align=32) uniform ubl9 {
|
||||
layout(offset=12, align=4) float f;
|
||||
layout(offset=20) float g;
|
||||
} inst9;
|
||||
|
||||
layout(std140) uniform block {
|
||||
vec4 a; // a takes offsets 0-15
|
||||
layout(offset = 32) vec3 b; // b takes offsets 32-43
|
||||
} spinst;
|
||||
|
||||
int aconst[gl_MaxTransformFeedbackBuffers];
|
||||
int bconst[gl_MaxTransformFeedbackInterleavedComponents];
|
||||
|
||||
const int start2 = 5;
|
||||
layout(location = start2 * start2 - 2 - 4) in vec4 v6;
|
||||
|
||||
layout(location = 28) in inblock2 {
|
||||
bool b1;
|
||||
float f1;
|
||||
layout(location = 25) float f2;
|
||||
} ininst2;
|
||||
|
||||
in ublock4 {
|
||||
layout(location = 50) float f1;
|
||||
layout(location = 51) float f2;
|
||||
} in4;
|
||||
|
||||
out bblck2g {
|
||||
layout(xfb_offset=64) vec4 bbv;
|
||||
} bbinst2g;
|
||||
|
||||
layout(xfb_buffer = 1, xfb_stride = 80) out; // default buffer is 3
|
||||
|
||||
layout(xfb_buffer=1, xfb_offset=48, xfb_stride=80) out vec4 bg;
|
||||
layout( xfb_offset=32, xfb_stride=80) out vec4 bh;
|
||||
|
||||
layout(xfb_stride=80, xfb_buffer=1, xfb_offset=16) out bblck4 {
|
||||
vec4 bbv1;
|
||||
} bbinst4;
|
||||
|
||||
out bblck5 {
|
||||
layout(xfb_offset=0) vec4 bbv1;
|
||||
layout(xfb_stride=80, xfb_buffer=1, xfb_offset=64) vec4 bbv2;
|
||||
} bbinst5;
|
||||
|
@ -134,3 +134,6 @@ layout(std430, align = 128) uniform block24301 {
|
||||
float h;
|
||||
dvec3 i;
|
||||
} specExample4301;
|
||||
|
||||
int aconst[gl_MaxTransformFeedbackBuffers];
|
||||
int bconst[gl_MaxTransformFeedbackInterleavedComponents];
|
||||
|
@ -13,9 +13,41 @@ ERROR: 0:30: '' : cannot use layout qualifiers on a function parameter
|
||||
ERROR: 0:31: '' : cannot use auxiliary or interpolation qualifiers on a function parameter
|
||||
ERROR: 0:42: 'location' : overlapping use of location 53
|
||||
ERROR: 0:47: 'gl_ClipDistance array size' : must be less than gl_MaxClipDistances (8)
|
||||
ERROR: 13 compilation errors. No code generated.
|
||||
ERROR: 0:51: 'start' : undeclared identifier
|
||||
ERROR: 0:51: '' : constant expression required
|
||||
ERROR: 0:51: 'layout-id value' : scalar integer expression required
|
||||
ERROR: 0:54: 'location on block member' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:58: 'location on block member' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:59: 'location on block member' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:62: 'uniform buffer-member align' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:64: 'uniform buffer-member align' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:65: 'uniform buffer-member offset' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:65: 'uniform buffer-member align' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:66: 'uniform buffer-member offset' : 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:71: 'uniform buffer-member offset' : 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
|
||||
ERROR: 0:78: 'transform feedback qualifier' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:81: 'transform feedback qualifier' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:81: 'transform feedback qualifier' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:83: 'transform feedback qualifier' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:83: 'transform feedback qualifier' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:83: 'transform feedback qualifier' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:84: 'transform feedback qualifier' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:84: 'transform feedback qualifier' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:86: 'transform feedback qualifier' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:86: 'transform feedback qualifier' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:86: 'transform feedback qualifier' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:92: 'transform feedback qualifier' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:93: 'transform feedback qualifier' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:93: 'transform feedback qualifier' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:93: 'transform feedback qualifier' : not supported for this version or the enabled extensions
|
||||
ERROR: 44 compilation errors. No code generated.
|
||||
|
||||
|
||||
in xfb mode
|
||||
ERROR: node is still EOpNull!
|
||||
0:14 Function Definition: foo( (void)
|
||||
0:14 Function Parameters:
|
||||
@ -47,6 +79,34 @@ ERROR: node is still EOpNull!
|
||||
0:? 'cg' (layout(location=53 ) smooth out float)
|
||||
0:? 'alias1' (layout(location=10 ) in 4-component vector of float)
|
||||
0:? 'alias2' (layout(location=10 ) in 4-component vector of float)
|
||||
0:? 'v6e' (layout(location=0 ) in 4-component vector of float)
|
||||
0:? 'ininst2e' (in block{layout(location=25 ) in float f2})
|
||||
0:? 'in4e' (in block{layout(location=50 ) in float f1, layout(location=51 ) in float f2})
|
||||
0:? 'inst4e' (layout(column_major std140 align=16 ) uniform block{layout(column_major std140 offset=0 align=16 ) uniform int a})
|
||||
0:? 'inst9e' (layout(column_major shared align=32 ) uniform block{layout(column_major shared offset=12 align=4 ) uniform float f, layout(column_major shared offset=20 ) uniform float g})
|
||||
0:? 'spinste' (layout(column_major std140 ) uniform block{layout(column_major std140 offset=0 ) uniform 4-component vector of float a, layout(column_major std140 offset=32 ) uniform 3-component vector of float b})
|
||||
0:? 'aconste' (4-element array of int)
|
||||
0:? 'bconste' (64-element array of int)
|
||||
0:? 'bbinst2' (out block{layout(xfb_buffer=0 xfb_offset=64 ) out 4-component vector of float bbv})
|
||||
0:? 'bge' (layout(xfb_buffer=2 xfb_offset=48 xfb_stride=80 ) smooth out 4-component vector of float)
|
||||
0:? 'bhe' (layout(xfb_buffer=3 xfb_offset=32 xfb_stride=64 ) smooth out 4-component vector of float)
|
||||
0:? 'bbinst4e' (layout(xfb_stride=80 ) out block{layout(xfb_buffer=2 xfb_offset=16 ) out 4-component vector of float bbv1, layout(xfb_buffer=2 xfb_offset=32 ) out 4-component vector of float bbv2})
|
||||
0:? 'bbinst5e' (out block{layout(xfb_buffer=3 xfb_offset=0 ) out 4-component vector of float bbv1, layout(xfb_buffer=3 xfb_offset=48 xfb_stride=64 ) out 4-component vector of float bbv2})
|
||||
0:? 'inst4' (layout(column_major std140 align=16 ) uniform block{layout(column_major std140 offset=0 align=16 ) uniform int a})
|
||||
0:? 'inst9' (layout(column_major std430 align=32 ) uniform block{layout(column_major std430 offset=12 align=4 ) uniform float f, layout(column_major std430 offset=20 align=32 ) uniform float g})
|
||||
0:? 'spinst' (layout(column_major std140 ) uniform block{layout(column_major std140 offset=0 ) uniform 4-component vector of float a, layout(column_major std140 offset=32 ) uniform 3-component vector of float b})
|
||||
0:? 'aconst' (4-element array of int)
|
||||
0:? 'bconst' (64-element array of int)
|
||||
0:? 'start2' (const int)
|
||||
0:? 5 (const int)
|
||||
0:? 'v6' (layout(location=19 ) in 4-component vector of float)
|
||||
0:? 'ininst2' (in block{layout(location=28 component=0 ) in bool b1, layout(location=29 component=0 ) in float f1, layout(location=25 ) in float f2})
|
||||
0:? 'in4' (in block{layout(location=50 ) in float f1, layout(location=51 ) in float f2})
|
||||
0:? 'bbinst2g' (out block{layout(xfb_buffer=3 xfb_offset=64 ) out 4-component vector of float bbv})
|
||||
0:? 'bg' (layout(xfb_buffer=1 xfb_offset=48 xfb_stride=80 ) smooth out 4-component vector of float)
|
||||
0:? 'bh' (layout(xfb_buffer=1 xfb_offset=32 xfb_stride=80 ) smooth out 4-component vector of float)
|
||||
0:? 'bbinst4' (layout(xfb_stride=80 ) out block{layout(xfb_buffer=1 xfb_offset=16 ) out 4-component vector of float bbv1})
|
||||
0:? 'bbinst5' (out block{layout(xfb_buffer=1 xfb_offset=0 ) out 4-component vector of float bbv1, layout(xfb_buffer=1 xfb_offset=64 xfb_stride=80 ) out 4-component vector of float bbv2})
|
||||
0:? 'gl_VertexID' (gl_VertexId int)
|
||||
0:? 'gl_InstanceID' (gl_InstanceId int)
|
||||
|
||||
@ -54,5 +114,8 @@ ERROR: node is still EOpNull!
|
||||
Linked vertex stage:
|
||||
|
||||
ERROR: Linking vertex stage: Missing entry point: Each stage requires one "void main()" entry point
|
||||
ERROR: Linking vertex stage: xfb_stride is too small to hold all buffer entries:
|
||||
ERROR: xfb_buffer 3, xfb_stride 64, minimum stride needed: 80
|
||||
|
||||
in xfb mode
|
||||
|
||||
|
@ -82,6 +82,8 @@ ERROR: node is still EOpNull!
|
||||
0:? 'specExample430' (layout(column_major std430 ) uniform block{layout(column_major std430 offset=0 ) uniform 4-component vector of float a, layout(column_major std430 offset=32 ) uniform 3-component vector of float b, layout(column_major std430 offset=48 ) uniform 2-component vector of float d, layout(column_major std430 offset=64 align=16 ) uniform float e, layout(column_major std430 offset=72 align=2 ) uniform double f, layout(column_major std430 offset=80 ) uniform float h, layout(column_major std430 offset=128 align=64 ) uniform 3-component vector of double i, layout(column_major std430 offset=168 align=8 ) uniform float j})
|
||||
0:? 'specExample4300' (layout(column_major std430 align=128 ) uniform block{layout(column_major std430 offset=0 align=128 ) uniform 4-component vector of float a, layout(column_major std430 offset=128 align=128 ) uniform 3-component vector of float b, layout(column_major std430 offset=256 align=128 ) uniform 2-component vector of float d, layout(column_major std430 offset=384 align=128 ) uniform float e, layout(column_major std430 offset=512 align=128 ) uniform double f, layout(column_major std430 offset=640 align=128 ) uniform float h, layout(column_major std430 offset=768 align=128 ) uniform 3-component vector of double i})
|
||||
0:? 'specExample4301' (layout(column_major std430 align=128 ) uniform block{layout(column_major std430 offset=0 align=128 ) uniform 4-component vector of float a, layout(column_major std430 offset=128 align=128 ) uniform 3-component vector of float b, layout(column_major std430 offset=256 align=128 ) uniform 2-component vector of float d, layout(column_major std430 offset=512 align=128 ) uniform float e, layout(column_major std430 offset=520 align=8 ) uniform double f, layout(column_major std430 offset=640 align=128 ) uniform float h, layout(column_major std430 offset=768 align=128 ) uniform 3-component vector of double i})
|
||||
0:? 'aconst' (4-element array of int)
|
||||
0:? 'bconst' (64-element array of int)
|
||||
|
||||
|
||||
Linked fragment stage:
|
||||
|
6
Todo.txt
6
Todo.txt
@ -237,12 +237,12 @@ Shader Functionality to Implement/Finish
|
||||
+ Add missing type in grammar, ATOMIC_UINT, and missing qualifiers COHERENT, VOLATILE, RESTRICT, READONLY, and WRITEONLY.
|
||||
+ Add missing initializer lists to grammar.
|
||||
GLSL 4.4
|
||||
- Incorporate the ARB_enhanced_layouts extension, which adds
|
||||
+ Incorporate the ARB_enhanced_layouts extension, which adds
|
||||
+ compile-time constant expressions for layout qualifier integers
|
||||
- new offset and align layout qualifiers for control over buffer block layouts
|
||||
+ new offset and align layout qualifiers for control over buffer block layouts
|
||||
+ add location layout qualifier for input and output blocks and block members
|
||||
+ new component layout qualifier for finer-grained layout control of input and output variables and blocks
|
||||
- new xfb_buffer, xfb_stride, and xfb_offsetlayout qualifiers to allow the shader to control
|
||||
+ new xfb_buffer, xfb_stride, and xfb_offsetlayout qualifiers to allow the shader to control
|
||||
transform feedback buffering.
|
||||
+ Bug 10530: To be consistent with ES, include sample types as valid in a precision statement.
|
||||
Note the defaults are irrelevant, as precision qualifiers are not required or have any meaning.
|
||||
|
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user