Merge pull request #542 from steve-lunarg/rwbuffers

HLSL: phase 2: add operator[]
This commit is contained in:
John Kessenich 2016-10-13 12:49:56 -06:00 committed by GitHub
commit f042e407a9
15 changed files with 4149 additions and 169 deletions

File diff suppressed because it is too large Load Diff

View File

@ -16,10 +16,7 @@ gl_FragCoord origin is upper left
0:39 's3' (temp structure{temp 3-component vector of bool b3})
0:40 move second child to first child (temp 4-component vector of float)
0:40 i: direct index for structure (temp 4-component vector of float)
0:40 s2: direct index for structure (layout(offset=48 ) uniform structure{temp 4-component vector of float i})
0:40 '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 structure{temp 4-component vector of float i} s2, layout(binding=5 offset=1620 ) uniform float ff5, layout(binding=8 offset=1636 ) uniform float ff6})
0:40 Constant:
0:40 1 (const uint)
0:40 's2' (global structure{temp 4-component vector of float i})
0:40 Constant:
0:40 0 (const int)
0:? 'ff4' (layout(location=7 binding=0 offset=4 ) in 4-component vector of float)
@ -29,8 +26,9 @@ gl_FragCoord origin is upper left
0:42 'input' (layout(location=0 ) in 4-component vector of float)
0:42 Branch: Return
0:? Linker Objects
0:? 's2' (global structure{temp 4-component vector of float i})
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'anon@0' (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 structure{temp 4-component vector of float i} s2, layout(binding=5 offset=1620 ) uniform float ff5, layout(binding=8 offset=1636 ) uniform float ff6})
0:? 'anon@0' (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:? 'input' (layout(location=0 ) in 4-component vector of float)
0:? 'a' (layout(location=1 ) smooth in 4-component vector of float)
0:? 'b' (layout(location=2 ) flat in bool)
@ -58,10 +56,7 @@ gl_FragCoord origin is upper left
0:39 's3' (temp structure{temp 3-component vector of bool b3})
0:40 move second child to first child (temp 4-component vector of float)
0:40 i: direct index for structure (temp 4-component vector of float)
0:40 s2: direct index for structure (layout(offset=48 ) uniform structure{temp 4-component vector of float i})
0:40 '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 structure{temp 4-component vector of float i} s2, layout(binding=5 offset=1620 ) uniform float ff5, layout(binding=8 offset=1636 ) uniform float ff6})
0:40 Constant:
0:40 1 (const uint)
0:40 's2' (global structure{temp 4-component vector of float i})
0:40 Constant:
0:40 0 (const int)
0:? 'ff4' (layout(location=7 binding=0 offset=4 ) in 4-component vector of float)
@ -71,8 +66,9 @@ gl_FragCoord origin is upper left
0:42 'input' (layout(location=0 ) in 4-component vector of float)
0:42 Branch: Return
0:? Linker Objects
0:? 's2' (global structure{temp 4-component vector of float i})
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'anon@0' (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 structure{temp 4-component vector of float i} s2, layout(binding=5 offset=1620 ) uniform float ff5, layout(binding=8 offset=1636 ) uniform float ff6})
0:? 'anon@0' (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:? 'input' (layout(location=0 ) in 4-component vector of float)
0:? 'a' (layout(location=1 ) smooth in 4-component vector of float)
0:? 'b' (layout(location=2 ) flat in bool)
@ -90,28 +86,28 @@ gl_FragCoord origin is upper left
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "PixelShaderFunction" 29 34 35 38 40 42 45 46 47 48
EntryPoint Fragment 4 "PixelShaderFunction" 25 30 31 38 40 42 45 46 47 48
ExecutionMode 4 OriginUpperLeft
Name 4 "PixelShaderFunction"
Name 8 "FS"
MemberName 8(FS) 0 "b3"
Name 10 "s3"
Name 20 "myS"
MemberName 20(myS) 0 "b"
MemberName 20(myS) 1 "c"
MemberName 20(myS) 2 "a"
MemberName 20(myS) 3 "d"
Name 21 ""
MemberName 21 0 "i"
Name 22 "$Global"
MemberName 22($Global) 0 "s1"
MemberName 22($Global) 1 "s2"
MemberName 22($Global) 2 "ff5"
MemberName 22($Global) 3 "ff6"
Name 24 ""
Name 29 "ff4"
Name 34 "@entryPointOutput"
Name 35 "input"
Name 19 ""
MemberName 19 0 "i"
Name 21 "s2"
Name 25 "ff4"
Name 30 "@entryPointOutput"
Name 31 "input"
Name 34 "myS"
MemberName 34(myS) 0 "b"
MemberName 34(myS) 1 "c"
MemberName 34(myS) 2 "a"
MemberName 34(myS) 3 "d"
Name 35 "$Global"
MemberName 35($Global) 0 "s1"
MemberName 35($Global) 1 "ff5"
MemberName 35($Global) 2 "ff6"
Name 37 ""
Name 38 "a"
Name 40 "b"
Name 42 "c"
@ -119,22 +115,13 @@ gl_FragCoord origin is upper left
Name 46 "ff1"
Name 47 "ff2"
Name 48 "ff3"
MemberDecorate 20(myS) 0 Offset 0
MemberDecorate 20(myS) 1 Offset 4
MemberDecorate 20(myS) 2 Offset 16
MemberDecorate 20(myS) 3 Offset 32
MemberDecorate 21 0 Offset 0
MemberDecorate 22($Global) 0 Offset 0
MemberDecorate 22($Global) 1 Offset 48
MemberDecorate 22($Global) 2 Offset 1620
MemberDecorate 22($Global) 3 Offset 1636
Decorate 22($Global) Block
Decorate 24 DescriptorSet 0
Decorate 29(ff4) Offset 4
Decorate 29(ff4) Location 7
Decorate 29(ff4) Binding 0
Decorate 34(@entryPointOutput) Location 0
Decorate 35(input) Location 0
Decorate 25(ff4) Offset 4
Decorate 25(ff4) Location 7
Decorate 25(ff4) Binding 0
Decorate 30(@entryPointOutput) Location 0
Decorate 31(input) Location 0
Decorate 35($Global) Block
Decorate 37 DescriptorSet 0
Decorate 38(a) Location 1
Decorate 40(b) Flat
Decorate 40(b) Location 2
@ -155,29 +142,29 @@ gl_FragCoord origin is upper left
7: TypeVector 6(bool) 3
8(FS): TypeStruct 7(bvec3)
9: TypePointer Function 8(FS)
17: TypeInt 32 0
18: TypeFloat 32
19: TypeVector 18(float) 4
20(myS): TypeStruct 17(int) 17(int) 19(fvec4) 19(fvec4)
21: TypeStruct 19(fvec4)
22($Global): TypeStruct 20(myS) 21(struct) 18(float) 18(float)
23: TypePointer Uniform 22($Global)
24: 23(ptr) Variable Uniform
25: TypeInt 32 1
26: 25(int) Constant 1
27: 25(int) Constant 0
28: TypePointer Input 19(fvec4)
29(ff4): 28(ptr) Variable Input
31: TypePointer Uniform 19(fvec4)
33: TypePointer Output 19(fvec4)
34(@entryPointOutput): 33(ptr) Variable Output
35(input): 28(ptr) Variable Input
38(a): 28(ptr) Variable Input
17: TypeFloat 32
18: TypeVector 17(float) 4
19: TypeStruct 18(fvec4)
20: TypePointer Private 19(struct)
21(s2): 20(ptr) Variable Private
22: TypeInt 32 1
23: 22(int) Constant 0
24: TypePointer Input 18(fvec4)
25(ff4): 24(ptr) Variable Input
27: TypePointer Private 18(fvec4)
29: TypePointer Output 18(fvec4)
30(@entryPointOutput): 29(ptr) Variable Output
31(input): 24(ptr) Variable Input
34(myS): TypeStruct 6(bool) 6(bool) 18(fvec4) 18(fvec4)
35($Global): TypeStruct 34(myS) 17(float) 17(float)
36: TypePointer Uniform 35($Global)
37: 36(ptr) Variable Uniform
38(a): 24(ptr) Variable Input
39: TypePointer Input 6(bool)
40(b): 39(ptr) Variable Input
41: TypePointer Input 18(float)
41: TypePointer Input 17(float)
42(c): 41(ptr) Variable Input
43: TypeVector 18(float) 2
43: TypeVector 17(float) 2
44: TypePointer Input 43(fvec2)
45(d): 44(ptr) Variable Input
46(ff1): 39(ptr) Variable Input
@ -192,10 +179,10 @@ gl_FragCoord origin is upper left
14: 7(bvec3) CompositeExtract 12 0
15: 7(bvec3) LogicalEqual 13 14
16: 6(bool) All 15
30: 19(fvec4) Load 29(ff4)
32: 31(ptr) AccessChain 24 26 27
Store 32 30
36: 19(fvec4) Load 35(input)
Store 34(@entryPointOutput) 36
26: 18(fvec4) Load 25(ff4)
28: 27(ptr) AccessChain 21(s2) 23
Store 28 26
32: 18(fvec4) Load 31(input)
Store 30(@entryPointOutput) 32
Return
FunctionEnd

View File

@ -0,0 +1,702 @@
hlsl.tx.bracket.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:38 Function Definition: Fn1(vi4; (temp 4-component vector of int)
0:38 Function Parameters:
0:38 'x' (in 4-component vector of int)
0:? Sequence
0:38 Branch: Return with expression
0:38 'x' (in 4-component vector of int)
0:39 Function Definition: Fn1(vu4; (temp 4-component vector of uint)
0:39 Function Parameters:
0:39 'x' (in 4-component vector of uint)
0:? Sequence
0:39 Branch: Return with expression
0:39 'x' (in 4-component vector of uint)
0:40 Function Definition: Fn1(vf4; (temp 4-component vector of float)
0:40 Function Parameters:
0:40 'x' (in 4-component vector of float)
0:? Sequence
0:40 Branch: Return with expression
0:40 'x' (in 4-component vector of float)
0:42 Function Definition: SomeValue( (temp 4-component vector of float)
0:42 Function Parameters:
0:? Sequence
0:42 Branch: Return with expression
0:42 Convert int to float (temp 4-component vector of float)
0:42 c4: direct index for structure (layout(offset=32 ) uniform 4-component vector of int)
0:42 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:42 Constant:
0:42 3 (const uint)
0:45 Function Definition: main( (temp structure{temp 4-component vector of float Color})
0:45 Function Parameters:
0:? Sequence
0:49 textureFetch (temp 4-component vector of float)
0:49 'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
0:49 c1: direct index for structure (layout(offset=0 ) uniform int)
0:49 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:49 Constant:
0:49 0 (const uint)
0:49 Constant:
0:49 0 (const int)
0:51 Sequence
0:51 move second child to first child (temp 4-component vector of float)
0:51 'r00' (temp 4-component vector of float)
0:51 textureFetch (temp 4-component vector of float)
0:51 'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
0:51 c1: direct index for structure (layout(offset=0 ) uniform int)
0:51 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:51 Constant:
0:51 0 (const uint)
0:51 Constant:
0:51 0 (const int)
0:52 Sequence
0:52 move second child to first child (temp 4-component vector of int)
0:52 'r01' (temp 4-component vector of int)
0:52 textureFetch (temp 4-component vector of int)
0:52 'g_tTex1di4' (uniform itexture1D)
0:52 c1: direct index for structure (layout(offset=0 ) uniform int)
0:52 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:52 Constant:
0:52 0 (const uint)
0:52 Constant:
0:52 0 (const int)
0:53 Sequence
0:53 move second child to first child (temp 4-component vector of uint)
0:53 'r02' (temp 4-component vector of uint)
0:53 textureFetch (temp 4-component vector of uint)
0:53 'g_tTex1du4' (uniform utexture1D)
0:53 c1: direct index for structure (layout(offset=0 ) uniform int)
0:53 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:53 Constant:
0:53 0 (const uint)
0:53 Constant:
0:53 0 (const int)
0:56 Sequence
0:56 move second child to first child (temp 4-component vector of float)
0:56 'r10' (temp 4-component vector of float)
0:56 textureFetch (temp 4-component vector of float)
0:56 'g_tTex2df4' (uniform texture2D)
0:56 c2: direct index for structure (layout(offset=8 ) uniform 2-component vector of int)
0:56 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:56 Constant:
0:56 1 (const uint)
0:56 Constant:
0:56 0 (const int)
0:57 Sequence
0:57 move second child to first child (temp 4-component vector of int)
0:57 'r11' (temp 4-component vector of int)
0:57 textureFetch (temp 4-component vector of int)
0:57 'g_tTex2di4' (uniform itexture2D)
0:57 c2: direct index for structure (layout(offset=8 ) uniform 2-component vector of int)
0:57 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:57 Constant:
0:57 1 (const uint)
0:57 Constant:
0:57 0 (const int)
0:58 Sequence
0:58 move second child to first child (temp 4-component vector of uint)
0:58 'r12' (temp 4-component vector of uint)
0:58 textureFetch (temp 4-component vector of uint)
0:58 'g_tTex2du4' (uniform utexture2D)
0:58 c2: direct index for structure (layout(offset=8 ) uniform 2-component vector of int)
0:58 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:58 Constant:
0:58 1 (const uint)
0:58 Constant:
0:58 0 (const int)
0:61 Sequence
0:61 move second child to first child (temp 4-component vector of float)
0:61 'r20' (temp 4-component vector of float)
0:61 textureFetch (temp 4-component vector of float)
0:61 'g_tTex3df4' (uniform texture3D)
0:61 c3: direct index for structure (layout(offset=16 ) uniform 3-component vector of int)
0:61 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:61 Constant:
0:61 2 (const uint)
0:61 Constant:
0:61 0 (const int)
0:62 Sequence
0:62 move second child to first child (temp 4-component vector of int)
0:62 'r21' (temp 4-component vector of int)
0:62 textureFetch (temp 4-component vector of int)
0:62 'g_tTex3di4' (uniform itexture3D)
0:62 c3: direct index for structure (layout(offset=16 ) uniform 3-component vector of int)
0:62 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:62 Constant:
0:62 2 (const uint)
0:62 Constant:
0:62 0 (const int)
0:63 Sequence
0:63 move second child to first child (temp 4-component vector of uint)
0:63 'r22' (temp 4-component vector of uint)
0:63 textureFetch (temp 4-component vector of uint)
0:63 'g_tTex3du4' (uniform utexture3D)
0:63 c3: direct index for structure (layout(offset=16 ) uniform 3-component vector of int)
0:63 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:63 Constant:
0:63 2 (const uint)
0:63 Constant:
0:63 0 (const int)
0:66 Function Call: Fn1(vf4; (temp 4-component vector of float)
0:66 textureFetch (temp 4-component vector of float)
0:66 'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
0:66 c1: direct index for structure (layout(offset=0 ) uniform int)
0:66 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:66 Constant:
0:66 0 (const uint)
0:66 Constant:
0:66 0 (const int)
0:67 Function Call: Fn1(vi4; (temp 4-component vector of int)
0:67 textureFetch (temp 4-component vector of int)
0:67 'g_tTex1di4' (uniform itexture1D)
0:67 c1: direct index for structure (layout(offset=0 ) uniform int)
0:67 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:67 Constant:
0:67 0 (const uint)
0:67 Constant:
0:67 0 (const int)
0:68 Function Call: Fn1(vu4; (temp 4-component vector of uint)
0:68 textureFetch (temp 4-component vector of uint)
0:68 'g_tTex1du4' (uniform utexture1D)
0:68 c1: direct index for structure (layout(offset=0 ) uniform int)
0:68 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:68 Constant:
0:68 0 (const uint)
0:68 Constant:
0:68 0 (const int)
0:70 move second child to first child (temp 4-component vector of float)
0:70 Color: direct index for structure (temp 4-component vector of float)
0:70 'psout' (temp structure{temp 4-component vector of float Color})
0:70 Constant:
0:70 0 (const int)
0:70 Constant:
0:70 1.000000
0:70 1.000000
0:70 1.000000
0:70 1.000000
0:72 Sequence
0:72 Sequence
0:72 move second child to first child (temp 4-component vector of float)
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:72 Color: direct index for structure (temp 4-component vector of float)
0:72 'psout' (temp structure{temp 4-component vector of float Color})
0:72 Constant:
0:72 0 (const int)
0:72 Branch: Return
0:? Linker Objects
0:? 'g_sSamp' (layout(binding=0 ) uniform sampler)
0:? 'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
0:? 'g_tTex1di4' (uniform itexture1D)
0:? 'g_tTex1du4' (uniform utexture1D)
0:? 'g_tTex2df4' (uniform texture2D)
0:? 'g_tTex2di4' (uniform itexture2D)
0:? 'g_tTex2du4' (uniform utexture2D)
0:? 'g_tTex3df4' (uniform texture3D)
0:? 'g_tTex3di4' (uniform itexture3D)
0:? 'g_tTex3du4' (uniform utexture3D)
0:? 'g_tTex1df4a' (uniform texture1DArray)
0:? 'g_tTex1di4a' (uniform itexture1DArray)
0:? 'g_tTex1du4a' (uniform utexture1DArray)
0:? 'g_tTex2df4a' (uniform texture2DArray)
0:? 'g_tTex2di4a' (uniform itexture2DArray)
0:? 'g_tTex2du4a' (uniform utexture2DArray)
0:? 'anon@0' (uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:38 Function Definition: Fn1(vi4; (temp 4-component vector of int)
0:38 Function Parameters:
0:38 'x' (in 4-component vector of int)
0:? Sequence
0:38 Branch: Return with expression
0:38 'x' (in 4-component vector of int)
0:39 Function Definition: Fn1(vu4; (temp 4-component vector of uint)
0:39 Function Parameters:
0:39 'x' (in 4-component vector of uint)
0:? Sequence
0:39 Branch: Return with expression
0:39 'x' (in 4-component vector of uint)
0:40 Function Definition: Fn1(vf4; (temp 4-component vector of float)
0:40 Function Parameters:
0:40 'x' (in 4-component vector of float)
0:? Sequence
0:40 Branch: Return with expression
0:40 'x' (in 4-component vector of float)
0:42 Function Definition: SomeValue( (temp 4-component vector of float)
0:42 Function Parameters:
0:? Sequence
0:42 Branch: Return with expression
0:42 Convert int to float (temp 4-component vector of float)
0:42 c4: direct index for structure (layout(offset=32 ) uniform 4-component vector of int)
0:42 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:42 Constant:
0:42 3 (const uint)
0:45 Function Definition: main( (temp structure{temp 4-component vector of float Color})
0:45 Function Parameters:
0:? Sequence
0:49 textureFetch (temp 4-component vector of float)
0:49 'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
0:49 c1: direct index for structure (layout(offset=0 ) uniform int)
0:49 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:49 Constant:
0:49 0 (const uint)
0:49 Constant:
0:49 0 (const int)
0:51 Sequence
0:51 move second child to first child (temp 4-component vector of float)
0:51 'r00' (temp 4-component vector of float)
0:51 textureFetch (temp 4-component vector of float)
0:51 'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
0:51 c1: direct index for structure (layout(offset=0 ) uniform int)
0:51 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:51 Constant:
0:51 0 (const uint)
0:51 Constant:
0:51 0 (const int)
0:52 Sequence
0:52 move second child to first child (temp 4-component vector of int)
0:52 'r01' (temp 4-component vector of int)
0:52 textureFetch (temp 4-component vector of int)
0:52 'g_tTex1di4' (uniform itexture1D)
0:52 c1: direct index for structure (layout(offset=0 ) uniform int)
0:52 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:52 Constant:
0:52 0 (const uint)
0:52 Constant:
0:52 0 (const int)
0:53 Sequence
0:53 move second child to first child (temp 4-component vector of uint)
0:53 'r02' (temp 4-component vector of uint)
0:53 textureFetch (temp 4-component vector of uint)
0:53 'g_tTex1du4' (uniform utexture1D)
0:53 c1: direct index for structure (layout(offset=0 ) uniform int)
0:53 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:53 Constant:
0:53 0 (const uint)
0:53 Constant:
0:53 0 (const int)
0:56 Sequence
0:56 move second child to first child (temp 4-component vector of float)
0:56 'r10' (temp 4-component vector of float)
0:56 textureFetch (temp 4-component vector of float)
0:56 'g_tTex2df4' (uniform texture2D)
0:56 c2: direct index for structure (layout(offset=8 ) uniform 2-component vector of int)
0:56 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:56 Constant:
0:56 1 (const uint)
0:56 Constant:
0:56 0 (const int)
0:57 Sequence
0:57 move second child to first child (temp 4-component vector of int)
0:57 'r11' (temp 4-component vector of int)
0:57 textureFetch (temp 4-component vector of int)
0:57 'g_tTex2di4' (uniform itexture2D)
0:57 c2: direct index for structure (layout(offset=8 ) uniform 2-component vector of int)
0:57 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:57 Constant:
0:57 1 (const uint)
0:57 Constant:
0:57 0 (const int)
0:58 Sequence
0:58 move second child to first child (temp 4-component vector of uint)
0:58 'r12' (temp 4-component vector of uint)
0:58 textureFetch (temp 4-component vector of uint)
0:58 'g_tTex2du4' (uniform utexture2D)
0:58 c2: direct index for structure (layout(offset=8 ) uniform 2-component vector of int)
0:58 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:58 Constant:
0:58 1 (const uint)
0:58 Constant:
0:58 0 (const int)
0:61 Sequence
0:61 move second child to first child (temp 4-component vector of float)
0:61 'r20' (temp 4-component vector of float)
0:61 textureFetch (temp 4-component vector of float)
0:61 'g_tTex3df4' (uniform texture3D)
0:61 c3: direct index for structure (layout(offset=16 ) uniform 3-component vector of int)
0:61 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:61 Constant:
0:61 2 (const uint)
0:61 Constant:
0:61 0 (const int)
0:62 Sequence
0:62 move second child to first child (temp 4-component vector of int)
0:62 'r21' (temp 4-component vector of int)
0:62 textureFetch (temp 4-component vector of int)
0:62 'g_tTex3di4' (uniform itexture3D)
0:62 c3: direct index for structure (layout(offset=16 ) uniform 3-component vector of int)
0:62 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:62 Constant:
0:62 2 (const uint)
0:62 Constant:
0:62 0 (const int)
0:63 Sequence
0:63 move second child to first child (temp 4-component vector of uint)
0:63 'r22' (temp 4-component vector of uint)
0:63 textureFetch (temp 4-component vector of uint)
0:63 'g_tTex3du4' (uniform utexture3D)
0:63 c3: direct index for structure (layout(offset=16 ) uniform 3-component vector of int)
0:63 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:63 Constant:
0:63 2 (const uint)
0:63 Constant:
0:63 0 (const int)
0:66 Function Call: Fn1(vf4; (temp 4-component vector of float)
0:66 textureFetch (temp 4-component vector of float)
0:66 'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
0:66 c1: direct index for structure (layout(offset=0 ) uniform int)
0:66 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:66 Constant:
0:66 0 (const uint)
0:66 Constant:
0:66 0 (const int)
0:67 Function Call: Fn1(vi4; (temp 4-component vector of int)
0:67 textureFetch (temp 4-component vector of int)
0:67 'g_tTex1di4' (uniform itexture1D)
0:67 c1: direct index for structure (layout(offset=0 ) uniform int)
0:67 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:67 Constant:
0:67 0 (const uint)
0:67 Constant:
0:67 0 (const int)
0:68 Function Call: Fn1(vu4; (temp 4-component vector of uint)
0:68 textureFetch (temp 4-component vector of uint)
0:68 'g_tTex1du4' (uniform utexture1D)
0:68 c1: direct index for structure (layout(offset=0 ) uniform int)
0:68 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:68 Constant:
0:68 0 (const uint)
0:68 Constant:
0:68 0 (const int)
0:70 move second child to first child (temp 4-component vector of float)
0:70 Color: direct index for structure (temp 4-component vector of float)
0:70 'psout' (temp structure{temp 4-component vector of float Color})
0:70 Constant:
0:70 0 (const int)
0:70 Constant:
0:70 1.000000
0:70 1.000000
0:70 1.000000
0:70 1.000000
0:72 Sequence
0:72 Sequence
0:72 move second child to first child (temp 4-component vector of float)
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:72 Color: direct index for structure (temp 4-component vector of float)
0:72 'psout' (temp structure{temp 4-component vector of float Color})
0:72 Constant:
0:72 0 (const int)
0:72 Branch: Return
0:? Linker Objects
0:? 'g_sSamp' (layout(binding=0 ) uniform sampler)
0:? 'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
0:? 'g_tTex1di4' (uniform itexture1D)
0:? 'g_tTex1du4' (uniform utexture1D)
0:? 'g_tTex2df4' (uniform texture2D)
0:? 'g_tTex2di4' (uniform itexture2D)
0:? 'g_tTex2du4' (uniform utexture2D)
0:? 'g_tTex3df4' (uniform texture3D)
0:? 'g_tTex3di4' (uniform itexture3D)
0:? 'g_tTex3du4' (uniform utexture3D)
0:? 'g_tTex1df4a' (uniform texture1DArray)
0:? 'g_tTex1di4a' (uniform itexture1DArray)
0:? 'g_tTex1du4a' (uniform utexture1DArray)
0:? 'g_tTex2df4a' (uniform texture2DArray)
0:? 'g_tTex2di4a' (uniform itexture2DArray)
0:? 'g_tTex2du4a' (uniform utexture2DArray)
0:? 'anon@0' (uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 183
Capability Shader
Capability Sampled1D
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 158
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 11 "Fn1(vi4;"
Name 10 "x"
Name 18 "Fn1(vu4;"
Name 17 "x"
Name 25 "Fn1(vf4;"
Name 24 "x"
Name 28 "SomeValue("
Name 41 "$Global"
MemberName 41($Global) 0 "c1"
MemberName 41($Global) 1 "c2"
MemberName 41($Global) 2 "c3"
MemberName 41($Global) 3 "c4"
MemberName 41($Global) 4 "o1"
MemberName 41($Global) 5 "o2"
MemberName 41($Global) 6 "o3"
MemberName 41($Global) 7 "o4"
Name 43 ""
Name 53 "g_tTex1df4"
Name 60 "r00"
Name 65 "r01"
Name 68 "g_tTex1di4"
Name 73 "r02"
Name 76 "g_tTex1du4"
Name 81 "r10"
Name 84 "g_tTex2df4"
Name 91 "r11"
Name 94 "g_tTex2di4"
Name 99 "r12"
Name 102 "g_tTex2du4"
Name 107 "r20"
Name 110 "g_tTex3df4"
Name 117 "r21"
Name 120 "g_tTex3di4"
Name 125 "r22"
Name 128 "g_tTex3du4"
Name 137 "param"
Name 143 "param"
Name 149 "param"
Name 151 "PS_OUTPUT"
MemberName 151(PS_OUTPUT) 0 "Color"
Name 153 "psout"
Name 158 "Color"
Name 164 "g_sSamp"
Name 167 "g_tTex1df4a"
Name 170 "g_tTex1di4a"
Name 173 "g_tTex1du4a"
Name 176 "g_tTex2df4a"
Name 179 "g_tTex2di4a"
Name 182 "g_tTex2du4a"
MemberDecorate 41($Global) 0 Offset 0
MemberDecorate 41($Global) 1 Offset 8
MemberDecorate 41($Global) 2 Offset 16
MemberDecorate 41($Global) 3 Offset 32
MemberDecorate 41($Global) 4 Offset 48
MemberDecorate 41($Global) 5 Offset 56
MemberDecorate 41($Global) 6 Offset 64
MemberDecorate 41($Global) 7 Offset 80
Decorate 41($Global) Block
Decorate 43 DescriptorSet 0
Decorate 53(g_tTex1df4) DescriptorSet 0
Decorate 53(g_tTex1df4) Binding 0
Decorate 68(g_tTex1di4) DescriptorSet 0
Decorate 76(g_tTex1du4) DescriptorSet 0
Decorate 84(g_tTex2df4) DescriptorSet 0
Decorate 94(g_tTex2di4) DescriptorSet 0
Decorate 102(g_tTex2du4) DescriptorSet 0
Decorate 110(g_tTex3df4) DescriptorSet 0
Decorate 120(g_tTex3di4) DescriptorSet 0
Decorate 128(g_tTex3du4) DescriptorSet 0
Decorate 158(Color) Location 0
Decorate 164(g_sSamp) DescriptorSet 0
Decorate 164(g_sSamp) Binding 0
Decorate 167(g_tTex1df4a) DescriptorSet 0
Decorate 170(g_tTex1di4a) DescriptorSet 0
Decorate 173(g_tTex1du4a) DescriptorSet 0
Decorate 176(g_tTex2df4a) DescriptorSet 0
Decorate 179(g_tTex2di4a) DescriptorSet 0
Decorate 182(g_tTex2du4a) DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypeVector 6(int) 4
8: TypePointer Function 7(ivec4)
9: TypeFunction 7(ivec4) 8(ptr)
13: TypeInt 32 0
14: TypeVector 13(int) 4
15: TypePointer Function 14(ivec4)
16: TypeFunction 14(ivec4) 15(ptr)
20: TypeFloat 32
21: TypeVector 20(float) 4
22: TypePointer Function 21(fvec4)
23: TypeFunction 21(fvec4) 22(ptr)
27: TypeFunction 21(fvec4)
39: TypeVector 6(int) 2
40: TypeVector 6(int) 3
41($Global): TypeStruct 6(int) 39(ivec2) 40(ivec3) 7(ivec4) 6(int) 39(ivec2) 40(ivec3) 7(ivec4)
42: TypePointer Uniform 41($Global)
43: 42(ptr) Variable Uniform
44: 6(int) Constant 3
45: TypePointer Uniform 7(ivec4)
51: TypeImage 20(float) 1D sampled format:Unknown
52: TypePointer UniformConstant 51
53(g_tTex1df4): 52(ptr) Variable UniformConstant
55: 6(int) Constant 0
56: TypePointer Uniform 6(int)
66: TypeImage 6(int) 1D sampled format:Unknown
67: TypePointer UniformConstant 66
68(g_tTex1di4): 67(ptr) Variable UniformConstant
74: TypeImage 13(int) 1D sampled format:Unknown
75: TypePointer UniformConstant 74
76(g_tTex1du4): 75(ptr) Variable UniformConstant
82: TypeImage 20(float) 2D sampled format:Unknown
83: TypePointer UniformConstant 82
84(g_tTex2df4): 83(ptr) Variable UniformConstant
86: 6(int) Constant 1
87: TypePointer Uniform 39(ivec2)
92: TypeImage 6(int) 2D sampled format:Unknown
93: TypePointer UniformConstant 92
94(g_tTex2di4): 93(ptr) Variable UniformConstant
100: TypeImage 13(int) 2D sampled format:Unknown
101: TypePointer UniformConstant 100
102(g_tTex2du4): 101(ptr) Variable UniformConstant
108: TypeImage 20(float) 3D sampled format:Unknown
109: TypePointer UniformConstant 108
110(g_tTex3df4): 109(ptr) Variable UniformConstant
112: 6(int) Constant 2
113: TypePointer Uniform 40(ivec3)
118: TypeImage 6(int) 3D sampled format:Unknown
119: TypePointer UniformConstant 118
120(g_tTex3di4): 119(ptr) Variable UniformConstant
126: TypeImage 13(int) 3D sampled format:Unknown
127: TypePointer UniformConstant 126
128(g_tTex3du4): 127(ptr) Variable UniformConstant
151(PS_OUTPUT): TypeStruct 21(fvec4)
152: TypePointer Function 151(PS_OUTPUT)
154: 20(float) Constant 1065353216
155: 21(fvec4) ConstantComposite 154 154 154 154
157: TypePointer Output 21(fvec4)
158(Color): 157(ptr) Variable Output
162: TypeSampler
163: TypePointer UniformConstant 162
164(g_sSamp): 163(ptr) Variable UniformConstant
165: TypeImage 20(float) 1D array sampled format:Unknown
166: TypePointer UniformConstant 165
167(g_tTex1df4a): 166(ptr) Variable UniformConstant
168: TypeImage 6(int) 1D array sampled format:Unknown
169: TypePointer UniformConstant 168
170(g_tTex1di4a): 169(ptr) Variable UniformConstant
171: TypeImage 13(int) 1D array sampled format:Unknown
172: TypePointer UniformConstant 171
173(g_tTex1du4a): 172(ptr) Variable UniformConstant
174: TypeImage 20(float) 2D array sampled format:Unknown
175: TypePointer UniformConstant 174
176(g_tTex2df4a): 175(ptr) Variable UniformConstant
177: TypeImage 6(int) 2D array sampled format:Unknown
178: TypePointer UniformConstant 177
179(g_tTex2di4a): 178(ptr) Variable UniformConstant
180: TypeImage 13(int) 2D array sampled format:Unknown
181: TypePointer UniformConstant 180
182(g_tTex2du4a): 181(ptr) Variable UniformConstant
4(main): 2 Function None 3
5: Label
60(r00): 22(ptr) Variable Function
65(r01): 8(ptr) Variable Function
73(r02): 15(ptr) Variable Function
81(r10): 22(ptr) Variable Function
91(r11): 8(ptr) Variable Function
99(r12): 15(ptr) Variable Function
107(r20): 22(ptr) Variable Function
117(r21): 8(ptr) Variable Function
125(r22): 15(ptr) Variable Function
137(param): 22(ptr) Variable Function
143(param): 8(ptr) Variable Function
149(param): 15(ptr) Variable Function
153(psout): 152(ptr) Variable Function
54: 51 Load 53(g_tTex1df4)
57: 56(ptr) AccessChain 43 55
58: 6(int) Load 57
59: 21(fvec4) ImageFetch 54 58 Lod 55
61: 51 Load 53(g_tTex1df4)
62: 56(ptr) AccessChain 43 55
63: 6(int) Load 62
64: 21(fvec4) ImageFetch 61 63 Lod 55
Store 60(r00) 64
69: 66 Load 68(g_tTex1di4)
70: 56(ptr) AccessChain 43 55
71: 6(int) Load 70
72: 7(ivec4) ImageFetch 69 71 Lod 55
Store 65(r01) 72
77: 74 Load 76(g_tTex1du4)
78: 56(ptr) AccessChain 43 55
79: 6(int) Load 78
80: 14(ivec4) ImageFetch 77 79 Lod 55
Store 73(r02) 80
85: 82 Load 84(g_tTex2df4)
88: 87(ptr) AccessChain 43 86
89: 39(ivec2) Load 88
90: 21(fvec4) ImageFetch 85 89 Lod 55
Store 81(r10) 90
95: 92 Load 94(g_tTex2di4)
96: 87(ptr) AccessChain 43 86
97: 39(ivec2) Load 96
98: 7(ivec4) ImageFetch 95 97 Lod 55
Store 91(r11) 98
103: 100 Load 102(g_tTex2du4)
104: 87(ptr) AccessChain 43 86
105: 39(ivec2) Load 104
106: 14(ivec4) ImageFetch 103 105 Lod 55
Store 99(r12) 106
111: 108 Load 110(g_tTex3df4)
114: 113(ptr) AccessChain 43 112
115: 40(ivec3) Load 114
116: 21(fvec4) ImageFetch 111 115 Lod 55
Store 107(r20) 116
121: 118 Load 120(g_tTex3di4)
122: 113(ptr) AccessChain 43 112
123: 40(ivec3) Load 122
124: 7(ivec4) ImageFetch 121 123 Lod 55
Store 117(r21) 124
129: 126 Load 128(g_tTex3du4)
130: 113(ptr) AccessChain 43 112
131: 40(ivec3) Load 130
132: 14(ivec4) ImageFetch 129 131 Lod 55
Store 125(r22) 132
133: 51 Load 53(g_tTex1df4)
134: 56(ptr) AccessChain 43 55
135: 6(int) Load 134
136: 21(fvec4) ImageFetch 133 135 Lod 55
Store 137(param) 136
138: 21(fvec4) FunctionCall 25(Fn1(vf4;) 137(param)
139: 66 Load 68(g_tTex1di4)
140: 56(ptr) AccessChain 43 55
141: 6(int) Load 140
142: 7(ivec4) ImageFetch 139 141 Lod 55
Store 143(param) 142
144: 7(ivec4) FunctionCall 11(Fn1(vi4;) 143(param)
145: 74 Load 76(g_tTex1du4)
146: 56(ptr) AccessChain 43 55
147: 6(int) Load 146
148: 14(ivec4) ImageFetch 145 147 Lod 55
Store 149(param) 148
150: 14(ivec4) FunctionCall 18(Fn1(vu4;) 149(param)
156: 22(ptr) AccessChain 153(psout) 55
Store 156 155
159: 22(ptr) AccessChain 153(psout) 55
160: 21(fvec4) Load 159
Store 158(Color) 160
Return
FunctionEnd
11(Fn1(vi4;): 7(ivec4) Function None 9
10(x): 8(ptr) FunctionParameter
12: Label
30: 7(ivec4) Load 10(x)
ReturnValue 30
FunctionEnd
18(Fn1(vu4;): 14(ivec4) Function None 16
17(x): 15(ptr) FunctionParameter
19: Label
33: 14(ivec4) Load 17(x)
ReturnValue 33
FunctionEnd
25(Fn1(vf4;): 21(fvec4) Function None 23
24(x): 22(ptr) FunctionParameter
26: Label
36: 21(fvec4) Load 24(x)
ReturnValue 36
FunctionEnd
28(SomeValue(): 21(fvec4) Function None 27
29: Label
46: 45(ptr) AccessChain 43 44
47: 7(ivec4) Load 46
48: 21(fvec4) ConvertSToF 47
ReturnValue 48
FunctionEnd

140
Test/hlsl.rw.bracket.frag Normal file
View File

@ -0,0 +1,140 @@
SamplerState g_sSamp : register(s0);
RWTexture1D <float4> g_tTex1df4 : register(t0);
RWTexture1D <int4> g_tTex1di4;
RWTexture1D <uint4> g_tTex1du4;
RWTexture2D <float4> g_tTex2df4;
RWTexture2D <int4> g_tTex2di4;
RWTexture2D <uint4> g_tTex2du4;
RWTexture3D <float4> g_tTex3df4;
RWTexture3D <int4> g_tTex3di4;
RWTexture3D <uint4> g_tTex3du4;
RWTexture1DArray <float4> g_tTex1df4a;
RWTexture1DArray <int4> g_tTex1di4a;
RWTexture1DArray <uint4> g_tTex1du4a;
RWTexture2DArray <float4> g_tTex2df4a;
RWTexture2DArray <int4> g_tTex2di4a;
RWTexture2DArray <uint4> g_tTex2du4a;
struct PS_OUTPUT
{
float4 Color : SV_Target0;
};
uniform int c1;
uniform int2 c2;
uniform int3 c3;
uniform int4 c4;
uniform int o1;
uniform int2 o2;
uniform int3 o3;
uniform int4 o4;
uniform float4 uf4;
uniform int4 ui4;
uniform uint4 uu4;
int4 Fn1(in int4 x) { return x; }
uint4 Fn1(in uint4 x) { return x; }
float4 Fn1(in float4 x) { return x; }
void Fn2(out int4 x) { x = int4(0); }
void Fn2(out uint4 x) { x = uint4(0); }
void Fn2(out float4 x) { x = float4(0); }
float4 SomeValue() { return c4; }
PS_OUTPUT main()
{
PS_OUTPUT psout;
// 1D
g_tTex1df4[c1];
float4 r00 = g_tTex1df4[c1];
int4 r01 = g_tTex1di4[c1];
uint4 r02 = g_tTex1du4[c1];
// 2D
float4 r10 = g_tTex2df4[c2];
int4 r11 = g_tTex2di4[c2];
uint4 r12 = g_tTex2du4[c2];
// 3D
float4 r20 = g_tTex3df4[c3];
int4 r21 = g_tTex3di4[c3];
uint4 r22 = g_tTex3du4[c3];
float4 lf4 = uf4;
// Test as L-values
// 1D
g_tTex1df4[c1] = SomeValue(); // complex R-value
g_tTex1df4[c1] = lf4;
g_tTex1di4[c1] = int4(2,2,3,4);
g_tTex1du4[c1] = uint4(3,2,3,4);
// Test some operator= things, which need to do both a load and a store.
float4 val1 = (g_tTex1df4[c1] *= 2.0);
g_tTex1df4[c1] -= 3.0;
g_tTex1df4[c1] += 4.0;
g_tTex1di4[c1] /= 2;
g_tTex1di4[c1] %= 2;
g_tTex1di4[c1] &= 0xffff;
g_tTex1di4[c1] |= 0xf0f0;
g_tTex1di4[c1] <<= 2;
g_tTex1di4[c1] >>= 2;
// 2D
g_tTex2df4[c2] = SomeValue(); // complex L-value
g_tTex2df4[c2] = lf4;
g_tTex2di4[c2] = int4(5,2,3,4);
g_tTex2du4[c2] = uint4(6,2,3,4);
// 3D
g_tTex3df4[c3] = SomeValue(); // complex L-value
g_tTex3df4[c3] = lf4;
g_tTex3di4[c3] = int4(8,6,7,8);
g_tTex3du4[c3] = uint4(9,2,3,4);
// Test function calling
Fn1(g_tTex1df4[c1]); // in
Fn1(g_tTex1di4[c1]); // in
Fn1(g_tTex1du4[c1]); // in
Fn2(g_tTex1df4[c1]); // out
Fn2(g_tTex1di4[c1]); // out
Fn2(g_tTex1du4[c1]); // out
// Test increment operators
// pre-ops
++g_tTex1df4[c1];
++g_tTex1di4[c1];
++g_tTex1du4[c1];
--g_tTex1df4[c1];
--g_tTex1di4[c1];
--g_tTex1du4[c1];
// post-ops
g_tTex1df4[c1]++;
g_tTex1du4[c1]--;
g_tTex1di4[c1]++;
g_tTex1df4[c1]--;
g_tTex1di4[c1]++;
g_tTex1du4[c1]--;
// read and write
g_tTex1df4[1] = g_tTex2df4[int2(2,3)];
psout.Color = 1.0;
return psout;
}

View File

@ -12,7 +12,7 @@ struct myS {
myS s1;
struct {
static struct {
float4 i;
} s2;

73
Test/hlsl.tx.bracket.frag Normal file
View File

@ -0,0 +1,73 @@
SamplerState g_sSamp : register(s0);
Texture1D <float4> g_tTex1df4 : register(t0);
Texture1D <int4> g_tTex1di4;
Texture1D <uint4> g_tTex1du4;
Texture2D <float4> g_tTex2df4;
Texture2D <int4> g_tTex2di4;
Texture2D <uint4> g_tTex2du4;
Texture3D <float4> g_tTex3df4;
Texture3D <int4> g_tTex3di4;
Texture3D <uint4> g_tTex3du4;
Texture1DArray <float4> g_tTex1df4a;
Texture1DArray <int4> g_tTex1di4a;
Texture1DArray <uint4> g_tTex1du4a;
Texture2DArray <float4> g_tTex2df4a;
Texture2DArray <int4> g_tTex2di4a;
Texture2DArray <uint4> g_tTex2du4a;
struct PS_OUTPUT
{
float4 Color : SV_Target0;
};
uniform int c1;
uniform int2 c2;
uniform int3 c3;
uniform int4 c4;
uniform int o1;
uniform int2 o2;
uniform int3 o3;
uniform int4 o4;
int4 Fn1(in int4 x) { return x; }
uint4 Fn1(in uint4 x) { return x; }
float4 Fn1(in float4 x) { return x; }
float4 SomeValue() { return c4; }
PS_OUTPUT main()
{
PS_OUTPUT psout;
// 1D
g_tTex1df4[c1];
float4 r00 = g_tTex1df4[c1];
int4 r01 = g_tTex1di4[c1];
uint4 r02 = g_tTex1du4[c1];
// 2D
float4 r10 = g_tTex2df4[c2];
int4 r11 = g_tTex2di4[c2];
uint4 r12 = g_tTex2du4[c2];
// 3D
float4 r20 = g_tTex3df4[c3];
int4 r21 = g_tTex3di4[c3];
uint4 r22 = g_tTex3du4[c3];
// Test function calling
Fn1(g_tTex1df4[c1]); // in
Fn1(g_tTex1di4[c1]); // in
Fn1(g_tTex1du4[c1]); // in
psout.Color = 1.0;
return psout;
}

View File

@ -136,13 +136,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
// Need a new node holding things together. Make
// one and promote it to the right type.
//
TIntermBinary* node = new TIntermBinary(op);
if (loc.line == 0)
loc = right->getLoc();
node->setLoc(loc);
node->setLeft(left);
node->setRight(right);
TIntermBinary* node = addBinaryNode(op, left, right, loc);
if (! node->promote())
return 0;
@ -172,6 +166,56 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
return node;
}
//
// Low level: add binary node (no promotions or other argument modifications)
//
TIntermBinary* TIntermediate::addBinaryNode(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc loc) const
{
// build the node
TIntermBinary* node = new TIntermBinary(op);
if (loc.line == 0)
loc = left->getLoc();
node->setLoc(loc);
node->setLeft(left);
node->setRight(right);
return node;
}
//
// like non-type form, but sets node's type.
//
TIntermBinary* TIntermediate::addBinaryNode(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc loc, const TType& type) const
{
TIntermBinary* node = addBinaryNode(op, left, right, loc);
node->setType(type);
return node;
}
//
// Low level: add unary node (no promotions or other argument modifications)
//
TIntermUnary* TIntermediate::addUnaryNode(TOperator op, TIntermTyped* child, TSourceLoc loc) const
{
TIntermUnary* node = new TIntermUnary(op);
if (loc.line == 0)
loc = child->getLoc();
node->setLoc(loc);
node->setOperand(child);
return node;
}
//
// like non-type form, but sets node's type.
//
TIntermUnary* TIntermediate::addUnaryNode(TOperator op, TIntermTyped* child, TSourceLoc loc, const TType& type) const
{
TIntermUnary* node = addUnaryNode(op, child, loc);
node->setType(type);
return node;
}
//
// Connect two nodes through an assignment.
//
@ -200,12 +244,7 @@ TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TInterm
right = addShapeConversion(op, left->getType(), right);
// build the node
TIntermBinary* node = new TIntermBinary(op);
if (loc.line == 0)
loc = left->getLoc();
node->setLoc(loc);
node->setLeft(left);
node->setRight(right);
TIntermBinary* node = addBinaryNode(op, left, right, loc);
if (! node->promote())
return nullptr;
@ -224,16 +263,8 @@ TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TInterm
//
TIntermTyped* TIntermediate::addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, TSourceLoc loc)
{
TIntermBinary* node = new TIntermBinary(op);
if (loc.line == 0)
loc = index->getLoc();
node->setLoc(loc);
node->setLeft(base);
node->setRight(index);
// caller should set the type
return node;
return addBinaryNode(op, base, index, loc);
}
//
@ -316,11 +347,7 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo
//
// Make a new node for the operator.
//
TIntermUnary* node = new TIntermUnary(op);
if (loc.line == 0)
loc = child->getLoc();
node->setLoc(loc);
node->setOperand(child);
TIntermUnary* node = addUnaryNode(op, child, loc);
if (! node->promote())
return 0;
@ -357,12 +384,7 @@ TIntermTyped* TIntermediate::addBuiltInFunctionCall(const TSourceLoc& loc, TOper
return folded;
}
TIntermUnary* node = new TIntermUnary(op);
node->setLoc(child->getLoc());
node->setOperand(child);
node->setType(returnType);
return node;
return addUnaryNode(op, child, child->getLoc(), returnType);
} else {
// setAggregateOperater() calls fold() for constant folding
TIntermTyped* node = setAggregateOperator(childNode, op, returnType, loc);
@ -725,9 +747,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
}
TType newType(promoteTo, EvqTemporary, node->getVectorSize(), node->getMatrixCols(), node->getMatrixRows());
newNode = new TIntermUnary(newOp, newType);
newNode->setLoc(node->getLoc());
newNode->setOperand(node);
newNode = addUnaryNode(newOp, node, node->getLoc(), newType);
// TODO: it seems that some unary folding operations should occur here, but are not

View File

@ -113,6 +113,114 @@ void C_DECL TParseContextBase::ppWarn(const TSourceLoc& loc, const char* szReaso
va_end(args);
}
//
// Both test and if necessary, spit out an error, to see if the node is really
// an l-value that can be operated on this way.
//
// Returns true if there was an error.
//
bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op, TIntermTyped* node)
{
TIntermBinary* binaryNode = node->getAsBinaryNode();
if (binaryNode) {
switch(binaryNode->getOp()) {
case EOpIndexDirect:
case EOpIndexIndirect: // fall through
case EOpIndexDirectStruct: // fall through
case EOpVectorSwizzle:
return lValueErrorCheck(loc, op, binaryNode->getLeft());
default:
break;
}
error(loc, " l-value required", op, "", "");
return true;
}
const char* symbol = nullptr;
TIntermSymbol* symNode = node->getAsSymbolNode();
if (symNode != nullptr)
symbol = symNode->getName().c_str();
const char* message = nullptr;
switch (node->getQualifier().storage) {
case EvqConst: message = "can't modify a const"; break;
case EvqConstReadOnly: message = "can't modify a const"; break;
case EvqUniform: message = "can't modify a uniform"; break;
case EvqBuffer:
if (node->getQualifier().readonly)
message = "can't modify a readonly buffer";
break;
default:
//
// Type that can't be written to?
//
switch (node->getBasicType()) {
case EbtSampler:
message = "can't modify a sampler";
break;
case EbtAtomicUint:
message = "can't modify an atomic_uint";
break;
case EbtVoid:
message = "can't modify void";
break;
default:
break;
}
}
if (message == nullptr && binaryNode == nullptr && symNode == nullptr) {
error(loc, " l-value required", op, "", "");
return true;
}
//
// Everything else is okay, no error.
//
if (message == nullptr)
return false;
//
// If we get here, we have an error and a message.
//
if (symNode)
error(loc, " l-value required", op, "\"%s\" (%s)", symbol, message);
else
error(loc, " l-value required", op, "(%s)", message);
return true;
}
// Test for and give an error if the node can't be read from.
void TParseContextBase::rValueErrorCheck(const TSourceLoc& loc, const char* op, TIntermTyped* node)
{
if (! node)
return;
TIntermBinary* binaryNode = node->getAsBinaryNode();
if (binaryNode) {
switch(binaryNode->getOp()) {
case EOpIndexDirect:
case EOpIndexIndirect:
case EOpIndexDirectStruct:
case EOpVectorSwizzle:
rValueErrorCheck(loc, op, binaryNode->getLeft());
default:
break;
}
return;
}
TIntermSymbol* symNode = node->getAsSymbolNode();
if (symNode && symNode->getQualifier().writeonly)
error(loc, "can't read from writeonly object: ", op, symNode->getName().c_str());
}
// Make a shared symbol have a non-shared version that can be edited by the current
// compile, such that editing its type will not change the shared version and will
// effect all nodes sharing it.

View File

@ -1902,14 +1902,14 @@ void TParseContext::variableCheck(TIntermTyped*& nodePtr)
// Both test and if necessary, spit out an error, to see if the node is really
// an l-value that can be operated on this way.
//
// Returns true if the was an error.
// Returns true if there was an error.
//
bool TParseContext::lValueErrorCheck(const TSourceLoc& loc, const char* op, TIntermTyped* node)
{
TIntermBinary* binaryNode = node->getAsBinaryNode();
if (binaryNode) {
bool errorReturn;
bool errorReturn = false;
switch(binaryNode->getOp()) {
case EOpIndexDirect:
@ -1928,9 +1928,9 @@ bool TParseContext::lValueErrorCheck(const TSourceLoc& loc, const char* op, TInt
}
}
// fall through
break; // left node is checked by base class
case EOpIndexDirectStruct:
return lValueErrorCheck(loc, op, binaryNode->getLeft());
break; // left node is checked by base class
case EOpVectorSwizzle:
errorReturn = lValueErrorCheck(loc, op, binaryNode->getLeft());
if (!errorReturn) {
@ -1955,11 +1955,16 @@ bool TParseContext::lValueErrorCheck(const TSourceLoc& loc, const char* op, TInt
default:
break;
}
error(loc, " l-value required", op, "", "");
if (errorReturn) {
error(loc, " l-value required", op, "", "");
return true;
}
}
// Let the base class check errors
if (TParseContextBase::lValueErrorCheck(loc, op, node))
return true;
const char* symbol = nullptr;
TIntermSymbol* symNode = node->getAsSymbolNode();
@ -1968,19 +1973,12 @@ bool TParseContext::lValueErrorCheck(const TSourceLoc& loc, const char* op, TInt
const char* message = nullptr;
switch (node->getQualifier().storage) {
case EvqConst: message = "can't modify a const"; break;
case EvqConstReadOnly: message = "can't modify a const"; break;
case EvqVaryingIn: message = "can't modify shader input"; break;
case EvqInstanceId: message = "can't modify gl_InstanceID"; break;
case EvqVertexId: message = "can't modify gl_VertexID"; break;
case EvqFace: message = "can't modify gl_FrontFace"; break;
case EvqFragCoord: message = "can't modify gl_FragCoord"; break;
case EvqPointCoord: message = "can't modify gl_PointCoord"; break;
case EvqUniform: message = "can't modify a uniform"; break;
case EvqBuffer:
if (node->getQualifier().readonly)
message = "can't modify a readonly buffer";
break;
case EvqFragDepth:
intermediate.setDepthReplacing();
// "In addition, it is an error to statically write to gl_FragDepth in the fragment shader."
@ -1989,22 +1987,7 @@ bool TParseContext::lValueErrorCheck(const TSourceLoc& loc, const char* op, TInt
break;
default:
//
// Type that can't be written to?
//
switch (node->getBasicType()) {
case EbtSampler:
message = "can't modify a sampler";
break;
case EbtAtomicUint:
message = "can't modify an atomic_uint";
break;
case EbtVoid:
message = "can't modify void";
break;
default:
break;
}
}
if (message == nullptr && binaryNode == nullptr && symNode == nullptr) {
@ -2013,7 +1996,6 @@ bool TParseContext::lValueErrorCheck(const TSourceLoc& loc, const char* op, TInt
return true;
}
//
// Everything else is okay, no error.
//
@ -2034,29 +2016,13 @@ bool TParseContext::lValueErrorCheck(const TSourceLoc& loc, const char* op, TInt
// Test for and give an error if the node can't be read from.
void TParseContext::rValueErrorCheck(const TSourceLoc& loc, const char* op, TIntermTyped* node)
{
if (! node)
return;
// Let the base class check errors
TParseContextBase::rValueErrorCheck(loc, op, node);
TIntermBinary* binaryNode = node->getAsBinaryNode();
if (binaryNode) {
switch(binaryNode->getOp()) {
case EOpIndexDirect:
case EOpIndexIndirect:
case EOpIndexDirectStruct:
case EOpVectorSwizzle:
rValueErrorCheck(loc, op, binaryNode->getLeft());
default:
break;
}
return;
}
TIntermSymbol* symNode = node->getAsSymbolNode();
if (symNode && symNode->getQualifier().writeonly)
error(loc, "can't read from writeonly object: ", op, symNode->getName().c_str());
#ifdef AMD_EXTENSIONS
else if (symNode && symNode->getQualifier().explicitInterp)
TIntermSymbol* symNode = node->getAsSymbolNode();
if (!(symNode && symNode->getQualifier().writeonly)) // base class checks
if (symNode && symNode->getQualifier().explicitInterp)
error(loc, "can't read from explicitly-interpolated object: ", op, symNode->getName().c_str());
#endif
}

View File

@ -143,6 +143,9 @@ public:
virtual void growGlobalUniformBlock(TSourceLoc&, TType&, TString& memberName);
virtual bool insertGlobalUniformBlock();
virtual bool lValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*);
virtual void rValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*);
protected:
TParseContextBase(TParseContextBase&);
TParseContextBase& operator=(TParseContextBase&);
@ -278,8 +281,8 @@ public:
void unaryOpError(const TSourceLoc&, const char* op, TString operand);
void binaryOpError(const TSourceLoc&, const char* op, TString left, TString right);
void variableCheck(TIntermTyped*& nodePtr);
bool lValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*);
void rValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*);
bool lValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*) override;
void rValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*) override;
void constantValueCheck(TIntermTyped* node, const char* token);
void integerCheck(const TIntermTyped* node, const char* token);
void globalCheck(const TSourceLoc&, const char* token);

View File

@ -236,6 +236,13 @@ public:
TIntermBranch* addBranch(TOperator, TIntermTyped*, const TSourceLoc&);
TIntermTyped* addSwizzle(TVectorFields&, const TSourceLoc&);
// Low level functions to add nodes (no conversions or other higher level transformations)
// If a type is provided, the node's type will be set to it.
TIntermBinary* addBinaryNode(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc) const;
TIntermBinary* addBinaryNode(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc, const TType&) const;
TIntermUnary* addUnaryNode(TOperator op, TIntermTyped* child, TSourceLoc) const;
TIntermUnary* addUnaryNode(TOperator op, TIntermTyped* child, TSourceLoc, const TType&) const;
// Constant folding (in Constant.cpp)
TIntermTyped* fold(TIntermAggregate* aggrNode);
TIntermTyped* foldConstructor(TIntermAggregate* aggrNode);

View File

@ -147,6 +147,7 @@ INSTANTIATE_TEST_CASE_P(
{"hlsl.pp.line.frag", "main"},
{"hlsl.precise.frag", "main"},
{"hlsl.promotions.frag", "main"},
{"hlsl.rw.bracket.frag", "main"},
{"hlsl.sample.array.dx10.frag", "main"},
{"hlsl.sample.basic.dx10.frag", "main"},
{"hlsl.sample.offset.dx10.frag", "main"},
@ -190,6 +191,7 @@ INSTANTIATE_TEST_CASE_P(
{"hlsl.switch.frag", "PixelShaderFunction"},
{"hlsl.swizzle.frag", "PixelShaderFunction"},
{"hlsl.templatetypes.frag", "PixelShaderFunction"},
{"hlsl.tx.bracket.frag", "main"},
{"hlsl.typedef.frag", "PixelShaderFunction"},
{"hlsl.whileLoop.frag", "PixelShaderFunction"},
{"hlsl.void.frag", "PixelShaderFunction"},

View File

@ -1783,6 +1783,8 @@ bool HlslGrammar::acceptAssignmentExpression(TIntermTyped*& node)
}
node = parseContext.handleAssign(loc, assignOp, node, rightNode);
node = parseContext.handleLvalue(loc, "assign", node);
if (node == nullptr) {
parseContext.error(loc, "could not create assignment", "", "");
return false;
@ -1946,6 +1948,7 @@ bool HlslGrammar::acceptUnaryExpression(TIntermTyped*& node)
return true;
node = intermediate.addUnaryMath(unaryOp, node, loc);
node = parseContext.handleLvalue(loc, "unary operator", node);
return node != nullptr;
}
@ -2061,6 +2064,7 @@ bool HlslGrammar::acceptPostfixExpression(TIntermTyped*& node)
case EOpPostDecrement:
// DEC_OP
node = intermediate.addUnaryMath(postOp, node, loc);
node = parseContext.handleLvalue(loc, "unary operator", node);
break;
default:
assert(0);

View File

@ -130,6 +130,276 @@ bool HlslParseContext::parseShaderStrings(TPpContext& ppContext, TInputScanner&
return numErrors == 0;
}
//
// Return true if this l-value node should be converted in some manner.
// For instance: turning a load aggregate into a store in an l-value.
//
bool HlslParseContext::shouldConvertLValue(const TIntermNode* node) const
{
if (node == nullptr)
return false;
const TIntermAggregate* lhsAsAggregate = node->getAsAggregate();
if (lhsAsAggregate != nullptr && lhsAsAggregate->getOp() == EOpImageLoad)
return true;
return false;
}
//
// Both test and if necessary, spit out an error, to see if the node is really
// an l-value that can be operated on this way.
//
// Returns true if there was an error.
//
bool HlslParseContext::lValueErrorCheck(const TSourceLoc& loc, const char* op, TIntermTyped* node)
{
if (shouldConvertLValue(node)) {
// if we're writing to a texture, it must be an RW form.
TIntermAggregate* lhsAsAggregate = node->getAsAggregate();
TIntermTyped* object = lhsAsAggregate->getSequence()[0]->getAsTyped();
if (!object->getType().getSampler().isImage()) {
error(loc, "operator[] on a non-RW texture must be an r-value", "", "");
return true;
}
}
// Let the base class check errors
return TParseContextBase::lValueErrorCheck(loc, op, node);
}
//
// This function handles l-value conversions and verifications. It uses, but is not synonymous
// with lValueErrorCheck. That function accepts an l-value directly, while this one must be
// given the surrounding tree - e.g, with an assignment, so we can convert the assign into a
// series of other image operations.
//
// Most things are passed through unmodified, except for error checking.
//
TIntermTyped* HlslParseContext::handleLvalue(const TSourceLoc& loc, const char* op, TIntermTyped* node)
{
if (node == nullptr)
return nullptr;
TIntermBinary* nodeAsBinary = node->getAsBinaryNode();
TIntermUnary* nodeAsUnary = node->getAsUnaryNode();
TIntermAggregate* sequence = nullptr;
TIntermTyped* lhs = nodeAsUnary ? nodeAsUnary->getOperand() :
nodeAsBinary ? nodeAsBinary->getLeft() :
nullptr;
// Early bail out if there is no conversion to apply
if (!shouldConvertLValue(lhs)) {
if (lhs != nullptr)
if (lValueErrorCheck(loc, op, lhs))
return nullptr;
return node;
}
// *** If we get here, we're going to apply some conversion to an l-value.
// Helper to create a load.
const auto makeLoad = [&](TIntermSymbol* rhsTmp, TIntermTyped* object, TIntermTyped* coord, const TType& derefType) {
TIntermAggregate* loadOp = new TIntermAggregate(EOpImageLoad);
loadOp->setLoc(loc);
loadOp->getSequence().push_back(object);
loadOp->getSequence().push_back(intermediate.addSymbol(*coord->getAsSymbolNode()));
loadOp->setType(derefType);
sequence = intermediate.growAggregate(sequence,
intermediate.addAssign(EOpAssign, rhsTmp, loadOp, loc),
loc);
};
// Helper to create a store.
const auto makeStore = [&](TIntermTyped* object, TIntermTyped* coord, TIntermSymbol* rhsTmp) {
TIntermAggregate* storeOp = new TIntermAggregate(EOpImageStore);
storeOp->getSequence().push_back(object);
storeOp->getSequence().push_back(coord);
storeOp->getSequence().push_back(intermediate.addSymbol(*rhsTmp));
storeOp->setLoc(loc);
storeOp->setType(TType(EbtVoid));
sequence = intermediate.growAggregate(sequence, storeOp);
};
// Helper to create an assign.
const auto makeBinary = [&](TOperator op, TIntermTyped* lhs, TIntermTyped* rhs) {
sequence = intermediate.growAggregate(sequence,
intermediate.addBinaryNode(op, lhs, rhs, loc, lhs->getType()),
loc);
};
// Helper to complete sequence by adding trailing variable, so we evaluate to the right value.
const auto finishSequence = [&](TIntermSymbol* rhsTmp, const TType& derefType) {
// Add a trailing use of the temp, so the sequence returns the proper value.
sequence = intermediate.growAggregate(sequence, intermediate.addSymbol(*rhsTmp));
sequence->setOperator(EOpSequence);
sequence->setLoc(loc);
sequence->setType(derefType);
return sequence;
};
// Helper to add unary op
const auto makeUnary = [&](TOperator op, TIntermSymbol* rhsTmp) {
sequence = intermediate.growAggregate(sequence,
intermediate.addUnaryNode(op, intermediate.addSymbol(*rhsTmp), loc,
rhsTmp->getType()),
loc);
};
// helper to create a temporary variable
const auto addTmpVar = [&](const char* name, const TType& derefType) {
TVariable* tmpVar = makeInternalVariable(name, derefType);
tmpVar->getWritableType().getQualifier().makeTemporary();
return intermediate.addSymbol(*tmpVar, loc);
};
TIntermAggregate* lhsAsAggregate = lhs->getAsAggregate();
TIntermTyped* object = lhsAsAggregate->getSequence()[0]->getAsTyped();
TIntermTyped* coord = lhsAsAggregate->getSequence()[1]->getAsTyped();
const TLayoutFormat fmt = object->getType().getQualifier().layoutFormat;
// We only handle 4 component formats at the moment.
assert(fmt == ElfRgba32f || fmt == ElfRgba32i || fmt == ElfRgba32ui);
const TType objDerefType(object->getType().getSampler().type, EvqTemporary, 4);
if (nodeAsBinary) {
TIntermTyped* rhs = nodeAsBinary->getRight();
const TOperator assignOp = nodeAsBinary->getOp();
bool isModifyOp = false;
switch (assignOp) {
case EOpAddAssign:
case EOpSubAssign:
case EOpMulAssign:
case EOpVectorTimesMatrixAssign:
case EOpVectorTimesScalarAssign:
case EOpMatrixTimesScalarAssign:
case EOpMatrixTimesMatrixAssign:
case EOpDivAssign:
case EOpModAssign:
case EOpAndAssign:
case EOpInclusiveOrAssign:
case EOpExclusiveOrAssign:
case EOpLeftShiftAssign:
case EOpRightShiftAssign:
isModifyOp = true;
// fall through...
case EOpAssign:
{
// Since this is an lvalue, we'll convert an image load to a sequence like this (to still provide the value):
// OpSequence
// OpImageStore(object, lhs, rhs)
// rhs
// But if it's not a simple symbol RHS (say, a fn call), we don't want to duplicate the RHS, so we'll convert
// instead to this:
// OpSequence
// rhsTmp = rhs
// OpImageStore(object, coord, rhsTmp)
// rhsTmp
// If this is a read-modify-write op, like +=, we issue:
// OpSequence
// coordtmp = load's param1
// rhsTmp = OpImageLoad(object, coordTmp)
// rhsTmp op= rhs
// OpImageStore(object, coordTmp, rhsTmp)
// rhsTmp
TIntermSymbol* rhsTmp = rhs->getAsSymbolNode();
TIntermTyped* coordTmp = coord;
if (rhsTmp == nullptr || isModifyOp) {
rhsTmp = addTmpVar("storeTemp", objDerefType);
// Assign storeTemp = rhs
if (isModifyOp) {
// We have to make a temp var for the coordinate, to avoid evaluating it twice.
coordTmp = addTmpVar("coordTemp", coord->getType());
makeBinary(EOpAssign, coordTmp, coord); // coordtmp = load[param1]
makeLoad(rhsTmp, object, coordTmp, objDerefType); // rhsTmp = OpImageLoad(object, coordTmp)
}
// rhsTmp op= rhs.
makeBinary(assignOp, intermediate.addSymbol(*rhsTmp), rhs);
}
makeStore(object, coordTmp, rhsTmp); // add a store
return finishSequence(rhsTmp, objDerefType); // return rhsTmp from sequence
}
default:
break;
}
}
if (nodeAsUnary) {
const TOperator assignOp = nodeAsUnary->getOp();
switch (assignOp) {
case EOpPreIncrement:
case EOpPreDecrement:
{
// We turn this into:
// OpSequence
// coordtmp = load's param1
// rhsTmp = OpImageLoad(object, coordTmp)
// rhsTmp op
// OpImageStore(object, coordTmp, rhsTmp)
// rhsTmp
TIntermSymbol* rhsTmp = addTmpVar("storeTemp", objDerefType);
TIntermTyped* coordTmp = addTmpVar("coordTemp", coord->getType());
makeBinary(EOpAssign, coordTmp, coord); // coordtmp = load[param1]
makeLoad(rhsTmp, object, coordTmp, objDerefType); // rhsTmp = OpImageLoad(object, coordTmp)
makeUnary(assignOp, rhsTmp); // op rhsTmp
makeStore(object, coordTmp, rhsTmp); // OpImageStore(object, coordTmp, rhsTmp)
return finishSequence(rhsTmp, objDerefType); // return rhsTmp from sequence
}
case EOpPostIncrement:
case EOpPostDecrement:
{
// We turn this into:
// OpSequence
// coordtmp = load's param1
// rhsTmp1 = OpImageLoad(object, coordTmp)
// rhsTmp2 = rhsTmp1
// rhsTmp2 op
// OpImageStore(object, coordTmp, rhsTmp2)
// rhsTmp1 (pre-op value)
TIntermSymbol* rhsTmp1 = addTmpVar("storeTempPre", objDerefType);
TIntermSymbol* rhsTmp2 = addTmpVar("storeTempPost", objDerefType);
TIntermTyped* coordTmp = addTmpVar("coordTemp", coord->getType());
makeBinary(EOpAssign, coordTmp, coord); // coordtmp = load[param1]
makeLoad(rhsTmp1, object, coordTmp, objDerefType); // rhsTmp1 = OpImageLoad(object, coordTmp)
makeBinary(EOpAssign, rhsTmp2, rhsTmp1); // rhsTmp2 = rhsTmp1
makeUnary(assignOp, rhsTmp2); // rhsTmp op
makeStore(object, coordTmp, rhsTmp2); // OpImageStore(object, coordTmp, rhsTmp2)
return finishSequence(rhsTmp1, objDerefType); // return rhsTmp from sequence
}
default:
break;
}
}
if (lhs)
if (lValueErrorCheck(loc, op, lhs))
return nullptr;
return node;
}
void HlslParseContext::handlePragma(const TSourceLoc& loc, const TVector<TString>& tokens)
{
if (pragmaCallback)
@ -297,12 +567,46 @@ TIntermTyped* HlslParseContext::handleVariable(const TSourceLoc& loc, TSymbol* s
return node;
}
//
// Handle operator[] on any objects it applies to. Currently:
// Textures
// Buffers
//
TIntermTyped* HlslParseContext::handleBracketOperator(const TSourceLoc& loc, TIntermTyped* base, TIntermTyped* index)
{
// handle r-value operator[] on textures and images. l-values will be processed later.
if (base->getType().getBasicType() == EbtSampler && !base->isArray()) {
const TSampler& sampler = base->getType().getSampler();
if (sampler.isImage() || sampler.isTexture()) {
const int vecSize = 4; // TODO: handle arbitrary sizes (get from qualifier)
TIntermAggregate* load = new TIntermAggregate(sampler.isImage() ? EOpImageLoad : EOpTextureFetch);
load->setType(TType(sampler.type, EvqTemporary, vecSize));
load->setLoc(loc);
load->getSequence().push_back(base);
load->getSequence().push_back(index);
// Textures need a MIP. First indirection is always to mip 0. If there's another, we'll add it
// later.
if (sampler.isTexture())
load->getSequence().push_back(intermediate.addConstantUnion(0, loc, true));
return load;
}
}
return nullptr;
}
//
// Handle seeing a base[index] dereference in the grammar.
//
TIntermTyped* HlslParseContext::handleBracketDereference(const TSourceLoc& loc, TIntermTyped* base, TIntermTyped* index)
{
TIntermTyped* result = nullptr;
TIntermTyped* result = handleBracketOperator(loc, base, index);
if (result != nullptr)
return result; // it was handled as an operator[]
bool flattened = false;
int indexValue = 0;
@ -425,10 +729,10 @@ TIntermTyped* HlslParseContext::handleDotDereference(const TSourceLoc& loc, TInt
field == "SampleLevel") {
// If it's not a method on a sampler object, we fall through in case it is a struct member.
if (base->getType().getBasicType() == EbtSampler) {
const TSampler& texType = base->getType().getSampler();
if (! texType.isPureSampler()) {
const int vecSize = texType.isShadow() ? 1 : 4;
return intermediate.addMethod(base, TType(texType.type, EvqTemporary, vecSize), &field, loc);
const TSampler& sampler = base->getType().getSampler();
if (! sampler.isPureSampler()) {
const int vecSize = sampler.isShadow() ? 1 : 4; // TODO: handle arbitrary sample return sizes
return intermediate.addMethod(base, TType(sampler.type, EvqTemporary, vecSize), &field, loc);
}
}
}
@ -937,6 +1241,9 @@ void HlslParseContext::handleFunctionArgument(TFunction* function, TIntermTyped*
// to intermediate.addAssign().
TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op, TIntermTyped* left, TIntermTyped* right) const
{
if (left == nullptr || right == nullptr)
return nullptr;
const auto mustFlatten = [&](const TIntermTyped& node) {
return shouldFlatten(node.getType()) && node.getAsSymbolNode() &&
flattenMap.find(node.getAsSymbolNode()->getId()) != flattenMap.end();
@ -1261,7 +1568,7 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
case Esd2D: numDims = 2; break; // W, H
case Esd3D: numDims = 3; break; // W, H, D
case EsdCube: numDims = 2; break; // W, H (cube)
case EsdBuffer: numDims = 1; break; // buffers
case EsdBuffer: numDims = 1; break; // W (buffers)
default:
assert(0 && "unhandled texture dimension");
}
@ -2260,12 +2567,13 @@ void HlslParseContext::addInputArgumentConversions(const TFunction& function, TI
//
// Returns a node of a subtree that evaluates to the return value of the function.
//
TIntermTyped* HlslParseContext::addOutputArgumentConversions(const TFunction& function, TIntermAggregate& intermNode) const
TIntermTyped* HlslParseContext::addOutputArgumentConversions(const TFunction& function, TIntermAggregate& intermNode)
{
TIntermSequence& arguments = intermNode.getSequence();
const auto needsConversion = [&](int argNum) {
return function[argNum].type->getQualifier().isParamOutput() &&
(*function[argNum].type != arguments[argNum]->getAsTyped()->getType() ||
shouldConvertLValue(arguments[argNum]) ||
shouldFlatten(arguments[argNum]->getAsTyped()->getType()));
};
@ -2313,7 +2621,8 @@ TIntermTyped* HlslParseContext::addOutputArgumentConversions(const TFunction& fu
TIntermSymbol* tempArgNode = intermediate.addSymbol(*tempArg, intermNode.getLoc());
// This makes the deepest level, the member-wise copy
TIntermTyped* tempAssign = handleAssign(arguments[i]->getLoc(), EOpAssign, arguments[i]->getAsTyped(), tempArgNode)->getAsAggregate();
TIntermTyped* tempAssign = handleAssign(arguments[i]->getLoc(), EOpAssign, arguments[i]->getAsTyped(), tempArgNode);
tempAssign = handleLvalue(arguments[i]->getLoc(), "assign", tempAssign);
conversionTree = intermediate.growAggregate(conversionTree, tempAssign, arguments[i]->getLoc());
// replace the argument with another node for the same tempArg variable

View File

@ -61,6 +61,7 @@ public:
void handlePragma(const TSourceLoc&, const TVector<TString>&);
TIntermTyped* handleVariable(const TSourceLoc&, TSymbol* symbol, const TString* string);
TIntermTyped* handleBracketDereference(const TSourceLoc&, TIntermTyped* base, TIntermTyped* index);
TIntermTyped* handleBracketOperator(const TSourceLoc&, TIntermTyped* base, TIntermTyped* index);
void checkIndex(const TSourceLoc&, const TType&, int& index);
TIntermTyped* handleBinaryMath(const TSourceLoc&, const char* str, TOperator op, TIntermTyped* left, TIntermTyped* right);
@ -80,7 +81,7 @@ public:
void decomposeSampleMethods(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments);
TIntermTyped* handleLengthMethod(const TSourceLoc&, TFunction*, TIntermNode*);
void addInputArgumentConversions(const TFunction&, TIntermNode*&) const;
TIntermTyped* addOutputArgumentConversions(const TFunction&, TIntermAggregate&) const;
TIntermTyped* addOutputArgumentConversions(const TFunction&, TIntermAggregate&);
void builtInOpCheck(const TSourceLoc&, const TFunction&, TIntermOperator&);
TFunction* handleConstructorCall(const TSourceLoc&, const TType&);
void handleSemantic(TSourceLoc, TQualifier&, const TString& semantic);
@ -151,6 +152,10 @@ public:
void pushSwitchSequence(TIntermSequence* sequence) { switchSequenceStack.push_back(sequence); }
void popSwitchSequence() { switchSequenceStack.pop_back(); }
// 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;
protected:
void inheritGlobalDefaults(TQualifier& dst) const;
TVariable* makeInternalVariable(const char* name, const TType&) const;
@ -160,6 +165,9 @@ protected:
TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer);
TOperator mapAtomicOp(const TSourceLoc& loc, TOperator op, bool isImage);
// Return true if this node requires L-value conversion (e.g, to an imageStore).
bool shouldConvertLValue(const TIntermNode*) const;
// Array and struct flattening
bool shouldFlatten(const TType& type) const { return shouldFlattenIO(type) || shouldFlattenUniform(type); }
TIntermTyped* flattenAccess(TIntermTyped* base, int member);