From 88c4464df52f2692a344a92a3ac68cd33aa31574 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Fri, 3 Feb 2017 14:06:36 -0700 Subject: [PATCH] HLSL: Have loose uniforms also go through the makeTypeNonIo() path. --- Test/baseResults/hlsl.array.flatten.frag.out | 8 ++++---- Test/baseResults/hlsl.float4.frag.out | 9 ++++----- Test/baseResults/hlsl.struct.frag.out | 8 ++++---- glslang/Include/revision.h | 2 +- hlsl/hlslParseHelper.cpp | 6 ++++++ hlsl/hlslParseHelper.h | 2 ++ 6 files changed, 21 insertions(+), 14 deletions(-) diff --git a/Test/baseResults/hlsl.array.flatten.frag.out b/Test/baseResults/hlsl.array.flatten.frag.out index 3b5a2a7..5ea13cc 100644 --- a/Test/baseResults/hlsl.array.flatten.frag.out +++ b/Test/baseResults/hlsl.array.flatten.frag.out @@ -87,7 +87,7 @@ gl_FragCoord origin is upper left 0:35 move second child to first child (temp 4-element array of float) 0:35 'local_float_array' (temp 4-element array of float) 0:35 g_floats: direct index for structure (layout(offset=384 ) uniform 4-element array of float) -0:35 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-element array of 3X3 matrix of float g_mats, layout(binding=10 offset=192 ) uniform 4-element array of 3X3 matrix of float g_mats_explicit, layout(offset=384 ) uniform 4-element array of float g_floats}) +0:35 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-element array of 3X3 matrix of float g_mats, layout(offset=192 ) uniform 4-element array of 3X3 matrix of float g_mats_explicit, layout(offset=384 ) uniform 4-element array of float g_floats}) 0:35 Constant: 0:35 2 (const uint) 0:37 move second child to first child (temp 4-component vector of float) @@ -165,7 +165,7 @@ gl_FragCoord origin is upper left 0:? 'g_samp_explicit[0]' (layout(binding=5 ) uniform sampler) 0:? 'g_samp_explicit[1]' (layout(binding=6 ) uniform sampler) 0:? 'g_samp_explicit[2]' (layout(binding=7 ) uniform sampler) -0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-element array of 3X3 matrix of float g_mats, layout(binding=10 offset=192 ) uniform 4-element array of 3X3 matrix of float g_mats_explicit, layout(offset=384 ) uniform 4-element array of float g_floats}) +0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-element array of 3X3 matrix of float g_mats, layout(offset=192 ) uniform 4-element array of 3X3 matrix of float g_mats_explicit, layout(offset=384 ) uniform 4-element array of float g_floats}) 0:? 'not_flattened_a' (global 5-element array of int) 0:? 'color' (layout(location=0 ) out 4-component vector of float) @@ -261,7 +261,7 @@ gl_FragCoord origin is upper left 0:35 move second child to first child (temp 4-element array of float) 0:35 'local_float_array' (temp 4-element array of float) 0:35 g_floats: direct index for structure (layout(offset=384 ) uniform 4-element array of float) -0:35 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-element array of 3X3 matrix of float g_mats, layout(binding=10 offset=192 ) uniform 4-element array of 3X3 matrix of float g_mats_explicit, layout(offset=384 ) uniform 4-element array of float g_floats}) +0:35 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-element array of 3X3 matrix of float g_mats, layout(offset=192 ) uniform 4-element array of 3X3 matrix of float g_mats_explicit, layout(offset=384 ) uniform 4-element array of float g_floats}) 0:35 Constant: 0:35 2 (const uint) 0:37 move second child to first child (temp 4-component vector of float) @@ -339,7 +339,7 @@ gl_FragCoord origin is upper left 0:? 'g_samp_explicit[0]' (layout(binding=5 ) uniform sampler) 0:? 'g_samp_explicit[1]' (layout(binding=6 ) uniform sampler) 0:? 'g_samp_explicit[2]' (layout(binding=7 ) uniform sampler) -0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-element array of 3X3 matrix of float g_mats, layout(binding=10 offset=192 ) uniform 4-element array of 3X3 matrix of float g_mats_explicit, layout(offset=384 ) uniform 4-element array of float g_floats}) +0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-element array of 3X3 matrix of float g_mats, layout(offset=192 ) uniform 4-element array of 3X3 matrix of float g_mats_explicit, layout(offset=384 ) uniform 4-element array of float g_floats}) 0:? 'not_flattened_a' (global 5-element array of int) 0:? 'color' (layout(location=0 ) out 4-component vector of float) diff --git a/Test/baseResults/hlsl.float4.frag.out b/Test/baseResults/hlsl.float4.frag.out index 27c9a5c..9a83da4 100755 --- a/Test/baseResults/hlsl.float4.frag.out +++ b/Test/baseResults/hlsl.float4.frag.out @@ -13,11 +13,11 @@ gl_FragCoord origin is upper left 0:10 component-wise multiply (temp 4-component vector of float) 0:10 'input' (in 4-component vector of float) 0:10 AmbientColor: direct index for structure (layout(offset=0 ) uniform 4-component vector of float) -0:10 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-component vector of float AmbientColor, layout(offset=16 ) uniform bool Face ff1, layout(offset=20 ) uniform float ff2, layout(binding=0 offset=32 ) uniform 4-component vector of float ff3, layout(binding=1 offset=48 ) uniform 4-component vector of float ff4}) +0:10 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-component vector of float AmbientColor, layout(offset=16 ) uniform bool ff1, layout(offset=20 ) uniform float ff2, layout(offset=32 ) uniform 4-component vector of float ff3, layout(offset=48 ) uniform 4-component vector of float ff4}) 0:10 Constant: 0:10 0 (const uint) 0:? Linker Objects -0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-component vector of float AmbientColor, layout(offset=16 ) uniform bool Face ff1, layout(offset=20 ) uniform float ff2, layout(binding=0 offset=32 ) uniform 4-component vector of float ff3, layout(binding=1 offset=48 ) uniform 4-component vector of float ff4}) +0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-component vector of float AmbientColor, layout(offset=16 ) uniform bool ff1, layout(offset=20 ) uniform float ff2, layout(offset=32 ) uniform 4-component vector of float ff3, layout(offset=48 ) uniform 4-component vector of float ff4}) Linked fragment stage: @@ -35,11 +35,11 @@ gl_FragCoord origin is upper left 0:10 component-wise multiply (temp 4-component vector of float) 0:10 'input' (in 4-component vector of float) 0:10 AmbientColor: direct index for structure (layout(offset=0 ) uniform 4-component vector of float) -0:10 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-component vector of float AmbientColor, layout(offset=16 ) uniform bool Face ff1, layout(offset=20 ) uniform float ff2, layout(binding=0 offset=32 ) uniform 4-component vector of float ff3, layout(binding=1 offset=48 ) uniform 4-component vector of float ff4}) +0:10 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-component vector of float AmbientColor, layout(offset=16 ) uniform bool ff1, layout(offset=20 ) uniform float ff2, layout(offset=32 ) uniform 4-component vector of float ff3, layout(offset=48 ) uniform 4-component vector of float ff4}) 0:10 Constant: 0:10 0 (const uint) 0:? Linker Objects -0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-component vector of float AmbientColor, layout(offset=16 ) uniform bool Face ff1, layout(offset=20 ) uniform float ff2, layout(binding=0 offset=32 ) uniform 4-component vector of float ff3, layout(binding=1 offset=48 ) uniform 4-component vector of float ff4}) +0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-component vector of float AmbientColor, layout(offset=16 ) uniform bool ff1, layout(offset=20 ) uniform float ff2, layout(offset=32 ) uniform 4-component vector of float ff3, layout(offset=48 ) uniform 4-component vector of float ff4}) // Module Version 10000 // Generated by (magic number): 80001 @@ -62,7 +62,6 @@ gl_FragCoord origin is upper left Name 17 "" MemberDecorate 15($Global) 0 Offset 0 MemberDecorate 15($Global) 1 Offset 16 - MemberDecorate 15($Global) 1 BuiltIn FrontFacing MemberDecorate 15($Global) 2 Offset 20 MemberDecorate 15($Global) 3 Offset 32 MemberDecorate 15($Global) 4 Offset 48 diff --git a/Test/baseResults/hlsl.struct.frag.out b/Test/baseResults/hlsl.struct.frag.out index e4aa492..c6bf413 100755 --- a/Test/baseResults/hlsl.struct.frag.out +++ b/Test/baseResults/hlsl.struct.frag.out @@ -111,7 +111,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float) 0:? 'input' (layout(location=0 ) in 4-component vector of float) 0:? 's' (layout(location=1 ) in structure{smooth temp 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, layout(offset=4 ) temp bool ff2, layout(binding=0 offset=4 ) temp bool ff3, layout(binding=0 offset=4 ) temp 4-component vector of float ff4}) -0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform structure{temp bool b, temp bool c, temp 4-component vector of float a, temp 4-component vector of float d} s1, layout(binding=5 offset=1620 ) uniform float ff5, layout(binding=8 offset=1636 ) uniform float ff6}) +0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform structure{temp bool b, temp bool c, temp 4-component vector of float a, temp 4-component vector of float d} s1, layout(offset=48 ) uniform float ff5, layout(offset=52 ) uniform float ff6}) 0:? 's_ff1' (in bool Face) @@ -226,7 +226,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float) 0:? 'input' (layout(location=0 ) in 4-component vector of float) 0:? 's' (layout(location=1 ) in structure{smooth temp 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, layout(offset=4 ) temp bool ff2, layout(binding=0 offset=4 ) temp bool ff3, layout(binding=0 offset=4 ) temp 4-component vector of float ff4}) -0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform structure{temp bool b, temp bool c, temp 4-component vector of float a, temp 4-component vector of float d} s1, layout(binding=5 offset=1620 ) uniform float ff5, layout(binding=8 offset=1636 ) uniform float ff6}) +0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform structure{temp bool b, temp bool c, temp 4-component vector of float a, temp 4-component vector of float d} s1, layout(offset=48 ) uniform float ff5, layout(offset=52 ) uniform float ff6}) 0:? 's_ff1' (in bool Face) // Module Version 10000 @@ -292,8 +292,8 @@ gl_FragCoord origin is upper left MemberDecorate 93(myS) 2 Offset 16 MemberDecorate 93(myS) 3 Offset 32 MemberDecorate 94($Global) 0 Offset 0 - MemberDecorate 94($Global) 1 Offset 1620 - MemberDecorate 94($Global) 2 Offset 1636 + MemberDecorate 94($Global) 1 Offset 48 + MemberDecorate 94($Global) 2 Offset 52 Decorate 94($Global) Block Decorate 96 DescriptorSet 0 2: TypeVoid diff --git a/glslang/Include/revision.h b/glslang/Include/revision.h index fd96c4d..aa0795d 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.1786" +#define GLSLANG_REVISION "Overload400-PrecQual.1787" #define GLSLANG_DATE "03-Feb-2017" diff --git a/hlsl/hlslParseHelper.cpp b/hlsl/hlslParseHelper.cpp index c615099..1c701a3 100755 --- a/hlsl/hlslParseHelper.cpp +++ b/hlsl/hlslParseHelper.cpp @@ -159,6 +159,12 @@ bool HlslParseContext::shouldConvertLValue(const TIntermNode* node) const return false; } +void HlslParseContext::growGlobalUniformBlock(TSourceLoc& loc, TType& memberType, TString& memberName) +{ + makeTypeNonIo(&memberType); //?? losing offsets is okay? + TParseContextBase::growGlobalUniformBlock(loc, memberType, memberName); +} + // // Return a TLayoutFormat corresponding to the given texture type. // diff --git a/hlsl/hlslParseHelper.h b/hlsl/hlslParseHelper.h index 912e510..89ef680 100755 --- a/hlsl/hlslParseHelper.h +++ b/hlsl/hlslParseHelper.h @@ -160,6 +160,8 @@ public: void pushSwitchSequence(TIntermSequence* sequence) { switchSequenceStack.push_back(sequence); } void popSwitchSequence() { switchSequenceStack.pop_back(); } + virtual void growGlobalUniformBlock(TSourceLoc&, TType&, TString& memberName) override; + // Apply L-value conversions. E.g, turning a write to a RWTexture into an ImageStore. TIntermTyped* handleLvalue(const TSourceLoc&, const char* op, TIntermTyped* node); bool lValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*) override; -- 2.7.4