diff --git a/Test/baseResults/hlsl.init.frag.out b/Test/baseResults/hlsl.init.frag.out index 42f94cae..c7e5e23f 100755 --- a/Test/baseResults/hlsl.init.frag.out +++ b/Test/baseResults/hlsl.init.frag.out @@ -1,4 +1,7 @@ hlsl.init.frag +WARNING: 0:40: 'typedef' : struct-member initializers ignored +WARNING: 0:40: 'typedef' : struct-member initializers ignored + Shader version: 450 gl_FragCoord origin is upper left 0:? Sequence @@ -152,6 +155,7 @@ gl_FragCoord origin is upper left 0:? 'single2' (global structure{temp 2-component vector of uint v}) 0:? 'single3' (global structure{temp structure{temp int f} s1}) 0:? 'single4' (global structure{temp structure{temp 2-component vector of uint v} s1}) +0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(row_major std140 ) uniform float a, layout(row_major std140 ) uniform float b, layout(row_major std140 ) uniform float c}) Linked fragment stage: @@ -310,10 +314,11 @@ gl_FragCoord origin is upper left 0:? 'single2' (global structure{temp 2-component vector of uint v}) 0:? 'single3' (global structure{temp structure{temp int f} s1}) 0:? 'single4' (global structure{temp structure{temp 2-component vector of uint v} s1}) +0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(row_major std140 ) uniform float a, layout(row_major std140 ) uniform float b, layout(row_major std140 ) uniform float c}) // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 97 +// Id's are bound by 100 Capability Shader 1: ExtInstImport "GLSL.std.450" @@ -361,8 +366,18 @@ gl_FragCoord origin is upper left Name 90 "input" Name 95 "c4" Name 96 "b5" + Name 97 "Constants" + MemberName 97(Constants) 0 "a" + MemberName 97(Constants) 1 "b" + MemberName 97(Constants) 2 "c" + Name 99 "" Decorate 88(@entryPointOutput) Location 0 Decorate 90(input) Location 0 + MemberDecorate 97(Constants) 0 Offset 0 + MemberDecorate 97(Constants) 1 Offset 4 + MemberDecorate 97(Constants) 2 Offset 8 + Decorate 97(Constants) Block + Decorate 99 DescriptorSet 0 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -437,6 +452,9 @@ gl_FragCoord origin is upper left 90(input): 89(ptr) Variable Input 95(c4): 22(ptr) Variable Private 96(b5): 22(ptr) Variable Private + 97(Constants): TypeStruct 6(float) 6(float) 6(float) + 98: TypePointer Uniform 97(Constants) + 99: 98(ptr) Variable Uniform 4(ShaderFunction): 2 Function None 3 5: Label 62(a2): 61(ptr) Variable Function diff --git a/Test/hlsl.init.frag b/Test/hlsl.init.frag index a3f6f0e7..8caf3c7d 100644 --- a/Test/hlsl.init.frag +++ b/Test/hlsl.init.frag @@ -34,3 +34,8 @@ float4 ShaderFunction(float4 input) : COLOR0 return input * a1; } + +cbuffer Constants +{ + float a = 1.0f, b, c = 2.0f; +}; diff --git a/glslang/Include/revision.h b/glslang/Include/revision.h index 55b6b282..796f81a9 100644 --- a/glslang/Include/revision.h +++ b/glslang/Include/revision.h @@ -2,5 +2,5 @@ // For the version, it uses the latest git tag followed by the number of commits. // For the date, it uses the current date (when then script is run). -#define GLSLANG_REVISION "Overload400-PrecQual.1804" +#define GLSLANG_REVISION "Overload400-PrecQual.1805" #define GLSLANG_DATE "02-Feb-2017" diff --git a/hlsl/hlslGrammar.cpp b/hlsl/hlslGrammar.cpp index 25fd5e3e..6c204137 100755 --- a/hlsl/hlslGrammar.cpp +++ b/hlsl/hlslGrammar.cpp @@ -1758,6 +1758,16 @@ bool HlslGrammar::acceptStructDeclarationList(TTypeList*& typeList) acceptPostDecls(member.type->getQualifier()); + // EQUAL assignment_expression + if (acceptTokenClass(EHTokAssign)) { + parseContext.warn(idToken.loc, "struct-member initializers ignored", "typedef", ""); + TIntermTyped* expressionNode = nullptr; + if (! acceptAssignmentExpression(expressionNode)) { + expected("initializer"); + return false; + } + } + // success on seeing the SEMICOLON coming up if (peekTokenClass(EHTokSemicolon)) break;