Flatten uniform arrays
This checkin adds a --flatten-uniform-arrays option which can break uniform arrays of samplers, textures, or UBOs up into individual scalars named (e.g) myarray[0], myarray[1], etc. These appear as individual linkage objects. Code notes: - shouldFlatten internally calls shouldFlattenIO, and shouldFlattenUniform, but is the only flattening query directly called. - flattenVariable will handle structs or arrays (but not yet arrayed structs; this is tested an an error is generated). - There's some error checking around unhandled situations. E.g, flattening uniform arrays with initializer lists is not implemented. - This piggybacks on as much of the existing mechanism for struct flattening as it can. E.g, it uses the same flattenMap, and the same flattenAccess() method. - handleAssign() has been generalized to cope with either structs or arrays. - Extended test infrastructure to test flattening ability.
This commit is contained in:
588
Test/baseResults/hlsl.array.flatten.frag.out
Normal file
588
Test/baseResults/hlsl.array.flatten.frag.out
Normal file
@@ -0,0 +1,588 @@
|
||||
hlsl.array.flatten.frag
|
||||
Shader version: 450
|
||||
gl_FragCoord origin is upper left
|
||||
0:? Sequence
|
||||
0:17 Function Definition: TestFn1( (global 4-component vector of float)
|
||||
0:17 Function Parameters:
|
||||
0:? Sequence
|
||||
0:18 Branch: Return with expression
|
||||
0:18 texture (global 4-component vector of float)
|
||||
0:18 Construct combined texture-sampler (temp sampler1D)
|
||||
0:? 'g_tex[1]' (temp texture1D)
|
||||
0:? 'g_samp[1]' (temp sampler)
|
||||
0:18 Constant:
|
||||
0:18 0.200000
|
||||
0:22 Function Definition: TestFn2(t11[3];p1[3]; (global 4-component vector of float)
|
||||
0:22 Function Parameters:
|
||||
0:22 'l_tex' (in 3-element array of texture1D)
|
||||
0:22 'l_samp' (in 3-element array of sampler)
|
||||
0:? Sequence
|
||||
0:23 Branch: Return with expression
|
||||
0:23 texture (global 4-component vector of float)
|
||||
0:23 Construct combined texture-sampler (temp sampler1D)
|
||||
0:23 direct index (temp texture1D)
|
||||
0:23 'l_tex' (in 3-element array of texture1D)
|
||||
0:23 Constant:
|
||||
0:23 2 (const int)
|
||||
0:23 direct index (temp sampler)
|
||||
0:23 'l_samp' (in 3-element array of sampler)
|
||||
0:23 Constant:
|
||||
0:23 2 (const int)
|
||||
0:23 Constant:
|
||||
0:23 0.200000
|
||||
0:26 Sequence
|
||||
0:26 move second child to first child (temp 5-element array of int)
|
||||
0:26 'not_flattened_a' (global 5-element array of int)
|
||||
0:26 Constant:
|
||||
0:26 1 (const int)
|
||||
0:26 2 (const int)
|
||||
0:26 3 (const int)
|
||||
0:26 4 (const int)
|
||||
0:26 5 (const int)
|
||||
0:31 Function Definition: main(struct-PS_OUTPUT-vf41; (global void)
|
||||
0:31 Function Parameters:
|
||||
0:31 'ps_output' (out structure{temp 4-component vector of float color})
|
||||
0:? Sequence
|
||||
0:33 Sequence
|
||||
0:? Sequence
|
||||
0:33 move second child to first child (temp sampler)
|
||||
0:33 direct index (temp sampler)
|
||||
0:33 'local_sampler_array' (temp 3-element array of sampler)
|
||||
0:33 Constant:
|
||||
0:33 0 (const int)
|
||||
0:? 'g_samp[0]' (uniform sampler)
|
||||
0:33 move second child to first child (temp sampler)
|
||||
0:33 direct index (temp sampler)
|
||||
0:33 'local_sampler_array' (temp 3-element array of sampler)
|
||||
0:33 Constant:
|
||||
0:33 1 (const int)
|
||||
0:? 'g_samp[1]' (uniform sampler)
|
||||
0:33 move second child to first child (temp sampler)
|
||||
0:33 direct index (temp sampler)
|
||||
0:33 'local_sampler_array' (temp 3-element array of sampler)
|
||||
0:33 Constant:
|
||||
0:33 2 (const int)
|
||||
0:? 'g_samp[2]' (uniform sampler)
|
||||
0:34 Sequence
|
||||
0:? Sequence
|
||||
0:34 move second child to first child (temp texture1D)
|
||||
0:34 direct index (temp texture1D)
|
||||
0:34 'local_texture_array' (temp 3-element array of texture1D)
|
||||
0:34 Constant:
|
||||
0:34 0 (const int)
|
||||
0:? 'g_tex[0]' (uniform texture1D)
|
||||
0:34 move second child to first child (temp texture1D)
|
||||
0:34 direct index (temp texture1D)
|
||||
0:34 'local_texture_array' (temp 3-element array of texture1D)
|
||||
0:34 Constant:
|
||||
0:34 1 (const int)
|
||||
0:? 'g_tex[1]' (uniform texture1D)
|
||||
0:34 move second child to first child (temp texture1D)
|
||||
0:34 direct index (temp texture1D)
|
||||
0:34 'local_texture_array' (temp 3-element array of texture1D)
|
||||
0:34 Constant:
|
||||
0:34 2 (const int)
|
||||
0:? 'g_tex[2]' (uniform texture1D)
|
||||
0:35 Sequence
|
||||
0:? Sequence
|
||||
0:35 move second child to first child (temp float)
|
||||
0:35 direct index (temp float)
|
||||
0:35 'local_float_array' (temp 4-element array of float)
|
||||
0:35 Constant:
|
||||
0:35 0 (const int)
|
||||
0:? 'g_floats[0]' (uniform float)
|
||||
0:35 move second child to first child (temp float)
|
||||
0:35 direct index (temp float)
|
||||
0:35 'local_float_array' (temp 4-element array of float)
|
||||
0:35 Constant:
|
||||
0:35 1 (const int)
|
||||
0:? 'g_floats[1]' (uniform float)
|
||||
0:35 move second child to first child (temp float)
|
||||
0:35 direct index (temp float)
|
||||
0:35 'local_float_array' (temp 4-element array of float)
|
||||
0:35 Constant:
|
||||
0:35 2 (const int)
|
||||
0:? 'g_floats[2]' (uniform float)
|
||||
0:35 move second child to first child (temp float)
|
||||
0:35 direct index (temp float)
|
||||
0:35 'local_float_array' (temp 4-element array of float)
|
||||
0:35 Constant:
|
||||
0:35 3 (const int)
|
||||
0:? 'g_floats[3]' (uniform float)
|
||||
0:37 move second child to first child (temp 4-component vector of float)
|
||||
0:? 'color' (layout(location=0 ) out 4-component vector of float)
|
||||
0:37 add (temp 4-component vector of float)
|
||||
0:37 Function Call: TestFn1( (global 4-component vector of float)
|
||||
0:37 Function Call: TestFn2(t11[3];p1[3]; (global 4-component vector of float)
|
||||
0:? Comma (temp 3-element array of texture1D)
|
||||
0:? Sequence
|
||||
0:? move second child to first child (temp texture1D)
|
||||
0:? direct index (temp texture1D)
|
||||
0:? 'aggShadow' (temp 3-element array of texture1D)
|
||||
0:? Constant:
|
||||
0:? 0 (const int)
|
||||
0:? 'g_tex[0]' (uniform texture1D)
|
||||
0:? move second child to first child (temp texture1D)
|
||||
0:? direct index (temp texture1D)
|
||||
0:? 'aggShadow' (temp 3-element array of texture1D)
|
||||
0:? Constant:
|
||||
0:? 1 (const int)
|
||||
0:? 'g_tex[1]' (uniform texture1D)
|
||||
0:? move second child to first child (temp texture1D)
|
||||
0:? direct index (temp texture1D)
|
||||
0:? 'aggShadow' (temp 3-element array of texture1D)
|
||||
0:? Constant:
|
||||
0:? 2 (const int)
|
||||
0:? 'g_tex[2]' (uniform texture1D)
|
||||
0:? 'aggShadow' (temp 3-element array of texture1D)
|
||||
0:? Comma (temp 3-element array of sampler)
|
||||
0:? Sequence
|
||||
0:? move second child to first child (temp sampler)
|
||||
0:? direct index (temp sampler)
|
||||
0:? 'aggShadow' (temp 3-element array of sampler)
|
||||
0:? Constant:
|
||||
0:? 0 (const int)
|
||||
0:? 'g_samp[0]' (uniform sampler)
|
||||
0:? move second child to first child (temp sampler)
|
||||
0:? direct index (temp sampler)
|
||||
0:? 'aggShadow' (temp 3-element array of sampler)
|
||||
0:? Constant:
|
||||
0:? 1 (const int)
|
||||
0:? 'g_samp[1]' (uniform sampler)
|
||||
0:? move second child to first child (temp sampler)
|
||||
0:? direct index (temp sampler)
|
||||
0:? 'aggShadow' (temp 3-element array of sampler)
|
||||
0:? Constant:
|
||||
0:? 2 (const int)
|
||||
0:? 'g_samp[2]' (uniform sampler)
|
||||
0:? 'aggShadow' (temp 3-element array of sampler)
|
||||
0:? Linker Objects
|
||||
0:? 'g_tex[0]' (uniform texture1D)
|
||||
0:? 'g_tex[1]' (uniform texture1D)
|
||||
0:? 'g_tex[2]' (uniform texture1D)
|
||||
0:? 'g_tex_explicit[0]' (layout(binding=1 ) uniform texture1D)
|
||||
0:? 'g_tex_explicit[1]' (layout(binding=2 ) uniform texture1D)
|
||||
0:? 'g_tex_explicit[2]' (layout(binding=3 ) uniform texture1D)
|
||||
0:? 'g_samp[0]' (uniform sampler)
|
||||
0:? 'g_samp[1]' (uniform sampler)
|
||||
0:? 'g_samp[2]' (uniform sampler)
|
||||
0:? 'g_samp_explicit[0]' (layout(binding=5 ) uniform sampler)
|
||||
0:? 'g_samp_explicit[1]' (layout(binding=6 ) uniform sampler)
|
||||
0:? 'g_samp_explicit[2]' (layout(binding=7 ) uniform sampler)
|
||||
0:? 'g_mats[0]' (uniform 3X3 matrix of float)
|
||||
0:? 'g_mats[1]' (uniform 3X3 matrix of float)
|
||||
0:? 'g_mats[2]' (uniform 3X3 matrix of float)
|
||||
0:? 'g_mats[3]' (uniform 3X3 matrix of float)
|
||||
0:? 'g_mats_explicit[0]' (layout(binding=10 ) uniform 3X3 matrix of float)
|
||||
0:? 'g_mats_explicit[1]' (layout(binding=11 ) uniform 3X3 matrix of float)
|
||||
0:? 'g_mats_explicit[2]' (layout(binding=12 ) uniform 3X3 matrix of float)
|
||||
0:? 'g_mats_explicit[3]' (layout(binding=13 ) uniform 3X3 matrix of float)
|
||||
0:? 'g_floats[0]' (uniform float)
|
||||
0:? 'g_floats[1]' (uniform float)
|
||||
0:? 'g_floats[2]' (uniform float)
|
||||
0:? 'g_floats[3]' (uniform float)
|
||||
0:? 'not_flattened_a' (global 5-element array of int)
|
||||
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:17 Function Definition: TestFn1( (global 4-component vector of float)
|
||||
0:17 Function Parameters:
|
||||
0:? Sequence
|
||||
0:18 Branch: Return with expression
|
||||
0:18 texture (global 4-component vector of float)
|
||||
0:18 Construct combined texture-sampler (temp sampler1D)
|
||||
0:? 'g_tex[1]' (temp texture1D)
|
||||
0:? 'g_samp[1]' (temp sampler)
|
||||
0:18 Constant:
|
||||
0:18 0.200000
|
||||
0:22 Function Definition: TestFn2(t11[3];p1[3]; (global 4-component vector of float)
|
||||
0:22 Function Parameters:
|
||||
0:22 'l_tex' (in 3-element array of texture1D)
|
||||
0:22 'l_samp' (in 3-element array of sampler)
|
||||
0:? Sequence
|
||||
0:23 Branch: Return with expression
|
||||
0:23 texture (global 4-component vector of float)
|
||||
0:23 Construct combined texture-sampler (temp sampler1D)
|
||||
0:23 direct index (temp texture1D)
|
||||
0:23 'l_tex' (in 3-element array of texture1D)
|
||||
0:23 Constant:
|
||||
0:23 2 (const int)
|
||||
0:23 direct index (temp sampler)
|
||||
0:23 'l_samp' (in 3-element array of sampler)
|
||||
0:23 Constant:
|
||||
0:23 2 (const int)
|
||||
0:23 Constant:
|
||||
0:23 0.200000
|
||||
0:26 Sequence
|
||||
0:26 move second child to first child (temp 5-element array of int)
|
||||
0:26 'not_flattened_a' (global 5-element array of int)
|
||||
0:26 Constant:
|
||||
0:26 1 (const int)
|
||||
0:26 2 (const int)
|
||||
0:26 3 (const int)
|
||||
0:26 4 (const int)
|
||||
0:26 5 (const int)
|
||||
0:31 Function Definition: main(struct-PS_OUTPUT-vf41; (global void)
|
||||
0:31 Function Parameters:
|
||||
0:31 'ps_output' (out structure{temp 4-component vector of float color})
|
||||
0:? Sequence
|
||||
0:33 Sequence
|
||||
0:? Sequence
|
||||
0:33 move second child to first child (temp sampler)
|
||||
0:33 direct index (temp sampler)
|
||||
0:33 'local_sampler_array' (temp 3-element array of sampler)
|
||||
0:33 Constant:
|
||||
0:33 0 (const int)
|
||||
0:? 'g_samp[0]' (uniform sampler)
|
||||
0:33 move second child to first child (temp sampler)
|
||||
0:33 direct index (temp sampler)
|
||||
0:33 'local_sampler_array' (temp 3-element array of sampler)
|
||||
0:33 Constant:
|
||||
0:33 1 (const int)
|
||||
0:? 'g_samp[1]' (uniform sampler)
|
||||
0:33 move second child to first child (temp sampler)
|
||||
0:33 direct index (temp sampler)
|
||||
0:33 'local_sampler_array' (temp 3-element array of sampler)
|
||||
0:33 Constant:
|
||||
0:33 2 (const int)
|
||||
0:? 'g_samp[2]' (uniform sampler)
|
||||
0:34 Sequence
|
||||
0:? Sequence
|
||||
0:34 move second child to first child (temp texture1D)
|
||||
0:34 direct index (temp texture1D)
|
||||
0:34 'local_texture_array' (temp 3-element array of texture1D)
|
||||
0:34 Constant:
|
||||
0:34 0 (const int)
|
||||
0:? 'g_tex[0]' (uniform texture1D)
|
||||
0:34 move second child to first child (temp texture1D)
|
||||
0:34 direct index (temp texture1D)
|
||||
0:34 'local_texture_array' (temp 3-element array of texture1D)
|
||||
0:34 Constant:
|
||||
0:34 1 (const int)
|
||||
0:? 'g_tex[1]' (uniform texture1D)
|
||||
0:34 move second child to first child (temp texture1D)
|
||||
0:34 direct index (temp texture1D)
|
||||
0:34 'local_texture_array' (temp 3-element array of texture1D)
|
||||
0:34 Constant:
|
||||
0:34 2 (const int)
|
||||
0:? 'g_tex[2]' (uniform texture1D)
|
||||
0:35 Sequence
|
||||
0:? Sequence
|
||||
0:35 move second child to first child (temp float)
|
||||
0:35 direct index (temp float)
|
||||
0:35 'local_float_array' (temp 4-element array of float)
|
||||
0:35 Constant:
|
||||
0:35 0 (const int)
|
||||
0:? 'g_floats[0]' (uniform float)
|
||||
0:35 move second child to first child (temp float)
|
||||
0:35 direct index (temp float)
|
||||
0:35 'local_float_array' (temp 4-element array of float)
|
||||
0:35 Constant:
|
||||
0:35 1 (const int)
|
||||
0:? 'g_floats[1]' (uniform float)
|
||||
0:35 move second child to first child (temp float)
|
||||
0:35 direct index (temp float)
|
||||
0:35 'local_float_array' (temp 4-element array of float)
|
||||
0:35 Constant:
|
||||
0:35 2 (const int)
|
||||
0:? 'g_floats[2]' (uniform float)
|
||||
0:35 move second child to first child (temp float)
|
||||
0:35 direct index (temp float)
|
||||
0:35 'local_float_array' (temp 4-element array of float)
|
||||
0:35 Constant:
|
||||
0:35 3 (const int)
|
||||
0:? 'g_floats[3]' (uniform float)
|
||||
0:37 move second child to first child (temp 4-component vector of float)
|
||||
0:? 'color' (layout(location=0 ) out 4-component vector of float)
|
||||
0:37 add (temp 4-component vector of float)
|
||||
0:37 Function Call: TestFn1( (global 4-component vector of float)
|
||||
0:37 Function Call: TestFn2(t11[3];p1[3]; (global 4-component vector of float)
|
||||
0:? Comma (temp 3-element array of texture1D)
|
||||
0:? Sequence
|
||||
0:? move second child to first child (temp texture1D)
|
||||
0:? direct index (temp texture1D)
|
||||
0:? 'aggShadow' (temp 3-element array of texture1D)
|
||||
0:? Constant:
|
||||
0:? 0 (const int)
|
||||
0:? 'g_tex[0]' (uniform texture1D)
|
||||
0:? move second child to first child (temp texture1D)
|
||||
0:? direct index (temp texture1D)
|
||||
0:? 'aggShadow' (temp 3-element array of texture1D)
|
||||
0:? Constant:
|
||||
0:? 1 (const int)
|
||||
0:? 'g_tex[1]' (uniform texture1D)
|
||||
0:? move second child to first child (temp texture1D)
|
||||
0:? direct index (temp texture1D)
|
||||
0:? 'aggShadow' (temp 3-element array of texture1D)
|
||||
0:? Constant:
|
||||
0:? 2 (const int)
|
||||
0:? 'g_tex[2]' (uniform texture1D)
|
||||
0:? 'aggShadow' (temp 3-element array of texture1D)
|
||||
0:? Comma (temp 3-element array of sampler)
|
||||
0:? Sequence
|
||||
0:? move second child to first child (temp sampler)
|
||||
0:? direct index (temp sampler)
|
||||
0:? 'aggShadow' (temp 3-element array of sampler)
|
||||
0:? Constant:
|
||||
0:? 0 (const int)
|
||||
0:? 'g_samp[0]' (uniform sampler)
|
||||
0:? move second child to first child (temp sampler)
|
||||
0:? direct index (temp sampler)
|
||||
0:? 'aggShadow' (temp 3-element array of sampler)
|
||||
0:? Constant:
|
||||
0:? 1 (const int)
|
||||
0:? 'g_samp[1]' (uniform sampler)
|
||||
0:? move second child to first child (temp sampler)
|
||||
0:? direct index (temp sampler)
|
||||
0:? 'aggShadow' (temp 3-element array of sampler)
|
||||
0:? Constant:
|
||||
0:? 2 (const int)
|
||||
0:? 'g_samp[2]' (uniform sampler)
|
||||
0:? 'aggShadow' (temp 3-element array of sampler)
|
||||
0:? Linker Objects
|
||||
0:? 'g_tex[0]' (uniform texture1D)
|
||||
0:? 'g_tex[1]' (uniform texture1D)
|
||||
0:? 'g_tex[2]' (uniform texture1D)
|
||||
0:? 'g_tex_explicit[0]' (layout(binding=1 ) uniform texture1D)
|
||||
0:? 'g_tex_explicit[1]' (layout(binding=2 ) uniform texture1D)
|
||||
0:? 'g_tex_explicit[2]' (layout(binding=3 ) uniform texture1D)
|
||||
0:? 'g_samp[0]' (uniform sampler)
|
||||
0:? 'g_samp[1]' (uniform sampler)
|
||||
0:? 'g_samp[2]' (uniform sampler)
|
||||
0:? 'g_samp_explicit[0]' (layout(binding=5 ) uniform sampler)
|
||||
0:? 'g_samp_explicit[1]' (layout(binding=6 ) uniform sampler)
|
||||
0:? 'g_samp_explicit[2]' (layout(binding=7 ) uniform sampler)
|
||||
0:? 'g_mats[0]' (uniform 3X3 matrix of float)
|
||||
0:? 'g_mats[1]' (uniform 3X3 matrix of float)
|
||||
0:? 'g_mats[2]' (uniform 3X3 matrix of float)
|
||||
0:? 'g_mats[3]' (uniform 3X3 matrix of float)
|
||||
0:? 'g_mats_explicit[0]' (layout(binding=10 ) uniform 3X3 matrix of float)
|
||||
0:? 'g_mats_explicit[1]' (layout(binding=11 ) uniform 3X3 matrix of float)
|
||||
0:? 'g_mats_explicit[2]' (layout(binding=12 ) uniform 3X3 matrix of float)
|
||||
0:? 'g_mats_explicit[3]' (layout(binding=13 ) uniform 3X3 matrix of float)
|
||||
0:? 'g_floats[0]' (uniform float)
|
||||
0:? 'g_floats[1]' (uniform float)
|
||||
0:? 'g_floats[2]' (uniform float)
|
||||
0:? 'g_floats[3]' (uniform float)
|
||||
0:? 'not_flattened_a' (global 5-element array of int)
|
||||
0:? 'color' (layout(location=0 ) out 4-component vector of float)
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 128
|
||||
|
||||
Capability Shader
|
||||
Capability Sampled1D
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 93
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Name 4 "main"
|
||||
Name 9 "TestFn1("
|
||||
Name 22 "TestFn2(t11[3];p1[3];"
|
||||
Name 20 "l_tex"
|
||||
Name 21 "l_samp"
|
||||
Name 28 "not_flattened_a"
|
||||
Name 36 "g_tex[1]"
|
||||
Name 39 "g_samp[1]"
|
||||
Name 55 "local_sampler_array"
|
||||
Name 57 "g_samp[0]"
|
||||
Name 62 "g_samp[2]"
|
||||
Name 65 "local_texture_array"
|
||||
Name 66 "g_tex[0]"
|
||||
Name 71 "g_tex[2]"
|
||||
Name 77 "local_float_array"
|
||||
Name 79 "g_floats[0]"
|
||||
Name 83 "g_floats[1]"
|
||||
Name 86 "g_floats[2]"
|
||||
Name 89 "g_floats[3]"
|
||||
Name 93 "color"
|
||||
Name 95 "aggShadow"
|
||||
Name 102 "aggShadow"
|
||||
Name 111 "g_tex_explicit[0]"
|
||||
Name 112 "g_tex_explicit[1]"
|
||||
Name 113 "g_tex_explicit[2]"
|
||||
Name 114 "g_samp_explicit[0]"
|
||||
Name 115 "g_samp_explicit[1]"
|
||||
Name 116 "g_samp_explicit[2]"
|
||||
Name 120 "g_mats[0]"
|
||||
Name 121 "g_mats[1]"
|
||||
Name 122 "g_mats[2]"
|
||||
Name 123 "g_mats[3]"
|
||||
Name 124 "g_mats_explicit[0]"
|
||||
Name 125 "g_mats_explicit[1]"
|
||||
Name 126 "g_mats_explicit[2]"
|
||||
Name 127 "g_mats_explicit[3]"
|
||||
Decorate 57(g_samp[0]) DescriptorSet 0
|
||||
Decorate 62(g_samp[2]) DescriptorSet 0
|
||||
Decorate 66(g_tex[0]) DescriptorSet 0
|
||||
Decorate 71(g_tex[2]) DescriptorSet 0
|
||||
Decorate 93(color) Location 0
|
||||
Decorate 111(g_tex_explicit[0]) DescriptorSet 0
|
||||
Decorate 111(g_tex_explicit[0]) Binding 1
|
||||
Decorate 112(g_tex_explicit[1]) DescriptorSet 0
|
||||
Decorate 112(g_tex_explicit[1]) Binding 2
|
||||
Decorate 113(g_tex_explicit[2]) DescriptorSet 0
|
||||
Decorate 113(g_tex_explicit[2]) Binding 3
|
||||
Decorate 114(g_samp_explicit[0]) DescriptorSet 0
|
||||
Decorate 114(g_samp_explicit[0]) Binding 5
|
||||
Decorate 115(g_samp_explicit[1]) DescriptorSet 0
|
||||
Decorate 115(g_samp_explicit[1]) Binding 6
|
||||
Decorate 116(g_samp_explicit[2]) DescriptorSet 0
|
||||
Decorate 116(g_samp_explicit[2]) Binding 7
|
||||
Decorate 124(g_mats_explicit[0]) Binding 10
|
||||
Decorate 125(g_mats_explicit[1]) Binding 11
|
||||
Decorate 126(g_mats_explicit[2]) Binding 12
|
||||
Decorate 127(g_mats_explicit[3]) Binding 13
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
7: TypeVector 6(float) 4
|
||||
8: TypeFunction 7(fvec4)
|
||||
11: TypeImage 6(float) 1D sampled format:Unknown
|
||||
12: TypeInt 32 0
|
||||
13: 12(int) Constant 3
|
||||
14: TypeArray 11 13
|
||||
15: TypePointer UniformConstant 14
|
||||
16: TypeSampler
|
||||
17: TypeArray 16 13
|
||||
18: TypePointer UniformConstant 17
|
||||
19: TypeFunction 7(fvec4) 15(ptr) 18(ptr)
|
||||
24: TypeInt 32 1
|
||||
25: 12(int) Constant 5
|
||||
26: TypeArray 24(int) 25
|
||||
27: TypePointer Private 26
|
||||
28(not_flattened_a): 27(ptr) Variable Private
|
||||
29: 24(int) Constant 1
|
||||
30: 24(int) Constant 2
|
||||
31: 24(int) Constant 3
|
||||
32: 24(int) Constant 4
|
||||
33: 24(int) Constant 5
|
||||
34: 26 ConstantComposite 29 30 31 32 33
|
||||
35: TypePointer UniformConstant 11
|
||||
36(g_tex[1]): 35(ptr) Variable UniformConstant
|
||||
38: TypePointer UniformConstant 16
|
||||
39(g_samp[1]): 38(ptr) Variable UniformConstant
|
||||
41: TypeSampledImage 11
|
||||
43: 6(float) Constant 1045220557
|
||||
55(local_sampler_array): 18(ptr) Variable UniformConstant
|
||||
56: 24(int) Constant 0
|
||||
57(g_samp[0]): 38(ptr) Variable UniformConstant
|
||||
62(g_samp[2]): 38(ptr) Variable UniformConstant
|
||||
65(local_texture_array): 15(ptr) Variable UniformConstant
|
||||
66(g_tex[0]): 35(ptr) Variable UniformConstant
|
||||
71(g_tex[2]): 35(ptr) Variable UniformConstant
|
||||
74: 12(int) Constant 4
|
||||
75: TypeArray 6(float) 74
|
||||
76: TypePointer Function 75
|
||||
78: TypePointer UniformConstant 6(float)
|
||||
79(g_floats[0]): 78(ptr) Variable UniformConstant
|
||||
81: TypePointer Function 6(float)
|
||||
83(g_floats[1]): 78(ptr) Variable UniformConstant
|
||||
86(g_floats[2]): 78(ptr) Variable UniformConstant
|
||||
89(g_floats[3]): 78(ptr) Variable UniformConstant
|
||||
92: TypePointer Output 7(fvec4)
|
||||
93(color): 92(ptr) Variable Output
|
||||
95(aggShadow): 15(ptr) Variable UniformConstant
|
||||
102(aggShadow): 18(ptr) Variable UniformConstant
|
||||
111(g_tex_explicit[0]): 35(ptr) Variable UniformConstant
|
||||
112(g_tex_explicit[1]): 35(ptr) Variable UniformConstant
|
||||
113(g_tex_explicit[2]): 35(ptr) Variable UniformConstant
|
||||
114(g_samp_explicit[0]): 38(ptr) Variable UniformConstant
|
||||
115(g_samp_explicit[1]): 38(ptr) Variable UniformConstant
|
||||
116(g_samp_explicit[2]): 38(ptr) Variable UniformConstant
|
||||
117: TypeVector 6(float) 3
|
||||
118: TypeMatrix 117(fvec3) 3
|
||||
119: TypePointer UniformConstant 118
|
||||
120(g_mats[0]): 119(ptr) Variable UniformConstant
|
||||
121(g_mats[1]): 119(ptr) Variable UniformConstant
|
||||
122(g_mats[2]): 119(ptr) Variable UniformConstant
|
||||
123(g_mats[3]): 119(ptr) Variable UniformConstant
|
||||
124(g_mats_explicit[0]): 119(ptr) Variable UniformConstant
|
||||
125(g_mats_explicit[1]): 119(ptr) Variable UniformConstant
|
||||
126(g_mats_explicit[2]): 119(ptr) Variable UniformConstant
|
||||
127(g_mats_explicit[3]): 119(ptr) Variable UniformConstant
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
77(local_float_array): 76(ptr) Variable Function
|
||||
Store 28(not_flattened_a) 34
|
||||
58: 16 Load 57(g_samp[0])
|
||||
59: 38(ptr) AccessChain 55(local_sampler_array) 56
|
||||
Store 59 58
|
||||
60: 16 Load 39(g_samp[1])
|
||||
61: 38(ptr) AccessChain 55(local_sampler_array) 29
|
||||
Store 61 60
|
||||
63: 16 Load 62(g_samp[2])
|
||||
64: 38(ptr) AccessChain 55(local_sampler_array) 30
|
||||
Store 64 63
|
||||
67: 11 Load 66(g_tex[0])
|
||||
68: 35(ptr) AccessChain 65(local_texture_array) 56
|
||||
Store 68 67
|
||||
69: 11 Load 36(g_tex[1])
|
||||
70: 35(ptr) AccessChain 65(local_texture_array) 29
|
||||
Store 70 69
|
||||
72: 11 Load 71(g_tex[2])
|
||||
73: 35(ptr) AccessChain 65(local_texture_array) 30
|
||||
Store 73 72
|
||||
80: 6(float) Load 79(g_floats[0])
|
||||
82: 81(ptr) AccessChain 77(local_float_array) 56
|
||||
Store 82 80
|
||||
84: 6(float) Load 83(g_floats[1])
|
||||
85: 81(ptr) AccessChain 77(local_float_array) 29
|
||||
Store 85 84
|
||||
87: 6(float) Load 86(g_floats[2])
|
||||
88: 81(ptr) AccessChain 77(local_float_array) 30
|
||||
Store 88 87
|
||||
90: 6(float) Load 89(g_floats[3])
|
||||
91: 81(ptr) AccessChain 77(local_float_array) 31
|
||||
Store 91 90
|
||||
94: 7(fvec4) FunctionCall 9(TestFn1()
|
||||
96: 11 Load 66(g_tex[0])
|
||||
97: 35(ptr) AccessChain 95(aggShadow) 56
|
||||
Store 97 96
|
||||
98: 11 Load 36(g_tex[1])
|
||||
99: 35(ptr) AccessChain 95(aggShadow) 29
|
||||
Store 99 98
|
||||
100: 11 Load 71(g_tex[2])
|
||||
101: 35(ptr) AccessChain 95(aggShadow) 30
|
||||
Store 101 100
|
||||
103: 16 Load 57(g_samp[0])
|
||||
104: 38(ptr) AccessChain 102(aggShadow) 56
|
||||
Store 104 103
|
||||
105: 16 Load 39(g_samp[1])
|
||||
106: 38(ptr) AccessChain 102(aggShadow) 29
|
||||
Store 106 105
|
||||
107: 16 Load 62(g_samp[2])
|
||||
108: 38(ptr) AccessChain 102(aggShadow) 30
|
||||
Store 108 107
|
||||
109: 7(fvec4) FunctionCall 22(TestFn2(t11[3];p1[3];) 95(aggShadow) 102(aggShadow)
|
||||
110: 7(fvec4) FAdd 94 109
|
||||
Store 93(color) 110
|
||||
Return
|
||||
FunctionEnd
|
||||
9(TestFn1(): 7(fvec4) Function None 8
|
||||
10: Label
|
||||
37: 11 Load 36(g_tex[1])
|
||||
40: 16 Load 39(g_samp[1])
|
||||
42: 41 SampledImage 37 40
|
||||
44: 7(fvec4) ImageSampleImplicitLod 42 43
|
||||
ReturnValue 44
|
||||
FunctionEnd
|
||||
22(TestFn2(t11[3];p1[3];): 7(fvec4) Function None 19
|
||||
20(l_tex): 15(ptr) FunctionParameter
|
||||
21(l_samp): 18(ptr) FunctionParameter
|
||||
23: Label
|
||||
47: 35(ptr) AccessChain 20(l_tex) 30
|
||||
48: 11 Load 47
|
||||
49: 38(ptr) AccessChain 21(l_samp) 30
|
||||
50: 16 Load 49
|
||||
51: 41 SampledImage 48 50
|
||||
52: 7(fvec4) ImageSampleImplicitLod 51 43
|
||||
ReturnValue 52
|
||||
FunctionEnd
|
||||
38
Test/hlsl.array.flatten.frag
Normal file
38
Test/hlsl.array.flatten.frag
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
// uniform Texture1D g_tex3[3][2]; // TODO: legal in HLSL, but we don't handle it yet.
|
||||
|
||||
uniform Texture1D g_tex[3];
|
||||
uniform Texture1D g_tex_explicit[3] : register(t1);
|
||||
|
||||
SamplerState g_samp[3];
|
||||
SamplerState g_samp_explicit[3] : register(s5);
|
||||
|
||||
uniform float3x3 g_mats[4];
|
||||
uniform float3x3 g_mats_explicit[4] : register(b10);
|
||||
uniform float g_floats[4];
|
||||
|
||||
// uniform float g_floats[4] = { 10, 11, 12, 13 }; // TODO: ... add when initializer lists can be flattened.
|
||||
|
||||
float4 TestFn1()
|
||||
{
|
||||
return g_tex[1].Sample(g_samp[1], 0.2);
|
||||
}
|
||||
|
||||
float4 TestFn2(Texture1D l_tex[3], SamplerState l_samp[3])
|
||||
{
|
||||
return l_tex[2].Sample(l_samp[2], 0.2);
|
||||
}
|
||||
|
||||
int not_flattened_a[5] = { 1, 2, 3, 4, 5 };
|
||||
|
||||
struct PS_OUTPUT { float4 color : SV_Target0; };
|
||||
|
||||
void main(out PS_OUTPUT ps_output)
|
||||
{
|
||||
// test flattening for local assignment initialization
|
||||
SamplerState local_sampler_array[3] = g_samp;
|
||||
Texture1D local_texture_array[3] = g_tex;
|
||||
float local_float_array[4] = g_floats;
|
||||
|
||||
ps_output.color = TestFn1() + TestFn2(g_tex, g_samp);
|
||||
}
|
||||
Reference in New Issue
Block a user