HLSL: inter-stage structure splitting.

This adds structure splitting, which among other things will enable GS support where input structs
are passed, and thus become input arrays of structs in the GS inputs.  That is a common GS case.

The salient points of this PR are:

* Structure splitting has been changed from "always between stages" to "only into the VS and out of
  the PS".  It had previously happened between stages because it's not legal to pass a struct
  containing a builtin IO variable.

* Structs passed between stages are now split into a struct containing ONLY user types, and a
  collection of loose builtin IO variables, if any.  The user-part is passed as a normal struct
  between stages, which is valid SPIR-V now that the builtin IO is removed.

* Internal to the shader, a sanitized struct (with IO qualifiers removed) is used, so that e.g,
  functions can work unmodified.

* If a builtin IO such as Position occurs in an arrayed struct, for example as an input to a GS,
  the array reference is moved to the split-off loose variable, which is given the array dimension
  itself.

When passing things around inside the shader, such as over a function call, the the original type
is used in a sanitized form that removes the builtIn qualifications and makes them temporaries.
This means internal function calls do not have to change.  However, the type when returned from
the shader will be member-wise copied from the internal sanitized one to the external type.
The sanitized type is used in variable declarations.

When copying split types and unsplit, if a sub-struct contains only user variables, it is copied
as a single entity to avoid more AST verbosity.

Above strategy arrived at with talks with @johnkslang.

This is a big complex change.  I'm inclined to leave it as a WIP until it can get some exposure to
real world cases.
This commit is contained in:
steve-lunarg 2016-12-14 15:22:25 -07:00
parent 807a0d9e2f
commit a2e7531057
18 changed files with 1615 additions and 482 deletions

View File

@ -9,7 +9,7 @@ output primitive = line_strip
0:16 Function Parameters: 0:16 Function Parameters:
0:16 'VertexID' (layout(location=0 ) in 3-element array of uint) 0:16 'VertexID' (layout(location=0 ) in 3-element array of uint)
0:16 'test' (layout(location=3 ) in 3-element array of uint) 0:16 'test' (layout(location=3 ) in 3-element array of uint)
0:16 'OutputStream' (out structure{temp float myfloat, temp int something}) 0:16 'OutputStream' (layout(location=0 ) out structure{temp float myfloat, temp int something})
0:? Sequence 0:? Sequence
0:19 move second child to first child (temp float) 0:19 move second child to first child (temp float)
0:19 myfloat: direct index for structure (temp float) 0:19 myfloat: direct index for structure (temp float)
@ -43,20 +43,19 @@ output primitive = line_strip
0:20 0 (const int) 0:20 0 (const int)
0:22 Sequence 0:22 Sequence
0:22 move second child to first child (temp structure{temp float myfloat, temp int something}) 0:22 move second child to first child (temp structure{temp float myfloat, temp int something})
0:22 'OutputStream' (out structure{temp float myfloat, temp int something}) 0:22 'OutputStream' (layout(location=0 ) out structure{temp float myfloat, temp int something})
0:22 'Vert' (temp structure{temp float myfloat, temp int something}) 0:22 'Vert' (temp structure{temp float myfloat, temp int something})
0:22 EmitVertex (temp void) 0:22 EmitVertex (temp void)
0:23 Sequence 0:23 Sequence
0:23 move second child to first child (temp structure{temp float myfloat, temp int something}) 0:23 move second child to first child (temp structure{temp float myfloat, temp int something})
0:23 'OutputStream' (out structure{temp float myfloat, temp int something}) 0:23 'OutputStream' (layout(location=0 ) out structure{temp float myfloat, temp int something})
0:23 'Vert' (temp structure{temp float myfloat, temp int something}) 0:23 'Vert' (temp structure{temp float myfloat, temp int something})
0:23 EmitVertex (temp void) 0:23 EmitVertex (temp void)
0:24 EndPrimitive (temp void) 0:24 EndPrimitive (temp void)
0:? Linker Objects 0:? Linker Objects
0:? 'VertexID' (layout(location=0 ) in 3-element array of uint) 0:? 'VertexID' (layout(location=0 ) in 3-element array of uint)
0:? 'test' (layout(location=3 ) in 3-element array of uint) 0:? 'test' (layout(location=3 ) in 3-element array of uint)
0:? 'myfloat' (layout(location=0 ) out float) 0:? 'OutputStream' (layout(location=0 ) out structure{temp float myfloat, temp int something})
0:? 'something' (layout(location=1 ) out int)
Linked geometry stage: Linked geometry stage:
@ -72,7 +71,7 @@ output primitive = line_strip
0:16 Function Parameters: 0:16 Function Parameters:
0:16 'VertexID' (layout(location=0 ) in 3-element array of uint) 0:16 'VertexID' (layout(location=0 ) in 3-element array of uint)
0:16 'test' (layout(location=3 ) in 3-element array of uint) 0:16 'test' (layout(location=3 ) in 3-element array of uint)
0:16 'OutputStream' (out structure{temp float myfloat, temp int something}) 0:16 'OutputStream' (layout(location=0 ) out structure{temp float myfloat, temp int something})
0:? Sequence 0:? Sequence
0:19 move second child to first child (temp float) 0:19 move second child to first child (temp float)
0:19 myfloat: direct index for structure (temp float) 0:19 myfloat: direct index for structure (temp float)
@ -106,29 +105,28 @@ output primitive = line_strip
0:20 0 (const int) 0:20 0 (const int)
0:22 Sequence 0:22 Sequence
0:22 move second child to first child (temp structure{temp float myfloat, temp int something}) 0:22 move second child to first child (temp structure{temp float myfloat, temp int something})
0:22 'OutputStream' (out structure{temp float myfloat, temp int something}) 0:22 'OutputStream' (layout(location=0 ) out structure{temp float myfloat, temp int something})
0:22 'Vert' (temp structure{temp float myfloat, temp int something}) 0:22 'Vert' (temp structure{temp float myfloat, temp int something})
0:22 EmitVertex (temp void) 0:22 EmitVertex (temp void)
0:23 Sequence 0:23 Sequence
0:23 move second child to first child (temp structure{temp float myfloat, temp int something}) 0:23 move second child to first child (temp structure{temp float myfloat, temp int something})
0:23 'OutputStream' (out structure{temp float myfloat, temp int something}) 0:23 'OutputStream' (layout(location=0 ) out structure{temp float myfloat, temp int something})
0:23 'Vert' (temp structure{temp float myfloat, temp int something}) 0:23 'Vert' (temp structure{temp float myfloat, temp int something})
0:23 EmitVertex (temp void) 0:23 EmitVertex (temp void)
0:24 EndPrimitive (temp void) 0:24 EndPrimitive (temp void)
0:? Linker Objects 0:? Linker Objects
0:? 'VertexID' (layout(location=0 ) in 3-element array of uint) 0:? 'VertexID' (layout(location=0 ) in 3-element array of uint)
0:? 'test' (layout(location=3 ) in 3-element array of uint) 0:? 'test' (layout(location=3 ) in 3-element array of uint)
0:? 'myfloat' (layout(location=0 ) out float) 0:? 'OutputStream' (layout(location=0 ) out structure{temp float myfloat, temp int something})
0:? 'something' (layout(location=1 ) out int)
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 45 // Id's are bound by 41
Capability Geometry Capability Geometry
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Geometry 4 "main" 16 31 38 42 44 EntryPoint Geometry 4 "main" 16 31 38
ExecutionMode 4 Triangles ExecutionMode 4 Triangles
ExecutionMode 4 Invocations 1 ExecutionMode 4 Invocations 1
ExecutionMode 4 OutputLineStrip ExecutionMode 4 OutputLineStrip
@ -141,12 +139,9 @@ output primitive = line_strip
Name 16 "test" Name 16 "test"
Name 31 "VertexID" Name 31 "VertexID"
Name 38 "OutputStream" Name 38 "OutputStream"
Name 42 "myfloat"
Name 44 "something"
Decorate 16(test) Location 3 Decorate 16(test) Location 3
Decorate 31(VertexID) Location 0 Decorate 31(VertexID) Location 0
Decorate 42(myfloat) Location 0 Decorate 38(OutputStream) Location 0
Decorate 44(something) Location 1
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
@ -167,10 +162,6 @@ output primitive = line_strip
35: TypePointer Function 7(int) 35: TypePointer Function 7(int)
37: TypePointer Output 8(PSInput) 37: TypePointer Output 8(PSInput)
38(OutputStream): 37(ptr) Variable Output 38(OutputStream): 37(ptr) Variable Output
41: TypePointer Output 6(float)
42(myfloat): 41(ptr) Variable Output
43: TypePointer Output 7(int)
44(something): 43(ptr) Variable Output
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
10(Vert): 9(ptr) Variable Function 10(Vert): 9(ptr) Variable Function

View File

@ -4,84 +4,48 @@ gl_FragCoord origin is upper left
0:? Sequence 0:? Sequence
0:8 Function Definition: fun(struct-InParam-vf2-vf4-vi21; (temp float) 0:8 Function Definition: fun(struct-InParam-vf2-vf4-vi21; (temp float)
0:8 Function Parameters: 0:8 Function Parameters:
0:8 'p' (in structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2}) 0:8 'p' (in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:? Sequence 0:? Sequence
0:9 Branch: Return with expression 0:9 Branch: Return with expression
0:9 add (temp float) 0:9 add (temp float)
0:9 direct index (temp float) 0:9 direct index (temp float)
0:9 v: direct index for structure (temp 2-component vector of float) 0:9 v: direct index for structure (temp 2-component vector of float)
0:9 'p' (in structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2}) 0:9 'p' (in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:9 Constant: 0:9 Constant:
0:9 0 (const int) 0:9 0 (const int)
0:9 Constant: 0:9 Constant:
0:9 1 (const int) 0:9 1 (const int)
0:9 direct index (temp float) 0:9 direct index (temp float)
0:9 fragCoord: direct index for structure (temp 4-component vector of float FragCoord) 0:9 fragCoord: direct index for structure (temp 4-component vector of float FragCoord)
0:9 'p' (in structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2}) 0:9 'p' (in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:9 Constant: 0:9 Constant:
0:9 1 (const int) 0:9 1 (const int)
0:9 Constant: 0:9 Constant:
0:9 0 (const int) 0:9 0 (const int)
0:13 Function Definition: PixelShaderFunction(struct-InParam-vf2-vf4-vi21; (temp 4-component vector of float) 0:13 Function Definition: PixelShaderFunction(struct-InParam-vf2-vf4-vi21; (temp 4-component vector of float)
0:13 Function Parameters: 0:13 Function Parameters:
0:13 'i' (in structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2}) 0:13 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:? Sequence 0:? Sequence
0:15 Sequence 0:15 move second child to first child (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:15 move second child to first child (temp 2-component vector of float) 0:15 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:15 v: direct index for structure (temp 2-component vector of float) 0:15 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:15 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:15 Constant:
0:15 0 (const int)
0:? 'v' (layout(location=0 ) in 2-component vector of float)
0:15 move second child to first child (temp 4-component vector of float)
0:15 fragCoord: direct index for structure (temp 4-component vector of float)
0:15 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:15 Constant:
0:15 1 (const int)
0:? 'fragCoord' (in 4-component vector of float FragCoord)
0:15 move second child to first child (temp 2-component vector of int)
0:15 i2: direct index for structure (temp 2-component vector of int)
0:15 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:15 Constant:
0:15 2 (const int)
0:? 'i2' (layout(location=1 ) in 2-component vector of int)
0:16 Sequence 0:16 Sequence
0:16 move second child to first child (temp float) 0:16 move second child to first child (temp float)
0:16 'ret1' (temp float) 0:16 'ret1' (temp float)
0:16 Function Call: fun(struct-InParam-vf2-vf4-vi21; (temp float) 0:16 Function Call: fun(struct-InParam-vf2-vf4-vi21; (temp float)
0:16 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2}) 0:16 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:17 Sequence 0:17 Sequence
0:17 move second child to first child (temp float) 0:17 move second child to first child (temp float)
0:17 'ret2' (temp float) 0:17 'ret2' (temp float)
0:17 Function Call: fun(struct-InParam-vf2-vf4-vi21; (temp float) 0:17 Function Call: fun(struct-InParam-vf2-vf4-vi21; (temp float)
0:17 Comma (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2}) 0:17 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:17 Sequence
0:17 move second child to first child (temp 2-component vector of float)
0:17 v: direct index for structure (temp 2-component vector of float)
0:17 'aggShadow' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:17 Constant:
0:17 0 (const int)
0:? 'v' (layout(location=0 ) in 2-component vector of float)
0:17 move second child to first child (temp 4-component vector of float)
0:17 fragCoord: direct index for structure (temp 4-component vector of float)
0:17 'aggShadow' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:17 Constant:
0:17 1 (const int)
0:? 'fragCoord' (in 4-component vector of float FragCoord)
0:17 move second child to first child (temp 2-component vector of int)
0:17 i2: direct index for structure (temp 2-component vector of int)
0:17 'aggShadow' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:17 Constant:
0:17 2 (const int)
0:? 'i2' (layout(location=1 ) in 2-component vector of int)
0:17 'aggShadow' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:19 Sequence 0:19 Sequence
0:19 move second child to first child (temp 4-component vector of float) 0:19 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float) 0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:19 vector-scale (temp 4-component vector of float) 0:19 vector-scale (temp 4-component vector of float)
0:19 vector-scale (temp 4-component vector of float) 0:19 vector-scale (temp 4-component vector of float)
0:19 fragCoord: direct index for structure (temp 4-component vector of float) 0:19 fragCoord: direct index for structure (temp 4-component vector of float FragCoord)
0:19 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2}) 0:19 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:19 Constant: 0:19 Constant:
0:19 1 (const int) 0:19 1 (const int)
0:19 'ret1' (temp float) 0:19 'ret1' (temp float)
@ -89,9 +53,7 @@ gl_FragCoord origin is upper left
0:19 Branch: Return 0:19 Branch: Return
0:? Linker Objects 0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float) 0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'v' (layout(location=0 ) in 2-component vector of float) 0:? 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:? 'fragCoord' (in 4-component vector of float FragCoord)
0:? 'i2' (layout(location=1 ) in 2-component vector of int)
Linked fragment stage: Linked fragment stage:
@ -102,84 +64,48 @@ gl_FragCoord origin is upper left
0:? Sequence 0:? Sequence
0:8 Function Definition: fun(struct-InParam-vf2-vf4-vi21; (temp float) 0:8 Function Definition: fun(struct-InParam-vf2-vf4-vi21; (temp float)
0:8 Function Parameters: 0:8 Function Parameters:
0:8 'p' (in structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2}) 0:8 'p' (in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:? Sequence 0:? Sequence
0:9 Branch: Return with expression 0:9 Branch: Return with expression
0:9 add (temp float) 0:9 add (temp float)
0:9 direct index (temp float) 0:9 direct index (temp float)
0:9 v: direct index for structure (temp 2-component vector of float) 0:9 v: direct index for structure (temp 2-component vector of float)
0:9 'p' (in structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2}) 0:9 'p' (in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:9 Constant: 0:9 Constant:
0:9 0 (const int) 0:9 0 (const int)
0:9 Constant: 0:9 Constant:
0:9 1 (const int) 0:9 1 (const int)
0:9 direct index (temp float) 0:9 direct index (temp float)
0:9 fragCoord: direct index for structure (temp 4-component vector of float FragCoord) 0:9 fragCoord: direct index for structure (temp 4-component vector of float FragCoord)
0:9 'p' (in structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2}) 0:9 'p' (in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:9 Constant: 0:9 Constant:
0:9 1 (const int) 0:9 1 (const int)
0:9 Constant: 0:9 Constant:
0:9 0 (const int) 0:9 0 (const int)
0:13 Function Definition: PixelShaderFunction(struct-InParam-vf2-vf4-vi21; (temp 4-component vector of float) 0:13 Function Definition: PixelShaderFunction(struct-InParam-vf2-vf4-vi21; (temp 4-component vector of float)
0:13 Function Parameters: 0:13 Function Parameters:
0:13 'i' (in structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2}) 0:13 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:? Sequence 0:? Sequence
0:15 Sequence 0:15 move second child to first child (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:15 move second child to first child (temp 2-component vector of float) 0:15 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:15 v: direct index for structure (temp 2-component vector of float) 0:15 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:15 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:15 Constant:
0:15 0 (const int)
0:? 'v' (layout(location=0 ) in 2-component vector of float)
0:15 move second child to first child (temp 4-component vector of float)
0:15 fragCoord: direct index for structure (temp 4-component vector of float)
0:15 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:15 Constant:
0:15 1 (const int)
0:? 'fragCoord' (in 4-component vector of float FragCoord)
0:15 move second child to first child (temp 2-component vector of int)
0:15 i2: direct index for structure (temp 2-component vector of int)
0:15 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:15 Constant:
0:15 2 (const int)
0:? 'i2' (layout(location=1 ) in 2-component vector of int)
0:16 Sequence 0:16 Sequence
0:16 move second child to first child (temp float) 0:16 move second child to first child (temp float)
0:16 'ret1' (temp float) 0:16 'ret1' (temp float)
0:16 Function Call: fun(struct-InParam-vf2-vf4-vi21; (temp float) 0:16 Function Call: fun(struct-InParam-vf2-vf4-vi21; (temp float)
0:16 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2}) 0:16 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:17 Sequence 0:17 Sequence
0:17 move second child to first child (temp float) 0:17 move second child to first child (temp float)
0:17 'ret2' (temp float) 0:17 'ret2' (temp float)
0:17 Function Call: fun(struct-InParam-vf2-vf4-vi21; (temp float) 0:17 Function Call: fun(struct-InParam-vf2-vf4-vi21; (temp float)
0:17 Comma (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2}) 0:17 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:17 Sequence
0:17 move second child to first child (temp 2-component vector of float)
0:17 v: direct index for structure (temp 2-component vector of float)
0:17 'aggShadow' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:17 Constant:
0:17 0 (const int)
0:? 'v' (layout(location=0 ) in 2-component vector of float)
0:17 move second child to first child (temp 4-component vector of float)
0:17 fragCoord: direct index for structure (temp 4-component vector of float)
0:17 'aggShadow' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:17 Constant:
0:17 1 (const int)
0:? 'fragCoord' (in 4-component vector of float FragCoord)
0:17 move second child to first child (temp 2-component vector of int)
0:17 i2: direct index for structure (temp 2-component vector of int)
0:17 'aggShadow' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:17 Constant:
0:17 2 (const int)
0:? 'i2' (layout(location=1 ) in 2-component vector of int)
0:17 'aggShadow' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:19 Sequence 0:19 Sequence
0:19 move second child to first child (temp 4-component vector of float) 0:19 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float) 0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:19 vector-scale (temp 4-component vector of float) 0:19 vector-scale (temp 4-component vector of float)
0:19 vector-scale (temp 4-component vector of float) 0:19 vector-scale (temp 4-component vector of float)
0:19 fragCoord: direct index for structure (temp 4-component vector of float) 0:19 fragCoord: direct index for structure (temp 4-component vector of float FragCoord)
0:19 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2}) 0:19 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:19 Constant: 0:19 Constant:
0:19 1 (const int) 0:19 1 (const int)
0:19 'ret1' (temp float) 0:19 'ret1' (temp float)
@ -187,18 +113,16 @@ gl_FragCoord origin is upper left
0:19 Branch: Return 0:19 Branch: Return
0:? Linker Objects 0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float) 0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'v' (layout(location=0 ) in 2-component vector of float) 0:? 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:? 'fragCoord' (in 4-component vector of float FragCoord)
0:? 'i2' (layout(location=1 ) in 2-component vector of int)
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 71 // Id's are bound by 52
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "PixelShaderFunction" 32 37 43 63 EntryPoint Fragment 4 "PixelShaderFunction" 32 43
ExecutionMode 4 OriginUpperLeft ExecutionMode 4 OriginUpperLeft
Name 4 "PixelShaderFunction" Name 4 "PixelShaderFunction"
Name 11 "InParam" Name 11 "InParam"
@ -208,19 +132,15 @@ gl_FragCoord origin is upper left
Name 15 "fun(struct-InParam-vf2-vf4-vi21;" Name 15 "fun(struct-InParam-vf2-vf4-vi21;"
Name 14 "p" Name 14 "p"
Name 30 "local" Name 30 "local"
Name 32 "v" Name 32 "i"
Name 37 "fragCoord" Name 34 "ret1"
Name 43 "i2" Name 35 "param"
Name 47 "ret1" Name 38 "ret2"
Name 48 "param" Name 39 "param"
Name 51 "ret2" Name 43 "@entryPointOutput"
Name 52 "aggShadow" MemberDecorate 11(InParam) 1 BuiltIn FragCoord
Name 59 "param" Decorate 32(i) Location 0
Name 63 "@entryPointOutput" Decorate 43(@entryPointOutput) Location 0
Decorate 32(v) Location 0
Decorate 37(fragCoord) BuiltIn FragCoord
Decorate 43(i2) Location 1
Decorate 63(@entryPointOutput) Location 0
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
@ -237,59 +157,35 @@ gl_FragCoord origin is upper left
20: TypePointer Function 6(float) 20: TypePointer Function 6(float)
23: 9(int) Constant 1 23: 9(int) Constant 1
24: 18(int) Constant 0 24: 18(int) Constant 0
31: TypePointer Input 7(fvec2) 31: TypePointer Input 11(InParam)
32(v): 31(ptr) Variable Input 32(i): 31(ptr) Variable Input
34: TypePointer Function 7(fvec2) 42: TypePointer Output 8(fvec4)
36: TypePointer Input 8(fvec4) 43(@entryPointOutput): 42(ptr) Variable Output
37(fragCoord): 36(ptr) Variable Input 44: TypePointer Function 8(fvec4)
39: TypePointer Function 8(fvec4)
41: 9(int) Constant 2
42: TypePointer Input 10(ivec2)
43(i2): 42(ptr) Variable Input
45: TypePointer Function 10(ivec2)
62: TypePointer Output 8(fvec4)
63(@entryPointOutput): 62(ptr) Variable Output
4(PixelShaderFunction): 2 Function None 3 4(PixelShaderFunction): 2 Function None 3
5: Label 5: Label
30(local): 12(ptr) Variable Function 30(local): 12(ptr) Variable Function
47(ret1): 20(ptr) Variable Function 34(ret1): 20(ptr) Variable Function
48(param): 12(ptr) Variable Function 35(param): 12(ptr) Variable Function
51(ret2): 20(ptr) Variable Function 38(ret2): 20(ptr) Variable Function
52(aggShadow): 12(ptr) Variable Function 39(param): 12(ptr) Variable Function
59(param): 12(ptr) Variable Function 33: 11(InParam) Load 32(i)
33: 7(fvec2) Load 32(v) Store 30(local) 33
35: 34(ptr) AccessChain 30(local) 17 36: 11(InParam) Load 30(local)
Store 35 33 Store 35(param) 36
38: 8(fvec4) Load 37(fragCoord) 37: 6(float) FunctionCall 15(fun(struct-InParam-vf2-vf4-vi21;) 35(param)
40: 39(ptr) AccessChain 30(local) 23 Store 34(ret1) 37
Store 40 38 40: 11(InParam) Load 32(i)
44: 10(ivec2) Load 43(i2) Store 39(param) 40
46: 45(ptr) AccessChain 30(local) 41 41: 6(float) FunctionCall 15(fun(struct-InParam-vf2-vf4-vi21;) 39(param)
Store 46 44 Store 38(ret2) 41
49: 11(InParam) Load 30(local) 45: 44(ptr) AccessChain 30(local) 23
Store 48(param) 49 46: 8(fvec4) Load 45
50: 6(float) FunctionCall 15(fun(struct-InParam-vf2-vf4-vi21;) 48(param) 47: 6(float) Load 34(ret1)
Store 47(ret1) 50 48: 8(fvec4) VectorTimesScalar 46 47
53: 7(fvec2) Load 32(v) 49: 6(float) Load 38(ret2)
54: 34(ptr) AccessChain 52(aggShadow) 17 50: 8(fvec4) VectorTimesScalar 48 49
Store 54 53 Store 43(@entryPointOutput) 50
55: 8(fvec4) Load 37(fragCoord)
56: 39(ptr) AccessChain 52(aggShadow) 23
Store 56 55
57: 10(ivec2) Load 43(i2)
58: 45(ptr) AccessChain 52(aggShadow) 41
Store 58 57
60: 11(InParam) Load 52(aggShadow)
Store 59(param) 60
61: 6(float) FunctionCall 15(fun(struct-InParam-vf2-vf4-vi21;) 59(param)
Store 51(ret2) 61
64: 39(ptr) AccessChain 30(local) 23
65: 8(fvec4) Load 64
66: 6(float) Load 47(ret1)
67: 8(fvec4) VectorTimesScalar 65 66
68: 6(float) Load 51(ret2)
69: 8(fvec4) VectorTimesScalar 67 68
Store 63(@entryPointOutput) 69
Return Return
FunctionEnd FunctionEnd
15(fun(struct-InParam-vf2-vf4-vi21;): 6(float) Function None 13 15(fun(struct-InParam-vf2-vf4-vi21;): 6(float) Function None 13

View File

@ -9,7 +9,7 @@ gl_FragCoord origin is upper left
0:34 Function Definition: PixelShaderFunction(vf4;struct-IN_S-vf4-b1-vf1-vf2-b1-b1-b1-vf41; (temp 4-component vector of float) 0:34 Function Definition: PixelShaderFunction(vf4;struct-IN_S-vf4-b1-vf1-vf2-b1-b1-b1-vf41; (temp 4-component vector of float)
0:34 Function Parameters: 0:34 Function Parameters:
0:34 'input' (layout(location=0 ) in 4-component vector of float) 0:34 'input' (layout(location=0 ) in 4-component vector of float)
0:34 's' (in structure{temp 4-component vector of float a, temp bool b, temp 1-component vector of float c, temp 2-component vector of float d, temp bool ff1, temp bool ff2, temp bool ff3, temp 4-component vector of float ff4}) 0:34 's' (layout(location=1 ) in structure{smooth temp 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, temp bool Face ff1, layout(offset=4 ) temp bool ff2, layout(binding=0 offset=4 ) temp bool ff3, layout(binding=0 offset=4 ) temp 4-component vector of float ff4})
0:? Sequence 0:? Sequence
0:39 Compare Equal (temp bool) 0:39 Compare Equal (temp bool)
0:39 's3' (temp structure{temp 3-component vector of bool b3}) 0:39 's3' (temp structure{temp 3-component vector of bool b3})
@ -19,7 +19,10 @@ gl_FragCoord origin is upper left
0:40 's2' (global structure{temp 4-component vector of float i}) 0:40 's2' (global structure{temp 4-component vector of float i})
0:40 Constant: 0:40 Constant:
0:40 0 (const int) 0:40 0 (const int)
0:? 'ff4' (layout(location=7 binding=0 offset=4 ) in 4-component vector of float) 0:40 ff4: direct index for structure (layout(binding=0 offset=4 ) temp 4-component vector of float)
0:40 's' (layout(location=1 ) in structure{smooth temp 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, temp bool Face ff1, layout(offset=4 ) temp bool ff2, layout(binding=0 offset=4 ) temp bool ff3, layout(binding=0 offset=4 ) temp 4-component vector of float ff4})
0:40 Constant:
0:40 7 (const int)
0:42 Sequence 0:42 Sequence
0:42 move second child to first child (temp 4-component vector of float) 0:42 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float) 0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
@ -28,14 +31,7 @@ gl_FragCoord origin is upper left
0:? Linker Objects 0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float) 0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'input' (layout(location=0 ) in 4-component vector of float) 0:? 'input' (layout(location=0 ) in 4-component vector of float)
0:? 'a' (layout(location=1 ) smooth in 4-component vector of float) 0:? 's' (layout(location=1 ) in structure{smooth temp 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, temp bool Face ff1, layout(offset=4 ) temp bool ff2, layout(binding=0 offset=4 ) temp bool ff3, layout(binding=0 offset=4 ) temp 4-component vector of float ff4})
0:? 'b' (layout(location=2 ) flat in bool)
0:? 'c' (layout(location=3 ) centroid noperspective in 1-component vector of float)
0:? 'd' (layout(location=4 ) centroid sample in 2-component vector of float)
0:? 'ff1' (in bool Face)
0:? 'ff2' (layout(location=5 offset=4 ) in bool)
0:? 'ff3' (layout(location=6 binding=0 offset=4 ) in bool)
0:? 'ff4' (layout(location=7 binding=0 offset=4 ) in 4-component vector of float)
0:? 's2' (global structure{temp 4-component vector of float i}) 0:? 's2' (global structure{temp 4-component vector of float i})
0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform structure{temp bool b, temp bool c, temp 4-component vector of float a, temp 4-component vector of float d} s1, layout(binding=5 offset=1620 ) uniform float ff5, layout(binding=8 offset=1636 ) uniform float ff6}) 0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform structure{temp bool b, temp bool c, temp 4-component vector of float a, temp 4-component vector of float d} s1, layout(binding=5 offset=1620 ) uniform float ff5, layout(binding=8 offset=1636 ) uniform float ff6})
@ -49,7 +45,7 @@ gl_FragCoord origin is upper left
0:34 Function Definition: PixelShaderFunction(vf4;struct-IN_S-vf4-b1-vf1-vf2-b1-b1-b1-vf41; (temp 4-component vector of float) 0:34 Function Definition: PixelShaderFunction(vf4;struct-IN_S-vf4-b1-vf1-vf2-b1-b1-b1-vf41; (temp 4-component vector of float)
0:34 Function Parameters: 0:34 Function Parameters:
0:34 'input' (layout(location=0 ) in 4-component vector of float) 0:34 'input' (layout(location=0 ) in 4-component vector of float)
0:34 's' (in structure{temp 4-component vector of float a, temp bool b, temp 1-component vector of float c, temp 2-component vector of float d, temp bool ff1, temp bool ff2, temp bool ff3, temp 4-component vector of float ff4}) 0:34 's' (layout(location=1 ) in structure{smooth temp 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, temp bool Face ff1, layout(offset=4 ) temp bool ff2, layout(binding=0 offset=4 ) temp bool ff3, layout(binding=0 offset=4 ) temp 4-component vector of float ff4})
0:? Sequence 0:? Sequence
0:39 Compare Equal (temp bool) 0:39 Compare Equal (temp bool)
0:39 's3' (temp structure{temp 3-component vector of bool b3}) 0:39 's3' (temp structure{temp 3-component vector of bool b3})
@ -59,7 +55,10 @@ gl_FragCoord origin is upper left
0:40 's2' (global structure{temp 4-component vector of float i}) 0:40 's2' (global structure{temp 4-component vector of float i})
0:40 Constant: 0:40 Constant:
0:40 0 (const int) 0:40 0 (const int)
0:? 'ff4' (layout(location=7 binding=0 offset=4 ) in 4-component vector of float) 0:40 ff4: direct index for structure (layout(binding=0 offset=4 ) temp 4-component vector of float)
0:40 's' (layout(location=1 ) in structure{smooth temp 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, temp bool Face ff1, layout(offset=4 ) temp bool ff2, layout(binding=0 offset=4 ) temp bool ff3, layout(binding=0 offset=4 ) temp 4-component vector of float ff4})
0:40 Constant:
0:40 7 (const int)
0:42 Sequence 0:42 Sequence
0:42 move second child to first child (temp 4-component vector of float) 0:42 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float) 0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
@ -68,25 +67,18 @@ gl_FragCoord origin is upper left
0:? Linker Objects 0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float) 0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'input' (layout(location=0 ) in 4-component vector of float) 0:? 'input' (layout(location=0 ) in 4-component vector of float)
0:? 'a' (layout(location=1 ) smooth in 4-component vector of float) 0:? 's' (layout(location=1 ) in structure{smooth temp 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, temp bool Face ff1, layout(offset=4 ) temp bool ff2, layout(binding=0 offset=4 ) temp bool ff3, layout(binding=0 offset=4 ) temp 4-component vector of float ff4})
0:? 'b' (layout(location=2 ) flat in bool)
0:? 'c' (layout(location=3 ) centroid noperspective in 1-component vector of float)
0:? 'd' (layout(location=4 ) centroid sample in 2-component vector of float)
0:? 'ff1' (in bool Face)
0:? 'ff2' (layout(location=5 offset=4 ) in bool)
0:? 'ff3' (layout(location=6 binding=0 offset=4 ) in bool)
0:? 'ff4' (layout(location=7 binding=0 offset=4 ) in 4-component vector of float)
0:? 's2' (global structure{temp 4-component vector of float i}) 0:? 's2' (global structure{temp 4-component vector of float i})
0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform structure{temp bool b, temp bool c, temp 4-component vector of float a, temp 4-component vector of float d} s1, layout(binding=5 offset=1620 ) uniform float ff5, layout(binding=8 offset=1636 ) uniform float ff6}) 0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform structure{temp bool b, temp bool c, temp 4-component vector of float a, temp 4-component vector of float d} s1, layout(binding=5 offset=1620 ) uniform float ff5, layout(binding=8 offset=1636 ) uniform float ff6})
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 50 // Id's are bound by 44
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "PixelShaderFunction" 25 30 31 34 36 38 41 42 43 44 EntryPoint Fragment 4 "PixelShaderFunction" 27 35 36
ExecutionMode 4 OriginUpperLeft ExecutionMode 4 OriginUpperLeft
Name 4 "PixelShaderFunction" Name 4 "PixelShaderFunction"
Name 8 "FS" Name 8 "FS"
@ -95,54 +87,41 @@ gl_FragCoord origin is upper left
Name 19 "" Name 19 ""
MemberName 19 0 "i" MemberName 19 0 "i"
Name 21 "s2" Name 21 "s2"
Name 25 "ff4" Name 25 "IN_S"
Name 30 "@entryPointOutput" MemberName 25(IN_S) 0 "a"
Name 31 "input" MemberName 25(IN_S) 1 "b"
Name 34 "a" MemberName 25(IN_S) 2 "c"
Name 36 "b" MemberName 25(IN_S) 3 "d"
Name 38 "c" MemberName 25(IN_S) 4 "ff1"
Name 41 "d" MemberName 25(IN_S) 5 "ff2"
Name 42 "ff1" MemberName 25(IN_S) 6 "ff3"
Name 43 "ff2" MemberName 25(IN_S) 7 "ff4"
Name 44 "ff3" Name 27 "s"
Name 46 "myS" Name 35 "@entryPointOutput"
MemberName 46(myS) 0 "b" Name 36 "input"
MemberName 46(myS) 1 "c" Name 40 "myS"
MemberName 46(myS) 2 "a" MemberName 40(myS) 0 "b"
MemberName 46(myS) 3 "d" MemberName 40(myS) 1 "c"
Name 47 "$Global" MemberName 40(myS) 2 "a"
MemberName 47($Global) 0 "s1" MemberName 40(myS) 3 "d"
MemberName 47($Global) 1 "ff5" Name 41 "$Global"
MemberName 47($Global) 2 "ff6" MemberName 41($Global) 0 "s1"
Name 49 "" MemberName 41($Global) 1 "ff5"
Decorate 25(ff4) Offset 4 MemberName 41($Global) 2 "ff6"
Decorate 25(ff4) Location 7 Name 43 ""
Decorate 25(ff4) Binding 0 MemberDecorate 25(IN_S) 4 BuiltIn FrontFacing
Decorate 30(@entryPointOutput) Location 0 Decorate 27(s) Location 1
Decorate 31(input) Location 0 Decorate 35(@entryPointOutput) Location 0
Decorate 34(a) Location 1 Decorate 36(input) Location 0
Decorate 36(b) Flat MemberDecorate 40(myS) 0 Offset 0
Decorate 36(b) Location 2 MemberDecorate 40(myS) 1 Offset 4
Decorate 38(c) NoPerspective MemberDecorate 40(myS) 2 Offset 16
Decorate 38(c) Centroid MemberDecorate 40(myS) 3 Offset 32
Decorate 38(c) Location 3 MemberDecorate 41($Global) 0 Offset 0
Decorate 41(d) Centroid MemberDecorate 41($Global) 1 Offset 1620
Decorate 41(d) Location 4 MemberDecorate 41($Global) 2 Offset 1636
Decorate 42(ff1) BuiltIn FrontFacing Decorate 41($Global) Block
Decorate 43(ff2) Offset 4 Decorate 43 DescriptorSet 0
Decorate 43(ff2) Location 5
Decorate 44(ff3) Offset 4
Decorate 44(ff3) Location 6
Decorate 44(ff3) Binding 0
MemberDecorate 46(myS) 0 Offset 0
MemberDecorate 46(myS) 1 Offset 4
MemberDecorate 46(myS) 2 Offset 16
MemberDecorate 46(myS) 3 Offset 32
MemberDecorate 47($Global) 0 Offset 0
MemberDecorate 47($Global) 1 Offset 1620
MemberDecorate 47($Global) 2 Offset 1636
Decorate 47($Global) Block
Decorate 49 DescriptorSet 0
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeBool 6: TypeBool
@ -156,28 +135,21 @@ gl_FragCoord origin is upper left
21(s2): 20(ptr) Variable Private 21(s2): 20(ptr) Variable Private
22: TypeInt 32 1 22: TypeInt 32 1
23: 22(int) Constant 0 23: 22(int) Constant 0
24: TypePointer Input 18(fvec4) 24: TypeVector 17(float) 2
25(ff4): 24(ptr) Variable Input 25(IN_S): TypeStruct 18(fvec4) 6(bool) 17(float) 24(fvec2) 6(bool) 6(bool) 6(bool) 18(fvec4)
27: TypePointer Private 18(fvec4) 26: TypePointer Input 25(IN_S)
29: TypePointer Output 18(fvec4) 27(s): 26(ptr) Variable Input
30(@entryPointOutput): 29(ptr) Variable Output 28: 22(int) Constant 7
31(input): 24(ptr) Variable Input 29: TypePointer Input 18(fvec4)
34(a): 24(ptr) Variable Input 32: TypePointer Private 18(fvec4)
35: TypePointer Input 6(bool) 34: TypePointer Output 18(fvec4)
36(b): 35(ptr) Variable Input 35(@entryPointOutput): 34(ptr) Variable Output
37: TypePointer Input 17(float) 36(input): 29(ptr) Variable Input
38(c): 37(ptr) Variable Input 39: TypeInt 32 0
39: TypeVector 17(float) 2 40(myS): TypeStruct 39(int) 39(int) 18(fvec4) 18(fvec4)
40: TypePointer Input 39(fvec2) 41($Global): TypeStruct 40(myS) 17(float) 17(float)
41(d): 40(ptr) Variable Input 42: TypePointer Uniform 41($Global)
42(ff1): 35(ptr) Variable Input 43: 42(ptr) Variable Uniform
43(ff2): 35(ptr) Variable Input
44(ff3): 35(ptr) Variable Input
45: TypeInt 32 0
46(myS): TypeStruct 45(int) 45(int) 18(fvec4) 18(fvec4)
47($Global): TypeStruct 46(myS) 17(float) 17(float)
48: TypePointer Uniform 47($Global)
49: 48(ptr) Variable Uniform
4(PixelShaderFunction): 2 Function None 3 4(PixelShaderFunction): 2 Function None 3
5: Label 5: Label
10(s3): 9(ptr) Variable Function 10(s3): 9(ptr) Variable Function
@ -187,10 +159,11 @@ gl_FragCoord origin is upper left
14: 7(bvec3) CompositeExtract 12 0 14: 7(bvec3) CompositeExtract 12 0
15: 7(bvec3) LogicalEqual 13 14 15: 7(bvec3) LogicalEqual 13 14
16: 6(bool) All 15 16: 6(bool) All 15
26: 18(fvec4) Load 25(ff4) 30: 29(ptr) AccessChain 27(s) 28
28: 27(ptr) AccessChain 21(s2) 23 31: 18(fvec4) Load 30
Store 28 26 33: 32(ptr) AccessChain 21(s2) 23
32: 18(fvec4) Load 31(input) Store 33 31
Store 30(@entryPointOutput) 32 37: 18(fvec4) Load 36(input)
Store 35(@entryPointOutput) 37
Return Return
FunctionEnd FunctionEnd

View File

@ -0,0 +1,209 @@
hlsl.struct.split-1.vert
Shader version: 450
0:? Sequence
0:17 Function Definition: main(struct-VS_INPUT-i1-vf4-i11;vf4; (temp structure{temp int x0_out, temp 4-component vector of float Position Pos_out, temp int x1_out})
0:17 Function Parameters:
0:17 'vsin' (in structure{temp int x0_in, temp 4-component vector of float Pos_in, temp int x1_in})
0:17 'Pos_loose' (in 4-component vector of float Position)
0:? Sequence
0:20 move second child to first child (temp int)
0:20 x0_out: direct index for structure (temp int)
0:20 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:20 Constant:
0:20 0 (const int)
0:? 'x0_in' (layout(location=0 ) in int)
0:21 move second child to first child (temp 4-component vector of float)
0:21 Pos_out: direct index for structure (temp 4-component vector of float)
0:21 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:21 Constant:
0:21 1 (const int)
0:21 add (temp 4-component vector of float)
0:? 'Pos_in' (in 4-component vector of float Position)
0:21 'Pos_loose' (in 4-component vector of float Position)
0:22 move second child to first child (temp int)
0:22 x1_out: direct index for structure (temp int)
0:22 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:22 Constant:
0:22 2 (const int)
0:? 'x1_in' (layout(location=1 ) in int)
0:24 Sequence
0:24 Sequence
0:24 move second child to first child (temp int)
0:24 x0_out: direct index for structure (temp int)
0:24 '@entryPointOutput' (layout(location=0 ) out structure{temp int x0_out, temp int x1_out})
0:24 Constant:
0:24 0 (const int)
0:24 x0_out: direct index for structure (temp int)
0:24 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:24 Constant:
0:24 0 (const int)
0:24 move second child to first child (temp 4-component vector of float)
0:? 'Pos_out' (out 4-component vector of float Position)
0:24 Pos_out: direct index for structure (temp 4-component vector of float)
0:24 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:24 Constant:
0:24 1 (const int)
0:24 move second child to first child (temp int)
0:24 x1_out: direct index for structure (temp int)
0:24 '@entryPointOutput' (layout(location=0 ) out structure{temp int x0_out, temp int x1_out})
0:24 Constant:
0:24 1 (const int)
0:24 x1_out: direct index for structure (temp int)
0:24 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:24 Constant:
0:24 2 (const int)
0:24 Branch: Return
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out structure{temp int x0_out, temp int x1_out})
0:? 'x0_in' (layout(location=0 ) in int)
0:? 'Pos_in' (in 4-component vector of float Position)
0:? 'x1_in' (layout(location=1 ) in int)
0:? 'Pos_loose' (in 4-component vector of float Position)
0:? 'Pos_out' (out 4-component vector of float Position)
Linked vertex stage:
Shader version: 450
0:? Sequence
0:17 Function Definition: main(struct-VS_INPUT-i1-vf4-i11;vf4; (temp structure{temp int x0_out, temp 4-component vector of float Position Pos_out, temp int x1_out})
0:17 Function Parameters:
0:17 'vsin' (in structure{temp int x0_in, temp 4-component vector of float Pos_in, temp int x1_in})
0:17 'Pos_loose' (in 4-component vector of float Position)
0:? Sequence
0:20 move second child to first child (temp int)
0:20 x0_out: direct index for structure (temp int)
0:20 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:20 Constant:
0:20 0 (const int)
0:? 'x0_in' (layout(location=0 ) in int)
0:21 move second child to first child (temp 4-component vector of float)
0:21 Pos_out: direct index for structure (temp 4-component vector of float)
0:21 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:21 Constant:
0:21 1 (const int)
0:21 add (temp 4-component vector of float)
0:? 'Pos_in' (in 4-component vector of float Position)
0:21 'Pos_loose' (in 4-component vector of float Position)
0:22 move second child to first child (temp int)
0:22 x1_out: direct index for structure (temp int)
0:22 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:22 Constant:
0:22 2 (const int)
0:? 'x1_in' (layout(location=1 ) in int)
0:24 Sequence
0:24 Sequence
0:24 move second child to first child (temp int)
0:24 x0_out: direct index for structure (temp int)
0:24 '@entryPointOutput' (layout(location=0 ) out structure{temp int x0_out, temp int x1_out})
0:24 Constant:
0:24 0 (const int)
0:24 x0_out: direct index for structure (temp int)
0:24 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:24 Constant:
0:24 0 (const int)
0:24 move second child to first child (temp 4-component vector of float)
0:? 'Pos_out' (out 4-component vector of float Position)
0:24 Pos_out: direct index for structure (temp 4-component vector of float)
0:24 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:24 Constant:
0:24 1 (const int)
0:24 move second child to first child (temp int)
0:24 x1_out: direct index for structure (temp int)
0:24 '@entryPointOutput' (layout(location=0 ) out structure{temp int x0_out, temp int x1_out})
0:24 Constant:
0:24 1 (const int)
0:24 x1_out: direct index for structure (temp int)
0:24 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:24 Constant:
0:24 2 (const int)
0:24 Branch: Return
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out structure{temp int x0_out, temp int x1_out})
0:? 'x0_in' (layout(location=0 ) in int)
0:? 'Pos_in' (in 4-component vector of float Position)
0:? 'x1_in' (layout(location=1 ) in int)
0:? 'Pos_loose' (in 4-component vector of float Position)
0:? 'Pos_out' (out 4-component vector of float Position)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 46
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 14 20 22 28 33 39
Name 4 "main"
Name 9 "VS_OUTPUT"
MemberName 9(VS_OUTPUT) 0 "x0_out"
MemberName 9(VS_OUTPUT) 1 "Pos_out"
MemberName 9(VS_OUTPUT) 2 "x1_out"
Name 11 "vsout"
Name 14 "x0_in"
Name 20 "Pos_in"
Name 22 "Pos_loose"
Name 28 "x1_in"
Name 31 "VS_OUTPUT"
MemberName 31(VS_OUTPUT) 0 "x0_out"
MemberName 31(VS_OUTPUT) 1 "x1_out"
Name 33 "@entryPointOutput"
Name 39 "Pos_out"
Decorate 14(x0_in) Location 0
Decorate 20(Pos_in) BuiltIn Position
Decorate 22(Pos_loose) BuiltIn Position
Decorate 28(x1_in) Location 1
Decorate 33(@entryPointOutput) Location 0
Decorate 39(Pos_out) BuiltIn Position
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypeFloat 32
8: TypeVector 7(float) 4
9(VS_OUTPUT): TypeStruct 6(int) 8(fvec4) 6(int)
10: TypePointer Function 9(VS_OUTPUT)
12: 6(int) Constant 0
13: TypePointer Input 6(int)
14(x0_in): 13(ptr) Variable Input
16: TypePointer Function 6(int)
18: 6(int) Constant 1
19: TypePointer Input 8(fvec4)
20(Pos_in): 19(ptr) Variable Input
22(Pos_loose): 19(ptr) Variable Input
25: TypePointer Function 8(fvec4)
27: 6(int) Constant 2
28(x1_in): 13(ptr) Variable Input
31(VS_OUTPUT): TypeStruct 6(int) 6(int)
32: TypePointer Output 31(VS_OUTPUT)
33(@entryPointOutput): 32(ptr) Variable Output
36: TypePointer Output 6(int)
38: TypePointer Output 8(fvec4)
39(Pos_out): 38(ptr) Variable Output
4(main): 2 Function None 3
5: Label
11(vsout): 10(ptr) Variable Function
15: 6(int) Load 14(x0_in)
17: 16(ptr) AccessChain 11(vsout) 12
Store 17 15
21: 8(fvec4) Load 20(Pos_in)
23: 8(fvec4) Load 22(Pos_loose)
24: 8(fvec4) FAdd 21 23
26: 25(ptr) AccessChain 11(vsout) 18
Store 26 24
29: 6(int) Load 28(x1_in)
30: 16(ptr) AccessChain 11(vsout) 27
Store 30 29
34: 16(ptr) AccessChain 11(vsout) 12
35: 6(int) Load 34
37: 36(ptr) AccessChain 33(@entryPointOutput) 12
Store 37 35
40: 25(ptr) AccessChain 11(vsout) 18
41: 8(fvec4) Load 40
Store 39(Pos_out) 41
42: 16(ptr) AccessChain 11(vsout) 27
43: 6(int) Load 42
44: 36(ptr) AccessChain 33(@entryPointOutput) 18
Store 44 43
Return
FunctionEnd

View File

@ -0,0 +1,317 @@
hlsl.struct.split.call.vert
Shader version: 450
0:? Sequence
0:17 Function Definition: Fn1(struct-VS_INPUT-i1-vf4-i11;struct-VS_OUTPUT-i1-vf4-i11; (temp void)
0:17 Function Parameters:
0:17 'fn1_in' (temp structure{temp int x0_in, temp 4-component vector of float Pos_in, temp int x1_in})
0:17 'fn1_out' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:? Sequence
0:18 add (temp 4-component vector of float)
0:18 Pos_in: direct index for structure (temp 4-component vector of float)
0:18 'fn1_in' (temp structure{temp int x0_in, temp 4-component vector of float Pos_in, temp int x1_in})
0:18 Constant:
0:18 1 (const int)
0:18 Pos_out: direct index for structure (temp 4-component vector of float)
0:18 'fn1_out' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:18 Constant:
0:18 1 (const int)
0:22 Function Definition: main(struct-VS_INPUT-i1-vf4-i11; (temp structure{temp int x0_out, temp 4-component vector of float Position Pos_out, temp int x1_out})
0:22 Function Parameters:
0:22 'vsin' (in structure{temp int x0_in, temp 4-component vector of float Pos_in, temp int x1_in})
0:? Sequence
0:25 move second child to first child (temp int)
0:25 x0_out: direct index for structure (temp int)
0:25 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:25 Constant:
0:25 0 (const int)
0:? 'x0_in' (layout(location=0 ) in int)
0:26 move second child to first child (temp 4-component vector of float)
0:26 Pos_out: direct index for structure (temp 4-component vector of float)
0:26 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:26 Constant:
0:26 1 (const int)
0:? 'Pos_in' (in 4-component vector of float Position)
0:27 move second child to first child (temp int)
0:27 x1_out: direct index for structure (temp int)
0:27 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:27 Constant:
0:27 2 (const int)
0:? 'x1_in' (layout(location=1 ) in int)
0:29 Function Call: Fn1(struct-VS_INPUT-i1-vf4-i11;struct-VS_OUTPUT-i1-vf4-i11; (temp void)
0:29 Comma (temp structure{temp int x0_in, temp 4-component vector of float Pos_in, temp int x1_in})
0:29 Sequence
0:29 move second child to first child (temp int)
0:29 x0_in: direct index for structure (temp int)
0:29 'aggShadow' (temp structure{temp int x0_in, temp 4-component vector of float Pos_in, temp int x1_in})
0:29 Constant:
0:29 0 (const int)
0:? 'x0_in' (layout(location=0 ) in int)
0:29 move second child to first child (temp 4-component vector of float)
0:29 Pos_in: direct index for structure (temp 4-component vector of float)
0:29 'aggShadow' (temp structure{temp int x0_in, temp 4-component vector of float Pos_in, temp int x1_in})
0:29 Constant:
0:29 1 (const int)
0:? 'Pos_in' (in 4-component vector of float Position)
0:29 move second child to first child (temp int)
0:29 x1_in: direct index for structure (temp int)
0:29 'aggShadow' (temp structure{temp int x0_in, temp 4-component vector of float Pos_in, temp int x1_in})
0:29 Constant:
0:29 2 (const int)
0:? 'x1_in' (layout(location=1 ) in int)
0:29 'aggShadow' (temp structure{temp int x0_in, temp 4-component vector of float Pos_in, temp int x1_in})
0:29 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:31 Sequence
0:31 Sequence
0:31 move second child to first child (temp int)
0:31 x0_out: direct index for structure (temp int)
0:31 '@entryPointOutput' (layout(location=0 ) out structure{temp int x0_out, temp int x1_out})
0:31 Constant:
0:31 0 (const int)
0:31 x0_out: direct index for structure (temp int)
0:31 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:31 Constant:
0:31 0 (const int)
0:31 move second child to first child (temp 4-component vector of float)
0:? 'Pos_out' (out 4-component vector of float Position)
0:31 Pos_out: direct index for structure (temp 4-component vector of float)
0:31 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:31 Constant:
0:31 1 (const int)
0:31 move second child to first child (temp int)
0:31 x1_out: direct index for structure (temp int)
0:31 '@entryPointOutput' (layout(location=0 ) out structure{temp int x0_out, temp int x1_out})
0:31 Constant:
0:31 1 (const int)
0:31 x1_out: direct index for structure (temp int)
0:31 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:31 Constant:
0:31 2 (const int)
0:31 Branch: Return
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out structure{temp int x0_out, temp int x1_out})
0:? 'x0_in' (layout(location=0 ) in int)
0:? 'Pos_in' (in 4-component vector of float Position)
0:? 'x1_in' (layout(location=1 ) in int)
0:? 'Pos_out' (out 4-component vector of float Position)
Linked vertex stage:
Shader version: 450
0:? Sequence
0:17 Function Definition: Fn1(struct-VS_INPUT-i1-vf4-i11;struct-VS_OUTPUT-i1-vf4-i11; (temp void)
0:17 Function Parameters:
0:17 'fn1_in' (temp structure{temp int x0_in, temp 4-component vector of float Pos_in, temp int x1_in})
0:17 'fn1_out' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:? Sequence
0:18 add (temp 4-component vector of float)
0:18 Pos_in: direct index for structure (temp 4-component vector of float)
0:18 'fn1_in' (temp structure{temp int x0_in, temp 4-component vector of float Pos_in, temp int x1_in})
0:18 Constant:
0:18 1 (const int)
0:18 Pos_out: direct index for structure (temp 4-component vector of float)
0:18 'fn1_out' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:18 Constant:
0:18 1 (const int)
0:22 Function Definition: main(struct-VS_INPUT-i1-vf4-i11; (temp structure{temp int x0_out, temp 4-component vector of float Position Pos_out, temp int x1_out})
0:22 Function Parameters:
0:22 'vsin' (in structure{temp int x0_in, temp 4-component vector of float Pos_in, temp int x1_in})
0:? Sequence
0:25 move second child to first child (temp int)
0:25 x0_out: direct index for structure (temp int)
0:25 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:25 Constant:
0:25 0 (const int)
0:? 'x0_in' (layout(location=0 ) in int)
0:26 move second child to first child (temp 4-component vector of float)
0:26 Pos_out: direct index for structure (temp 4-component vector of float)
0:26 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:26 Constant:
0:26 1 (const int)
0:? 'Pos_in' (in 4-component vector of float Position)
0:27 move second child to first child (temp int)
0:27 x1_out: direct index for structure (temp int)
0:27 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:27 Constant:
0:27 2 (const int)
0:? 'x1_in' (layout(location=1 ) in int)
0:29 Function Call: Fn1(struct-VS_INPUT-i1-vf4-i11;struct-VS_OUTPUT-i1-vf4-i11; (temp void)
0:29 Comma (temp structure{temp int x0_in, temp 4-component vector of float Pos_in, temp int x1_in})
0:29 Sequence
0:29 move second child to first child (temp int)
0:29 x0_in: direct index for structure (temp int)
0:29 'aggShadow' (temp structure{temp int x0_in, temp 4-component vector of float Pos_in, temp int x1_in})
0:29 Constant:
0:29 0 (const int)
0:? 'x0_in' (layout(location=0 ) in int)
0:29 move second child to first child (temp 4-component vector of float)
0:29 Pos_in: direct index for structure (temp 4-component vector of float)
0:29 'aggShadow' (temp structure{temp int x0_in, temp 4-component vector of float Pos_in, temp int x1_in})
0:29 Constant:
0:29 1 (const int)
0:? 'Pos_in' (in 4-component vector of float Position)
0:29 move second child to first child (temp int)
0:29 x1_in: direct index for structure (temp int)
0:29 'aggShadow' (temp structure{temp int x0_in, temp 4-component vector of float Pos_in, temp int x1_in})
0:29 Constant:
0:29 2 (const int)
0:? 'x1_in' (layout(location=1 ) in int)
0:29 'aggShadow' (temp structure{temp int x0_in, temp 4-component vector of float Pos_in, temp int x1_in})
0:29 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:31 Sequence
0:31 Sequence
0:31 move second child to first child (temp int)
0:31 x0_out: direct index for structure (temp int)
0:31 '@entryPointOutput' (layout(location=0 ) out structure{temp int x0_out, temp int x1_out})
0:31 Constant:
0:31 0 (const int)
0:31 x0_out: direct index for structure (temp int)
0:31 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:31 Constant:
0:31 0 (const int)
0:31 move second child to first child (temp 4-component vector of float)
0:? 'Pos_out' (out 4-component vector of float Position)
0:31 Pos_out: direct index for structure (temp 4-component vector of float)
0:31 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:31 Constant:
0:31 1 (const int)
0:31 move second child to first child (temp int)
0:31 x1_out: direct index for structure (temp int)
0:31 '@entryPointOutput' (layout(location=0 ) out structure{temp int x0_out, temp int x1_out})
0:31 Constant:
0:31 1 (const int)
0:31 x1_out: direct index for structure (temp int)
0:31 'vsout' (temp structure{temp int x0_out, temp 4-component vector of float Pos_out, temp int x1_out})
0:31 Constant:
0:31 2 (const int)
0:31 Branch: Return
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out structure{temp int x0_out, temp int x1_out})
0:? 'x0_in' (layout(location=0 ) in int)
0:? 'Pos_in' (in 4-component vector of float Position)
0:? 'x1_in' (layout(location=1 ) in int)
0:? 'Pos_out' (out 4-component vector of float Position)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 69
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 28 33 37 56 62
Name 4 "main"
Name 9 "VS_INPUT"
MemberName 9(VS_INPUT) 0 "x0_in"
MemberName 9(VS_INPUT) 1 "Pos_in"
MemberName 9(VS_INPUT) 2 "x1_in"
Name 11 "VS_OUTPUT"
MemberName 11(VS_OUTPUT) 0 "x0_out"
MemberName 11(VS_OUTPUT) 1 "Pos_out"
MemberName 11(VS_OUTPUT) 2 "x1_out"
Name 16 "Fn1(struct-VS_INPUT-i1-vf4-i11;struct-VS_OUTPUT-i1-vf4-i11;"
Name 14 "fn1_in"
Name 15 "fn1_out"
Name 25 "vsout"
Name 28 "x0_in"
Name 33 "Pos_in"
Name 37 "x1_in"
Name 40 "VS_INPUT"
MemberName 40(VS_INPUT) 0 "x0_in"
MemberName 40(VS_INPUT) 1 "Pos_in"
MemberName 40(VS_INPUT) 2 "x1_in"
Name 42 "aggShadow"
Name 49 "param"
Name 51 "param"
Name 54 "VS_OUTPUT"
MemberName 54(VS_OUTPUT) 0 "x0_out"
MemberName 54(VS_OUTPUT) 1 "x1_out"
Name 56 "@entryPointOutput"
Name 62 "Pos_out"
Decorate 28(x0_in) Location 0
Decorate 33(Pos_in) BuiltIn Position
Decorate 37(x1_in) Location 1
Decorate 56(@entryPointOutput) Location 0
Decorate 62(Pos_out) BuiltIn Position
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypeFloat 32
8: TypeVector 7(float) 4
9(VS_INPUT): TypeStruct 6(int) 8(fvec4) 6(int)
10: TypePointer Function 9(VS_INPUT)
11(VS_OUTPUT): TypeStruct 6(int) 8(fvec4) 6(int)
12: TypePointer Function 11(VS_OUTPUT)
13: TypeFunction 2 10(ptr) 12(ptr)
18: 6(int) Constant 1
19: TypePointer Function 8(fvec4)
26: 6(int) Constant 0
27: TypePointer Input 6(int)
28(x0_in): 27(ptr) Variable Input
30: TypePointer Function 6(int)
32: TypePointer Input 8(fvec4)
33(Pos_in): 32(ptr) Variable Input
36: 6(int) Constant 2
37(x1_in): 27(ptr) Variable Input
40(VS_INPUT): TypeStruct 6(int) 8(fvec4) 6(int)
41: TypePointer Function 40(VS_INPUT)
54(VS_OUTPUT): TypeStruct 6(int) 6(int)
55: TypePointer Output 54(VS_OUTPUT)
56(@entryPointOutput): 55(ptr) Variable Output
59: TypePointer Output 6(int)
61: TypePointer Output 8(fvec4)
62(Pos_out): 61(ptr) Variable Output
4(main): 2 Function None 3
5: Label
25(vsout): 12(ptr) Variable Function
42(aggShadow): 41(ptr) Variable Function
49(param): 41(ptr) Variable Function
51(param): 12(ptr) Variable Function
29: 6(int) Load 28(x0_in)
31: 30(ptr) AccessChain 25(vsout) 26
Store 31 29
34: 8(fvec4) Load 33(Pos_in)
35: 19(ptr) AccessChain 25(vsout) 18
Store 35 34
38: 6(int) Load 37(x1_in)
39: 30(ptr) AccessChain 25(vsout) 36
Store 39 38
43: 6(int) Load 28(x0_in)
44: 30(ptr) AccessChain 42(aggShadow) 26
Store 44 43
45: 8(fvec4) Load 33(Pos_in)
46: 19(ptr) AccessChain 42(aggShadow) 18
Store 46 45
47: 6(int) Load 37(x1_in)
48: 30(ptr) AccessChain 42(aggShadow) 36
Store 48 47
50:40(VS_INPUT) Load 42(aggShadow)
Store 49(param) 50
52:11(VS_OUTPUT) Load 25(vsout)
Store 51(param) 52
53: 2 FunctionCall 16(Fn1(struct-VS_INPUT-i1-vf4-i11;struct-VS_OUTPUT-i1-vf4-i11;) 49(param) 51(param)
57: 30(ptr) AccessChain 25(vsout) 26
58: 6(int) Load 57
60: 59(ptr) AccessChain 56(@entryPointOutput) 26
Store 60 58
63: 19(ptr) AccessChain 25(vsout) 18
64: 8(fvec4) Load 63
Store 62(Pos_out) 64
65: 30(ptr) AccessChain 25(vsout) 36
66: 6(int) Load 65
67: 59(ptr) AccessChain 56(@entryPointOutput) 18
Store 67 66
Return
FunctionEnd
16(Fn1(struct-VS_INPUT-i1-vf4-i11;struct-VS_OUTPUT-i1-vf4-i11;): 2 Function None 13
14(fn1_in): 10(ptr) FunctionParameter
15(fn1_out): 12(ptr) FunctionParameter
17: Label
20: 19(ptr) AccessChain 14(fn1_in) 18
21: 8(fvec4) Load 20
22: 19(ptr) AccessChain 15(fn1_out) 18
23: 8(fvec4) Load 22
24: 8(fvec4) FAdd 21 23
Return
FunctionEnd

View File

@ -0,0 +1,108 @@
hlsl.struct.split.trivial.vert
Shader version: 450
0:? Sequence
0:16 Function Definition: main(struct-VS_INPUT-vf41;vf4; (temp structure{temp 4-component vector of float Pos})
0:16 Function Parameters:
0:16 'vsin' (in structure{temp 4-component vector of float Pos_in})
0:16 'Pos_loose' (in 4-component vector of float Position)
0:? Sequence
0:19 move second child to first child (temp 4-component vector of float)
0:19 Pos: direct index for structure (temp 4-component vector of float)
0:19 'vsout' (temp structure{temp 4-component vector of float Pos})
0:19 Constant:
0:19 0 (const int)
0:19 add (temp 4-component vector of float)
0:? 'Pos_in' (in 4-component vector of float Position)
0:19 'Pos_loose' (in 4-component vector of float Position)
0:21 Sequence
0:21 Sequence
0:21 move second child to first child (temp 4-component vector of float)
0:? 'Pos' (out 4-component vector of float Position)
0:21 Pos: direct index for structure (temp 4-component vector of float)
0:21 'vsout' (temp structure{temp 4-component vector of float Pos})
0:21 Constant:
0:21 0 (const int)
0:21 Branch: Return
0:? Linker Objects
0:? 'Pos' (out 4-component vector of float Position)
0:? 'Pos_in' (in 4-component vector of float Position)
0:? 'Pos_loose' (in 4-component vector of float Position)
Linked vertex stage:
Shader version: 450
0:? Sequence
0:16 Function Definition: main(struct-VS_INPUT-vf41;vf4; (temp structure{temp 4-component vector of float Pos})
0:16 Function Parameters:
0:16 'vsin' (in structure{temp 4-component vector of float Pos_in})
0:16 'Pos_loose' (in 4-component vector of float Position)
0:? Sequence
0:19 move second child to first child (temp 4-component vector of float)
0:19 Pos: direct index for structure (temp 4-component vector of float)
0:19 'vsout' (temp structure{temp 4-component vector of float Pos})
0:19 Constant:
0:19 0 (const int)
0:19 add (temp 4-component vector of float)
0:? 'Pos_in' (in 4-component vector of float Position)
0:19 'Pos_loose' (in 4-component vector of float Position)
0:21 Sequence
0:21 Sequence
0:21 move second child to first child (temp 4-component vector of float)
0:? 'Pos' (out 4-component vector of float Position)
0:21 Pos: direct index for structure (temp 4-component vector of float)
0:21 'vsout' (temp structure{temp 4-component vector of float Pos})
0:21 Constant:
0:21 0 (const int)
0:21 Branch: Return
0:? Linker Objects
0:? 'Pos' (out 4-component vector of float Position)
0:? 'Pos_in' (in 4-component vector of float Position)
0:? 'Pos_loose' (in 4-component vector of float Position)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 26
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 14 16 22
Name 4 "main"
Name 8 "VS_OUTPUT"
MemberName 8(VS_OUTPUT) 0 "Pos"
Name 10 "vsout"
Name 14 "Pos_in"
Name 16 "Pos_loose"
Name 22 "Pos"
Decorate 14(Pos_in) BuiltIn Position
Decorate 16(Pos_loose) BuiltIn Position
Decorate 22(Pos) BuiltIn Position
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8(VS_OUTPUT): TypeStruct 7(fvec4)
9: TypePointer Function 8(VS_OUTPUT)
11: TypeInt 32 1
12: 11(int) Constant 0
13: TypePointer Input 7(fvec4)
14(Pos_in): 13(ptr) Variable Input
16(Pos_loose): 13(ptr) Variable Input
19: TypePointer Function 7(fvec4)
21: TypePointer Output 7(fvec4)
22(Pos): 21(ptr) Variable Output
4(main): 2 Function None 3
5: Label
10(vsout): 9(ptr) Variable Function
15: 7(fvec4) Load 14(Pos_in)
17: 7(fvec4) Load 16(Pos_loose)
18: 7(fvec4) FAdd 15 17
20: 19(ptr) AccessChain 10(vsout) 12
Store 20 18
23: 19(ptr) AccessChain 10(vsout) 12
24: 7(fvec4) Load 23
Store 22(Pos) 24
Return
FunctionEnd

View File

@ -1,52 +1,82 @@
hlsl.structarray.flatten.geom 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 Shader version: 450
invocations = -1 invocations = -1
max_vertices = 4 max_vertices = 4
input primitive = lines input primitive = lines
output primitive = triangle_strip output primitive = triangle_strip
ERROR: node is still EOpNull! 0:? Sequence
0:10 Function Definition: main(struct-VertexData-vf4-vf4-vf21[2];struct-VertexData-vf4-vf4-vf21; (temp void) 0:16 Function Definition: main(struct-VertexData-vf4-vf4-vf21[2];struct-PS_IN-vf4-vf4-vf21; (temp void)
0:10 Function Parameters: 0:16 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:16 'vin' (layout(location=0 ) 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:16 'outStream' (out structure{temp 4-component vector of float Position position, temp 4-component vector of float color, temp 2-component vector of float uv})
0:? Sequence 0:? Sequence
0:13 move second child to first child (temp 4-component vector of float) 0:19 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:19 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:19 '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:19 Constant:
0:13 1 (const int) 0:19 1 (const int)
0:? 'vin[0].color' (layout(location=1 ) in 4-component vector of float) 0:19 color: direct index for structure (temp 4-component vector of float)
0:14 move second child to first child (temp 2-component vector of float) 0:19 direct index (layout(location=0 ) 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 uv: direct index for structure (temp 2-component vector of float) 0:19 'vin' (layout(location=0 ) 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: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:19 Constant:
0:14 Constant: 0:19 1 (const int)
0:14 2 (const int) 0:19 Constant:
0:? 'vin[0].uv' (layout(location=2 ) in 2-component vector of float) 0:19 1 (const int)
0:15 move second child to first child (temp 4-component vector of float) 0:20 move second child to first child (temp 2-component vector of float)
0:15 position: direct index for structure (temp 4-component vector of float) 0:20 uv: direct index for structure (temp 2-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:20 '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:20 Constant:
0:15 0 (const int) 0:20 2 (const int)
0:? 'vin[0].position' (layout(location=0 ) in 4-component vector of float) 0:20 uv: direct index for structure (temp 2-component vector of float)
0:16 Sequence 0:20 direct index (layout(location=0 ) 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 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:20 'vin' (layout(location=0 ) 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: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:20 Constant:
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:20 1 (const int)
0:16 EmitVertex (temp void) 0:20 Constant:
0:20 2 (const int)
0:21 move second child to first child (temp 4-component vector of float)
0:21 position: direct index for structure (temp 4-component vector of float)
0:21 '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:21 Constant:
0:21 0 (const int)
0:21 position: direct index for structure (temp 4-component vector of float)
0:21 direct index (layout(location=0 ) temp structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
0:21 'vin' (layout(location=0 ) 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:21 Constant:
0:21 1 (const int)
0:21 Constant:
0:21 0 (const int)
0:22 Sequence
0:22 Sequence
0:22 move second child to first child (temp 4-component vector of float)
0:? 'position' (out 4-component vector of float Position)
0:22 position: direct index for structure (temp 4-component vector of float)
0:22 '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:22 Constant:
0:22 0 (const int)
0:22 move second child to first child (temp 4-component vector of float)
0:22 color: direct index for structure (temp 4-component vector of float)
0:22 'outStream' (layout(location=0 ) out structure{temp 4-component vector of float color, temp 2-component vector of float uv})
0:22 Constant:
0:22 0 (const int)
0:22 color: direct index for structure (temp 4-component vector of float)
0:22 '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:22 Constant:
0:22 1 (const int)
0:22 move second child to first child (temp 2-component vector of float)
0:22 uv: direct index for structure (temp 2-component vector of float)
0:22 'outStream' (layout(location=0 ) out structure{temp 4-component vector of float color, temp 2-component vector of float uv})
0:22 Constant:
0:22 1 (const int)
0:22 uv: direct index for structure (temp 2-component vector of float)
0:22 '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:22 Constant:
0:22 2 (const int)
0:22 EmitVertex (temp void)
0:? Linker Objects 0:? Linker Objects
0:? 'vin[0].position' (layout(location=0 ) in 4-component vector of float) 0:? 'vin' (layout(location=0 ) 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:? 'vin[0].color' (layout(location=1 ) in 4-component vector of float) 0:? 'outStream' (layout(location=0 ) out structure{temp 4-component vector of float color, temp 2-component vector of float uv})
0:? 'vin[0].uv' (layout(location=2 ) in 2-component vector of float) 0:? 'position' (out 4-component vector of float Position)
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: Linked geometry stage:
@ -57,44 +87,164 @@ invocations = 1
max_vertices = 4 max_vertices = 4
input primitive = lines input primitive = lines
output primitive = triangle_strip output primitive = triangle_strip
ERROR: node is still EOpNull! 0:? Sequence
0:10 Function Definition: main(struct-VertexData-vf4-vf4-vf21[2];struct-VertexData-vf4-vf4-vf21; (temp void) 0:16 Function Definition: main(struct-VertexData-vf4-vf4-vf21[2];struct-PS_IN-vf4-vf4-vf21; (temp void)
0:10 Function Parameters: 0:16 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:16 'vin' (layout(location=0 ) 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:16 'outStream' (out structure{temp 4-component vector of float Position position, temp 4-component vector of float color, temp 2-component vector of float uv})
0:? Sequence 0:? Sequence
0:13 move second child to first child (temp 4-component vector of float) 0:19 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:19 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:19 '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:19 Constant:
0:13 1 (const int) 0:19 1 (const int)
0:? 'vin[0].color' (layout(location=1 ) in 4-component vector of float) 0:19 color: direct index for structure (temp 4-component vector of float)
0:14 move second child to first child (temp 2-component vector of float) 0:19 direct index (layout(location=0 ) 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 uv: direct index for structure (temp 2-component vector of float) 0:19 'vin' (layout(location=0 ) 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: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:19 Constant:
0:14 Constant: 0:19 1 (const int)
0:14 2 (const int) 0:19 Constant:
0:? 'vin[0].uv' (layout(location=2 ) in 2-component vector of float) 0:19 1 (const int)
0:15 move second child to first child (temp 4-component vector of float) 0:20 move second child to first child (temp 2-component vector of float)
0:15 position: direct index for structure (temp 4-component vector of float) 0:20 uv: direct index for structure (temp 2-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:20 '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:20 Constant:
0:15 0 (const int) 0:20 2 (const int)
0:? 'vin[0].position' (layout(location=0 ) in 4-component vector of float) 0:20 uv: direct index for structure (temp 2-component vector of float)
0:16 Sequence 0:20 direct index (layout(location=0 ) 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 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:20 'vin' (layout(location=0 ) 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: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:20 Constant:
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:20 1 (const int)
0:16 EmitVertex (temp void) 0:20 Constant:
0:20 2 (const int)
0:21 move second child to first child (temp 4-component vector of float)
0:21 position: direct index for structure (temp 4-component vector of float)
0:21 '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:21 Constant:
0:21 0 (const int)
0:21 position: direct index for structure (temp 4-component vector of float)
0:21 direct index (layout(location=0 ) temp structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
0:21 'vin' (layout(location=0 ) 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:21 Constant:
0:21 1 (const int)
0:21 Constant:
0:21 0 (const int)
0:22 Sequence
0:22 Sequence
0:22 move second child to first child (temp 4-component vector of float)
0:? 'position' (out 4-component vector of float Position)
0:22 position: direct index for structure (temp 4-component vector of float)
0:22 '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:22 Constant:
0:22 0 (const int)
0:22 move second child to first child (temp 4-component vector of float)
0:22 color: direct index for structure (temp 4-component vector of float)
0:22 'outStream' (layout(location=0 ) out structure{temp 4-component vector of float color, temp 2-component vector of float uv})
0:22 Constant:
0:22 0 (const int)
0:22 color: direct index for structure (temp 4-component vector of float)
0:22 '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:22 Constant:
0:22 1 (const int)
0:22 move second child to first child (temp 2-component vector of float)
0:22 uv: direct index for structure (temp 2-component vector of float)
0:22 'outStream' (layout(location=0 ) out structure{temp 4-component vector of float color, temp 2-component vector of float uv})
0:22 Constant:
0:22 1 (const int)
0:22 uv: direct index for structure (temp 2-component vector of float)
0:22 '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:22 Constant:
0:22 2 (const int)
0:22 EmitVertex (temp void)
0:? Linker Objects 0:? Linker Objects
0:? 'vin[0].position' (layout(location=0 ) in 4-component vector of float) 0:? 'vin' (layout(location=0 ) 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:? 'vin[0].color' (layout(location=1 ) in 4-component vector of float) 0:? 'outStream' (layout(location=0 ) out structure{temp 4-component vector of float color, temp 2-component vector of float uv})
0:? 'vin[0].uv' (layout(location=2 ) in 2-component vector of float) 0:? 'position' (out 4-component vector of float Position)
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 // Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 49
Capability Geometry
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Geometry 4 "main" 19 36 41
ExecutionMode 4 InputLines
ExecutionMode 4 Invocations 1
ExecutionMode 4 OutputTriangleStrip
ExecutionMode 4 OutputVertices 4
Name 4 "main"
Name 9 "PS_IN"
MemberName 9(PS_IN) 0 "position"
MemberName 9(PS_IN) 1 "color"
MemberName 9(PS_IN) 2 "uv"
Name 11 "vout"
Name 14 "VertexData"
MemberName 14(VertexData) 0 "position"
MemberName 14(VertexData) 1 "color"
MemberName 14(VertexData) 2 "uv"
Name 19 "vin"
Name 36 "position"
Name 39 "PS_IN"
MemberName 39(PS_IN) 0 "color"
MemberName 39(PS_IN) 1 "uv"
Name 41 "outStream"
Decorate 19(vin) Location 0
Decorate 36(position) BuiltIn Position
Decorate 41(outStream) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypeVector 6(float) 2
9(PS_IN): TypeStruct 7(fvec4) 7(fvec4) 8(fvec2)
10: TypePointer Function 9(PS_IN)
12: TypeInt 32 1
13: 12(int) Constant 1
14(VertexData): TypeStruct 7(fvec4) 7(fvec4) 8(fvec2)
15: TypeInt 32 0
16: 15(int) Constant 2
17: TypeArray 14(VertexData) 16
18: TypePointer Input 17
19(vin): 18(ptr) Variable Input
20: TypePointer Input 7(fvec4)
23: TypePointer Function 7(fvec4)
25: 12(int) Constant 2
26: TypePointer Input 8(fvec2)
29: TypePointer Function 8(fvec2)
31: 12(int) Constant 0
35: TypePointer Output 7(fvec4)
36(position): 35(ptr) Variable Output
39(PS_IN): TypeStruct 7(fvec4) 8(fvec2)
40: TypePointer Output 39(PS_IN)
41(outStream): 40(ptr) Variable Output
47: TypePointer Output 8(fvec2)
4(main): 2 Function None 3
5: Label
11(vout): 10(ptr) Variable Function
21: 20(ptr) AccessChain 19(vin) 13 13
22: 7(fvec4) Load 21
24: 23(ptr) AccessChain 11(vout) 13
Store 24 22
27: 26(ptr) AccessChain 19(vin) 13 25
28: 8(fvec2) Load 27
30: 29(ptr) AccessChain 11(vout) 25
Store 30 28
32: 20(ptr) AccessChain 19(vin) 13 31
33: 7(fvec4) Load 32
34: 23(ptr) AccessChain 11(vout) 31
Store 34 33
37: 23(ptr) AccessChain 11(vout) 31
38: 7(fvec4) Load 37
Store 36(position) 38
42: 23(ptr) AccessChain 11(vout) 13
43: 7(fvec4) Load 42
44: 35(ptr) AccessChain 41(outStream) 31
Store 44 43
45: 29(ptr) AccessChain 11(vout) 25
46: 8(fvec2) Load 45
48: 47(ptr) AccessChain 41(outStream) 13
Store 48 46
EmitVertex
Return
FunctionEnd

View File

@ -29,7 +29,13 @@ Shader version: 450
0:13 Sequence 0:13 Sequence
0:13 Sequence 0:13 Sequence
0:13 move second child to first child (temp 4-component vector of float) 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 '@entryPointOutput' (out structure Position{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, smooth 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 direct index (temp 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 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 '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})
@ -38,7 +44,13 @@ Shader version: 450
0:13 Constant: 0:13 Constant:
0:13 0 (const int) 0:13 0 (const int)
0:13 move second child to first child (temp 4-component vector of float) 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 '@entryPointOutput' (out structure Position{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, smooth 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 direct index (temp 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 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 '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})
@ -47,31 +59,32 @@ Shader version: 450
0:13 Constant: 0:13 Constant:
0:13 1 (const int) 0:13 1 (const int)
0:13 move second child to first child (temp 2-component vector of uint) 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)
0:13 '@entryPointOutput' (out structure Position{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, smooth temp 4-component vector of float b})
0:13 Constant:
0:13 1 (const int)
0:13 coord: direct index for structure (temp 2-component vector of uint) 0:13 coord: direct index for structure (temp 2-component vector of uint)
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 '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 Constant:
0:13 1 (const int) 0:13 1 (const int)
0:13 move second child to first child (temp 4-component vector of float) 0:13 move second child to first child (temp 4-component vector of float)
0:? 'b' (layout(location=3 ) smooth out 4-component vector of float) 0:13 b: direct index for structure (temp 4-component vector of float)
0:13 '@entryPointOutput' (out structure Position{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, smooth temp 4-component vector of float b})
0:13 Constant:
0:13 2 (const int)
0:13 b: direct index for structure (temp 4-component vector of float) 0:13 b: direct index for structure (temp 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 '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 Constant:
0:13 2 (const int) 0:13 2 (const int)
0:13 Branch: Return 0:13 Branch: Return
0:? Linker Objects 0:? Linker Objects
0:? 'm[0]' (layout(location=0 ) out 4-component vector of float) 0:? '@entryPointOutput' (out structure Position{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, smooth temp 4-component vector of float b})
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:? 'd' (layout(location=0 ) in 4-component vector of float)
0:? 'm[0]' (layout(location=1 ) in 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:? 'm[1]' (layout(location=2 ) in 4-component vector of float)
0:? 'coord' (layout(location=3 ) in 2-component vector of uint) 0:? 'coord' (layout(location=3 ) in 2-component vector of uint)
0:? 'b' (layout(location=4 ) in 4-component vector of float) 0:? 'b' (layout(location=4 ) smooth in 4-component vector of float)
0:? 'e' (layout(location=5 ) 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[0]' (layout(location=1 ) in 4-component vector of float)
0:? 'm[1]' (layout(location=2 ) in 4-component vector of float) 0:? 'm[1]' (layout(location=2 ) in 4-component vector of float)
@ -109,7 +122,13 @@ Shader version: 450
0:13 Sequence 0:13 Sequence
0:13 Sequence 0:13 Sequence
0:13 move second child to first child (temp 4-component vector of float) 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 '@entryPointOutput' (out structure Position{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, smooth 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 direct index (temp 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 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 '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})
@ -118,7 +137,13 @@ Shader version: 450
0:13 Constant: 0:13 Constant:
0:13 0 (const int) 0:13 0 (const int)
0:13 move second child to first child (temp 4-component vector of float) 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 '@entryPointOutput' (out structure Position{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, smooth 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 direct index (temp 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 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 '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})
@ -127,42 +152,43 @@ Shader version: 450
0:13 Constant: 0:13 Constant:
0:13 1 (const int) 0:13 1 (const int)
0:13 move second child to first child (temp 2-component vector of uint) 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)
0:13 '@entryPointOutput' (out structure Position{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, smooth temp 4-component vector of float b})
0:13 Constant:
0:13 1 (const int)
0:13 coord: direct index for structure (temp 2-component vector of uint) 0:13 coord: direct index for structure (temp 2-component vector of uint)
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 '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 Constant:
0:13 1 (const int) 0:13 1 (const int)
0:13 move second child to first child (temp 4-component vector of float) 0:13 move second child to first child (temp 4-component vector of float)
0:? 'b' (layout(location=3 ) smooth out 4-component vector of float) 0:13 b: direct index for structure (temp 4-component vector of float)
0:13 '@entryPointOutput' (out structure Position{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, smooth temp 4-component vector of float b})
0:13 Constant:
0:13 2 (const int)
0:13 b: direct index for structure (temp 4-component vector of float) 0:13 b: direct index for structure (temp 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 '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 Constant:
0:13 2 (const int) 0:13 2 (const int)
0:13 Branch: Return 0:13 Branch: Return
0:? Linker Objects 0:? Linker Objects
0:? 'm[0]' (layout(location=0 ) out 4-component vector of float) 0:? '@entryPointOutput' (out structure Position{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, smooth temp 4-component vector of float b})
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:? 'd' (layout(location=0 ) in 4-component vector of float)
0:? 'm[0]' (layout(location=1 ) in 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:? 'm[1]' (layout(location=2 ) in 4-component vector of float)
0:? 'coord' (layout(location=3 ) in 2-component vector of uint) 0:? 'coord' (layout(location=3 ) in 2-component vector of uint)
0:? 'b' (layout(location=4 ) in 4-component vector of float) 0:? 'b' (layout(location=4 ) smooth in 4-component vector of float)
0:? 'e' (layout(location=5 ) 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[0]' (layout(location=1 ) in 4-component vector of float)
0:? 'm[1]' (layout(location=2 ) in 4-component vector of float) 0:? 'm[1]' (layout(location=2 ) in 4-component vector of float)
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 59 // Id's are bound by 62
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 18 20 24 32 35 41 45 50 54 58 EntryPoint Vertex 4 "main" 18 20 24 32 35 42 61
Name 4 "main" Name 4 "main"
Name 12 "VI" Name 12 "VI"
MemberName 12(VI) 0 "m" MemberName 12(VI) 0 "m"
@ -174,21 +200,19 @@ Shader version: 450
Name 24 "coord" Name 24 "coord"
Name 32 "d" Name 32 "d"
Name 35 "e" Name 35 "e"
Name 41 "m[0]" Name 40 "VI"
Name 45 "m[1]" MemberName 40(VI) 0 "m"
Name 50 "coord" MemberName 40(VI) 1 "coord"
Name 54 "b" MemberName 40(VI) 2 "b"
Name 58 "b" Name 42 "@entryPointOutput"
Name 61 "b"
Decorate 18(m[1]) Location 2 Decorate 18(m[1]) Location 2
Decorate 20(m[0]) Location 1 Decorate 20(m[0]) Location 1
Decorate 24(coord) Location 3 Decorate 24(coord) Location 3
Decorate 32(d) Location 0 Decorate 32(d) Location 0
Decorate 35(e) Location 5 Decorate 35(e) Location 5
Decorate 41(m[0]) Location 0 Decorate 42(@entryPointOutput) BuiltIn Position
Decorate 45(m[1]) Location 1 Decorate 61(b) Location 4
Decorate 50(coord) Location 2
Decorate 54(b) Location 3
Decorate 58(b) Location 4
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
@ -211,16 +235,15 @@ Shader version: 450
32(d): 17(ptr) Variable Input 32(d): 17(ptr) Variable Input
35(e): 17(ptr) Variable Input 35(e): 17(ptr) Variable Input
38: TypePointer Function 7(fvec4) 38: TypePointer Function 7(fvec4)
40: TypePointer Output 7(fvec4) 40(VI): TypeStruct 10 11(ivec2) 7(fvec4)
41(m[0]): 40(ptr) Variable Output 41: TypePointer Output 40(VI)
42: 15(int) Constant 0 42(@entryPointOutput): 41(ptr) Variable Output
45(m[1]): 40(ptr) Variable Output 43: 15(int) Constant 0
46: 15(int) Constant 1 46: TypePointer Output 7(fvec4)
49: TypePointer Output 11(ivec2) 48: 15(int) Constant 1
50(coord): 49(ptr) Variable Output 52: TypePointer Function 11(ivec2)
51: TypePointer Function 11(ivec2) 55: TypePointer Output 11(ivec2)
54(b): 40(ptr) Variable Output 61(b): 17(ptr) Variable Input
58(b): 17(ptr) Variable Input
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
14(local): 13(ptr) Variable Function 14(local): 13(ptr) Variable Function
@ -238,17 +261,21 @@ Shader version: 450
37: 7(fvec4) FAdd 34 36 37: 7(fvec4) FAdd 34 36
39: 38(ptr) AccessChain 14(local) 16 39: 38(ptr) AccessChain 14(local) 16
Store 39 37 Store 39 37
43: 38(ptr) AccessChain 14(local) 42 42 44: 38(ptr) AccessChain 14(local) 43 43
44: 7(fvec4) Load 43 45: 7(fvec4) Load 44
Store 41(m[0]) 44 47: 46(ptr) AccessChain 42(@entryPointOutput) 43 43
47: 38(ptr) AccessChain 14(local) 42 46 Store 47 45
48: 7(fvec4) Load 47 49: 38(ptr) AccessChain 14(local) 43 48
Store 45(m[1]) 48 50: 7(fvec4) Load 49
52: 51(ptr) AccessChain 14(local) 46 51: 46(ptr) AccessChain 42(@entryPointOutput) 43 48
53: 11(ivec2) Load 52 Store 51 50
Store 50(coord) 53 53: 52(ptr) AccessChain 14(local) 48
55: 38(ptr) AccessChain 14(local) 16 54: 11(ivec2) Load 53
56: 7(fvec4) Load 55 56: 55(ptr) AccessChain 42(@entryPointOutput) 48
Store 54(b) 56 Store 56 54
57: 38(ptr) AccessChain 14(local) 16
58: 7(fvec4) Load 57
59: 46(ptr) AccessChain 42(@entryPointOutput) 16
Store 59 58
Return Return
FunctionEnd FunctionEnd

View File

@ -9,7 +9,7 @@ struct PS_OUTPUT
PS_OUTPUT Func1() PS_OUTPUT Func1()
{ {
return PS_OUTPUT(float4(1), 2, 3, 4); return PS_OUTPUT(float4(1,1,1,1), 2, 3, 4);
} }
PS_OUTPUT main() PS_OUTPUT main()

View File

@ -0,0 +1,18 @@
#define foobarblee zzzz
#define ar qqqq
#define MACRO1(x,y) foo##x##y
// #define MACRO2 abc##def
// #define SPACE_IN_MACRO int var1
float4 main() : SV_Target0
{
// float MACRO2 = 10;
float MACRO1(b##ar,blee) = 3;
return float4(foobarblee,0,0,0);
}

View File

@ -0,0 +1,25 @@
struct VS_INPUT
{
int x0_in : foo0;
float4 Pos_in : SV_Position;
int x1_in : foo1;
};
struct VS_OUTPUT
{
int x0_out : foo0;
float4 Pos_out : SV_Position;
int x1_out : foo1;
};
VS_OUTPUT main(VS_INPUT vsin, float4 Pos_loose : SV_Position)
{
VS_OUTPUT vsout;
vsout.x0_out = vsin.x0_in;
vsout.Pos_out = vsin.Pos_in + Pos_loose;
vsout.x1_out = vsin.x1_in;
return vsout;
}

View File

@ -0,0 +1,32 @@
// Test passing split structs to functions.
struct VS_INPUT
{
int x0_in : foo0;
float4 Pos_in : SV_Position;
int x1_in : foo1;
};
struct VS_OUTPUT
{
int x0_out : foo0;
float4 Pos_out : SV_Position;
int x1_out : foo1;
};
void Fn1(VS_INPUT fn1_in, VS_OUTPUT fn1_out) {
fn1_in.Pos_in + fn1_out.Pos_out;
}
VS_OUTPUT main(VS_INPUT vsin)
{
VS_OUTPUT vsout;
vsout.x0_out = vsin.x0_in;
vsout.Pos_out = vsin.Pos_in;
vsout.x1_out = vsin.x1_in;
Fn1(vsin, vsout);
return vsout;
}

View File

@ -0,0 +1,22 @@
// Test trivial case for structure splitting: the IN and OUT structs have ONLY an interstage IO.
// This should fall back to flattening, and not produce any empty structures.
struct VS_INPUT
{
float4 Pos_in : SV_Position;
};
struct VS_OUTPUT
{
float4 Pos : SV_Position;
};
VS_OUTPUT main(VS_INPUT vsin, float4 Pos_loose : SV_Position)
{
VS_OUTPUT vsout;
vsout.Pos = vsin.Pos_in + Pos_loose;
return vsout;
}

View File

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

View File

@ -1223,6 +1223,16 @@ public:
typeName = NewPoolTString(copyOf.typeName->c_str()); typeName = NewPoolTString(copyOf.typeName->c_str());
} }
// Recursively make temporary
void makeTemporary()
{
getQualifier().makeTemporary();
if (isStruct())
for (unsigned int i = 0; i < structure->size(); ++i)
(*structure)[i].type->makeTemporary();
}
TType* clone() const TType* clone() const
{ {
TType *newType = new TType(); TType *newType = new TType();
@ -1309,6 +1319,20 @@ public:
virtual bool isImage() const { return basicType == EbtSampler && getSampler().isImage(); } virtual bool isImage() const { return basicType == EbtSampler && getSampler().isImage(); }
virtual bool isSubpass() const { return basicType == EbtSampler && getSampler().isSubpass(); } virtual bool isSubpass() const { return basicType == EbtSampler && getSampler().isSubpass(); }
// Return true if this is interstage IO
virtual bool isInterstageIO() const
{
switch (getQualifier().builtIn) {
case EbvPosition:
case EbvPointSize:
case EbvClipDistance:
case EbvCullDistance:
return true;
default:
return false;
}
}
// Recursively checks if the type contains the given basic type // Recursively checks if the type contains the given basic type
virtual bool containsBasicType(TBasicType checkType) const virtual bool containsBasicType(TBasicType checkType) const
{ {
@ -1376,6 +1400,34 @@ public:
return false; return false;
} }
// Recursively checks if the type contains an interstage IO builtin
virtual bool containsInterstageIO() const
{
if (isInterstageIO())
return true;
if (! structure)
return false;
for (unsigned int i = 0; i < structure->size(); ++i) {
if ((*structure)[i].type->containsInterstageIO())
return true;
}
return false;
}
// Recursively checks whether a struct contains only interstage IO
virtual bool containsOnlyInterstageIO() const
{
if (! structure)
return isInterstageIO();
for (unsigned int i = 0; i < structure->size(); ++i) {
if (!(*structure)[i].type->containsOnlyInterstageIO())
return false;
}
return true;
}
virtual bool containsNonOpaque() const virtual bool containsNonOpaque() const
{ {
// list all non-opaque types // list all non-opaque types

View File

@ -204,6 +204,9 @@ INSTANTIATE_TEST_CASE_P(
{"hlsl.shapeConvRet.frag", "main"}, {"hlsl.shapeConvRet.frag", "main"},
{"hlsl.stringtoken.frag", "main"}, {"hlsl.stringtoken.frag", "main"},
{"hlsl.string.frag", "main"}, {"hlsl.string.frag", "main"},
{"hlsl.struct.split-1.vert", "main"},
{"hlsl.struct.split.call.vert", "main"},
{"hlsl.struct.split.trivial.vert", "main"},
{"hlsl.structarray.flatten.frag", "main"}, {"hlsl.structarray.flatten.frag", "main"},
{"hlsl.structarray.flatten.geom", "main"}, {"hlsl.structarray.flatten.geom", "main"},
{"hlsl.structin.vert", "main"}, {"hlsl.structin.vert", "main"},

View File

@ -658,7 +658,7 @@ TIntermTyped* HlslParseContext::handleBracketDereference(const TSourceLoc& loc,
if (index->getQualifier().storage != EvqConst) if (index->getQualifier().storage != EvqConst)
error(loc, "Invalid variable index to flattened uniform array", base->getAsSymbolNode()->getName().c_str(), ""); error(loc, "Invalid variable index to flattened uniform array", base->getAsSymbolNode()->getName().c_str(), "");
result = flattenAccess(loc, base, indexValue); result = flattenAccess(base, indexValue);
flattened = (result != base); flattened = (result != base);
} else { } else {
if (index->getQualifier().storage == EvqConst) { if (index->getQualifier().storage == EvqConst) {
@ -834,15 +834,21 @@ TIntermTyped* HlslParseContext::handleDotDereference(const TSourceLoc& loc, TInt
} }
} }
if (fieldFound) { if (fieldFound) {
if (base->getAsSymbolNode() && (wasFlattened(base) || shouldFlatten(base->getType()))) if (base->getAsSymbolNode() && (wasFlattened(base) || shouldFlatten(base->getType()))) {
result = flattenAccess(loc, base, member); result = flattenAccess(base, member);
else { } else {
if (base->getType().getQualifier().storage == EvqConst) // Update the base and member to access if this was a split structure.
result = intermediate.foldDereference(base, member, loc); result = splitAccess(loc, base, member);
else { fields = base->getType().getStruct();
TIntermTyped* index = intermediate.addConstantUnion(member, loc);
result = intermediate.addIndex(EOpIndexDirectStruct, base, index, loc); if (result == nullptr) {
result->setType(*(*fields)[member].type); if (base->getType().getQualifier().storage == EvqConst)
result = intermediate.foldDereference(base, member, loc);
else {
TIntermTyped* index = intermediate.addConstantUnion(member, loc);
result = intermediate.addIndex(EOpIndexDirectStruct, base, index, loc);
result->setType(*(*fields)[member].type);
}
} }
} }
} else } else
@ -853,6 +859,82 @@ TIntermTyped* HlslParseContext::handleDotDereference(const TSourceLoc& loc, TInt
return result; return result;
} }
// Determine whether we should split this structure
bool HlslParseContext::shouldSplit(const TSourceLoc& loc, const TType& type)
{
if (! inEntryPoint)
return false;
const TStorageQualifier qualifier = type.getQualifier().storage;
if (type.containsInterstageIO() && type.containsStructure())
error(loc, "structure splitting not yet supported on nested structures", "", "");
// If it contains interstage IO, but not ONLY interstage IO, split the struct.
return (type.containsInterstageIO() && !type.containsOnlyInterstageIO()) &&
(qualifier == EvqVaryingIn || qualifier == EvqVaryingOut);
}
// Split the type of the node into two structs:
// 1. interstage IO
// 2. everything else
// IO members are put into the ioStruct. The type is modified to remove them.
void HlslParseContext::split(TIntermTyped* node)
{
if (node == nullptr)
return;
TIntermSymbol* symNode = node->getAsSymbolNode();
if (symNode == nullptr)
return;
// Create a new variable:
splitIoVars[symNode->getId()] = makeInternalVariable(symNode->getName(), split(*symNode->getType().clone()));
}
// Split the type of the variable into two structs:
void HlslParseContext::split(const TVariable& variable)
{
const TType& type = variable.getType();
// Create a new variable:
splitIoVars[variable.getUniqueId()] = makeInternalVariable(variable.getName(), split(*type.clone()));
}
// Recursive implementation of split(const TVariable& variable).
// Returns reference to the modified type.
TType& HlslParseContext::split(TType& type)
{
// We can ignore arrayness: it's uninvolved.
if (type.isStruct()) {
TTypeList* userStructure = type.getWritableStruct();
// Get iterator to (now at end) set of iterstage IO members
const auto firstIo = std::stable_partition(userStructure->begin(), userStructure->end(),
[](const TTypeLoc& t) {return !t.type->isInterstageIO();});
// Move these to the IO.
for (auto ioType = firstIo; ioType != userStructure->end(); ++ioType) {
const TType& memberType = *ioType->type;
TVariable* ioVar = makeInternalVariable(memberType.getFieldName(), memberType);
// Merge qualifier from the user structure
mergeQualifiers(ioVar->getWritableType().getQualifier(), type.getQualifier());
interstageIo[memberType.getQualifier().builtIn] = ioVar;
}
// Erase the IO vars from the user structure.
userStructure->erase(firstIo, userStructure->end());
// Recurse further into the members.
for (unsigned int i = 0; i < userStructure->size(); ++i)
split(*(*userStructure)[i].type);
}
return type;
}
// Determine whether we should flatten an arbitrary type. // Determine whether we should flatten an arbitrary type.
bool HlslParseContext::shouldFlatten(const TType& type) const bool HlslParseContext::shouldFlatten(const TType& type) const
{ {
@ -868,9 +950,16 @@ bool HlslParseContext::shouldFlattenIO(const TType& type) const
const TStorageQualifier qualifier = type.getQualifier().storage; const TStorageQualifier qualifier = type.getQualifier().storage;
return type.isStruct() && if (!type.isStruct())
(qualifier == EvqVaryingIn || return false;
qualifier == EvqVaryingOut);
// Regardless of stage, we flatten IO structs containing only interstage IO,
// to avoid degenerate structure splitting.
if (type.containsOnlyInterstageIO())
return true;
return ((language == EShLangVertex && qualifier == EvqVaryingIn) ||
(language == EShLangFragment && qualifier == EvqVaryingOut));
} }
// Is this a uniform array which should be flattened? // Is this a uniform array which should be flattened?
@ -891,7 +980,7 @@ void HlslParseContext::flatten(const TSourceLoc& loc, const TVariable& variable)
// emplace gives back a pair whose .first is an iterator to the item... // emplace gives back a pair whose .first is an iterator to the item...
auto entry = flattenMap.emplace(variable.getUniqueId(), auto entry = flattenMap.emplace(variable.getUniqueId(),
TFlattenData(type.getQualifier().layoutBinding)); TFlattenData(type.getQualifier().layoutBinding));
// ... and the item is a map pair, so first->second is the TFlattenData itself. // ... and the item is a map pair, so first->second is the TFlattenData itself.
flatten(loc, variable, type, entry.first->second, ""); flatten(loc, variable, type, entry.first->second, "");
} }
@ -926,11 +1015,11 @@ void HlslParseContext::flatten(const TSourceLoc& loc, const TVariable& variable)
int HlslParseContext::flatten(const TSourceLoc& loc, const TVariable& variable, const TType& type, int HlslParseContext::flatten(const TSourceLoc& loc, const TVariable& variable, const TType& type,
TFlattenData& flattenData, TString name) TFlattenData& flattenData, TString name)
{ {
// TODO: when struct splitting is in place we can remove this restriction. // This should be handled by structure splitting, not flattening.
if (language == EShLangGeometry) { if (language == EShLangGeometry) {
const TType derefType(type, 0); const TType derefType(type, 0);
if (!isFinalFlattening(derefType) && type.getQualifier().storage == EvqVaryingIn) if (!isFinalFlattening(derefType) && type.getQualifier().storage == EvqVaryingIn)
error(loc, "recursive type not yet supported in GS input", variable.getName().c_str(), ""); error(loc, "recursive type not supported in GS input", variable.getName().c_str(), "");
} }
// If something is an arrayed struct, the array flattener will recursively call flatten() // If something is an arrayed struct, the array flattener will recursively call flatten()
@ -953,7 +1042,7 @@ int HlslParseContext::addFlattenedMember(const TSourceLoc& loc,
{ {
if (isFinalFlattening(type)) { if (isFinalFlattening(type)) {
// This is as far as we flatten. Insert the variable. // This is as far as we flatten. Insert the variable.
TVariable* memberVariable = makeInternalVariable(memberName.c_str(), type); TVariable* memberVariable = makeInternalVariable(memberName, type);
mergeQualifiers(memberVariable->getWritableType().getQualifier(), variable.getType().getQualifier()); mergeQualifiers(memberVariable->getWritableType().getQualifier(), variable.getType().getQualifier());
if (flattenData.nextBinding != TQualifier::layoutBindingEnd) if (flattenData.nextBinding != TQualifier::layoutBindingEnd)
@ -1043,16 +1132,22 @@ int HlslParseContext::flattenArray(const TSourceLoc& loc, const TVariable& varia
// Return true if we have flattened this node. // Return true if we have flattened this node.
bool HlslParseContext::wasFlattened(const TIntermTyped* node) const bool HlslParseContext::wasFlattened(const TIntermTyped* node) const
{ {
return node != nullptr && return node != nullptr && node->getAsSymbolNode() != nullptr &&
node->getAsSymbolNode() != nullptr &&
wasFlattened(node->getAsSymbolNode()->getId()); wasFlattened(node->getAsSymbolNode()->getId());
} }
// Return true if we have split this structure
bool HlslParseContext::wasSplit(const TIntermTyped* node) const
{
return node != nullptr && node->getAsSymbolNode() != nullptr &&
wasSplit(node->getAsSymbolNode()->getId());
}
// Turn an access into an aggregate that was flattened to instead be // Turn an access into an aggregate that was flattened to instead be
// an access to the individual variable the member was flattened to. // an access to the individual variable the member was flattened to.
// Assumes shouldFlatten() or equivalent was called first. // Assumes shouldFlatten() or equivalent was called first.
TIntermTyped* HlslParseContext::flattenAccess(const TSourceLoc&, TIntermTyped* base, int member) TIntermTyped* HlslParseContext::flattenAccess(TIntermTyped* base, int member)
{ {
const TType dereferencedType(base->getType(), member); // dereferenced type const TType dereferencedType(base->getType(), member); // dereferenced type
@ -1078,6 +1173,75 @@ TIntermTyped* HlslParseContext::flattenAccess(const TSourceLoc&, TIntermTyped* b
} }
} }
// Find and return the split IO TVariable for id, or nullptr if none.
TVariable* HlslParseContext::getSplitIoVar(int id) const
{
const auto splitIoVar = splitIoVars.find(id);
if (splitIoVar == splitIoVars.end())
return nullptr;
return splitIoVar->second;
}
// Find and return the split IO TVariable for variable, or nullptr if none.
TVariable* HlslParseContext::getSplitIoVar(const TVariable* var) const
{
if (var == nullptr)
return nullptr;
return getSplitIoVar(var->getUniqueId());
}
// Find and return the split IO TVariable for symbol in this node, or nullptr if none.
TVariable* HlslParseContext::getSplitIoVar(const TIntermTyped* node) const
{
if (node == nullptr)
return nullptr;
const TIntermSymbol* symbolNode = node->getAsSymbolNode();
if (symbolNode == nullptr)
return nullptr;
return getSplitIoVar(symbolNode->getId());
}
// Turn an access into an aggregate that was split to instead be
// an access to either the modified variable, or one of the split
// member variables.
TIntermTyped* HlslParseContext::splitAccess(const TSourceLoc& loc, TIntermTyped*& base, int& member)
{
// nothing to do
if (base == nullptr || base->getAsSymbolNode() == nullptr)
return nullptr;
const TVariable* splitIoVar = getSplitIoVar(base);
if (splitIoVar == nullptr)
return nullptr;
const TTypeList& members = *base->getType().getStruct();
if (members[member].type->isInterstageIO()) {
// It's one of the interstage IO variables we split out.
return intermediate.addSymbol(*interstageIo[members[member].type->getQualifier().builtIn], loc);
} else {
// It's not an IO variable. Find the equivalent index into the new variable.
base = intermediate.addSymbol(*splitIoVar, loc);
int newMember = 0;
for (int m=0; m<member; ++m)
if (!members[m].type->isInterstageIO())
++newMember;
member = newMember;
return nullptr;
}
}
// Variables that correspond to the user-interface in and out of a stage // Variables that correspond to the user-interface in and out of a stage
// (not the built-in interface) are assigned locations and // (not the built-in interface) are assigned locations and
// registered as a linkage node (part of the stage's external interface). // registered as a linkage node (part of the stage's external interface).
@ -1105,8 +1269,11 @@ void HlslParseContext::assignLocations(TVariable& variable)
auto& memberList = flattenMap[variable.getUniqueId()].members; auto& memberList = flattenMap[variable.getUniqueId()].members;
for (auto member = memberList.begin(); member != memberList.end(); ++member) for (auto member = memberList.begin(); member != memberList.end(); ++member)
assignLocation(**member); assignLocation(**member);
} else } else if (wasSplit(variable.getUniqueId())) {
assignLocation(*getSplitIoVar(&variable));
} else {
assignLocation(variable); assignLocation(variable);
}
} }
// //
@ -1150,6 +1317,25 @@ TFunction& HlslParseContext::handleFunctionDeclarator(const TSourceLoc& loc, TFu
return function; return function;
} }
// Add interstage IO variables to the linkage in canonical order.
void HlslParseContext::addInterstageIoToLinkage()
{
if (inEntryPoint) {
std::vector<TBuiltInVariable> io;
io.reserve(interstageIo.size());
for (auto ioVar = interstageIo.begin(); ioVar != interstageIo.end(); ++ioVar)
io.push_back(ioVar->first);
// Our canonical order is the TBuiltInVariable value order.
std::sort(io.begin(), io.end());
for (int ioVar = 0; ioVar < int(io.size()); ++ioVar)
trackLinkageDeferred(*interstageIo[io[ioVar]]);
}
}
// //
// Handle seeing the function prototype in front of a function definition in the grammar. // Handle seeing the function prototype in front of a function definition in the grammar.
// The body is handled after this function returns. // The body is handled after this function returns.
@ -1188,6 +1374,8 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l
if (entryPointOutput) { if (entryPointOutput) {
if (shouldFlatten(entryPointOutput->getType())) if (shouldFlatten(entryPointOutput->getType()))
flatten(loc, *entryPointOutput); flatten(loc, *entryPointOutput);
if (shouldSplit(loc, entryPointOutput->getType()))
split(*entryPointOutput);
assignLocations(*entryPointOutput); assignLocations(*entryPointOutput);
} }
} else } else
@ -1215,7 +1403,15 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l
for (int i = 0; i < function.getParamCount(); i++) { for (int i = 0; i < function.getParamCount(); i++) {
TParameter& param = function[i]; TParameter& param = function[i];
if (param.name != nullptr) { if (param.name != nullptr) {
TVariable *variable = new TVariable(param.name, *param.type); TType* sanitizedType;
// If we're not in the entry point, parameters are sanitized types.
if (inEntryPoint)
sanitizedType = param.type;
else
sanitizedType = sanitizeType(param.type);
TVariable *variable = new TVariable(param.name, *sanitizedType);
// Insert the parameters with name in the symbol table. // Insert the parameters with name in the symbol table.
if (! symbolTable.insert(*variable)) if (! symbolTable.insert(*variable))
@ -1225,6 +1421,8 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l
if (inEntryPoint) { if (inEntryPoint) {
if (shouldFlatten(*param.type)) if (shouldFlatten(*param.type))
flatten(loc, *variable); flatten(loc, *variable);
if (shouldSplit(loc, *param.type))
split(*variable);
assignLocations(*variable); assignLocations(*variable);
} }
@ -1239,6 +1437,7 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l
} else } else
paramNodes = intermediate.growAggregate(paramNodes, intermediate.addSymbol(*param.type, loc), loc); paramNodes = intermediate.growAggregate(paramNodes, intermediate.addSymbol(*param.type, loc), loc);
} }
intermediate.setAggregateOperator(paramNodes, EOpParameters, TType(EbtVoid), loc); intermediate.setAggregateOperator(paramNodes, EOpParameters, TType(EbtVoid), loc);
loopNestingLevel = 0; loopNestingLevel = 0;
controlFlowNestingLevel = 0; controlFlowNestingLevel = 0;
@ -1373,10 +1572,12 @@ TIntermNode* HlslParseContext::handleReturnValue(const TSourceLoc& loc, TIntermT
return intermediate.addBranch(EOpReturn, value, loc); return intermediate.addBranch(EOpReturn, value, loc);
} }
void HlslParseContext::handleFunctionArgument(TFunction* function, TIntermTyped*& arguments, TIntermTyped* newArg) void HlslParseContext::handleFunctionArgument(TFunction* function,
TIntermTyped*& arguments, TIntermTyped* newArg)
{ {
TParameter param = { 0, new TType }; TParameter param = { 0, new TType };
param.type->shallowCopy(newArg->getType()); param.type->shallowCopy(newArg->getType());
function->addParameter(param); function->addParameter(param);
if (arguments) if (arguments)
arguments = intermediate.growAggregate(arguments, newArg); arguments = intermediate.growAggregate(arguments, newArg);
@ -1392,14 +1593,15 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
if (left == nullptr || right == nullptr) if (left == nullptr || right == nullptr)
return nullptr; return nullptr;
const auto mustFlatten = [&](const TIntermTyped& node) { const bool splitLeft = wasSplit(left);
return wasFlattened(&node) && node.getAsSymbolNode() && const bool splitRight = wasSplit(right);
flattenMap.find(node.getAsSymbolNode()->getId()) != flattenMap.end();
};
const bool flattenLeft = mustFlatten(*left); const bool flattenLeft = wasFlattened(left);
const bool flattenRight = mustFlatten(*right); const bool flattenRight = wasFlattened(right);
if (! flattenLeft && ! flattenRight)
// OK to do a single assign if both are split, or both are unsplit. But if one is and the other
// isn't, we fall back to a memberwise copy.
if (! flattenLeft && ! flattenRight && !splitLeft && !splitRight)
return intermediate.addAssign(op, left, right, loc); return intermediate.addAssign(op, left, right, loc);
TIntermAggregate* assignList = nullptr; TIntermAggregate* assignList = nullptr;
@ -1456,11 +1658,15 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
int memberIdx = 0; int memberIdx = 0;
const auto getMember = [&](bool flatten, TIntermTyped* node, const auto getMember = [&](bool flatten, bool split, TIntermTyped* node,
const TVector<TVariable*>& memberVariables, int member, const TVector<TVariable*>& memberVariables, int member,
TOperator op, const TType& memberType) -> TIntermTyped * { TOperator op, const TType& memberType) -> TIntermTyped * {
TIntermTyped* subTree; TIntermTyped* subTree;
if (flatten && isFinalFlattening(memberType)) {
if (split && memberType.isInterstageIO()) {
// copy from interstage IO variable if needed
subTree = intermediate.addSymbol(*interstageIo.find(memberType.getQualifier().builtIn)->second);
} else if (flatten && isFinalFlattening(memberType)) {
subTree = intermediate.addSymbol(*memberVariables[memberIdx++]); subTree = intermediate.addSymbol(*memberVariables[memberIdx++]);
} else { } else {
subTree = intermediate.addIndex(op, node, intermediate.addConstantUnion(member, loc), loc); subTree = intermediate.addIndex(op, node, intermediate.addConstantUnion(member, loc), loc);
@ -1470,6 +1676,21 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
return subTree; return subTree;
}; };
// Use the proper RHS node: a new symbol from a TVariable, copy
// of an TIntermSymbol node, or sometimes the right node directly.
right = rhsTempVar ? intermediate.addSymbol(*rhsTempVar, loc) :
cloneSymNode ? intermediate.addSymbol(*cloneSymNode) :
right;
TIntermTyped* leftVar = left;
TIntermTyped* rightVar = right;
// If either left or right was a split structure, use the split form when reading and writing
if (splitLeft)
leftVar = intermediate.addSymbol(*getSplitIoVar(left), loc);
if (splitRight)
rightVar = intermediate.addSymbol(*getSplitIoVar(right), loc);
// Cannot use auto here, because this is recursive, and auto can't work out the type without seeing the // Cannot use auto here, because this is recursive, and auto can't work out the type without seeing the
// whole thing. So, we'll resort to an explicit type via std::function. // whole thing. So, we'll resort to an explicit type via std::function.
const std::function<void(TIntermTyped* left, TIntermTyped* right)> const std::function<void(TIntermTyped* left, TIntermTyped* right)>
@ -1483,9 +1704,9 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
for (int element=0; element < left->getType().getOuterArraySize(); ++element) { for (int element=0; element < left->getType().getOuterArraySize(); ++element) {
// Add a new AST symbol node if we have a temp variable holding a complex RHS. // Add a new AST symbol node if we have a temp variable holding a complex RHS.
TIntermTyped* subRight = getMember(flattenRight, right, *rightVariables, element, TIntermTyped* subRight = getMember(flattenRight, splitRight, right, *rightVariables, element,
EOpIndexDirect, dereferencedType); EOpIndexDirect, dereferencedType);
TIntermTyped* subLeft = getMember(flattenLeft, left, *leftVariables, element, TIntermTyped* subLeft = getMember(flattenLeft, splitLeft, left, *leftVariables, element,
EOpIndexDirect, dereferencedType); EOpIndexDirect, dereferencedType);
if (isFinalFlattening(dereferencedType)) if (isFinalFlattening(dereferencedType))
@ -1495,18 +1716,32 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
} }
} else if (left->getType().isStruct()) { } else if (left->getType().isStruct()) {
// struct case // struct case
const auto& members = *left->getType().getStruct(); const auto& membersL = *left->getType().getStruct();
const auto& membersR = *right->getType().getStruct();
for (int member = 0; member < (int)members.size(); ++member) { // These track the members in the split structures corresponding to the same in the unsplit structures.
TIntermTyped* subRight = getMember(flattenRight, right, *rightVariables, member, int memberL = 0;
EOpIndexDirectStruct, *members[member].type); int memberR = 0;
TIntermTyped* subLeft = getMember(flattenLeft, left, *leftVariables, member,
EOpIndexDirectStruct, *members[member].type);
if (isFinalFlattening(*members[member].type)) for (int member = 0; member < int(membersL.size()); ++member) {
assignList = intermediate.growAggregate(assignList, intermediate.addAssign(op, subLeft, subRight, loc), loc); const TType& typeL = *membersL[member].type;
else const TType& typeR = *membersR[member].type;
TIntermTyped* subLeft = getMember(flattenLeft, splitLeft, leftVar, *leftVariables,
memberL, EOpIndexDirectStruct, typeL);
TIntermTyped* subRight = getMember(flattenRight, splitRight, rightVar, *rightVariables,
memberR, EOpIndexDirectStruct, typeR);
if (!isFinalFlattening(typeL)) {
// TODO: if we're not flattening, that means we got here because of struct splitting, and
// we could copy whole sub-structures at once as long as they do not contain interstage IO themselves.
traverse(subLeft, subRight); traverse(subLeft, subRight);
} else {
assignList = intermediate.growAggregate(assignList, intermediate.addAssign(op, subLeft, subRight, loc), loc);
}
memberL += (typeL.isInterstageIO() ? 0 : 1);
memberR += (typeR.isInterstageIO() ? 0 : 1);
} }
} else { } else {
assert(0); // we should never be called on a non-flattenable thing, because assert(0); // we should never be called on a non-flattenable thing, because
@ -1515,12 +1750,6 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
}; };
// Use the proper RHS node: a new symbol from a TVariable, copy
// of an TIntermSymbol node, or sometimes the right node directly.
right = rhsTempVar ? intermediate.addSymbol(*rhsTempVar, loc) :
cloneSymNode ? intermediate.addSymbol(*cloneSymNode) :
right;
// This makes the whole assignment, recursing through subtypes as needed. // This makes the whole assignment, recursing through subtypes as needed.
traverse(left, right); traverse(left, right);
@ -2214,9 +2443,9 @@ void HlslParseContext::decomposeGeometryMethods(const TSourceLoc& loc, TIntermTy
emit->setType(TType(EbtVoid)); emit->setType(TType(EbtVoid));
sequence = intermediate.growAggregate(sequence, sequence = intermediate.growAggregate(sequence,
intermediate.addAssign(EOpAssign, handleAssign(loc, EOpAssign,
argAggregate->getSequence()[0]->getAsTyped(), argAggregate->getSequence()[0]->getAsTyped(),
argAggregate->getSequence()[1]->getAsTyped(), loc), argAggregate->getSequence()[1]->getAsTyped()),
loc); loc);
sequence = intermediate.growAggregate(sequence, emit); sequence = intermediate.growAggregate(sequence, emit);
@ -2819,7 +3048,7 @@ void HlslParseContext::addInputArgumentConversions(const TFunction& function, TI
else else
error(arg->getLoc(), "cannot convert input argument, argument", "", "%d", i); error(arg->getLoc(), "cannot convert input argument, argument", "", "%d", i);
} else { } else {
if (wasFlattened(arg)) { if (wasFlattened(arg) || wasSplit(arg)) {
// Will make a two-level subtree. // Will make a two-level subtree.
// The deepest will copy member-by-member to build the structure to pass. // The deepest will copy member-by-member to build the structure to pass.
// The level above that will be a two-operand EOpComma sequence that follows the copy by the // The level above that will be a two-operand EOpComma sequence that follows the copy by the
@ -4720,6 +4949,35 @@ void HlslParseContext::declareTypedef(const TSourceLoc& loc, TString& identifier
error(loc, "name already defined", "typedef", identifier.c_str()); error(loc, "name already defined", "typedef", identifier.c_str());
} }
// Type sanitization: return existing sanitized (temporary) type if there is one, else make new one.
TType* HlslParseContext::sanitizeType(TType* type)
{
// We only do this for structs.
if (!type->isStruct())
return type;
// Type sanitization: if this is declaring a variable of a type that contains
// interstage IO, we want to make it a temporary.
const auto sanitizedTypeIter = sanitizedTypeMap.find(type->getStruct());
if (sanitizedTypeIter != sanitizedTypeMap.end()) {
// We've sanitized this before. Use that one.
return sanitizedTypeIter->second;
} else {
if (type->containsInterstageIO()) {
// This means the type contains interstage IO, but we've never encountered it before.
// Copy it, sanitize it, and remember it in the sanitizedTypeMap
TType* sanitizedType = type->clone();
sanitizedType->makeTemporary();
sanitizedTypeMap[type->getStruct()] = sanitizedType;
return sanitizedType;
} else {
// This means the type has no interstage IO, so we can use it as is.
return type;
}
}
}
// //
// Do everything necessary to handle a variable (non-block) declaration. // Do everything necessary to handle a variable (non-block) declaration.
// Either redeclaring a variable, or making a new one, updating the symbol // Either redeclaring a variable, or making a new one, updating the symbol
@ -4742,15 +5000,20 @@ TIntermNode* HlslParseContext::declareVariable(const TSourceLoc& loc, TString& i
inheritGlobalDefaults(type.getQualifier()); inheritGlobalDefaults(type.getQualifier());
const bool flattenVar = shouldFlatten(type); const bool flattenVar = shouldFlatten(type);
const bool splitVar = shouldSplit(loc, type);
// Type sanitization: if this is declaring a variable of a type that contains
// interstage IO, we want to make it a temporary.
TType* sanitizedType = sanitizeType(&type);
// Declare the variable // Declare the variable
if (type.isArray()) { if (type.isArray()) {
// array case // array case
declareArray(loc, identifier, type, symbol, !flattenVar); declareArray(loc, identifier, *sanitizedType, symbol, !flattenVar);
} else { } else {
// non-array case // non-array case
if (! symbol) if (! symbol)
symbol = declareNonArray(loc, identifier, type, !flattenVar); symbol = declareNonArray(loc, identifier, *sanitizedType, !flattenVar);
else if (type != symbol->getType()) else if (type != symbol->getType())
error(loc, "cannot change the type of", "redeclaration", symbol->getName().c_str()); error(loc, "cannot change the type of", "redeclaration", symbol->getName().c_str());
} }
@ -4758,6 +5021,9 @@ TIntermNode* HlslParseContext::declareVariable(const TSourceLoc& loc, TString& i
if (flattenVar) if (flattenVar)
flatten(loc, *symbol->getAsVariable()); flatten(loc, *symbol->getAsVariable());
if (splitVar)
split(*symbol->getAsVariable());
if (! symbol) if (! symbol)
return nullptr; return nullptr;
@ -5792,4 +6058,13 @@ void HlslParseContext::renameShaderFunction(TString*& name) const
name = new TString(intermediate.getEntryPointName().c_str()); name = new TString(intermediate.getEntryPointName().c_str());
} }
// post-processing
void HlslParseContext::finish()
{
addInterstageIoToLinkage();
TParseContextBase::finish();
}
} // end namespace glslang } // end namespace glslang

View File

@ -185,6 +185,9 @@ protected:
void inheritGlobalDefaults(TQualifier& dst) const; void inheritGlobalDefaults(TQualifier& dst) const;
TVariable* makeInternalVariable(const char* name, const TType&) const; TVariable* makeInternalVariable(const char* name, const TType&) const;
TVariable* makeInternalVariable(const TString& name, const TType& type) const {
return makeInternalVariable(name.c_str(), type);
}
TVariable* declareNonArray(const TSourceLoc&, TString& identifier, TType&, bool track); TVariable* declareNonArray(const TSourceLoc&, TString& identifier, TType&, bool track);
void declareArray(const TSourceLoc&, TString& identifier, const TType&, TSymbol*&, bool track); void declareArray(const TSourceLoc&, TString& identifier, const TType&, TSymbol*&, bool track);
TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable); TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable);
@ -197,7 +200,7 @@ protected:
// Array and struct flattening // Array and struct flattening
bool shouldFlatten(const TType& type) const; bool shouldFlatten(const TType& type) const;
TIntermTyped* flattenAccess(const TSourceLoc&, TIntermTyped* base, int member); TIntermTyped* flattenAccess(TIntermTyped* base, int member);
bool shouldFlattenIO(const TType&) const; bool shouldFlattenIO(const TType&) const;
bool shouldFlattenUniform(const TType&) const; bool shouldFlattenUniform(const TType&) const;
bool wasFlattened(const TIntermTyped* node) const; bool wasFlattened(const TIntermTyped* node) const;
@ -205,11 +208,29 @@ protected:
int addFlattenedMember(const TSourceLoc& loc, const TVariable&, const TType&, TFlattenData&, const TString& name, bool track); int addFlattenedMember(const TSourceLoc& loc, const TVariable&, const TType&, TFlattenData&, const TString& name, bool track);
bool isFinalFlattening(const TType& type) const { return !(type.isStruct() || type.isArray()); } bool isFinalFlattening(const TType& type) const { return !(type.isStruct() || type.isArray()); }
// Structure splitting (splits interstage builtin types into its own struct)
bool shouldSplit(const TSourceLoc& loc, const TType&);
TIntermTyped* splitAccess(const TSourceLoc& loc, TIntermTyped*& base, int& member);
TType& split(TType& type);
void split(TIntermTyped*);
void split(const TVariable&);
bool wasSplit(const TIntermTyped* node) const;
bool wasSplit(int id) const { return splitIoVars.find(id) != splitIoVars.end(); }
TVariable* getSplitIoVar(const TIntermTyped* node) const;
TVariable* getSplitIoVar(const TVariable* var) const;
TVariable* getSplitIoVar(int id) const;
void addInterstageIoToLinkage();
void flatten(const TSourceLoc& loc, const TVariable& variable); void flatten(const TSourceLoc& loc, const TVariable& variable);
int flatten(const TSourceLoc& loc, const TVariable& variable, const TType&, TFlattenData&, TString name); int flatten(const TSourceLoc& loc, const TVariable& variable, const TType&, TFlattenData&, TString name);
int flattenStruct(const TSourceLoc& loc, const TVariable& variable, const TType&, TFlattenData&, TString name); int flattenStruct(const TSourceLoc& loc, const TVariable& variable, const TType&, TFlattenData&, TString name);
int flattenArray(const TSourceLoc& loc, const TVariable& variable, const TType&, TFlattenData&, TString name); int flattenArray(const TSourceLoc& loc, const TVariable& variable, const TType&, TFlattenData&, TString name);
// Type sanitization: return existing sanitized (temporary) type if there is one, else make new one.
TType* sanitizeType(TType*);
void finish(); // post-processing
// Current state of parsing // Current state of parsing
struct TPragma contextPragma; struct TPragma contextPragma;
int loopNestingLevel; // 0 if outside all loops int loopNestingLevel; // 0 if outside all loops
@ -275,6 +296,14 @@ protected:
TVector<int> flattenLevel; // nested postfix operator level for flattening TVector<int> flattenLevel; // nested postfix operator level for flattening
TVector<int> flattenOffset; // cumulative offset for flattening TVector<int> flattenOffset; // cumulative offset for flattening
// Sanitized type map. During declarations we use the sanitized form of the type
// if it exists.
TMap<const TTypeList*, TType*> sanitizedTypeMap;
// Structure splitting data:
TMap<TBuiltInVariable, TVariable*> interstageIo; // new structure created for interstage IO from user structs.
TMap<int, TVariable*> splitIoVars; // individual flattened variables
unsigned int nextInLocation; unsigned int nextInLocation;
unsigned int nextOutLocation; unsigned int nextOutLocation;