HLSL: Recursive composite flattening

This PR implements recursive type flattening.  For example, an array of structs of other structs
can be flattened to individual member variables at the shader interface.

This is sufficient for many purposes, e.g, uniforms containing opaque types, but is not sufficient
for geometry shader arrayed inputs.  That will be handled separately with structure splitting,
 which is not implemented by this PR.  In the meantime, that case is detected and triggers an error.

The recursive flattening extends the following three aspects of single-level flattening:

- Flattening of structures to individual members with names such as "foo[0].samp[1]";

- Turning constant references to the nested composite type into a reference to a particular
  flattened member.

- Shadow copies between arrays of flattened members and the nested composite type.

Previous single-level flattening only flattened at the shader interface, and that is unchanged by this PR.
Internally, shadow copies are, such as if the type is passed to a function.

Also, the reasons for flattening are unchanged.  Uniforms containing opaque types, and interface struct
types are flattened.  (The latter will change with structure splitting).

One existing test changes: hlsl.structin.vert, which did in fact contain a nested composite type to be
flattened.

Two new tests are added: hlsl.structarray.flatten.frag, and hlsl.structarray.flatten.geom (currently
issues an error until type splitting is online).

The process of arriving at the individual member from chained postfix expressions is more complex than
it was with one level.  See large-ish comment above HlslParseContext::flatten() for details.
This commit is contained in:
steve-lunarg
2016-11-28 17:09:54 -07:00
parent b56f4ac72c
commit a2b01a0da8
10 changed files with 724 additions and 204 deletions

View File

@@ -0,0 +1,197 @@
hlsl.structarray.flatten.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:23 Function Definition: main(struct-PS_OUTPUT-vf41; (temp void)
0:23 Function Parameters:
0:23 'ps_output' (out structure{temp 4-component vector of float color})
0:? Sequence
0:24 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:26 add (temp 4-component vector of float)
0:25 add (temp 4-component vector of float)
0:25 texture (temp 4-component vector of float)
0:25 Construct combined texture-sampler (temp sampler1D)
0:? 'tex' (uniform texture1D)
0:? 'samp' (uniform sampler)
0:25 Constant:
0:25 0.500000
0:26 texture (temp 4-component vector of float)
0:26 Construct combined texture-sampler (temp sampler1D)
0:? 'g_texdata_array[1].tex' (uniform texture1D)
0:? 'g_texdata_array[1].samp' (uniform sampler)
0:26 Constant:
0:26 0.400000
0:27 texture (temp 4-component vector of float)
0:27 Construct combined texture-sampler (temp sampler1D)
0:? 'g_texdata_array2[1].tex[0]' (uniform texture1D)
0:? 'g_texdata_array2[1].samp[0]' (uniform sampler)
0:27 Constant:
0:27 0.300000
0:? Linker Objects
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:? 'g_samp' (uniform sampler)
0:? 'g_tex' (uniform texture1D)
0:? 'g_texdata_array2[0].samp[0]' (uniform sampler)
0:? 'g_texdata_array2[0].samp[1]' (uniform sampler)
0:? 'g_texdata_array2[0].tex[0]' (uniform texture1D)
0:? 'g_texdata_array2[0].tex[1]' (uniform texture1D)
0:? 'g_texdata_array2[1].samp[0]' (uniform sampler)
0:? 'g_texdata_array2[1].samp[1]' (uniform sampler)
0:? 'g_texdata_array2[1].tex[0]' (uniform texture1D)
0:? 'g_texdata_array2[1].tex[1]' (uniform texture1D)
0:? 'g_texdata_array2[2].samp[0]' (uniform sampler)
0:? 'g_texdata_array2[2].samp[1]' (uniform sampler)
0:? 'g_texdata_array2[2].tex[0]' (uniform texture1D)
0:? 'g_texdata_array2[2].tex[1]' (uniform texture1D)
Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:23 Function Definition: main(struct-PS_OUTPUT-vf41; (temp void)
0:23 Function Parameters:
0:23 'ps_output' (out structure{temp 4-component vector of float color})
0:? Sequence
0:24 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:26 add (temp 4-component vector of float)
0:25 add (temp 4-component vector of float)
0:25 texture (temp 4-component vector of float)
0:25 Construct combined texture-sampler (temp sampler1D)
0:? 'tex' (uniform texture1D)
0:? 'samp' (uniform sampler)
0:25 Constant:
0:25 0.500000
0:26 texture (temp 4-component vector of float)
0:26 Construct combined texture-sampler (temp sampler1D)
0:? 'g_texdata_array[1].tex' (uniform texture1D)
0:? 'g_texdata_array[1].samp' (uniform sampler)
0:26 Constant:
0:26 0.400000
0:27 texture (temp 4-component vector of float)
0:27 Construct combined texture-sampler (temp sampler1D)
0:? 'g_texdata_array2[1].tex[0]' (uniform texture1D)
0:? 'g_texdata_array2[1].samp[0]' (uniform sampler)
0:27 Constant:
0:27 0.300000
0:? Linker Objects
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:? 'g_samp' (uniform sampler)
0:? 'g_tex' (uniform texture1D)
0:? 'g_texdata_array2[0].samp[0]' (uniform sampler)
0:? 'g_texdata_array2[0].samp[1]' (uniform sampler)
0:? 'g_texdata_array2[0].tex[0]' (uniform texture1D)
0:? 'g_texdata_array2[0].tex[1]' (uniform texture1D)
0:? 'g_texdata_array2[1].samp[0]' (uniform sampler)
0:? 'g_texdata_array2[1].samp[1]' (uniform sampler)
0:? 'g_texdata_array2[1].tex[0]' (uniform texture1D)
0:? 'g_texdata_array2[1].tex[1]' (uniform texture1D)
0:? 'g_texdata_array2[2].samp[0]' (uniform sampler)
0:? 'g_texdata_array2[2].samp[1]' (uniform sampler)
0:? 'g_texdata_array2[2].tex[0]' (uniform texture1D)
0:? 'g_texdata_array2[2].tex[1]' (uniform texture1D)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 50
Capability Shader
Capability Sampled1D
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 9
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 9 "color"
Name 12 "tex"
Name 16 "samp"
Name 22 "g_texdata_array[1].tex"
Name 24 "g_texdata_array[1].samp"
Name 30 "g_texdata_array2[1].tex[0]"
Name 32 "g_texdata_array2[1].samp[0]"
Name 38 "g_samp"
Name 39 "g_tex"
Name 40 "g_texdata_array2[0].samp[0]"
Name 41 "g_texdata_array2[0].samp[1]"
Name 42 "g_texdata_array2[0].tex[0]"
Name 43 "g_texdata_array2[0].tex[1]"
Name 44 "g_texdata_array2[1].samp[1]"
Name 45 "g_texdata_array2[1].tex[1]"
Name 46 "g_texdata_array2[2].samp[0]"
Name 47 "g_texdata_array2[2].samp[1]"
Name 48 "g_texdata_array2[2].tex[0]"
Name 49 "g_texdata_array2[2].tex[1]"
Decorate 9(color) Location 0
Decorate 12(tex) DescriptorSet 0
Decorate 16(samp) DescriptorSet 0
Decorate 22(g_texdata_array[1].tex) DescriptorSet 0
Decorate 24(g_texdata_array[1].samp) DescriptorSet 0
Decorate 30(g_texdata_array2[1].tex[0]) DescriptorSet 0
Decorate 32(g_texdata_array2[1].samp[0]) DescriptorSet 0
Decorate 38(g_samp) DescriptorSet 0
Decorate 39(g_tex) DescriptorSet 0
Decorate 40(g_texdata_array2[0].samp[0]) DescriptorSet 0
Decorate 41(g_texdata_array2[0].samp[1]) DescriptorSet 0
Decorate 42(g_texdata_array2[0].tex[0]) DescriptorSet 0
Decorate 43(g_texdata_array2[0].tex[1]) DescriptorSet 0
Decorate 44(g_texdata_array2[1].samp[1]) DescriptorSet 0
Decorate 45(g_texdata_array2[1].tex[1]) DescriptorSet 0
Decorate 46(g_texdata_array2[2].samp[0]) DescriptorSet 0
Decorate 47(g_texdata_array2[2].samp[1]) DescriptorSet 0
Decorate 48(g_texdata_array2[2].tex[0]) DescriptorSet 0
Decorate 49(g_texdata_array2[2].tex[1]) DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Output 7(fvec4)
9(color): 8(ptr) Variable Output
10: TypeImage 6(float) 1D sampled format:Unknown
11: TypePointer UniformConstant 10
12(tex): 11(ptr) Variable UniformConstant
14: TypeSampler
15: TypePointer UniformConstant 14
16(samp): 15(ptr) Variable UniformConstant
18: TypeSampledImage 10
20: 6(float) Constant 1056964608
22(g_texdata_array[1].tex): 11(ptr) Variable UniformConstant
24(g_texdata_array[1].samp): 15(ptr) Variable UniformConstant
27: 6(float) Constant 1053609165
30(g_texdata_array2[1].tex[0]): 11(ptr) Variable UniformConstant
32(g_texdata_array2[1].samp[0]): 15(ptr) Variable UniformConstant
35: 6(float) Constant 1050253722
38(g_samp): 15(ptr) Variable UniformConstant
39(g_tex): 11(ptr) Variable UniformConstant
40(g_texdata_array2[0].samp[0]): 15(ptr) Variable UniformConstant
41(g_texdata_array2[0].samp[1]): 15(ptr) Variable UniformConstant
42(g_texdata_array2[0].tex[0]): 11(ptr) Variable UniformConstant
43(g_texdata_array2[0].tex[1]): 11(ptr) Variable UniformConstant
44(g_texdata_array2[1].samp[1]): 15(ptr) Variable UniformConstant
45(g_texdata_array2[1].tex[1]): 11(ptr) Variable UniformConstant
46(g_texdata_array2[2].samp[0]): 15(ptr) Variable UniformConstant
47(g_texdata_array2[2].samp[1]): 15(ptr) Variable UniformConstant
48(g_texdata_array2[2].tex[0]): 11(ptr) Variable UniformConstant
49(g_texdata_array2[2].tex[1]): 11(ptr) Variable UniformConstant
4(main): 2 Function None 3
5: Label
13: 10 Load 12(tex)
17: 14 Load 16(samp)
19: 18 SampledImage 13 17
21: 7(fvec4) ImageSampleImplicitLod 19 20
23: 10 Load 22(g_texdata_array[1].tex)
25: 14 Load 24(g_texdata_array[1].samp)
26: 18 SampledImage 23 25
28: 7(fvec4) ImageSampleImplicitLod 26 27
29: 7(fvec4) FAdd 21 28
31: 10 Load 30(g_texdata_array2[1].tex[0])
33: 14 Load 32(g_texdata_array2[1].samp[0])
34: 18 SampledImage 31 33
36: 7(fvec4) ImageSampleImplicitLod 34 35
37: 7(fvec4) FAdd 29 36
Store 9(color) 37
Return
FunctionEnd

View File

@@ -0,0 +1,100 @@
hlsl.structarray.flatten.geom
ERROR: 0:10: 'vin' : recursive type not yet supported in GS input
ERROR: 1 compilation errors. No code generated.
Shader version: 450
invocations = -1
max_vertices = 4
input primitive = lines
output primitive = triangle_strip
ERROR: node is still EOpNull!
0:10 Function Definition: main(struct-VertexData-vf4-vf4-vf21[2];struct-VertexData-vf4-vf4-vf21; (temp void)
0:10 Function Parameters:
0:10 'vin' (in 2-element array of structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
0:10 'outStream' (out structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
0:? Sequence
0:13 move second child to first child (temp 4-component vector of float)
0:13 color: direct index for structure (temp 4-component vector of float)
0:13 'vout' (temp structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
0:13 Constant:
0:13 1 (const int)
0:? 'vin[0].color' (layout(location=1 ) in 4-component vector of float)
0:14 move second child to first child (temp 2-component vector of float)
0:14 uv: direct index for structure (temp 2-component vector of float)
0:14 'vout' (temp structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
0:14 Constant:
0:14 2 (const int)
0:? 'vin[0].uv' (layout(location=2 ) in 2-component vector of float)
0:15 move second child to first child (temp 4-component vector of float)
0:15 position: direct index for structure (temp 4-component vector of float)
0:15 'vout' (temp structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
0:15 Constant:
0:15 0 (const int)
0:? 'vin[0].position' (layout(location=0 ) in 4-component vector of float)
0:16 Sequence
0:16 move second child to first child (temp structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
0:16 'outStream' (out structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
0:16 'vout' (temp structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
0:16 EmitVertex (temp void)
0:? Linker Objects
0:? 'vin[0].position' (layout(location=0 ) in 4-component vector of float)
0:? 'vin[0].color' (layout(location=1 ) in 4-component vector of float)
0:? 'vin[0].uv' (layout(location=2 ) in 2-component vector of float)
0:? 'vin[1].position' (layout(location=3 ) in 4-component vector of float)
0:? 'vin[1].color' (layout(location=4 ) in 4-component vector of float)
0:? 'vin[1].uv' (layout(location=5 ) in 2-component vector of float)
0:? 'position' (layout(location=0 ) out 4-component vector of float)
0:? 'color' (layout(location=1 ) out 4-component vector of float)
0:? 'uv' (layout(location=2 ) out 2-component vector of float)
Linked geometry stage:
Shader version: 450
invocations = 1
max_vertices = 4
input primitive = lines
output primitive = triangle_strip
ERROR: node is still EOpNull!
0:10 Function Definition: main(struct-VertexData-vf4-vf4-vf21[2];struct-VertexData-vf4-vf4-vf21; (temp void)
0:10 Function Parameters:
0:10 'vin' (in 2-element array of structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
0:10 'outStream' (out structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
0:? Sequence
0:13 move second child to first child (temp 4-component vector of float)
0:13 color: direct index for structure (temp 4-component vector of float)
0:13 'vout' (temp structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
0:13 Constant:
0:13 1 (const int)
0:? 'vin[0].color' (layout(location=1 ) in 4-component vector of float)
0:14 move second child to first child (temp 2-component vector of float)
0:14 uv: direct index for structure (temp 2-component vector of float)
0:14 'vout' (temp structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
0:14 Constant:
0:14 2 (const int)
0:? 'vin[0].uv' (layout(location=2 ) in 2-component vector of float)
0:15 move second child to first child (temp 4-component vector of float)
0:15 position: direct index for structure (temp 4-component vector of float)
0:15 'vout' (temp structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
0:15 Constant:
0:15 0 (const int)
0:? 'vin[0].position' (layout(location=0 ) in 4-component vector of float)
0:16 Sequence
0:16 move second child to first child (temp structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
0:16 'outStream' (out structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
0:16 'vout' (temp structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
0:16 EmitVertex (temp void)
0:? Linker Objects
0:? 'vin[0].position' (layout(location=0 ) in 4-component vector of float)
0:? 'vin[0].color' (layout(location=1 ) in 4-component vector of float)
0:? 'vin[0].uv' (layout(location=2 ) in 2-component vector of float)
0:? 'vin[1].position' (layout(location=3 ) in 4-component vector of float)
0:? 'vin[1].color' (layout(location=4 ) in 4-component vector of float)
0:? 'vin[1].uv' (layout(location=5 ) in 2-component vector of float)
0:? 'position' (layout(location=0 ) out 4-component vector of float)
0:? 'color' (layout(location=1 ) out 4-component vector of float)
0:? 'uv' (layout(location=2 ) out 2-component vector of float)
SPIR-V is not generated for failed compile or link

View File

@@ -16,14 +16,8 @@ Shader version: 450
0:11 add (temp 4-component vector of float)
0:11 add (temp 4-component vector of float)
0:11 add (temp 4-component vector of float)
0:11 direct index (layout(location=1 ) temp 4-component vector of float)
0:? 'm' (layout(location=1 ) in 2-element array of 4-component vector of float)
0:11 Constant:
0:11 1 (const int)
0:11 direct index (layout(location=1 ) temp 4-component vector of float)
0:? 'm' (layout(location=1 ) in 2-element array of 4-component vector of float)
0:11 Constant:
0:11 0 (const int)
0:? 'm[1]' (layout(location=2 ) in 4-component vector of float)
0:? 'm[0]' (layout(location=1 ) in 4-component vector of float)
0:11 Construct vec4 (temp 4-component vector of float)
0:11 Convert uint to float (temp float)
0:11 direct index (temp uint)
@@ -34,12 +28,24 @@ Shader version: 450
0:11 'e' (layout(location=5 ) in 4-component vector of float)
0:13 Sequence
0:13 Sequence
0:13 move second child to first child (temp 2-element array of 4-component vector of float)
0:? 'm' (layout(location=0 ) out 2-element array of 4-component vector of float)
0:13 m: direct index for structure (temp 2-element array of 4-component vector of float)
0:13 'local' (temp structure{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, temp 4-component vector of float b})
0:13 move second child to first child (temp 4-component vector of float)
0:? 'm[0]' (layout(location=0 ) out 4-component vector of float)
0:13 direct index (temp 4-component vector of float)
0:13 m: direct index for structure (temp 2-element array of 4-component vector of float)
0:13 'local' (temp structure{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, temp 4-component vector of float b})
0:13 Constant:
0:13 0 (const int)
0:13 Constant:
0:13 0 (const int)
0:13 move second child to first child (temp 4-component vector of float)
0:? 'm[1]' (layout(location=1 ) out 4-component vector of float)
0:13 direct index (temp 4-component vector of float)
0:13 m: direct index for structure (temp 2-element array of 4-component vector of float)
0:13 'local' (temp structure{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, temp 4-component vector of float b})
0:13 Constant:
0:13 0 (const int)
0:13 Constant:
0:13 1 (const int)
0:13 move second child to first child (temp 2-component vector of uint)
0:? 'coord' (layout(location=2 ) out 2-component vector of uint)
0:13 coord: direct index for structure (temp 2-component vector of uint)
@@ -54,14 +60,20 @@ Shader version: 450
0:13 2 (const int)
0:13 Branch: Return
0:? Linker Objects
0:? 'm' (layout(location=0 ) out 2-element array of 4-component vector of float)
0:? 'm[0]' (layout(location=0 ) out 4-component vector of float)
0:? 'm[1]' (layout(location=1 ) out 4-component vector of float)
0:? 'coord' (layout(location=2 ) out 2-component vector of uint)
0:? 'b' (layout(location=3 ) smooth out 4-component vector of float)
0:? 'd' (layout(location=0 ) in 4-component vector of float)
0:? 'm' (layout(location=1 ) in 2-element array of 4-component vector of float)
0:? 'm[0]' (layout(location=1 ) in 4-component vector of float)
0:? 'm[1]' (layout(location=2 ) in 4-component vector of float)
0:? 'coord' (layout(location=3 ) in 2-component vector of uint)
0:? 'b' (layout(location=4 ) in 4-component vector of float)
0:? 'e' (layout(location=5 ) in 4-component vector of float)
0:? 'm[0]' (layout(location=0 ) out 4-component vector of float)
0:? 'm[1]' (layout(location=1 ) out 4-component vector of float)
0:? 'm[0]' (layout(location=1 ) in 4-component vector of float)
0:? 'm[1]' (layout(location=2 ) in 4-component vector of float)
Linked vertex stage:
@@ -84,14 +96,8 @@ Shader version: 450
0:11 add (temp 4-component vector of float)
0:11 add (temp 4-component vector of float)
0:11 add (temp 4-component vector of float)
0:11 direct index (layout(location=1 ) temp 4-component vector of float)
0:? 'm' (layout(location=1 ) in 2-element array of 4-component vector of float)
0:11 Constant:
0:11 1 (const int)
0:11 direct index (layout(location=1 ) temp 4-component vector of float)
0:? 'm' (layout(location=1 ) in 2-element array of 4-component vector of float)
0:11 Constant:
0:11 0 (const int)
0:? 'm[1]' (layout(location=2 ) in 4-component vector of float)
0:? 'm[0]' (layout(location=1 ) in 4-component vector of float)
0:11 Construct vec4 (temp 4-component vector of float)
0:11 Convert uint to float (temp float)
0:11 direct index (temp uint)
@@ -102,12 +108,24 @@ Shader version: 450
0:11 'e' (layout(location=5 ) in 4-component vector of float)
0:13 Sequence
0:13 Sequence
0:13 move second child to first child (temp 2-element array of 4-component vector of float)
0:? 'm' (layout(location=0 ) out 2-element array of 4-component vector of float)
0:13 m: direct index for structure (temp 2-element array of 4-component vector of float)
0:13 'local' (temp structure{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, temp 4-component vector of float b})
0:13 move second child to first child (temp 4-component vector of float)
0:? 'm[0]' (layout(location=0 ) out 4-component vector of float)
0:13 direct index (temp 4-component vector of float)
0:13 m: direct index for structure (temp 2-element array of 4-component vector of float)
0:13 'local' (temp structure{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, temp 4-component vector of float b})
0:13 Constant:
0:13 0 (const int)
0:13 Constant:
0:13 0 (const int)
0:13 move second child to first child (temp 4-component vector of float)
0:? 'm[1]' (layout(location=1 ) out 4-component vector of float)
0:13 direct index (temp 4-component vector of float)
0:13 m: direct index for structure (temp 2-element array of 4-component vector of float)
0:13 'local' (temp structure{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, temp 4-component vector of float b})
0:13 Constant:
0:13 0 (const int)
0:13 Constant:
0:13 1 (const int)
0:13 move second child to first child (temp 2-component vector of uint)
0:? 'coord' (layout(location=2 ) out 2-component vector of uint)
0:13 coord: direct index for structure (temp 2-component vector of uint)
@@ -122,45 +140,55 @@ Shader version: 450
0:13 2 (const int)
0:13 Branch: Return
0:? Linker Objects
0:? 'm' (layout(location=0 ) out 2-element array of 4-component vector of float)
0:? 'm[0]' (layout(location=0 ) out 4-component vector of float)
0:? 'm[1]' (layout(location=1 ) out 4-component vector of float)
0:? 'coord' (layout(location=2 ) out 2-component vector of uint)
0:? 'b' (layout(location=3 ) smooth out 4-component vector of float)
0:? 'd' (layout(location=0 ) in 4-component vector of float)
0:? 'm' (layout(location=1 ) in 2-element array of 4-component vector of float)
0:? 'm[0]' (layout(location=1 ) in 4-component vector of float)
0:? 'm[1]' (layout(location=2 ) in 4-component vector of float)
0:? 'coord' (layout(location=3 ) in 2-component vector of uint)
0:? 'b' (layout(location=4 ) in 4-component vector of float)
0:? 'e' (layout(location=5 ) in 4-component vector of float)
0:? 'm[0]' (layout(location=0 ) out 4-component vector of float)
0:? 'm[1]' (layout(location=1 ) out 4-component vector of float)
0:? 'm[0]' (layout(location=1 ) in 4-component vector of float)
0:? 'm[1]' (layout(location=2 ) in 4-component vector of float)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 60
// Id's are bound by 59
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 18 28 36 39 45 50 55 59
EntryPoint Vertex 4 "main" 18 20 24 32 35 41 45 50 54 58
Name 4 "main"
Name 12 "VI"
MemberName 12(VI) 0 "m"
MemberName 12(VI) 1 "coord"
MemberName 12(VI) 2 "b"
Name 14 "local"
Name 18 "m"
Name 28 "coord"
Name 36 "d"
Name 39 "e"
Name 45 "m"
Name 18 "m[1]"
Name 20 "m[0]"
Name 24 "coord"
Name 32 "d"
Name 35 "e"
Name 41 "m[0]"
Name 45 "m[1]"
Name 50 "coord"
Name 55 "b"
Name 59 "b"
Decorate 18(m) Location 1
Decorate 28(coord) Location 3
Decorate 36(d) Location 0
Decorate 39(e) Location 5
Decorate 45(m) Location 0
Name 54 "b"
Name 58 "b"
Decorate 18(m[1]) Location 2
Decorate 20(m[0]) Location 1
Decorate 24(coord) Location 3
Decorate 32(d) Location 0
Decorate 35(e) Location 5
Decorate 41(m[0]) Location 0
Decorate 45(m[1]) Location 1
Decorate 50(coord) Location 2
Decorate 55(b) Location 3
Decorate 59(b) Location 4
Decorate 54(b) Location 3
Decorate 58(b) Location 4
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@@ -173,54 +201,54 @@ Shader version: 450
13: TypePointer Function 12(VI)
15: TypeInt 32 1
16: 15(int) Constant 2
17: TypePointer Input 10
18(m): 17(ptr) Variable Input
19: 15(int) Constant 1
20: TypePointer Input 7(fvec4)
23: 15(int) Constant 0
27: TypePointer Input 11(ivec2)
28(coord): 27(ptr) Variable Input
29: 8(int) Constant 0
30: TypePointer Input 8(int)
36(d): 20(ptr) Variable Input
39(e): 20(ptr) Variable Input
42: TypePointer Function 7(fvec4)
44: TypePointer Output 10
45(m): 44(ptr) Variable Output
46: TypePointer Function 10
17: TypePointer Input 7(fvec4)
18(m[1]): 17(ptr) Variable Input
20(m[0]): 17(ptr) Variable Input
23: TypePointer Input 11(ivec2)
24(coord): 23(ptr) Variable Input
25: 8(int) Constant 0
26: TypePointer Input 8(int)
32(d): 17(ptr) Variable Input
35(e): 17(ptr) Variable Input
38: TypePointer Function 7(fvec4)
40: TypePointer Output 7(fvec4)
41(m[0]): 40(ptr) Variable Output
42: 15(int) Constant 0
45(m[1]): 40(ptr) Variable Output
46: 15(int) Constant 1
49: TypePointer Output 11(ivec2)
50(coord): 49(ptr) Variable Output
51: TypePointer Function 11(ivec2)
54: TypePointer Output 7(fvec4)
55(b): 54(ptr) Variable Output
59(b): 20(ptr) Variable Input
54(b): 40(ptr) Variable Output
58(b): 17(ptr) Variable Input
4(main): 2 Function None 3
5: Label
14(local): 13(ptr) Variable Function
21: 20(ptr) AccessChain 18(m) 19
22: 7(fvec4) Load 21
24: 20(ptr) AccessChain 18(m) 23
25: 7(fvec4) Load 24
26: 7(fvec4) FAdd 22 25
31: 30(ptr) AccessChain 28(coord) 29
32: 8(int) Load 31
33: 6(float) ConvertUToF 32
34: 7(fvec4) CompositeConstruct 33 33 33 33
35: 7(fvec4) FAdd 26 34
37: 7(fvec4) Load 36(d)
38: 7(fvec4) FAdd 35 37
40: 7(fvec4) Load 39(e)
41: 7(fvec4) FAdd 38 40
43: 42(ptr) AccessChain 14(local) 16
Store 43 41
47: 46(ptr) AccessChain 14(local) 23
48: 10 Load 47
Store 45(m) 48
52: 51(ptr) AccessChain 14(local) 19
19: 7(fvec4) Load 18(m[1])
21: 7(fvec4) Load 20(m[0])
22: 7(fvec4) FAdd 19 21
27: 26(ptr) AccessChain 24(coord) 25
28: 8(int) Load 27
29: 6(float) ConvertUToF 28
30: 7(fvec4) CompositeConstruct 29 29 29 29
31: 7(fvec4) FAdd 22 30
33: 7(fvec4) Load 32(d)
34: 7(fvec4) FAdd 31 33
36: 7(fvec4) Load 35(e)
37: 7(fvec4) FAdd 34 36
39: 38(ptr) AccessChain 14(local) 16
Store 39 37
43: 38(ptr) AccessChain 14(local) 42 42
44: 7(fvec4) Load 43
Store 41(m[0]) 44
47: 38(ptr) AccessChain 14(local) 42 46
48: 7(fvec4) Load 47
Store 45(m[1]) 48
52: 51(ptr) AccessChain 14(local) 46
53: 11(ivec2) Load 52
Store 50(coord) 53
56: 42(ptr) AccessChain 14(local) 16
57: 7(fvec4) Load 56
Store 55(b) 57
55: 38(ptr) AccessChain 14(local) 16
56: 7(fvec4) Load 55
Store 54(b) 56
Return
FunctionEnd

View File

@@ -0,0 +1,28 @@
SamplerState g_samp;
Texture1D g_tex;
struct tex_t {
SamplerState samp;
Texture1D tex;
int nonopaque_thing;
};
struct tex_with_arrays_t {
SamplerState samp[2];
Texture1D tex[2];
int nonopaque_thing;
};
uniform tex_t g_texdata;
uniform tex_t g_texdata_array[3];
uniform tex_with_arrays_t g_texdata_array2[3];
struct PS_OUTPUT { float4 color : SV_Target0; };
void main(out PS_OUTPUT ps_output)
{
ps_output.color =
g_texdata.tex.Sample(g_texdata.samp, 0.5) +
g_texdata_array[1].tex.Sample(g_texdata_array[1].samp, 0.4) +
g_texdata_array2[1].tex[0].Sample(g_texdata_array2[1].samp[0], 0.3);
}

View File

@@ -0,0 +1,17 @@
struct VertexData {
float4 position : POSITION;
float4 color : COLOR0;
float2 uv : TEXCOORD0;
};
[maxvertexcount(4)]
void main(line VertexData vin[2], inout TriangleStream<VertexData> outStream)
{
VertexData vout;
vout.color = vin[0].color;
vout.uv = vin[0].uv;
vout.position = vin[0].position;
outStream.Append(vout);
}

View File

@@ -11,4 +11,4 @@ VI main(float4 d, VI vi, float4 e) : SV_POSITION
local.b = vi.m[1] + vi.m[0] + float4(vi.coord.x) + d + e;
return local;
}
}