From e2cda3c2d755d58fe09f737f5b53efb24dba0329 Mon Sep 17 00:00:00 2001 From: LoopDawg Date: Wed, 23 Aug 2017 12:34:42 -0600 Subject: [PATCH] HLSL: handle clip and cull distance input builtin type conversion HLSL allows a range of types for clip and cull distances. There are three dimensions, including arrayness, vectorness, and semantic ID. SPIR-V requires clip and cull distance be a single array of floats in all cases. This code provides input side conversion between the SPIR-V form and the HLSL form. (Output conversion was added in PR #947 and #997). This PR extends HlslParseContext::assignClipCullDistance to cope with the input side conversion. Not as much changed as appears: there was also a lot of renaming to reflect the fact that the code now handles either direction. Currently, non-{frag,vert} stages are not handled, and are explicitly rejected. Fixes #1026. --- Test/baseResults/hlsl.clipdistance-1.frag.out | 190 ++++++++++++ Test/baseResults/hlsl.clipdistance-1.geom.out | 153 ++++++++++ Test/baseResults/hlsl.clipdistance-2.frag.out | 419 ++++++++++++++++++++++++++ Test/baseResults/hlsl.clipdistance-2.geom.out | 171 +++++++++++ Test/baseResults/hlsl.clipdistance-3.frag.out | 190 ++++++++++++ Test/baseResults/hlsl.clipdistance-4.frag.out | 262 ++++++++++++++++ Test/baseResults/hlsl.clipdistance-5.frag.out | 325 ++++++++++++++++++++ Test/baseResults/hlsl.clipdistance-6.frag.out | 399 ++++++++++++++++++++++++ Test/baseResults/hlsl.clipdistance-7.frag.out | 385 +++++++++++++++++++++++ Test/baseResults/hlsl.clipdistance-8.frag.out | 285 ++++++++++++++++++ Test/baseResults/hlsl.clipdistance-9.frag.out | 250 +++++++++++++++ Test/baseResults/hlsl.semantic.geom.out | 177 +---------- Test/baseResults/hlsl.semantic.vert.out | 20 +- Test/hlsl.clipdistance-1.frag | 6 + Test/hlsl.clipdistance-1.geom | 22 ++ Test/hlsl.clipdistance-2.frag | 7 + Test/hlsl.clipdistance-2.geom | 19 ++ Test/hlsl.clipdistance-3.frag | 8 + Test/hlsl.clipdistance-4.frag | 9 + Test/hlsl.clipdistance-5.frag | 9 + Test/hlsl.clipdistance-6.frag | 10 + Test/hlsl.clipdistance-7.frag | 10 + Test/hlsl.clipdistance-8.frag | 10 + Test/hlsl.clipdistance-9.frag | 8 + gtests/Hlsl.FromFile.cpp | 11 + hlsl/hlslParseHelper.cpp | 160 ++++++---- hlsl/hlslParseHelper.h | 4 +- 27 files changed, 3272 insertions(+), 247 deletions(-) create mode 100644 Test/baseResults/hlsl.clipdistance-1.frag.out create mode 100644 Test/baseResults/hlsl.clipdistance-1.geom.out create mode 100644 Test/baseResults/hlsl.clipdistance-2.frag.out create mode 100644 Test/baseResults/hlsl.clipdistance-2.geom.out create mode 100644 Test/baseResults/hlsl.clipdistance-3.frag.out create mode 100644 Test/baseResults/hlsl.clipdistance-4.frag.out create mode 100644 Test/baseResults/hlsl.clipdistance-5.frag.out create mode 100644 Test/baseResults/hlsl.clipdistance-6.frag.out create mode 100644 Test/baseResults/hlsl.clipdistance-7.frag.out create mode 100644 Test/baseResults/hlsl.clipdistance-8.frag.out create mode 100644 Test/baseResults/hlsl.clipdistance-9.frag.out create mode 100644 Test/hlsl.clipdistance-1.frag create mode 100644 Test/hlsl.clipdistance-1.geom create mode 100644 Test/hlsl.clipdistance-2.frag create mode 100644 Test/hlsl.clipdistance-2.geom create mode 100644 Test/hlsl.clipdistance-3.frag create mode 100644 Test/hlsl.clipdistance-4.frag create mode 100644 Test/hlsl.clipdistance-5.frag create mode 100644 Test/hlsl.clipdistance-6.frag create mode 100644 Test/hlsl.clipdistance-7.frag create mode 100644 Test/hlsl.clipdistance-8.frag create mode 100644 Test/hlsl.clipdistance-9.frag diff --git a/Test/baseResults/hlsl.clipdistance-1.frag.out b/Test/baseResults/hlsl.clipdistance-1.frag.out new file mode 100644 index 0000000..70465c8 --- /dev/null +++ b/Test/baseResults/hlsl.clipdistance-1.frag.out @@ -0,0 +1,190 @@ +hlsl.clipdistance-1.frag +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:4 Function Definition: @main(vf4;f1;f1; ( temp 4-component vector of float) +0:4 Function Parameters: +0:4 'pos' ( in 4-component vector of float) +0:4 'clip' ( in float) +0:4 'cull' ( in float) +0:? Sequence +0:5 Branch: Return with expression +0:5 add ( temp 4-component vector of float) +0:5 add ( temp 4-component vector of float) +0:5 'pos' ( in 4-component vector of float) +0:5 'clip' ( in float) +0:5 'cull' ( in float) +0:4 Function Definition: main( ( temp void) +0:4 Function Parameters: +0:? Sequence +0:4 move second child to first child ( temp 4-component vector of float) +0:? 'pos' ( temp 4-component vector of float) +0:? 'pos' ( in 4-component vector of float FragCoord) +0:? Sequence +0:4 move second child to first child ( temp float) +0:? 'clip' ( temp float) +0:4 direct index ( temp float) +0:? 'clip' ( in 1-element array of float ClipDistance) +0:4 Constant: +0:4 0 (const int) +0:? Sequence +0:4 move second child to first child ( temp float) +0:? 'cull' ( temp float) +0:4 direct index ( temp float) +0:? 'cull' ( in 1-element array of float CullDistance) +0:4 Constant: +0:4 0 (const int) +0:4 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:4 Function Call: @main(vf4;f1;f1; ( temp 4-component vector of float) +0:? 'pos' ( temp 4-component vector of float) +0:? 'clip' ( temp float) +0:? 'cull' ( temp float) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:? 'pos' ( in 4-component vector of float FragCoord) +0:? 'clip' ( in 1-element array of float ClipDistance) +0:? 'cull' ( in 1-element array of float CullDistance) + + +Linked fragment stage: + + +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:4 Function Definition: @main(vf4;f1;f1; ( temp 4-component vector of float) +0:4 Function Parameters: +0:4 'pos' ( in 4-component vector of float) +0:4 'clip' ( in float) +0:4 'cull' ( in float) +0:? Sequence +0:5 Branch: Return with expression +0:5 add ( temp 4-component vector of float) +0:5 add ( temp 4-component vector of float) +0:5 'pos' ( in 4-component vector of float) +0:5 'clip' ( in float) +0:5 'cull' ( in float) +0:4 Function Definition: main( ( temp void) +0:4 Function Parameters: +0:? Sequence +0:4 move second child to first child ( temp 4-component vector of float) +0:? 'pos' ( temp 4-component vector of float) +0:? 'pos' ( in 4-component vector of float FragCoord) +0:? Sequence +0:4 move second child to first child ( temp float) +0:? 'clip' ( temp float) +0:4 direct index ( temp float) +0:? 'clip' ( in 1-element array of float ClipDistance) +0:4 Constant: +0:4 0 (const int) +0:? Sequence +0:4 move second child to first child ( temp float) +0:? 'cull' ( temp float) +0:4 direct index ( temp float) +0:? 'cull' ( in 1-element array of float CullDistance) +0:4 Constant: +0:4 0 (const int) +0:4 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:4 Function Call: @main(vf4;f1;f1; ( temp 4-component vector of float) +0:? 'pos' ( temp 4-component vector of float) +0:? 'clip' ( temp float) +0:? 'cull' ( temp float) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:? 'pos' ( in 4-component vector of float FragCoord) +0:? 'clip' ( in 1-element array of float ClipDistance) +0:? 'cull' ( in 1-element array of float CullDistance) + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 53 + + Capability Shader + Capability ClipDistance + Capability CullDistance + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 27 34 41 45 + ExecutionMode 4 OriginUpperLeft + Source HLSL 500 + Name 4 "main" + Name 14 "@main(vf4;f1;f1;" + Name 11 "pos" + Name 12 "clip" + Name 13 "cull" + Name 25 "pos" + Name 27 "pos" + Name 29 "clip" + Name 34 "clip" + Name 40 "cull" + Name 41 "cull" + Name 45 "@entryPointOutput" + Name 46 "param" + Name 48 "param" + Name 50 "param" + Decorate 27(pos) BuiltIn FragCoord + Decorate 34(clip) BuiltIn ClipDistance + Decorate 41(cull) BuiltIn CullDistance + Decorate 45(@entryPointOutput) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Function 7(fvec4) + 9: TypePointer Function 6(float) + 10: TypeFunction 7(fvec4) 8(ptr) 9(ptr) 9(ptr) + 26: TypePointer Input 7(fvec4) + 27(pos): 26(ptr) Variable Input + 30: TypeInt 32 0 + 31: 30(int) Constant 1 + 32: TypeArray 6(float) 31 + 33: TypePointer Input 32 + 34(clip): 33(ptr) Variable Input + 35: TypeInt 32 1 + 36: 35(int) Constant 0 + 37: TypePointer Input 6(float) + 41(cull): 33(ptr) Variable Input + 44: TypePointer Output 7(fvec4) +45(@entryPointOutput): 44(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 25(pos): 8(ptr) Variable Function + 29(clip): 9(ptr) Variable Function + 40(cull): 9(ptr) Variable Function + 46(param): 8(ptr) Variable Function + 48(param): 9(ptr) Variable Function + 50(param): 9(ptr) Variable Function + 28: 7(fvec4) Load 27(pos) + Store 25(pos) 28 + 38: 37(ptr) AccessChain 34(clip) 36 + 39: 6(float) Load 38 + Store 29(clip) 39 + 42: 37(ptr) AccessChain 41(cull) 36 + 43: 6(float) Load 42 + Store 40(cull) 43 + 47: 7(fvec4) Load 25(pos) + Store 46(param) 47 + 49: 6(float) Load 29(clip) + Store 48(param) 49 + 51: 6(float) Load 40(cull) + Store 50(param) 51 + 52: 7(fvec4) FunctionCall 14(@main(vf4;f1;f1;) 46(param) 48(param) 50(param) + Store 45(@entryPointOutput) 52 + Return + FunctionEnd +14(@main(vf4;f1;f1;): 7(fvec4) Function None 10 + 11(pos): 8(ptr) FunctionParameter + 12(clip): 9(ptr) FunctionParameter + 13(cull): 9(ptr) FunctionParameter + 15: Label + 16: 7(fvec4) Load 11(pos) + 17: 6(float) Load 12(clip) + 18: 7(fvec4) CompositeConstruct 17 17 17 17 + 19: 7(fvec4) FAdd 16 18 + 20: 6(float) Load 13(cull) + 21: 7(fvec4) CompositeConstruct 20 20 20 20 + 22: 7(fvec4) FAdd 19 21 + ReturnValue 22 + FunctionEnd diff --git a/Test/baseResults/hlsl.clipdistance-1.geom.out b/Test/baseResults/hlsl.clipdistance-1.geom.out new file mode 100644 index 0000000..c9263bc --- /dev/null +++ b/Test/baseResults/hlsl.clipdistance-1.geom.out @@ -0,0 +1,153 @@ +hlsl.clipdistance-1.geom +ERROR: 0:13: '' : unimplemented: clip/cull not currently implemented for this stage +ERROR: 0:13: '' : unimplemented: clip/cull not currently implemented for this stage +ERROR: 0:20: '' : unimplemented: clip/cull not currently implemented for this stage +ERROR: 0:20: '' : unimplemented: clip/cull not currently implemented for this stage +ERROR: 4 compilation errors. No code generated. + + +Shader version: 500 +invocations = -1 +max_vertices = 3 +input primitive = triangles +output primitive = line_strip +ERROR: node is still EOpNull! +0:13 Function Definition: @main(vf4[3];u1[3];struct-S-vf4-f1-f11;f1[3];f1[3]; ( temp void) +0:13 Function Parameters: +0:13 'pos' ( in 3-element array of 4-component vector of float) +0:13 'VertexID' ( in 3-element array of uint) +0:13 'OutputStream' ( out structure{ temp 4-component vector of float pos, temp float clip, temp float cull}) +0:13 'clip' ( in 3-element array of float) +0:13 'cull' ( in 3-element array of float) +0:? Sequence +0:16 move second child to first child ( temp 4-component vector of float) +0:16 pos: direct index for structure ( temp 4-component vector of float) +0:16 's' ( temp structure{ temp 4-component vector of float pos, temp float clip, temp float cull}) +0:16 Constant: +0:16 0 (const int) +0:16 direct index ( temp 4-component vector of float) +0:16 'pos' ( in 3-element array of 4-component vector of float) +0:16 Constant: +0:16 0 (const int) +0:17 move second child to first child ( temp float) +0:17 clip: direct index for structure ( temp float) +0:17 's' ( temp structure{ temp 4-component vector of float pos, temp float clip, temp float cull}) +0:17 Constant: +0:17 1 (const int) +0:17 direct index ( temp float) +0:17 'clip' ( in 3-element array of float) +0:17 Constant: +0:17 0 (const int) +0:18 move second child to first child ( temp float) +0:18 cull: direct index for structure ( temp float) +0:18 's' ( temp structure{ temp 4-component vector of float pos, temp float clip, temp float cull}) +0:18 Constant: +0:18 2 (const int) +0:18 direct index ( temp float) +0:18 'cull' ( in 3-element array of float) +0:18 Constant: +0:18 0 (const int) +0:20 Sequence +0:20 Sequence +0:20 move second child to first child ( temp 4-component vector of float) +0:? 'OutputStream.pos' ( out 4-component vector of float Position) +0:20 pos: direct index for structure ( temp 4-component vector of float) +0:20 's' ( temp structure{ temp 4-component vector of float pos, temp float clip, temp float cull}) +0:20 Constant: +0:20 0 (const int) +0:20 EmitVertex ( temp void) +0:13 Function Definition: main( ( temp void) +0:13 Function Parameters: +0:? Sequence +0:13 move second child to first child ( temp 3-element array of 4-component vector of float) +0:? 'pos' ( temp 3-element array of 4-component vector of float) +0:? 'pos' ( in 3-element array of 4-component vector of float Position) +0:13 move second child to first child ( temp 3-element array of uint) +0:? 'VertexID' ( temp 3-element array of uint) +0:? 'VertexID' (layout( location=0) in 3-element array of uint) +0:13 Function Call: @main(vf4[3];u1[3];struct-S-vf4-f1-f11;f1[3];f1[3]; ( temp void) +0:? 'pos' ( temp 3-element array of 4-component vector of float) +0:? 'VertexID' ( temp 3-element array of uint) +0:? 'OutputStream' ( temp structure{ temp 4-component vector of float pos, temp float clip, temp float cull}) +0:? 'clip' ( temp 3-element array of float) +0:? 'cull' ( temp 3-element array of float) +0:? Linker Objects +0:? 'pos' ( in 3-element array of 4-component vector of float Position) +0:? 'VertexID' (layout( location=0) in 3-element array of uint) +0:? 'OutputStream.pos' ( out 4-component vector of float Position) + + +Linked geometry stage: + + +Shader version: 500 +invocations = 1 +max_vertices = 3 +input primitive = triangles +output primitive = line_strip +ERROR: node is still EOpNull! +0:13 Function Definition: @main(vf4[3];u1[3];struct-S-vf4-f1-f11;f1[3];f1[3]; ( temp void) +0:13 Function Parameters: +0:13 'pos' ( in 3-element array of 4-component vector of float) +0:13 'VertexID' ( in 3-element array of uint) +0:13 'OutputStream' ( out structure{ temp 4-component vector of float pos, temp float clip, temp float cull}) +0:13 'clip' ( in 3-element array of float) +0:13 'cull' ( in 3-element array of float) +0:? Sequence +0:16 move second child to first child ( temp 4-component vector of float) +0:16 pos: direct index for structure ( temp 4-component vector of float) +0:16 's' ( temp structure{ temp 4-component vector of float pos, temp float clip, temp float cull}) +0:16 Constant: +0:16 0 (const int) +0:16 direct index ( temp 4-component vector of float) +0:16 'pos' ( in 3-element array of 4-component vector of float) +0:16 Constant: +0:16 0 (const int) +0:17 move second child to first child ( temp float) +0:17 clip: direct index for structure ( temp float) +0:17 's' ( temp structure{ temp 4-component vector of float pos, temp float clip, temp float cull}) +0:17 Constant: +0:17 1 (const int) +0:17 direct index ( temp float) +0:17 'clip' ( in 3-element array of float) +0:17 Constant: +0:17 0 (const int) +0:18 move second child to first child ( temp float) +0:18 cull: direct index for structure ( temp float) +0:18 's' ( temp structure{ temp 4-component vector of float pos, temp float clip, temp float cull}) +0:18 Constant: +0:18 2 (const int) +0:18 direct index ( temp float) +0:18 'cull' ( in 3-element array of float) +0:18 Constant: +0:18 0 (const int) +0:20 Sequence +0:20 Sequence +0:20 move second child to first child ( temp 4-component vector of float) +0:? 'OutputStream.pos' ( out 4-component vector of float Position) +0:20 pos: direct index for structure ( temp 4-component vector of float) +0:20 's' ( temp structure{ temp 4-component vector of float pos, temp float clip, temp float cull}) +0:20 Constant: +0:20 0 (const int) +0:20 EmitVertex ( temp void) +0:13 Function Definition: main( ( temp void) +0:13 Function Parameters: +0:? Sequence +0:13 move second child to first child ( temp 3-element array of 4-component vector of float) +0:? 'pos' ( temp 3-element array of 4-component vector of float) +0:? 'pos' ( in 3-element array of 4-component vector of float Position) +0:13 move second child to first child ( temp 3-element array of uint) +0:? 'VertexID' ( temp 3-element array of uint) +0:? 'VertexID' (layout( location=0) in 3-element array of uint) +0:13 Function Call: @main(vf4[3];u1[3];struct-S-vf4-f1-f11;f1[3];f1[3]; ( temp void) +0:? 'pos' ( temp 3-element array of 4-component vector of float) +0:? 'VertexID' ( temp 3-element array of uint) +0:? 'OutputStream' ( temp structure{ temp 4-component vector of float pos, temp float clip, temp float cull}) +0:? 'clip' ( temp 3-element array of float) +0:? 'cull' ( temp 3-element array of float) +0:? Linker Objects +0:? 'pos' ( in 3-element array of 4-component vector of float Position) +0:? 'VertexID' (layout( location=0) in 3-element array of uint) +0:? 'OutputStream.pos' ( out 4-component vector of float Position) + +SPIR-V is not generated for failed compile or link diff --git a/Test/baseResults/hlsl.clipdistance-2.frag.out b/Test/baseResults/hlsl.clipdistance-2.frag.out new file mode 100644 index 0000000..f7b8256 --- /dev/null +++ b/Test/baseResults/hlsl.clipdistance-2.frag.out @@ -0,0 +1,419 @@ +hlsl.clipdistance-2.frag +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:4 Function Definition: @main(vf4;vf2[2];vf2[2]; ( temp 4-component vector of float) +0:4 Function Parameters: +0:4 'pos' ( in 4-component vector of float) +0:4 'clip' ( in 2-element array of 2-component vector of float) +0:4 'cull' ( in 2-element array of 2-component vector of float) +0:? Sequence +0:6 Branch: Return with expression +0:6 add ( temp 4-component vector of float) +0:6 add ( temp 4-component vector of float) +0:6 'pos' ( in 4-component vector of float) +0:6 direct index ( temp float) +0:6 direct index ( temp 2-component vector of float) +0:6 'clip' ( in 2-element array of 2-component vector of float) +0:6 Constant: +0:6 0 (const int) +0:6 Constant: +0:6 0 (const int) +0:6 direct index ( temp float) +0:6 direct index ( temp 2-component vector of float) +0:6 'cull' ( in 2-element array of 2-component vector of float) +0:6 Constant: +0:6 0 (const int) +0:6 Constant: +0:6 0 (const int) +0:4 Function Definition: main( ( temp void) +0:4 Function Parameters: +0:? Sequence +0:4 move second child to first child ( temp 4-component vector of float) +0:? 'pos' ( temp 4-component vector of float) +0:? 'pos' ( in 4-component vector of float FragCoord) +0:? Sequence +0:4 move second child to first child ( temp float) +0:4 direct index ( temp float) +0:4 direct index ( temp 2-component vector of float) +0:? 'clip' ( temp 2-element array of 2-component vector of float) +0:4 Constant: +0:4 0 (const int) +0:4 Constant: +0:4 0 (const int) +0:4 direct index ( temp float) +0:? 'clip' ( in 4-element array of float ClipDistance) +0:4 Constant: +0:4 0 (const int) +0:4 move second child to first child ( temp float) +0:4 direct index ( temp float) +0:4 direct index ( temp 2-component vector of float) +0:? 'clip' ( temp 2-element array of 2-component vector of float) +0:4 Constant: +0:4 0 (const int) +0:4 Constant: +0:4 1 (const int) +0:4 direct index ( temp float) +0:? 'clip' ( in 4-element array of float ClipDistance) +0:4 Constant: +0:4 1 (const int) +0:4 move second child to first child ( temp float) +0:4 direct index ( temp float) +0:4 direct index ( temp 2-component vector of float) +0:? 'clip' ( temp 2-element array of 2-component vector of float) +0:4 Constant: +0:4 1 (const int) +0:4 Constant: +0:4 0 (const int) +0:4 direct index ( temp float) +0:? 'clip' ( in 4-element array of float ClipDistance) +0:4 Constant: +0:4 2 (const int) +0:4 move second child to first child ( temp float) +0:4 direct index ( temp float) +0:4 direct index ( temp 2-component vector of float) +0:? 'clip' ( temp 2-element array of 2-component vector of float) +0:4 Constant: +0:4 1 (const int) +0:4 Constant: +0:4 1 (const int) +0:4 direct index ( temp float) +0:? 'clip' ( in 4-element array of float ClipDistance) +0:4 Constant: +0:4 3 (const int) +0:? Sequence +0:4 move second child to first child ( temp float) +0:4 direct index ( temp float) +0:4 direct index ( temp 2-component vector of float) +0:? 'cull' ( temp 2-element array of 2-component vector of float) +0:4 Constant: +0:4 0 (const int) +0:4 Constant: +0:4 0 (const int) +0:4 direct index ( temp float) +0:? 'cull' ( in 4-element array of float CullDistance) +0:4 Constant: +0:4 0 (const int) +0:4 move second child to first child ( temp float) +0:4 direct index ( temp float) +0:4 direct index ( temp 2-component vector of float) +0:? 'cull' ( temp 2-element array of 2-component vector of float) +0:4 Constant: +0:4 0 (const int) +0:4 Constant: +0:4 1 (const int) +0:4 direct index ( temp float) +0:? 'cull' ( in 4-element array of float CullDistance) +0:4 Constant: +0:4 1 (const int) +0:4 move second child to first child ( temp float) +0:4 direct index ( temp float) +0:4 direct index ( temp 2-component vector of float) +0:? 'cull' ( temp 2-element array of 2-component vector of float) +0:4 Constant: +0:4 1 (const int) +0:4 Constant: +0:4 0 (const int) +0:4 direct index ( temp float) +0:? 'cull' ( in 4-element array of float CullDistance) +0:4 Constant: +0:4 2 (const int) +0:4 move second child to first child ( temp float) +0:4 direct index ( temp float) +0:4 direct index ( temp 2-component vector of float) +0:? 'cull' ( temp 2-element array of 2-component vector of float) +0:4 Constant: +0:4 1 (const int) +0:4 Constant: +0:4 1 (const int) +0:4 direct index ( temp float) +0:? 'cull' ( in 4-element array of float CullDistance) +0:4 Constant: +0:4 3 (const int) +0:4 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:4 Function Call: @main(vf4;vf2[2];vf2[2]; ( temp 4-component vector of float) +0:? 'pos' ( temp 4-component vector of float) +0:? 'clip' ( temp 2-element array of 2-component vector of float) +0:? 'cull' ( temp 2-element array of 2-component vector of float) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:? 'pos' ( in 4-component vector of float FragCoord) +0:? 'clip' ( in 4-element array of float ClipDistance) +0:? 'cull' ( in 4-element array of float CullDistance) + + +Linked fragment stage: + + +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:4 Function Definition: @main(vf4;vf2[2];vf2[2]; ( temp 4-component vector of float) +0:4 Function Parameters: +0:4 'pos' ( in 4-component vector of float) +0:4 'clip' ( in 2-element array of 2-component vector of float) +0:4 'cull' ( in 2-element array of 2-component vector of float) +0:? Sequence +0:6 Branch: Return with expression +0:6 add ( temp 4-component vector of float) +0:6 add ( temp 4-component vector of float) +0:6 'pos' ( in 4-component vector of float) +0:6 direct index ( temp float) +0:6 direct index ( temp 2-component vector of float) +0:6 'clip' ( in 2-element array of 2-component vector of float) +0:6 Constant: +0:6 0 (const int) +0:6 Constant: +0:6 0 (const int) +0:6 direct index ( temp float) +0:6 direct index ( temp 2-component vector of float) +0:6 'cull' ( in 2-element array of 2-component vector of float) +0:6 Constant: +0:6 0 (const int) +0:6 Constant: +0:6 0 (const int) +0:4 Function Definition: main( ( temp void) +0:4 Function Parameters: +0:? Sequence +0:4 move second child to first child ( temp 4-component vector of float) +0:? 'pos' ( temp 4-component vector of float) +0:? 'pos' ( in 4-component vector of float FragCoord) +0:? Sequence +0:4 move second child to first child ( temp float) +0:4 direct index ( temp float) +0:4 direct index ( temp 2-component vector of float) +0:? 'clip' ( temp 2-element array of 2-component vector of float) +0:4 Constant: +0:4 0 (const int) +0:4 Constant: +0:4 0 (const int) +0:4 direct index ( temp float) +0:? 'clip' ( in 4-element array of float ClipDistance) +0:4 Constant: +0:4 0 (const int) +0:4 move second child to first child ( temp float) +0:4 direct index ( temp float) +0:4 direct index ( temp 2-component vector of float) +0:? 'clip' ( temp 2-element array of 2-component vector of float) +0:4 Constant: +0:4 0 (const int) +0:4 Constant: +0:4 1 (const int) +0:4 direct index ( temp float) +0:? 'clip' ( in 4-element array of float ClipDistance) +0:4 Constant: +0:4 1 (const int) +0:4 move second child to first child ( temp float) +0:4 direct index ( temp float) +0:4 direct index ( temp 2-component vector of float) +0:? 'clip' ( temp 2-element array of 2-component vector of float) +0:4 Constant: +0:4 1 (const int) +0:4 Constant: +0:4 0 (const int) +0:4 direct index ( temp float) +0:? 'clip' ( in 4-element array of float ClipDistance) +0:4 Constant: +0:4 2 (const int) +0:4 move second child to first child ( temp float) +0:4 direct index ( temp float) +0:4 direct index ( temp 2-component vector of float) +0:? 'clip' ( temp 2-element array of 2-component vector of float) +0:4 Constant: +0:4 1 (const int) +0:4 Constant: +0:4 1 (const int) +0:4 direct index ( temp float) +0:? 'clip' ( in 4-element array of float ClipDistance) +0:4 Constant: +0:4 3 (const int) +0:? Sequence +0:4 move second child to first child ( temp float) +0:4 direct index ( temp float) +0:4 direct index ( temp 2-component vector of float) +0:? 'cull' ( temp 2-element array of 2-component vector of float) +0:4 Constant: +0:4 0 (const int) +0:4 Constant: +0:4 0 (const int) +0:4 direct index ( temp float) +0:? 'cull' ( in 4-element array of float CullDistance) +0:4 Constant: +0:4 0 (const int) +0:4 move second child to first child ( temp float) +0:4 direct index ( temp float) +0:4 direct index ( temp 2-component vector of float) +0:? 'cull' ( temp 2-element array of 2-component vector of float) +0:4 Constant: +0:4 0 (const int) +0:4 Constant: +0:4 1 (const int) +0:4 direct index ( temp float) +0:? 'cull' ( in 4-element array of float CullDistance) +0:4 Constant: +0:4 1 (const int) +0:4 move second child to first child ( temp float) +0:4 direct index ( temp float) +0:4 direct index ( temp 2-component vector of float) +0:? 'cull' ( temp 2-element array of 2-component vector of float) +0:4 Constant: +0:4 1 (const int) +0:4 Constant: +0:4 0 (const int) +0:4 direct index ( temp float) +0:? 'cull' ( in 4-element array of float CullDistance) +0:4 Constant: +0:4 2 (const int) +0:4 move second child to first child ( temp float) +0:4 direct index ( temp float) +0:4 direct index ( temp 2-component vector of float) +0:? 'cull' ( temp 2-element array of 2-component vector of float) +0:4 Constant: +0:4 1 (const int) +0:4 Constant: +0:4 1 (const int) +0:4 direct index ( temp float) +0:? 'cull' ( in 4-element array of float CullDistance) +0:4 Constant: +0:4 3 (const int) +0:4 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:4 Function Call: @main(vf4;vf2[2];vf2[2]; ( temp 4-component vector of float) +0:? 'pos' ( temp 4-component vector of float) +0:? 'clip' ( temp 2-element array of 2-component vector of float) +0:? 'cull' ( temp 2-element array of 2-component vector of float) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:? 'pos' ( in 4-component vector of float FragCoord) +0:? 'clip' ( in 4-element array of float ClipDistance) +0:? 'cull' ( in 4-element array of float CullDistance) + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 84 + + Capability Shader + Capability ClipDistance + Capability CullDistance + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 37 43 62 76 + ExecutionMode 4 OriginUpperLeft + Source HLSL 500 + Name 4 "main" + Name 18 "@main(vf4;vf2[2];vf2[2];" + Name 15 "pos" + Name 16 "clip" + Name 17 "cull" + Name 35 "pos" + Name 37 "pos" + Name 39 "clip" + Name 43 "clip" + Name 61 "cull" + Name 62 "cull" + Name 76 "@entryPointOutput" + Name 77 "param" + Name 79 "param" + Name 81 "param" + Decorate 37(pos) BuiltIn FragCoord + Decorate 43(clip) BuiltIn ClipDistance + Decorate 62(cull) BuiltIn CullDistance + Decorate 76(@entryPointOutput) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Function 7(fvec4) + 9: TypeVector 6(float) 2 + 10: TypeInt 32 0 + 11: 10(int) Constant 2 + 12: TypeArray 9(fvec2) 11 + 13: TypePointer Function 12 + 14: TypeFunction 7(fvec4) 8(ptr) 13(ptr) 13(ptr) + 21: TypeInt 32 1 + 22: 21(int) Constant 0 + 23: 10(int) Constant 0 + 24: TypePointer Function 6(float) + 36: TypePointer Input 7(fvec4) + 37(pos): 36(ptr) Variable Input + 40: 10(int) Constant 4 + 41: TypeArray 6(float) 40 + 42: TypePointer Input 41 + 43(clip): 42(ptr) Variable Input + 44: TypePointer Input 6(float) + 48: 21(int) Constant 1 + 51: 10(int) Constant 1 + 53: 21(int) Constant 2 + 57: 21(int) Constant 3 + 62(cull): 42(ptr) Variable Input + 75: TypePointer Output 7(fvec4) +76(@entryPointOutput): 75(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 35(pos): 8(ptr) Variable Function + 39(clip): 13(ptr) Variable Function + 61(cull): 13(ptr) Variable Function + 77(param): 8(ptr) Variable Function + 79(param): 13(ptr) Variable Function + 81(param): 13(ptr) Variable Function + 38: 7(fvec4) Load 37(pos) + Store 35(pos) 38 + 45: 44(ptr) AccessChain 43(clip) 22 + 46: 6(float) Load 45 + 47: 24(ptr) AccessChain 39(clip) 22 23 + Store 47 46 + 49: 44(ptr) AccessChain 43(clip) 48 + 50: 6(float) Load 49 + 52: 24(ptr) AccessChain 39(clip) 22 51 + Store 52 50 + 54: 44(ptr) AccessChain 43(clip) 53 + 55: 6(float) Load 54 + 56: 24(ptr) AccessChain 39(clip) 48 23 + Store 56 55 + 58: 44(ptr) AccessChain 43(clip) 57 + 59: 6(float) Load 58 + 60: 24(ptr) AccessChain 39(clip) 48 51 + Store 60 59 + 63: 44(ptr) AccessChain 62(cull) 22 + 64: 6(float) Load 63 + 65: 24(ptr) AccessChain 61(cull) 22 23 + Store 65 64 + 66: 44(ptr) AccessChain 62(cull) 48 + 67: 6(float) Load 66 + 68: 24(ptr) AccessChain 61(cull) 22 51 + Store 68 67 + 69: 44(ptr) AccessChain 62(cull) 53 + 70: 6(float) Load 69 + 71: 24(ptr) AccessChain 61(cull) 48 23 + Store 71 70 + 72: 44(ptr) AccessChain 62(cull) 57 + 73: 6(float) Load 72 + 74: 24(ptr) AccessChain 61(cull) 48 51 + Store 74 73 + 78: 7(fvec4) Load 35(pos) + Store 77(param) 78 + 80: 12 Load 39(clip) + Store 79(param) 80 + 82: 12 Load 61(cull) + Store 81(param) 82 + 83: 7(fvec4) FunctionCall 18(@main(vf4;vf2[2];vf2[2];) 77(param) 79(param) 81(param) + Store 76(@entryPointOutput) 83 + Return + FunctionEnd +18(@main(vf4;vf2[2];vf2[2];): 7(fvec4) Function None 14 + 15(pos): 8(ptr) FunctionParameter + 16(clip): 13(ptr) FunctionParameter + 17(cull): 13(ptr) FunctionParameter + 19: Label + 20: 7(fvec4) Load 15(pos) + 25: 24(ptr) AccessChain 16(clip) 22 23 + 26: 6(float) Load 25 + 27: 7(fvec4) CompositeConstruct 26 26 26 26 + 28: 7(fvec4) FAdd 20 27 + 29: 24(ptr) AccessChain 17(cull) 22 23 + 30: 6(float) Load 29 + 31: 7(fvec4) CompositeConstruct 30 30 30 30 + 32: 7(fvec4) FAdd 28 31 + ReturnValue 32 + FunctionEnd diff --git a/Test/baseResults/hlsl.clipdistance-2.geom.out b/Test/baseResults/hlsl.clipdistance-2.geom.out new file mode 100644 index 0000000..a2b568a --- /dev/null +++ b/Test/baseResults/hlsl.clipdistance-2.geom.out @@ -0,0 +1,171 @@ +hlsl.clipdistance-2.geom +ERROR: 0:11: '' : unimplemented: clip/cull not currently implemented for this stage +ERROR: 0:18: '' : unimplemented: clip/cull not currently implemented for this stage +ERROR: 2 compilation errors. No code generated. + + +Shader version: 500 +invocations = -1 +max_vertices = 3 +input primitive = triangles +output primitive = line_strip +ERROR: node is still EOpNull! +0:11 Function Definition: @main(vf4[3];u1[3];struct-S-vf4-vf2[2]1;vf2[3][2]; ( temp void) +0:11 Function Parameters: +0:11 'pos' ( in 3-element array of 4-component vector of float) +0:11 'VertexID' ( in 3-element array of uint) +0:11 'OutputStream' ( out structure{ temp 4-component vector of float pos, temp 2-element array of 2-component vector of float clip}) +0:11 'clip' ( in 3-element array of 2-element array of 2-component vector of float) +0:? Sequence +0:14 move second child to first child ( temp 4-component vector of float) +0:14 pos: direct index for structure ( temp 4-component vector of float) +0:14 's' ( temp structure{ temp 4-component vector of float pos, temp 2-element array of 2-component vector of float clip}) +0:14 Constant: +0:14 0 (const int) +0:14 direct index ( temp 4-component vector of float) +0:14 'pos' ( in 3-element array of 4-component vector of float) +0:14 Constant: +0:14 0 (const int) +0:15 move second child to first child ( temp 2-component vector of float) +0:15 direct index ( temp 2-component vector of float) +0:15 clip: direct index for structure ( temp 2-element array of 2-component vector of float) +0:15 's' ( temp structure{ temp 4-component vector of float pos, temp 2-element array of 2-component vector of float clip}) +0:15 Constant: +0:15 1 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 direct index ( temp 2-component vector of float) +0:15 direct index ( temp 2-element array of 2-component vector of float) +0:15 'clip' ( in 3-element array of 2-element array of 2-component vector of float) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:16 move second child to first child ( temp 2-component vector of float) +0:16 direct index ( temp 2-component vector of float) +0:16 clip: direct index for structure ( temp 2-element array of 2-component vector of float) +0:16 's' ( temp structure{ temp 4-component vector of float pos, temp 2-element array of 2-component vector of float clip}) +0:16 Constant: +0:16 1 (const int) +0:16 Constant: +0:16 1 (const int) +0:16 direct index ( temp 2-component vector of float) +0:16 direct index ( temp 2-element array of 2-component vector of float) +0:16 'clip' ( in 3-element array of 2-element array of 2-component vector of float) +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 1 (const int) +0:18 Sequence +0:18 Sequence +0:18 move second child to first child ( temp 4-component vector of float) +0:? 'OutputStream.pos' ( out 4-component vector of float Position) +0:18 pos: direct index for structure ( temp 4-component vector of float) +0:18 's' ( temp structure{ temp 4-component vector of float pos, temp 2-element array of 2-component vector of float clip}) +0:18 Constant: +0:18 0 (const int) +0:18 EmitVertex ( temp void) +0:11 Function Definition: main( ( temp void) +0:11 Function Parameters: +0:? Sequence +0:11 move second child to first child ( temp 3-element array of 4-component vector of float) +0:? 'pos' ( temp 3-element array of 4-component vector of float) +0:? 'pos' ( in 3-element array of 4-component vector of float Position) +0:11 move second child to first child ( temp 3-element array of uint) +0:? 'VertexID' ( temp 3-element array of uint) +0:? 'VertexID' (layout( location=0) in 3-element array of uint) +0:11 Function Call: @main(vf4[3];u1[3];struct-S-vf4-vf2[2]1;vf2[3][2]; ( temp void) +0:? 'pos' ( temp 3-element array of 4-component vector of float) +0:? 'VertexID' ( temp 3-element array of uint) +0:? 'OutputStream' ( temp structure{ temp 4-component vector of float pos, temp 2-element array of 2-component vector of float clip}) +0:? 'clip' ( temp 3-element array of 2-element array of 2-component vector of float) +0:? Linker Objects +0:? 'pos' ( in 3-element array of 4-component vector of float Position) +0:? 'VertexID' (layout( location=0) in 3-element array of uint) +0:? 'OutputStream.pos' ( out 4-component vector of float Position) + + +Linked geometry stage: + + +Shader version: 500 +invocations = 1 +max_vertices = 3 +input primitive = triangles +output primitive = line_strip +ERROR: node is still EOpNull! +0:11 Function Definition: @main(vf4[3];u1[3];struct-S-vf4-vf2[2]1;vf2[3][2]; ( temp void) +0:11 Function Parameters: +0:11 'pos' ( in 3-element array of 4-component vector of float) +0:11 'VertexID' ( in 3-element array of uint) +0:11 'OutputStream' ( out structure{ temp 4-component vector of float pos, temp 2-element array of 2-component vector of float clip}) +0:11 'clip' ( in 3-element array of 2-element array of 2-component vector of float) +0:? Sequence +0:14 move second child to first child ( temp 4-component vector of float) +0:14 pos: direct index for structure ( temp 4-component vector of float) +0:14 's' ( temp structure{ temp 4-component vector of float pos, temp 2-element array of 2-component vector of float clip}) +0:14 Constant: +0:14 0 (const int) +0:14 direct index ( temp 4-component vector of float) +0:14 'pos' ( in 3-element array of 4-component vector of float) +0:14 Constant: +0:14 0 (const int) +0:15 move second child to first child ( temp 2-component vector of float) +0:15 direct index ( temp 2-component vector of float) +0:15 clip: direct index for structure ( temp 2-element array of 2-component vector of float) +0:15 's' ( temp structure{ temp 4-component vector of float pos, temp 2-element array of 2-component vector of float clip}) +0:15 Constant: +0:15 1 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 direct index ( temp 2-component vector of float) +0:15 direct index ( temp 2-element array of 2-component vector of float) +0:15 'clip' ( in 3-element array of 2-element array of 2-component vector of float) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:16 move second child to first child ( temp 2-component vector of float) +0:16 direct index ( temp 2-component vector of float) +0:16 clip: direct index for structure ( temp 2-element array of 2-component vector of float) +0:16 's' ( temp structure{ temp 4-component vector of float pos, temp 2-element array of 2-component vector of float clip}) +0:16 Constant: +0:16 1 (const int) +0:16 Constant: +0:16 1 (const int) +0:16 direct index ( temp 2-component vector of float) +0:16 direct index ( temp 2-element array of 2-component vector of float) +0:16 'clip' ( in 3-element array of 2-element array of 2-component vector of float) +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 1 (const int) +0:18 Sequence +0:18 Sequence +0:18 move second child to first child ( temp 4-component vector of float) +0:? 'OutputStream.pos' ( out 4-component vector of float Position) +0:18 pos: direct index for structure ( temp 4-component vector of float) +0:18 's' ( temp structure{ temp 4-component vector of float pos, temp 2-element array of 2-component vector of float clip}) +0:18 Constant: +0:18 0 (const int) +0:18 EmitVertex ( temp void) +0:11 Function Definition: main( ( temp void) +0:11 Function Parameters: +0:? Sequence +0:11 move second child to first child ( temp 3-element array of 4-component vector of float) +0:? 'pos' ( temp 3-element array of 4-component vector of float) +0:? 'pos' ( in 3-element array of 4-component vector of float Position) +0:11 move second child to first child ( temp 3-element array of uint) +0:? 'VertexID' ( temp 3-element array of uint) +0:? 'VertexID' (layout( location=0) in 3-element array of uint) +0:11 Function Call: @main(vf4[3];u1[3];struct-S-vf4-vf2[2]1;vf2[3][2]; ( temp void) +0:? 'pos' ( temp 3-element array of 4-component vector of float) +0:? 'VertexID' ( temp 3-element array of uint) +0:? 'OutputStream' ( temp structure{ temp 4-component vector of float pos, temp 2-element array of 2-component vector of float clip}) +0:? 'clip' ( temp 3-element array of 2-element array of 2-component vector of float) +0:? Linker Objects +0:? 'pos' ( in 3-element array of 4-component vector of float Position) +0:? 'VertexID' (layout( location=0) in 3-element array of uint) +0:? 'OutputStream.pos' ( out 4-component vector of float Position) + +SPIR-V is not generated for failed compile or link diff --git a/Test/baseResults/hlsl.clipdistance-3.frag.out b/Test/baseResults/hlsl.clipdistance-3.frag.out new file mode 100644 index 0000000..8515cd7 --- /dev/null +++ b/Test/baseResults/hlsl.clipdistance-3.frag.out @@ -0,0 +1,190 @@ +hlsl.clipdistance-3.frag +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:4 Function Definition: @main(vf4;f1[2];f1[2]; ( temp 4-component vector of float) +0:4 Function Parameters: +0:4 'pos' ( in 4-component vector of float) +0:4 'clip' ( in 2-element array of float) +0:4 'cull' ( in 2-element array of float) +0:? Sequence +0:5 Branch: Return with expression +0:5 add ( temp 4-component vector of float) +0:5 add ( temp 4-component vector of float) +0:5 'pos' ( in 4-component vector of float) +0:5 direct index ( temp float) +0:5 'clip' ( in 2-element array of float) +0:5 Constant: +0:5 0 (const int) +0:5 direct index ( temp float) +0:5 'cull' ( in 2-element array of float) +0:5 Constant: +0:5 0 (const int) +0:4 Function Definition: main( ( temp void) +0:4 Function Parameters: +0:? Sequence +0:4 move second child to first child ( temp 4-component vector of float) +0:? 'pos' ( temp 4-component vector of float) +0:? 'pos' ( in 4-component vector of float FragCoord) +0:? Sequence +0:4 move second child to first child ( temp 2-element array of float) +0:? 'clip' ( temp 2-element array of float) +0:? 'clip' ( in 2-element array of float ClipDistance) +0:? Sequence +0:4 move second child to first child ( temp 2-element array of float) +0:? 'cull' ( temp 2-element array of float) +0:? 'cull' ( in 2-element array of float CullDistance) +0:4 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:4 Function Call: @main(vf4;f1[2];f1[2]; ( temp 4-component vector of float) +0:? 'pos' ( temp 4-component vector of float) +0:? 'clip' ( temp 2-element array of float) +0:? 'cull' ( temp 2-element array of float) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:? 'pos' ( in 4-component vector of float FragCoord) +0:? 'clip' ( in 2-element array of float ClipDistance) +0:? 'cull' ( in 2-element array of float CullDistance) + + +Linked fragment stage: + + +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:4 Function Definition: @main(vf4;f1[2];f1[2]; ( temp 4-component vector of float) +0:4 Function Parameters: +0:4 'pos' ( in 4-component vector of float) +0:4 'clip' ( in 2-element array of float) +0:4 'cull' ( in 2-element array of float) +0:? Sequence +0:5 Branch: Return with expression +0:5 add ( temp 4-component vector of float) +0:5 add ( temp 4-component vector of float) +0:5 'pos' ( in 4-component vector of float) +0:5 direct index ( temp float) +0:5 'clip' ( in 2-element array of float) +0:5 Constant: +0:5 0 (const int) +0:5 direct index ( temp float) +0:5 'cull' ( in 2-element array of float) +0:5 Constant: +0:5 0 (const int) +0:4 Function Definition: main( ( temp void) +0:4 Function Parameters: +0:? Sequence +0:4 move second child to first child ( temp 4-component vector of float) +0:? 'pos' ( temp 4-component vector of float) +0:? 'pos' ( in 4-component vector of float FragCoord) +0:? Sequence +0:4 move second child to first child ( temp 2-element array of float) +0:? 'clip' ( temp 2-element array of float) +0:? 'clip' ( in 2-element array of float ClipDistance) +0:? Sequence +0:4 move second child to first child ( temp 2-element array of float) +0:? 'cull' ( temp 2-element array of float) +0:? 'cull' ( in 2-element array of float CullDistance) +0:4 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:4 Function Call: @main(vf4;f1[2];f1[2]; ( temp 4-component vector of float) +0:? 'pos' ( temp 4-component vector of float) +0:? 'clip' ( temp 2-element array of float) +0:? 'cull' ( temp 2-element array of float) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:? 'pos' ( in 4-component vector of float FragCoord) +0:? 'clip' ( in 2-element array of float ClipDistance) +0:? 'cull' ( in 2-element array of float CullDistance) + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 53 + + Capability Shader + Capability ClipDistance + Capability CullDistance + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 35 39 42 45 + ExecutionMode 4 OriginUpperLeft + Source HLSL 500 + Name 4 "main" + Name 17 "@main(vf4;f1[2];f1[2];" + Name 14 "pos" + Name 15 "clip" + Name 16 "cull" + Name 33 "pos" + Name 35 "pos" + Name 37 "clip" + Name 39 "clip" + Name 41 "cull" + Name 42 "cull" + Name 45 "@entryPointOutput" + Name 46 "param" + Name 48 "param" + Name 50 "param" + Decorate 35(pos) BuiltIn FragCoord + Decorate 39(clip) BuiltIn ClipDistance + Decorate 42(cull) BuiltIn CullDistance + Decorate 45(@entryPointOutput) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Function 7(fvec4) + 9: TypeInt 32 0 + 10: 9(int) Constant 2 + 11: TypeArray 6(float) 10 + 12: TypePointer Function 11 + 13: TypeFunction 7(fvec4) 8(ptr) 12(ptr) 12(ptr) + 20: TypeInt 32 1 + 21: 20(int) Constant 0 + 22: TypePointer Function 6(float) + 34: TypePointer Input 7(fvec4) + 35(pos): 34(ptr) Variable Input + 38: TypePointer Input 11 + 39(clip): 38(ptr) Variable Input + 42(cull): 38(ptr) Variable Input + 44: TypePointer Output 7(fvec4) +45(@entryPointOutput): 44(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 33(pos): 8(ptr) Variable Function + 37(clip): 12(ptr) Variable Function + 41(cull): 12(ptr) Variable Function + 46(param): 8(ptr) Variable Function + 48(param): 12(ptr) Variable Function + 50(param): 12(ptr) Variable Function + 36: 7(fvec4) Load 35(pos) + Store 33(pos) 36 + 40: 11 Load 39(clip) + Store 37(clip) 40 + 43: 11 Load 42(cull) + Store 41(cull) 43 + 47: 7(fvec4) Load 33(pos) + Store 46(param) 47 + 49: 11 Load 37(clip) + Store 48(param) 49 + 51: 11 Load 41(cull) + Store 50(param) 51 + 52: 7(fvec4) FunctionCall 17(@main(vf4;f1[2];f1[2];) 46(param) 48(param) 50(param) + Store 45(@entryPointOutput) 52 + Return + FunctionEnd +17(@main(vf4;f1[2];f1[2];): 7(fvec4) Function None 13 + 14(pos): 8(ptr) FunctionParameter + 15(clip): 12(ptr) FunctionParameter + 16(cull): 12(ptr) FunctionParameter + 18: Label + 19: 7(fvec4) Load 14(pos) + 23: 22(ptr) AccessChain 15(clip) 21 + 24: 6(float) Load 23 + 25: 7(fvec4) CompositeConstruct 24 24 24 24 + 26: 7(fvec4) FAdd 19 25 + 27: 22(ptr) AccessChain 16(cull) 21 + 28: 6(float) Load 27 + 29: 7(fvec4) CompositeConstruct 28 28 28 28 + 30: 7(fvec4) FAdd 26 29 + ReturnValue 30 + FunctionEnd diff --git a/Test/baseResults/hlsl.clipdistance-4.frag.out b/Test/baseResults/hlsl.clipdistance-4.frag.out new file mode 100644 index 0000000..54a5405 --- /dev/null +++ b/Test/baseResults/hlsl.clipdistance-4.frag.out @@ -0,0 +1,262 @@ +hlsl.clipdistance-4.frag +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:7 Function Definition: @main(struct-VS_OUTPUT-vf4-vf41; ( temp 4-component vector of float) +0:7 Function Parameters: +0:7 'v' ( const (read only) structure{ temp 4-component vector of float Position, temp 4-component vector of float ClipRect}) +0:? Sequence +0:8 Branch: Return with expression +0:8 add ( temp 4-component vector of float) +0:8 Position: direct index for structure ( temp 4-component vector of float) +0:8 'v' ( const (read only) structure{ temp 4-component vector of float Position, temp 4-component vector of float ClipRect}) +0:8 Constant: +0:8 0 (const int) +0:8 ClipRect: direct index for structure ( temp 4-component vector of float) +0:8 'v' ( const (read only) structure{ temp 4-component vector of float Position, temp 4-component vector of float ClipRect}) +0:8 Constant: +0:8 1 (const int) +0:7 Function Definition: main( ( temp void) +0:7 Function Parameters: +0:? Sequence +0:7 Sequence +0:7 move second child to first child ( temp 4-component vector of float) +0:7 Position: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float ClipRect}) +0:7 Constant: +0:7 0 (const int) +0:? 'v.Position' ( in 4-component vector of float FragCoord) +0:? Sequence +0:7 move second child to first child ( temp float) +0:7 direct index ( temp float) +0:7 ClipRect: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float ClipRect}) +0:7 Constant: +0:7 1 (const int) +0:7 Constant: +0:7 0 (const int) +0:7 direct index ( temp float) +0:? 'v.ClipRect' ( in 4-element array of float ClipDistance) +0:7 Constant: +0:7 0 (const int) +0:7 move second child to first child ( temp float) +0:7 direct index ( temp float) +0:7 ClipRect: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float ClipRect}) +0:7 Constant: +0:7 1 (const int) +0:7 Constant: +0:7 1 (const int) +0:7 direct index ( temp float) +0:? 'v.ClipRect' ( in 4-element array of float ClipDistance) +0:7 Constant: +0:7 1 (const int) +0:7 move second child to first child ( temp float) +0:7 direct index ( temp float) +0:7 ClipRect: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float ClipRect}) +0:7 Constant: +0:7 1 (const int) +0:7 Constant: +0:7 2 (const int) +0:7 direct index ( temp float) +0:? 'v.ClipRect' ( in 4-element array of float ClipDistance) +0:7 Constant: +0:7 2 (const int) +0:7 move second child to first child ( temp float) +0:7 direct index ( temp float) +0:7 ClipRect: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float ClipRect}) +0:7 Constant: +0:7 1 (const int) +0:7 Constant: +0:7 3 (const int) +0:7 direct index ( temp float) +0:? 'v.ClipRect' ( in 4-element array of float ClipDistance) +0:7 Constant: +0:7 3 (const int) +0:7 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:7 Function Call: @main(struct-VS_OUTPUT-vf4-vf41; ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float ClipRect}) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:? 'v.Position' ( in 4-component vector of float FragCoord) +0:? 'v.ClipRect' ( in 4-element array of float ClipDistance) + + +Linked fragment stage: + + +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:7 Function Definition: @main(struct-VS_OUTPUT-vf4-vf41; ( temp 4-component vector of float) +0:7 Function Parameters: +0:7 'v' ( const (read only) structure{ temp 4-component vector of float Position, temp 4-component vector of float ClipRect}) +0:? Sequence +0:8 Branch: Return with expression +0:8 add ( temp 4-component vector of float) +0:8 Position: direct index for structure ( temp 4-component vector of float) +0:8 'v' ( const (read only) structure{ temp 4-component vector of float Position, temp 4-component vector of float ClipRect}) +0:8 Constant: +0:8 0 (const int) +0:8 ClipRect: direct index for structure ( temp 4-component vector of float) +0:8 'v' ( const (read only) structure{ temp 4-component vector of float Position, temp 4-component vector of float ClipRect}) +0:8 Constant: +0:8 1 (const int) +0:7 Function Definition: main( ( temp void) +0:7 Function Parameters: +0:? Sequence +0:7 Sequence +0:7 move second child to first child ( temp 4-component vector of float) +0:7 Position: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float ClipRect}) +0:7 Constant: +0:7 0 (const int) +0:? 'v.Position' ( in 4-component vector of float FragCoord) +0:? Sequence +0:7 move second child to first child ( temp float) +0:7 direct index ( temp float) +0:7 ClipRect: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float ClipRect}) +0:7 Constant: +0:7 1 (const int) +0:7 Constant: +0:7 0 (const int) +0:7 direct index ( temp float) +0:? 'v.ClipRect' ( in 4-element array of float ClipDistance) +0:7 Constant: +0:7 0 (const int) +0:7 move second child to first child ( temp float) +0:7 direct index ( temp float) +0:7 ClipRect: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float ClipRect}) +0:7 Constant: +0:7 1 (const int) +0:7 Constant: +0:7 1 (const int) +0:7 direct index ( temp float) +0:? 'v.ClipRect' ( in 4-element array of float ClipDistance) +0:7 Constant: +0:7 1 (const int) +0:7 move second child to first child ( temp float) +0:7 direct index ( temp float) +0:7 ClipRect: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float ClipRect}) +0:7 Constant: +0:7 1 (const int) +0:7 Constant: +0:7 2 (const int) +0:7 direct index ( temp float) +0:? 'v.ClipRect' ( in 4-element array of float ClipDistance) +0:7 Constant: +0:7 2 (const int) +0:7 move second child to first child ( temp float) +0:7 direct index ( temp float) +0:7 ClipRect: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float ClipRect}) +0:7 Constant: +0:7 1 (const int) +0:7 Constant: +0:7 3 (const int) +0:7 direct index ( temp float) +0:? 'v.ClipRect' ( in 4-element array of float ClipDistance) +0:7 Constant: +0:7 3 (const int) +0:7 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:7 Function Call: @main(struct-VS_OUTPUT-vf4-vf41; ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float ClipRect}) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:? 'v.Position' ( in 4-component vector of float FragCoord) +0:? 'v.ClipRect' ( in 4-element array of float ClipDistance) + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 57 + + Capability Shader + Capability ClipDistance + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 24 32 54 + ExecutionMode 4 OriginUpperLeft + Source HLSL 500 + Name 4 "main" + Name 8 "VS_OUTPUT" + MemberName 8(VS_OUTPUT) 0 "Position" + MemberName 8(VS_OUTPUT) 1 "ClipRect" + Name 11 "@main(struct-VS_OUTPUT-vf4-vf41;" + Name 10 "v" + Name 22 "v" + Name 24 "v.Position" + Name 32 "v.ClipRect" + Name 54 "@entryPointOutput" + Decorate 24(v.Position) BuiltIn FragCoord + Decorate 32(v.ClipRect) BuiltIn ClipDistance + Decorate 54(@entryPointOutput) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8(VS_OUTPUT): TypeStruct 7(fvec4) 7(fvec4) + 9: TypeFunction 7(fvec4) 8(VS_OUTPUT) + 13: TypeInt 32 1 + 14: 13(int) Constant 0 + 16: 13(int) Constant 1 + 21: TypePointer Function 8(VS_OUTPUT) + 23: TypePointer Input 7(fvec4) + 24(v.Position): 23(ptr) Variable Input + 26: TypePointer Function 7(fvec4) + 28: TypeInt 32 0 + 29: 28(int) Constant 4 + 30: TypeArray 6(float) 29 + 31: TypePointer Input 30 + 32(v.ClipRect): 31(ptr) Variable Input + 33: TypePointer Input 6(float) + 36: 28(int) Constant 0 + 37: TypePointer Function 6(float) + 41: 28(int) Constant 1 + 43: 13(int) Constant 2 + 46: 28(int) Constant 2 + 48: 13(int) Constant 3 + 51: 28(int) Constant 3 + 53: TypePointer Output 7(fvec4) +54(@entryPointOutput): 53(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 22(v): 21(ptr) Variable Function + 25: 7(fvec4) Load 24(v.Position) + 27: 26(ptr) AccessChain 22(v) 14 + Store 27 25 + 34: 33(ptr) AccessChain 32(v.ClipRect) 14 + 35: 6(float) Load 34 + 38: 37(ptr) AccessChain 22(v) 16 36 + Store 38 35 + 39: 33(ptr) AccessChain 32(v.ClipRect) 16 + 40: 6(float) Load 39 + 42: 37(ptr) AccessChain 22(v) 16 41 + Store 42 40 + 44: 33(ptr) AccessChain 32(v.ClipRect) 43 + 45: 6(float) Load 44 + 47: 37(ptr) AccessChain 22(v) 16 46 + Store 47 45 + 49: 33(ptr) AccessChain 32(v.ClipRect) 48 + 50: 6(float) Load 49 + 52: 37(ptr) AccessChain 22(v) 16 51 + Store 52 50 + 55:8(VS_OUTPUT) Load 22(v) + 56: 7(fvec4) FunctionCall 11(@main(struct-VS_OUTPUT-vf4-vf41;) 55 + Store 54(@entryPointOutput) 56 + Return + FunctionEnd +11(@main(struct-VS_OUTPUT-vf4-vf41;): 7(fvec4) Function None 9 + 10(v):8(VS_OUTPUT) FunctionParameter + 12: Label + 15: 7(fvec4) CompositeExtract 10(v) 0 + 17: 7(fvec4) CompositeExtract 10(v) 1 + 18: 7(fvec4) FAdd 15 17 + ReturnValue 18 + FunctionEnd diff --git a/Test/baseResults/hlsl.clipdistance-5.frag.out b/Test/baseResults/hlsl.clipdistance-5.frag.out new file mode 100644 index 0000000..4b0ce7f --- /dev/null +++ b/Test/baseResults/hlsl.clipdistance-5.frag.out @@ -0,0 +1,325 @@ +hlsl.clipdistance-5.frag +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:7 Function Definition: @main(struct-VS_OUTPUT-vf4-vf2[2]1; ( temp 4-component vector of float) +0:7 Function Parameters: +0:7 'v' ( const (read only) structure{ temp 4-component vector of float Position, temp 2-element array of 2-component vector of float ClipRect}) +0:? Sequence +0:8 Branch: Return with expression +0:8 add ( temp 4-component vector of float) +0:8 add ( temp 4-component vector of float) +0:8 Position: direct index for structure ( temp 4-component vector of float) +0:8 'v' ( const (read only) structure{ temp 4-component vector of float Position, temp 2-element array of 2-component vector of float ClipRect}) +0:8 Constant: +0:8 0 (const int) +0:8 direct index ( temp float) +0:8 direct index ( temp 2-component vector of float) +0:8 ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float) +0:8 'v' ( const (read only) structure{ temp 4-component vector of float Position, temp 2-element array of 2-component vector of float ClipRect}) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 0 (const int) +0:8 Constant: +0:8 0 (const int) +0:8 direct index ( temp float) +0:8 direct index ( temp 2-component vector of float) +0:8 ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float) +0:8 'v' ( const (read only) structure{ temp 4-component vector of float Position, temp 2-element array of 2-component vector of float ClipRect}) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 0 (const int) +0:7 Function Definition: main( ( temp void) +0:7 Function Parameters: +0:? Sequence +0:7 Sequence +0:7 move second child to first child ( temp 4-component vector of float) +0:7 Position: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 2-element array of 2-component vector of float ClipRect}) +0:7 Constant: +0:7 0 (const int) +0:? 'v.Position' ( in 4-component vector of float FragCoord) +0:? Sequence +0:7 move second child to first child ( temp float) +0:7 direct index ( temp float) +0:7 direct index ( temp 2-component vector of float) +0:7 ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 2-element array of 2-component vector of float ClipRect}) +0:7 Constant: +0:7 1 (const int) +0:7 Constant: +0:7 0 (const int) +0:7 Constant: +0:7 0 (const int) +0:7 direct index ( temp float) +0:? 'v.ClipRect' ( in 4-element array of float ClipDistance) +0:7 Constant: +0:7 0 (const int) +0:7 move second child to first child ( temp float) +0:7 direct index ( temp float) +0:7 direct index ( temp 2-component vector of float) +0:7 ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 2-element array of 2-component vector of float ClipRect}) +0:7 Constant: +0:7 1 (const int) +0:7 Constant: +0:7 0 (const int) +0:7 Constant: +0:7 1 (const int) +0:7 direct index ( temp float) +0:? 'v.ClipRect' ( in 4-element array of float ClipDistance) +0:7 Constant: +0:7 1 (const int) +0:7 move second child to first child ( temp float) +0:7 direct index ( temp float) +0:7 direct index ( temp 2-component vector of float) +0:7 ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 2-element array of 2-component vector of float ClipRect}) +0:7 Constant: +0:7 1 (const int) +0:7 Constant: +0:7 1 (const int) +0:7 Constant: +0:7 0 (const int) +0:7 direct index ( temp float) +0:? 'v.ClipRect' ( in 4-element array of float ClipDistance) +0:7 Constant: +0:7 2 (const int) +0:7 move second child to first child ( temp float) +0:7 direct index ( temp float) +0:7 direct index ( temp 2-component vector of float) +0:7 ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 2-element array of 2-component vector of float ClipRect}) +0:7 Constant: +0:7 1 (const int) +0:7 Constant: +0:7 1 (const int) +0:7 Constant: +0:7 1 (const int) +0:7 direct index ( temp float) +0:? 'v.ClipRect' ( in 4-element array of float ClipDistance) +0:7 Constant: +0:7 3 (const int) +0:7 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:7 Function Call: @main(struct-VS_OUTPUT-vf4-vf2[2]1; ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 2-element array of 2-component vector of float ClipRect}) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:? 'v.Position' ( in 4-component vector of float FragCoord) +0:? 'v.ClipRect' ( in 4-element array of float ClipDistance) + + +Linked fragment stage: + + +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:7 Function Definition: @main(struct-VS_OUTPUT-vf4-vf2[2]1; ( temp 4-component vector of float) +0:7 Function Parameters: +0:7 'v' ( const (read only) structure{ temp 4-component vector of float Position, temp 2-element array of 2-component vector of float ClipRect}) +0:? Sequence +0:8 Branch: Return with expression +0:8 add ( temp 4-component vector of float) +0:8 add ( temp 4-component vector of float) +0:8 Position: direct index for structure ( temp 4-component vector of float) +0:8 'v' ( const (read only) structure{ temp 4-component vector of float Position, temp 2-element array of 2-component vector of float ClipRect}) +0:8 Constant: +0:8 0 (const int) +0:8 direct index ( temp float) +0:8 direct index ( temp 2-component vector of float) +0:8 ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float) +0:8 'v' ( const (read only) structure{ temp 4-component vector of float Position, temp 2-element array of 2-component vector of float ClipRect}) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 0 (const int) +0:8 Constant: +0:8 0 (const int) +0:8 direct index ( temp float) +0:8 direct index ( temp 2-component vector of float) +0:8 ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float) +0:8 'v' ( const (read only) structure{ temp 4-component vector of float Position, temp 2-element array of 2-component vector of float ClipRect}) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 0 (const int) +0:7 Function Definition: main( ( temp void) +0:7 Function Parameters: +0:? Sequence +0:7 Sequence +0:7 move second child to first child ( temp 4-component vector of float) +0:7 Position: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 2-element array of 2-component vector of float ClipRect}) +0:7 Constant: +0:7 0 (const int) +0:? 'v.Position' ( in 4-component vector of float FragCoord) +0:? Sequence +0:7 move second child to first child ( temp float) +0:7 direct index ( temp float) +0:7 direct index ( temp 2-component vector of float) +0:7 ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 2-element array of 2-component vector of float ClipRect}) +0:7 Constant: +0:7 1 (const int) +0:7 Constant: +0:7 0 (const int) +0:7 Constant: +0:7 0 (const int) +0:7 direct index ( temp float) +0:? 'v.ClipRect' ( in 4-element array of float ClipDistance) +0:7 Constant: +0:7 0 (const int) +0:7 move second child to first child ( temp float) +0:7 direct index ( temp float) +0:7 direct index ( temp 2-component vector of float) +0:7 ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 2-element array of 2-component vector of float ClipRect}) +0:7 Constant: +0:7 1 (const int) +0:7 Constant: +0:7 0 (const int) +0:7 Constant: +0:7 1 (const int) +0:7 direct index ( temp float) +0:? 'v.ClipRect' ( in 4-element array of float ClipDistance) +0:7 Constant: +0:7 1 (const int) +0:7 move second child to first child ( temp float) +0:7 direct index ( temp float) +0:7 direct index ( temp 2-component vector of float) +0:7 ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 2-element array of 2-component vector of float ClipRect}) +0:7 Constant: +0:7 1 (const int) +0:7 Constant: +0:7 1 (const int) +0:7 Constant: +0:7 0 (const int) +0:7 direct index ( temp float) +0:? 'v.ClipRect' ( in 4-element array of float ClipDistance) +0:7 Constant: +0:7 2 (const int) +0:7 move second child to first child ( temp float) +0:7 direct index ( temp float) +0:7 direct index ( temp 2-component vector of float) +0:7 ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 2-element array of 2-component vector of float ClipRect}) +0:7 Constant: +0:7 1 (const int) +0:7 Constant: +0:7 1 (const int) +0:7 Constant: +0:7 1 (const int) +0:7 direct index ( temp float) +0:? 'v.ClipRect' ( in 4-element array of float ClipDistance) +0:7 Constant: +0:7 3 (const int) +0:7 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:7 Function Call: @main(struct-VS_OUTPUT-vf4-vf2[2]1; ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 2-element array of 2-component vector of float ClipRect}) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:? 'v.Position' ( in 4-component vector of float FragCoord) +0:? 'v.ClipRect' ( in 4-element array of float ClipDistance) + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 62 + + Capability Shader + Capability ClipDistance + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 33 40 59 + ExecutionMode 4 OriginUpperLeft + Source HLSL 500 + Name 4 "main" + Name 12 "VS_OUTPUT" + MemberName 12(VS_OUTPUT) 0 "Position" + MemberName 12(VS_OUTPUT) 1 "ClipRect" + Name 15 "@main(struct-VS_OUTPUT-vf4-vf2[2]1;" + Name 14 "v" + Name 31 "v" + Name 33 "v.Position" + Name 40 "v.ClipRect" + Name 59 "@entryPointOutput" + Decorate 33(v.Position) BuiltIn FragCoord + Decorate 40(v.ClipRect) BuiltIn ClipDistance + Decorate 59(@entryPointOutput) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypeVector 6(float) 2 + 9: TypeInt 32 0 + 10: 9(int) Constant 2 + 11: TypeArray 8(fvec2) 10 + 12(VS_OUTPUT): TypeStruct 7(fvec4) 11 + 13: TypeFunction 7(fvec4) 12(VS_OUTPUT) + 17: TypeInt 32 1 + 18: 17(int) Constant 0 + 20: 17(int) Constant 1 + 21: 9(int) Constant 0 + 30: TypePointer Function 12(VS_OUTPUT) + 32: TypePointer Input 7(fvec4) + 33(v.Position): 32(ptr) Variable Input + 35: TypePointer Function 7(fvec4) + 37: 9(int) Constant 4 + 38: TypeArray 6(float) 37 + 39: TypePointer Input 38 + 40(v.ClipRect): 39(ptr) Variable Input + 41: TypePointer Input 6(float) + 44: TypePointer Function 6(float) + 48: 9(int) Constant 1 + 50: 17(int) Constant 2 + 54: 17(int) Constant 3 + 58: TypePointer Output 7(fvec4) +59(@entryPointOutput): 58(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 31(v): 30(ptr) Variable Function + 34: 7(fvec4) Load 33(v.Position) + 36: 35(ptr) AccessChain 31(v) 18 + Store 36 34 + 42: 41(ptr) AccessChain 40(v.ClipRect) 18 + 43: 6(float) Load 42 + 45: 44(ptr) AccessChain 31(v) 20 18 21 + Store 45 43 + 46: 41(ptr) AccessChain 40(v.ClipRect) 20 + 47: 6(float) Load 46 + 49: 44(ptr) AccessChain 31(v) 20 18 48 + Store 49 47 + 51: 41(ptr) AccessChain 40(v.ClipRect) 50 + 52: 6(float) Load 51 + 53: 44(ptr) AccessChain 31(v) 20 20 21 + Store 53 52 + 55: 41(ptr) AccessChain 40(v.ClipRect) 54 + 56: 6(float) Load 55 + 57: 44(ptr) AccessChain 31(v) 20 20 48 + Store 57 56 + 60:12(VS_OUTPUT) Load 31(v) + 61: 7(fvec4) FunctionCall 15(@main(struct-VS_OUTPUT-vf4-vf2[2]1;) 60 + Store 59(@entryPointOutput) 61 + Return + FunctionEnd +15(@main(struct-VS_OUTPUT-vf4-vf2[2]1;): 7(fvec4) Function None 13 + 14(v):12(VS_OUTPUT) FunctionParameter + 16: Label + 19: 7(fvec4) CompositeExtract 14(v) 0 + 22: 6(float) CompositeExtract 14(v) 1 0 0 + 23: 7(fvec4) CompositeConstruct 22 22 22 22 + 24: 7(fvec4) FAdd 19 23 + 25: 6(float) CompositeExtract 14(v) 1 1 0 + 26: 7(fvec4) CompositeConstruct 25 25 25 25 + 27: 7(fvec4) FAdd 24 26 + ReturnValue 27 + FunctionEnd diff --git a/Test/baseResults/hlsl.clipdistance-6.frag.out b/Test/baseResults/hlsl.clipdistance-6.frag.out new file mode 100644 index 0000000..57166ae --- /dev/null +++ b/Test/baseResults/hlsl.clipdistance-6.frag.out @@ -0,0 +1,399 @@ +hlsl.clipdistance-6.frag +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:8 Function Definition: @main(struct-VS_OUTPUT-vf4-vf4-vf41; ( temp 4-component vector of float) +0:8 Function Parameters: +0:8 'v' ( in structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:? Sequence +0:9 Branch: Return with expression +0:9 add ( temp 4-component vector of float) +0:9 add ( temp 4-component vector of float) +0:9 Position: direct index for structure ( temp 4-component vector of float) +0:9 'v' ( in structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:9 Constant: +0:9 0 (const int) +0:9 clip0: direct index for structure ( temp 4-component vector of float) +0:9 'v' ( in structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:9 Constant: +0:9 1 (const int) +0:9 clip1: direct index for structure ( temp 4-component vector of float) +0:9 'v' ( in structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:9 Constant: +0:9 2 (const int) +0:8 Function Definition: main( ( temp void) +0:8 Function Parameters: +0:? Sequence +0:8 Sequence +0:8 move second child to first child ( temp 4-component vector of float) +0:8 Position: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 0 (const int) +0:? 'v.Position' ( in 4-component vector of float FragCoord) +0:? Sequence +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip0: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 0 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 0 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip0: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 1 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 1 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip0: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 2 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 2 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip0: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 3 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 3 (const int) +0:? Sequence +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip1: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 2 (const int) +0:8 Constant: +0:8 0 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 4 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip1: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 2 (const int) +0:8 Constant: +0:8 1 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 5 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip1: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 2 (const int) +0:8 Constant: +0:8 2 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 6 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip1: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 2 (const int) +0:8 Constant: +0:8 3 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 7 (const int) +0:8 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:8 Function Call: @main(struct-VS_OUTPUT-vf4-vf4-vf41; ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:? 'v.Position' ( in 4-component vector of float FragCoord) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) + + +Linked fragment stage: + + +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:8 Function Definition: @main(struct-VS_OUTPUT-vf4-vf4-vf41; ( temp 4-component vector of float) +0:8 Function Parameters: +0:8 'v' ( in structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:? Sequence +0:9 Branch: Return with expression +0:9 add ( temp 4-component vector of float) +0:9 add ( temp 4-component vector of float) +0:9 Position: direct index for structure ( temp 4-component vector of float) +0:9 'v' ( in structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:9 Constant: +0:9 0 (const int) +0:9 clip0: direct index for structure ( temp 4-component vector of float) +0:9 'v' ( in structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:9 Constant: +0:9 1 (const int) +0:9 clip1: direct index for structure ( temp 4-component vector of float) +0:9 'v' ( in structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:9 Constant: +0:9 2 (const int) +0:8 Function Definition: main( ( temp void) +0:8 Function Parameters: +0:? Sequence +0:8 Sequence +0:8 move second child to first child ( temp 4-component vector of float) +0:8 Position: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 0 (const int) +0:? 'v.Position' ( in 4-component vector of float FragCoord) +0:? Sequence +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip0: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 0 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 0 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip0: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 1 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 1 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip0: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 2 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 2 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip0: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 3 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 3 (const int) +0:? Sequence +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip1: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 2 (const int) +0:8 Constant: +0:8 0 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 4 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip1: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 2 (const int) +0:8 Constant: +0:8 1 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 5 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip1: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 2 (const int) +0:8 Constant: +0:8 2 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 6 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip1: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 2 (const int) +0:8 Constant: +0:8 3 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 7 (const int) +0:8 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:8 Function Call: @main(struct-VS_OUTPUT-vf4-vf4-vf41; ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 4-component vector of float clip0, temp 4-component vector of float clip1}) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:? 'v.Position' ( in 4-component vector of float FragCoord) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 79 + + Capability Shader + Capability ClipDistance + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 31 38 75 + ExecutionMode 4 OriginUpperLeft + Source HLSL 500 + Name 4 "main" + Name 8 "VS_OUTPUT" + MemberName 8(VS_OUTPUT) 0 "Position" + MemberName 8(VS_OUTPUT) 1 "clip0" + MemberName 8(VS_OUTPUT) 2 "clip1" + Name 12 "@main(struct-VS_OUTPUT-vf4-vf4-vf41;" + Name 11 "v" + Name 29 "v" + Name 31 "v.Position" + Name 38 "v.clip1" + Name 75 "@entryPointOutput" + Name 76 "param" + Decorate 31(v.Position) BuiltIn FragCoord + Decorate 38(v.clip1) BuiltIn ClipDistance + Decorate 75(@entryPointOutput) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8(VS_OUTPUT): TypeStruct 7(fvec4) 7(fvec4) 7(fvec4) + 9: TypePointer Function 8(VS_OUTPUT) + 10: TypeFunction 7(fvec4) 9(ptr) + 14: TypeInt 32 1 + 15: 14(int) Constant 0 + 16: TypePointer Function 7(fvec4) + 19: 14(int) Constant 1 + 23: 14(int) Constant 2 + 30: TypePointer Input 7(fvec4) + 31(v.Position): 30(ptr) Variable Input + 34: TypeInt 32 0 + 35: 34(int) Constant 8 + 36: TypeArray 6(float) 35 + 37: TypePointer Input 36 + 38(v.clip1): 37(ptr) Variable Input + 39: TypePointer Input 6(float) + 42: 34(int) Constant 0 + 43: TypePointer Function 6(float) + 47: 34(int) Constant 1 + 51: 34(int) Constant 2 + 53: 14(int) Constant 3 + 56: 34(int) Constant 3 + 58: 14(int) Constant 4 + 62: 14(int) Constant 5 + 66: 14(int) Constant 6 + 70: 14(int) Constant 7 + 74: TypePointer Output 7(fvec4) +75(@entryPointOutput): 74(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 29(v): 9(ptr) Variable Function + 76(param): 9(ptr) Variable Function + 32: 7(fvec4) Load 31(v.Position) + 33: 16(ptr) AccessChain 29(v) 15 + Store 33 32 + 40: 39(ptr) AccessChain 38(v.clip1) 15 + 41: 6(float) Load 40 + 44: 43(ptr) AccessChain 29(v) 19 42 + Store 44 41 + 45: 39(ptr) AccessChain 38(v.clip1) 19 + 46: 6(float) Load 45 + 48: 43(ptr) AccessChain 29(v) 19 47 + Store 48 46 + 49: 39(ptr) AccessChain 38(v.clip1) 23 + 50: 6(float) Load 49 + 52: 43(ptr) AccessChain 29(v) 19 51 + Store 52 50 + 54: 39(ptr) AccessChain 38(v.clip1) 53 + 55: 6(float) Load 54 + 57: 43(ptr) AccessChain 29(v) 19 56 + Store 57 55 + 59: 39(ptr) AccessChain 38(v.clip1) 58 + 60: 6(float) Load 59 + 61: 43(ptr) AccessChain 29(v) 23 42 + Store 61 60 + 63: 39(ptr) AccessChain 38(v.clip1) 62 + 64: 6(float) Load 63 + 65: 43(ptr) AccessChain 29(v) 23 47 + Store 65 64 + 67: 39(ptr) AccessChain 38(v.clip1) 66 + 68: 6(float) Load 67 + 69: 43(ptr) AccessChain 29(v) 23 51 + Store 69 68 + 71: 39(ptr) AccessChain 38(v.clip1) 70 + 72: 6(float) Load 71 + 73: 43(ptr) AccessChain 29(v) 23 56 + Store 73 72 + 77:8(VS_OUTPUT) Load 29(v) + Store 76(param) 77 + 78: 7(fvec4) FunctionCall 12(@main(struct-VS_OUTPUT-vf4-vf4-vf41;) 76(param) + Store 75(@entryPointOutput) 78 + Return + FunctionEnd +12(@main(struct-VS_OUTPUT-vf4-vf4-vf41;): 7(fvec4) Function None 10 + 11(v): 9(ptr) FunctionParameter + 13: Label + 17: 16(ptr) AccessChain 11(v) 15 + 18: 7(fvec4) Load 17 + 20: 16(ptr) AccessChain 11(v) 19 + 21: 7(fvec4) Load 20 + 22: 7(fvec4) FAdd 18 21 + 24: 16(ptr) AccessChain 11(v) 23 + 25: 7(fvec4) Load 24 + 26: 7(fvec4) FAdd 22 25 + ReturnValue 26 + FunctionEnd diff --git a/Test/baseResults/hlsl.clipdistance-7.frag.out b/Test/baseResults/hlsl.clipdistance-7.frag.out new file mode 100644 index 0000000..22cb0e5 --- /dev/null +++ b/Test/baseResults/hlsl.clipdistance-7.frag.out @@ -0,0 +1,385 @@ +hlsl.clipdistance-7.frag +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:8 Function Definition: @main(struct-VS_OUTPUT-vf4-vf3-vf41; ( temp 4-component vector of float) +0:8 Function Parameters: +0:8 'v' ( in structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:? Sequence +0:9 Branch: Return with expression +0:9 add ( temp 4-component vector of float) +0:9 add ( temp 4-component vector of float) +0:9 Position: direct index for structure ( temp 4-component vector of float) +0:9 'v' ( in structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:9 Constant: +0:9 0 (const int) +0:9 direct index ( temp float) +0:9 clip0: direct index for structure ( temp 3-component vector of float) +0:9 'v' ( in structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:9 Constant: +0:9 1 (const int) +0:9 Constant: +0:9 0 (const int) +0:9 direct index ( temp float) +0:9 clip1: direct index for structure ( temp 4-component vector of float) +0:9 'v' ( in structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:9 Constant: +0:9 2 (const int) +0:9 Constant: +0:9 0 (const int) +0:8 Function Definition: main( ( temp void) +0:8 Function Parameters: +0:? Sequence +0:8 Sequence +0:8 move second child to first child ( temp 4-component vector of float) +0:8 Position: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 0 (const int) +0:? 'v.Position' ( in 4-component vector of float FragCoord) +0:? Sequence +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip0: direct index for structure ( temp 3-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 0 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 0 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip0: direct index for structure ( temp 3-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 1 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 1 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip0: direct index for structure ( temp 3-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 2 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 2 (const int) +0:? Sequence +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip1: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 2 (const int) +0:8 Constant: +0:8 0 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 4 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip1: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 2 (const int) +0:8 Constant: +0:8 1 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 5 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip1: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 2 (const int) +0:8 Constant: +0:8 2 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 6 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip1: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 2 (const int) +0:8 Constant: +0:8 3 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 7 (const int) +0:8 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:8 Function Call: @main(struct-VS_OUTPUT-vf4-vf3-vf41; ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:? 'v.Position' ( in 4-component vector of float FragCoord) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) + + +Linked fragment stage: + + +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:8 Function Definition: @main(struct-VS_OUTPUT-vf4-vf3-vf41; ( temp 4-component vector of float) +0:8 Function Parameters: +0:8 'v' ( in structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:? Sequence +0:9 Branch: Return with expression +0:9 add ( temp 4-component vector of float) +0:9 add ( temp 4-component vector of float) +0:9 Position: direct index for structure ( temp 4-component vector of float) +0:9 'v' ( in structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:9 Constant: +0:9 0 (const int) +0:9 direct index ( temp float) +0:9 clip0: direct index for structure ( temp 3-component vector of float) +0:9 'v' ( in structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:9 Constant: +0:9 1 (const int) +0:9 Constant: +0:9 0 (const int) +0:9 direct index ( temp float) +0:9 clip1: direct index for structure ( temp 4-component vector of float) +0:9 'v' ( in structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:9 Constant: +0:9 2 (const int) +0:9 Constant: +0:9 0 (const int) +0:8 Function Definition: main( ( temp void) +0:8 Function Parameters: +0:? Sequence +0:8 Sequence +0:8 move second child to first child ( temp 4-component vector of float) +0:8 Position: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 0 (const int) +0:? 'v.Position' ( in 4-component vector of float FragCoord) +0:? Sequence +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip0: direct index for structure ( temp 3-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 0 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 0 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip0: direct index for structure ( temp 3-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 1 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 1 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip0: direct index for structure ( temp 3-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 2 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 2 (const int) +0:? Sequence +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip1: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 2 (const int) +0:8 Constant: +0:8 0 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 4 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip1: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 2 (const int) +0:8 Constant: +0:8 1 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 5 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip1: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 2 (const int) +0:8 Constant: +0:8 2 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 6 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip1: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:8 Constant: +0:8 2 (const int) +0:8 Constant: +0:8 3 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) +0:8 Constant: +0:8 7 (const int) +0:8 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:8 Function Call: @main(struct-VS_OUTPUT-vf4-vf3-vf41; ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp 4-component vector of float clip1}) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:? 'v.Position' ( in 4-component vector of float FragCoord) +0:? 'v.clip1' ( in 8-element array of float ClipDistance) + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 78 + + Capability Shader + Capability ClipDistance + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 37 43 74 + ExecutionMode 4 OriginUpperLeft + Source HLSL 500 + Name 4 "main" + Name 9 "VS_OUTPUT" + MemberName 9(VS_OUTPUT) 0 "Position" + MemberName 9(VS_OUTPUT) 1 "clip0" + MemberName 9(VS_OUTPUT) 2 "clip1" + Name 13 "@main(struct-VS_OUTPUT-vf4-vf3-vf41;" + Name 12 "v" + Name 35 "v" + Name 37 "v.Position" + Name 43 "v.clip1" + Name 74 "@entryPointOutput" + Name 75 "param" + Decorate 37(v.Position) BuiltIn FragCoord + Decorate 43(v.clip1) BuiltIn ClipDistance + Decorate 74(@entryPointOutput) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypeVector 6(float) 3 + 9(VS_OUTPUT): TypeStruct 7(fvec4) 8(fvec3) 7(fvec4) + 10: TypePointer Function 9(VS_OUTPUT) + 11: TypeFunction 7(fvec4) 10(ptr) + 15: TypeInt 32 1 + 16: 15(int) Constant 0 + 17: TypePointer Function 7(fvec4) + 20: 15(int) Constant 1 + 21: TypeInt 32 0 + 22: 21(int) Constant 0 + 23: TypePointer Function 6(float) + 28: 15(int) Constant 2 + 36: TypePointer Input 7(fvec4) + 37(v.Position): 36(ptr) Variable Input + 40: 21(int) Constant 8 + 41: TypeArray 6(float) 40 + 42: TypePointer Input 41 + 43(v.clip1): 42(ptr) Variable Input + 44: TypePointer Input 6(float) + 50: 21(int) Constant 1 + 54: 21(int) Constant 2 + 56: 15(int) Constant 4 + 60: 15(int) Constant 5 + 64: 15(int) Constant 6 + 68: 15(int) Constant 7 + 71: 21(int) Constant 3 + 73: TypePointer Output 7(fvec4) +74(@entryPointOutput): 73(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 35(v): 10(ptr) Variable Function + 75(param): 10(ptr) Variable Function + 38: 7(fvec4) Load 37(v.Position) + 39: 17(ptr) AccessChain 35(v) 16 + Store 39 38 + 45: 44(ptr) AccessChain 43(v.clip1) 16 + 46: 6(float) Load 45 + 47: 23(ptr) AccessChain 35(v) 20 22 + Store 47 46 + 48: 44(ptr) AccessChain 43(v.clip1) 20 + 49: 6(float) Load 48 + 51: 23(ptr) AccessChain 35(v) 20 50 + Store 51 49 + 52: 44(ptr) AccessChain 43(v.clip1) 28 + 53: 6(float) Load 52 + 55: 23(ptr) AccessChain 35(v) 20 54 + Store 55 53 + 57: 44(ptr) AccessChain 43(v.clip1) 56 + 58: 6(float) Load 57 + 59: 23(ptr) AccessChain 35(v) 28 22 + Store 59 58 + 61: 44(ptr) AccessChain 43(v.clip1) 60 + 62: 6(float) Load 61 + 63: 23(ptr) AccessChain 35(v) 28 50 + Store 63 62 + 65: 44(ptr) AccessChain 43(v.clip1) 64 + 66: 6(float) Load 65 + 67: 23(ptr) AccessChain 35(v) 28 54 + Store 67 66 + 69: 44(ptr) AccessChain 43(v.clip1) 68 + 70: 6(float) Load 69 + 72: 23(ptr) AccessChain 35(v) 28 71 + Store 72 70 + 76:9(VS_OUTPUT) Load 35(v) + Store 75(param) 76 + 77: 7(fvec4) FunctionCall 13(@main(struct-VS_OUTPUT-vf4-vf3-vf41;) 75(param) + Store 74(@entryPointOutput) 77 + Return + FunctionEnd +13(@main(struct-VS_OUTPUT-vf4-vf3-vf41;): 7(fvec4) Function None 11 + 12(v): 10(ptr) FunctionParameter + 14: Label + 18: 17(ptr) AccessChain 12(v) 16 + 19: 7(fvec4) Load 18 + 24: 23(ptr) AccessChain 12(v) 20 22 + 25: 6(float) Load 24 + 26: 7(fvec4) CompositeConstruct 25 25 25 25 + 27: 7(fvec4) FAdd 19 26 + 29: 23(ptr) AccessChain 12(v) 28 22 + 30: 6(float) Load 29 + 31: 7(fvec4) CompositeConstruct 30 30 30 30 + 32: 7(fvec4) FAdd 27 31 + ReturnValue 32 + FunctionEnd diff --git a/Test/baseResults/hlsl.clipdistance-8.frag.out b/Test/baseResults/hlsl.clipdistance-8.frag.out new file mode 100644 index 0000000..a1f6648 --- /dev/null +++ b/Test/baseResults/hlsl.clipdistance-8.frag.out @@ -0,0 +1,285 @@ +hlsl.clipdistance-8.frag +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:8 Function Definition: @main(struct-VS_OUTPUT-vf4-vf3-f11; ( temp 4-component vector of float) +0:8 Function Parameters: +0:8 'v' ( in structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1}) +0:? Sequence +0:9 Branch: Return with expression +0:9 add ( temp 4-component vector of float) +0:9 add ( temp 4-component vector of float) +0:9 Position: direct index for structure ( temp 4-component vector of float) +0:9 'v' ( in structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1}) +0:9 Constant: +0:9 0 (const int) +0:9 direct index ( temp float) +0:9 clip0: direct index for structure ( temp 3-component vector of float) +0:9 'v' ( in structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1}) +0:9 Constant: +0:9 1 (const int) +0:9 Constant: +0:9 0 (const int) +0:9 clip1: direct index for structure ( temp float) +0:9 'v' ( in structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1}) +0:9 Constant: +0:9 2 (const int) +0:8 Function Definition: main( ( temp void) +0:8 Function Parameters: +0:? Sequence +0:8 Sequence +0:8 move second child to first child ( temp 4-component vector of float) +0:8 Position: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1}) +0:8 Constant: +0:8 0 (const int) +0:? 'v.Position' ( in 4-component vector of float FragCoord) +0:? Sequence +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip0: direct index for structure ( temp 3-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1}) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 0 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 4-element array of float ClipDistance) +0:8 Constant: +0:8 0 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip0: direct index for structure ( temp 3-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1}) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 1 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 4-element array of float ClipDistance) +0:8 Constant: +0:8 1 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip0: direct index for structure ( temp 3-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1}) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 2 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 4-element array of float ClipDistance) +0:8 Constant: +0:8 2 (const int) +0:? Sequence +0:8 move second child to first child ( temp float) +0:8 clip1: direct index for structure ( temp float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1}) +0:8 Constant: +0:8 2 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 4-element array of float ClipDistance) +0:8 Constant: +0:8 3 (const int) +0:8 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:8 Function Call: @main(struct-VS_OUTPUT-vf4-vf3-f11; ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1}) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:? 'v.Position' ( in 4-component vector of float FragCoord) +0:? 'v.clip1' ( in 4-element array of float ClipDistance) + + +Linked fragment stage: + + +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:8 Function Definition: @main(struct-VS_OUTPUT-vf4-vf3-f11; ( temp 4-component vector of float) +0:8 Function Parameters: +0:8 'v' ( in structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1}) +0:? Sequence +0:9 Branch: Return with expression +0:9 add ( temp 4-component vector of float) +0:9 add ( temp 4-component vector of float) +0:9 Position: direct index for structure ( temp 4-component vector of float) +0:9 'v' ( in structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1}) +0:9 Constant: +0:9 0 (const int) +0:9 direct index ( temp float) +0:9 clip0: direct index for structure ( temp 3-component vector of float) +0:9 'v' ( in structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1}) +0:9 Constant: +0:9 1 (const int) +0:9 Constant: +0:9 0 (const int) +0:9 clip1: direct index for structure ( temp float) +0:9 'v' ( in structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1}) +0:9 Constant: +0:9 2 (const int) +0:8 Function Definition: main( ( temp void) +0:8 Function Parameters: +0:? Sequence +0:8 Sequence +0:8 move second child to first child ( temp 4-component vector of float) +0:8 Position: direct index for structure ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1}) +0:8 Constant: +0:8 0 (const int) +0:? 'v.Position' ( in 4-component vector of float FragCoord) +0:? Sequence +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip0: direct index for structure ( temp 3-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1}) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 0 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 4-element array of float ClipDistance) +0:8 Constant: +0:8 0 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip0: direct index for structure ( temp 3-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1}) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 1 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 4-element array of float ClipDistance) +0:8 Constant: +0:8 1 (const int) +0:8 move second child to first child ( temp float) +0:8 direct index ( temp float) +0:8 clip0: direct index for structure ( temp 3-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1}) +0:8 Constant: +0:8 1 (const int) +0:8 Constant: +0:8 2 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 4-element array of float ClipDistance) +0:8 Constant: +0:8 2 (const int) +0:? Sequence +0:8 move second child to first child ( temp float) +0:8 clip1: direct index for structure ( temp float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1}) +0:8 Constant: +0:8 2 (const int) +0:8 direct index ( temp float) +0:? 'v.clip1' ( in 4-element array of float ClipDistance) +0:8 Constant: +0:8 3 (const int) +0:8 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:8 Function Call: @main(struct-VS_OUTPUT-vf4-vf3-f11; ( temp 4-component vector of float) +0:? 'v' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1}) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:? 'v.Position' ( in 4-component vector of float FragCoord) +0:? 'v.clip1' ( in 4-element array of float ClipDistance) + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 65 + + Capability Shader + Capability ClipDistance + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 37 43 61 + ExecutionMode 4 OriginUpperLeft + Source HLSL 500 + Name 4 "main" + Name 9 "VS_OUTPUT" + MemberName 9(VS_OUTPUT) 0 "Position" + MemberName 9(VS_OUTPUT) 1 "clip0" + MemberName 9(VS_OUTPUT) 2 "clip1" + Name 13 "@main(struct-VS_OUTPUT-vf4-vf3-f11;" + Name 12 "v" + Name 35 "v" + Name 37 "v.Position" + Name 43 "v.clip1" + Name 61 "@entryPointOutput" + Name 62 "param" + Decorate 37(v.Position) BuiltIn FragCoord + Decorate 43(v.clip1) BuiltIn ClipDistance + Decorate 61(@entryPointOutput) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypeVector 6(float) 3 + 9(VS_OUTPUT): TypeStruct 7(fvec4) 8(fvec3) 6(float) + 10: TypePointer Function 9(VS_OUTPUT) + 11: TypeFunction 7(fvec4) 10(ptr) + 15: TypeInt 32 1 + 16: 15(int) Constant 0 + 17: TypePointer Function 7(fvec4) + 20: 15(int) Constant 1 + 21: TypeInt 32 0 + 22: 21(int) Constant 0 + 23: TypePointer Function 6(float) + 28: 15(int) Constant 2 + 36: TypePointer Input 7(fvec4) + 37(v.Position): 36(ptr) Variable Input + 40: 21(int) Constant 4 + 41: TypeArray 6(float) 40 + 42: TypePointer Input 41 + 43(v.clip1): 42(ptr) Variable Input + 44: TypePointer Input 6(float) + 50: 21(int) Constant 1 + 54: 21(int) Constant 2 + 56: 15(int) Constant 3 + 60: TypePointer Output 7(fvec4) +61(@entryPointOutput): 60(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 35(v): 10(ptr) Variable Function + 62(param): 10(ptr) Variable Function + 38: 7(fvec4) Load 37(v.Position) + 39: 17(ptr) AccessChain 35(v) 16 + Store 39 38 + 45: 44(ptr) AccessChain 43(v.clip1) 16 + 46: 6(float) Load 45 + 47: 23(ptr) AccessChain 35(v) 20 22 + Store 47 46 + 48: 44(ptr) AccessChain 43(v.clip1) 20 + 49: 6(float) Load 48 + 51: 23(ptr) AccessChain 35(v) 20 50 + Store 51 49 + 52: 44(ptr) AccessChain 43(v.clip1) 28 + 53: 6(float) Load 52 + 55: 23(ptr) AccessChain 35(v) 20 54 + Store 55 53 + 57: 44(ptr) AccessChain 43(v.clip1) 56 + 58: 6(float) Load 57 + 59: 23(ptr) AccessChain 35(v) 28 + Store 59 58 + 63:9(VS_OUTPUT) Load 35(v) + Store 62(param) 63 + 64: 7(fvec4) FunctionCall 13(@main(struct-VS_OUTPUT-vf4-vf3-f11;) 62(param) + Store 61(@entryPointOutput) 64 + Return + FunctionEnd +13(@main(struct-VS_OUTPUT-vf4-vf3-f11;): 7(fvec4) Function None 11 + 12(v): 10(ptr) FunctionParameter + 14: Label + 18: 17(ptr) AccessChain 12(v) 16 + 19: 7(fvec4) Load 18 + 24: 23(ptr) AccessChain 12(v) 20 22 + 25: 6(float) Load 24 + 26: 7(fvec4) CompositeConstruct 25 25 25 25 + 27: 7(fvec4) FAdd 19 26 + 29: 23(ptr) AccessChain 12(v) 28 + 30: 6(float) Load 29 + 31: 7(fvec4) CompositeConstruct 30 30 30 30 + 32: 7(fvec4) FAdd 27 31 + ReturnValue 32 + FunctionEnd diff --git a/Test/baseResults/hlsl.clipdistance-9.frag.out b/Test/baseResults/hlsl.clipdistance-9.frag.out new file mode 100644 index 0000000..ef52b23 --- /dev/null +++ b/Test/baseResults/hlsl.clipdistance-9.frag.out @@ -0,0 +1,250 @@ +hlsl.clipdistance-9.frag +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:6 Function Definition: @main(vf4;vf3;f1; ( temp 4-component vector of float) +0:6 Function Parameters: +0:6 'Position' ( in 4-component vector of float) +0:6 'clip0' ( in 3-component vector of float) +0:6 'clip1' ( in float) +0:? Sequence +0:7 Branch: Return with expression +0:7 add ( temp 4-component vector of float) +0:7 add ( temp 4-component vector of float) +0:7 'Position' ( in 4-component vector of float) +0:7 direct index ( temp float) +0:7 'clip0' ( in 3-component vector of float) +0:7 Constant: +0:7 0 (const int) +0:7 'clip1' ( in float) +0:6 Function Definition: main( ( temp void) +0:6 Function Parameters: +0:? Sequence +0:6 move second child to first child ( temp 4-component vector of float) +0:? 'Position' ( temp 4-component vector of float) +0:? 'Position' ( in 4-component vector of float FragCoord) +0:? Sequence +0:6 move second child to first child ( temp float) +0:6 direct index ( temp float) +0:? 'clip0' ( temp 3-component vector of float) +0:6 Constant: +0:6 0 (const int) +0:6 direct index ( temp float) +0:? 'clip0' ( in 4-element array of float ClipDistance) +0:6 Constant: +0:6 0 (const int) +0:6 move second child to first child ( temp float) +0:6 direct index ( temp float) +0:? 'clip0' ( temp 3-component vector of float) +0:6 Constant: +0:6 1 (const int) +0:6 direct index ( temp float) +0:? 'clip0' ( in 4-element array of float ClipDistance) +0:6 Constant: +0:6 1 (const int) +0:6 move second child to first child ( temp float) +0:6 direct index ( temp float) +0:? 'clip0' ( temp 3-component vector of float) +0:6 Constant: +0:6 2 (const int) +0:6 direct index ( temp float) +0:? 'clip0' ( in 4-element array of float ClipDistance) +0:6 Constant: +0:6 2 (const int) +0:? Sequence +0:6 move second child to first child ( temp float) +0:? 'clip1' ( temp float) +0:6 direct index ( temp float) +0:? 'clip0' ( in 4-element array of float ClipDistance) +0:6 Constant: +0:6 3 (const int) +0:6 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:6 Function Call: @main(vf4;vf3;f1; ( temp 4-component vector of float) +0:? 'Position' ( temp 4-component vector of float) +0:? 'clip0' ( temp 3-component vector of float) +0:? 'clip1' ( temp float) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:? 'Position' ( in 4-component vector of float FragCoord) +0:? 'clip0' ( in 4-element array of float ClipDistance) + + +Linked fragment stage: + + +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:6 Function Definition: @main(vf4;vf3;f1; ( temp 4-component vector of float) +0:6 Function Parameters: +0:6 'Position' ( in 4-component vector of float) +0:6 'clip0' ( in 3-component vector of float) +0:6 'clip1' ( in float) +0:? Sequence +0:7 Branch: Return with expression +0:7 add ( temp 4-component vector of float) +0:7 add ( temp 4-component vector of float) +0:7 'Position' ( in 4-component vector of float) +0:7 direct index ( temp float) +0:7 'clip0' ( in 3-component vector of float) +0:7 Constant: +0:7 0 (const int) +0:7 'clip1' ( in float) +0:6 Function Definition: main( ( temp void) +0:6 Function Parameters: +0:? Sequence +0:6 move second child to first child ( temp 4-component vector of float) +0:? 'Position' ( temp 4-component vector of float) +0:? 'Position' ( in 4-component vector of float FragCoord) +0:? Sequence +0:6 move second child to first child ( temp float) +0:6 direct index ( temp float) +0:? 'clip0' ( temp 3-component vector of float) +0:6 Constant: +0:6 0 (const int) +0:6 direct index ( temp float) +0:? 'clip0' ( in 4-element array of float ClipDistance) +0:6 Constant: +0:6 0 (const int) +0:6 move second child to first child ( temp float) +0:6 direct index ( temp float) +0:? 'clip0' ( temp 3-component vector of float) +0:6 Constant: +0:6 1 (const int) +0:6 direct index ( temp float) +0:? 'clip0' ( in 4-element array of float ClipDistance) +0:6 Constant: +0:6 1 (const int) +0:6 move second child to first child ( temp float) +0:6 direct index ( temp float) +0:? 'clip0' ( temp 3-component vector of float) +0:6 Constant: +0:6 2 (const int) +0:6 direct index ( temp float) +0:? 'clip0' ( in 4-element array of float ClipDistance) +0:6 Constant: +0:6 2 (const int) +0:? Sequence +0:6 move second child to first child ( temp float) +0:? 'clip1' ( temp float) +0:6 direct index ( temp float) +0:? 'clip0' ( in 4-element array of float ClipDistance) +0:6 Constant: +0:6 3 (const int) +0:6 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:6 Function Call: @main(vf4;vf3;f1; ( temp 4-component vector of float) +0:? 'Position' ( temp 4-component vector of float) +0:? 'clip0' ( temp 3-component vector of float) +0:? 'clip1' ( temp float) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:? 'Position' ( in 4-component vector of float FragCoord) +0:? 'clip0' ( in 4-element array of float ClipDistance) + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 68 + + Capability Shader + Capability ClipDistance + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 32 38 60 + ExecutionMode 4 OriginUpperLeft + Source HLSL 500 + Name 4 "main" + Name 16 "@main(vf4;vf3;f1;" + Name 13 "Position" + Name 14 "clip0" + Name 15 "clip1" + Name 30 "Position" + Name 32 "Position" + Name 34 "clip0" + Name 38 "clip0" + Name 55 "clip1" + Name 60 "@entryPointOutput" + Name 61 "param" + Name 63 "param" + Name 65 "param" + Decorate 32(Position) BuiltIn FragCoord + Decorate 38(clip0) BuiltIn ClipDistance + Decorate 60(@entryPointOutput) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Function 7(fvec4) + 9: TypeVector 6(float) 3 + 10: TypePointer Function 9(fvec3) + 11: TypePointer Function 6(float) + 12: TypeFunction 7(fvec4) 8(ptr) 10(ptr) 11(ptr) + 19: TypeInt 32 0 + 20: 19(int) Constant 0 + 31: TypePointer Input 7(fvec4) + 32(Position): 31(ptr) Variable Input + 35: 19(int) Constant 4 + 36: TypeArray 6(float) 35 + 37: TypePointer Input 36 + 38(clip0): 37(ptr) Variable Input + 39: TypeInt 32 1 + 40: 39(int) Constant 0 + 41: TypePointer Input 6(float) + 45: 39(int) Constant 1 + 48: 19(int) Constant 1 + 50: 39(int) Constant 2 + 53: 19(int) Constant 2 + 56: 39(int) Constant 3 + 59: TypePointer Output 7(fvec4) +60(@entryPointOutput): 59(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 30(Position): 8(ptr) Variable Function + 34(clip0): 10(ptr) Variable Function + 55(clip1): 11(ptr) Variable Function + 61(param): 8(ptr) Variable Function + 63(param): 10(ptr) Variable Function + 65(param): 11(ptr) Variable Function + 33: 7(fvec4) Load 32(Position) + Store 30(Position) 33 + 42: 41(ptr) AccessChain 38(clip0) 40 + 43: 6(float) Load 42 + 44: 11(ptr) AccessChain 34(clip0) 20 + Store 44 43 + 46: 41(ptr) AccessChain 38(clip0) 45 + 47: 6(float) Load 46 + 49: 11(ptr) AccessChain 34(clip0) 48 + Store 49 47 + 51: 41(ptr) AccessChain 38(clip0) 50 + 52: 6(float) Load 51 + 54: 11(ptr) AccessChain 34(clip0) 53 + Store 54 52 + 57: 41(ptr) AccessChain 38(clip0) 56 + 58: 6(float) Load 57 + Store 55(clip1) 58 + 62: 7(fvec4) Load 30(Position) + Store 61(param) 62 + 64: 9(fvec3) Load 34(clip0) + Store 63(param) 64 + 66: 6(float) Load 55(clip1) + Store 65(param) 66 + 67: 7(fvec4) FunctionCall 16(@main(vf4;vf3;f1;) 61(param) 63(param) 65(param) + Store 60(@entryPointOutput) 67 + Return + FunctionEnd +16(@main(vf4;vf3;f1;): 7(fvec4) Function None 12 + 13(Position): 8(ptr) FunctionParameter + 14(clip0): 10(ptr) FunctionParameter + 15(clip1): 11(ptr) FunctionParameter + 17: Label + 18: 7(fvec4) Load 13(Position) + 21: 11(ptr) AccessChain 14(clip0) 20 + 22: 6(float) Load 21 + 23: 7(fvec4) CompositeConstruct 22 22 22 22 + 24: 7(fvec4) FAdd 18 23 + 25: 6(float) Load 15(clip1) + 26: 7(fvec4) CompositeConstruct 25 25 25 25 + 27: 7(fvec4) FAdd 24 26 + ReturnValue 27 + FunctionEnd diff --git a/Test/baseResults/hlsl.semantic.geom.out b/Test/baseResults/hlsl.semantic.geom.out index f7b82b6..38acc27 100755 --- a/Test/baseResults/hlsl.semantic.geom.out +++ b/Test/baseResults/hlsl.semantic.geom.out @@ -1,10 +1,15 @@ hlsl.semantic.geom +ERROR: 0:15: '' : unimplemented: clip/cull not currently implemented for this stage +ERROR: 0:15: '' : unimplemented: clip/cull not currently implemented for this stage +ERROR: 2 compilation errors. No code generated. + + Shader version: 500 invocations = -1 max_vertices = 4 input primitive = triangles output primitive = line_strip -0:? Sequence +ERROR: node is still EOpNull! 0:13 Function Definition: @main(u1[3];struct-S-f1-f1-f1-u1-u1-i11; ( temp void) 0:13 Function Parameters: 0:13 'VertexID' ( in 3-element array of uint) @@ -18,26 +23,6 @@ output primitive = line_strip 0:15 's' ( temp structure{ temp float clip0, temp float clip0, temp float cull0, temp uint vpai, temp uint rtai, temp int ii}) 0:15 Constant: 0:15 0 (const int) -0:? Sequence -0:15 move second child to first child ( temp float) -0:15 direct index ( temp float) -0:? 'OutputStream.clip0' ( out 1-element array of float ClipDistance) -0:15 Constant: -0:15 0 (const int) -0:15 clip0: direct index for structure ( temp float) -0:15 's' ( temp structure{ temp float clip0, temp float clip0, temp float cull0, temp uint vpai, temp uint rtai, temp int ii}) -0:15 Constant: -0:15 1 (const int) -0:? Sequence -0:15 move second child to first child ( temp float) -0:15 direct index ( temp float) -0:? 'OutputStream.cull0' ( out 1-element array of float CullDistance) -0:15 Constant: -0:15 0 (const int) -0:15 cull0: direct index for structure ( temp float) -0:15 's' ( temp structure{ temp float clip0, temp float clip0, temp float cull0, temp uint vpai, temp uint rtai, temp int ii}) -0:15 Constant: -0:15 2 (const int) 0:15 move second child to first child ( temp uint) 0:? 'OutputStream.vpai' ( out uint ViewportIndex) 0:15 vpai: direct index for structure ( temp uint) @@ -72,8 +57,6 @@ output primitive = line_strip 0:? 'OutputStream.vpai' ( out uint ViewportIndex) 0:? 'OutputStream.rtai' ( out uint Layer) 0:? 'OutputStream.ii' (layout( location=0) out int) -0:? 'OutputStream.clip0' ( out 1-element array of float ClipDistance) -0:? 'OutputStream.cull0' ( out 1-element array of float CullDistance) Linked geometry stage: @@ -84,7 +67,7 @@ invocations = 1 max_vertices = 4 input primitive = triangles output primitive = line_strip -0:? Sequence +ERROR: node is still EOpNull! 0:13 Function Definition: @main(u1[3];struct-S-f1-f1-f1-u1-u1-i11; ( temp void) 0:13 Function Parameters: 0:13 'VertexID' ( in 3-element array of uint) @@ -98,26 +81,6 @@ output primitive = line_strip 0:15 's' ( temp structure{ temp float clip0, temp float clip0, temp float cull0, temp uint vpai, temp uint rtai, temp int ii}) 0:15 Constant: 0:15 0 (const int) -0:? Sequence -0:15 move second child to first child ( temp float) -0:15 direct index ( temp float) -0:? 'OutputStream.clip0' ( out 1-element array of float ClipDistance) -0:15 Constant: -0:15 0 (const int) -0:15 clip0: direct index for structure ( temp float) -0:15 's' ( temp structure{ temp float clip0, temp float clip0, temp float cull0, temp uint vpai, temp uint rtai, temp int ii}) -0:15 Constant: -0:15 1 (const int) -0:? Sequence -0:15 move second child to first child ( temp float) -0:15 direct index ( temp float) -0:? 'OutputStream.cull0' ( out 1-element array of float CullDistance) -0:15 Constant: -0:15 0 (const int) -0:15 cull0: direct index for structure ( temp float) -0:15 's' ( temp structure{ temp float clip0, temp float clip0, temp float cull0, temp uint vpai, temp uint rtai, temp int ii}) -0:15 Constant: -0:15 2 (const int) 0:15 move second child to first child ( temp uint) 0:? 'OutputStream.vpai' ( out uint ViewportIndex) 0:15 vpai: direct index for structure ( temp uint) @@ -152,129 +115,5 @@ output primitive = line_strip 0:? 'OutputStream.vpai' ( out uint ViewportIndex) 0:? 'OutputStream.rtai' ( out uint Layer) 0:? 'OutputStream.ii' (layout( location=0) out int) -0:? 'OutputStream.clip0' ( out 1-element array of float ClipDistance) -0:? 'OutputStream.cull0' ( out 1-element array of float CullDistance) - -// Module Version 10000 -// Generated by (magic number): 80001 -// Id's are bound by 65 - Capability Geometry - Capability ClipDistance - Capability CullDistance - Capability MultiViewport - 1: ExtInstImport "GLSL.std.450" - MemoryModel Logical GLSL450 - EntryPoint Geometry 4 "main" 20 29 34 40 45 50 57 - ExecutionMode 4 Triangles - ExecutionMode 4 Invocations 1 - ExecutionMode 4 OutputLineStrip - ExecutionMode 4 OutputVertices 4 - Source HLSL 500 - Name 4 "main" - Name 12 "S" - MemberName 12(S) 0 "clip0" - MemberName 12(S) 1 "clip0" - MemberName 12(S) 2 "cull0" - MemberName 12(S) 3 "vpai" - MemberName 12(S) 4 "rtai" - MemberName 12(S) 5 "ii" - Name 17 "@main(u1[3];struct-S-f1-f1-f1-u1-u1-i11;" - Name 15 "VertexID" - Name 16 "OutputStream" - Name 20 "OutputStream.clip0" - Name 21 "s" - Name 29 "OutputStream.clip0" - Name 34 "OutputStream.cull0" - Name 40 "OutputStream.vpai" - Name 45 "OutputStream.rtai" - Name 50 "OutputStream.ii" - Name 55 "VertexID" - Name 57 "VertexID" - Name 59 "OutputStream" - Name 60 "param" - Name 62 "param" - Decorate 20(OutputStream.clip0) BuiltIn Position - Decorate 29(OutputStream.clip0) BuiltIn ClipDistance - Decorate 34(OutputStream.cull0) BuiltIn CullDistance - Decorate 40(OutputStream.vpai) BuiltIn ViewportIndex - Decorate 45(OutputStream.rtai) BuiltIn Layer - Decorate 50(OutputStream.ii) Location 0 - Decorate 57(VertexID) Location 0 - 2: TypeVoid - 3: TypeFunction 2 - 6: TypeInt 32 0 - 7: 6(int) Constant 3 - 8: TypeArray 6(int) 7 - 9: TypePointer Function 8 - 10: TypeFloat 32 - 11: TypeInt 32 1 - 12(S): TypeStruct 10(float) 10(float) 10(float) 6(int) 6(int) 11(int) - 13: TypePointer Function 12(S) - 14: TypeFunction 2 9(ptr) 13(ptr) - 19: TypePointer Output 10(float) -20(OutputStream.clip0): 19(ptr) Variable Output - 22: 11(int) Constant 0 - 23: TypePointer Function 10(float) - 26: 6(int) Constant 1 - 27: TypeArray 10(float) 26 - 28: TypePointer Output 27 -29(OutputStream.clip0): 28(ptr) Variable Output - 30: 11(int) Constant 1 -34(OutputStream.cull0): 28(ptr) Variable Output - 35: 11(int) Constant 2 - 39: TypePointer Output 6(int) -40(OutputStream.vpai): 39(ptr) Variable Output - 41: 11(int) Constant 3 - 42: TypePointer Function 6(int) -45(OutputStream.rtai): 39(ptr) Variable Output - 46: 11(int) Constant 4 - 49: TypePointer Output 11(int) -50(OutputStream.ii): 49(ptr) Variable Output - 51: 11(int) Constant 5 - 52: TypePointer Function 11(int) - 56: TypePointer Input 8 - 57(VertexID): 56(ptr) Variable Input - 4(main): 2 Function None 3 - 5: Label - 55(VertexID): 9(ptr) Variable Function -59(OutputStream): 13(ptr) Variable Function - 60(param): 9(ptr) Variable Function - 62(param): 13(ptr) Variable Function - 58: 8 Load 57(VertexID) - Store 55(VertexID) 58 - 61: 8 Load 55(VertexID) - Store 60(param) 61 - 63: 2 FunctionCall 17(@main(u1[3];struct-S-f1-f1-f1-u1-u1-i11;) 60(param) 62(param) - 64: 12(S) Load 62(param) - Store 59(OutputStream) 64 - Return - FunctionEnd -17(@main(u1[3];struct-S-f1-f1-f1-u1-u1-i11;): 2 Function None 14 - 15(VertexID): 9(ptr) FunctionParameter -16(OutputStream): 13(ptr) FunctionParameter - 18: Label - 21(s): 13(ptr) Variable Function - 24: 23(ptr) AccessChain 21(s) 22 - 25: 10(float) Load 24 - Store 20(OutputStream.clip0) 25 - 31: 23(ptr) AccessChain 21(s) 30 - 32: 10(float) Load 31 - 33: 19(ptr) AccessChain 29(OutputStream.clip0) 22 - Store 33 32 - 36: 23(ptr) AccessChain 21(s) 35 - 37: 10(float) Load 36 - 38: 19(ptr) AccessChain 34(OutputStream.cull0) 22 - Store 38 37 - 43: 42(ptr) AccessChain 21(s) 41 - 44: 6(int) Load 43 - Store 40(OutputStream.vpai) 44 - 47: 42(ptr) AccessChain 21(s) 46 - 48: 6(int) Load 47 - Store 45(OutputStream.rtai) 48 - 53: 52(ptr) AccessChain 21(s) 51 - 54: 11(int) Load 53 - Store 50(OutputStream.ii) 54 - EmitVertex - Return - FunctionEnd +SPIR-V is not generated for failed compile or link diff --git a/Test/baseResults/hlsl.semantic.vert.out b/Test/baseResults/hlsl.semantic.vert.out index a3aa340..086a4aa 100755 --- a/Test/baseResults/hlsl.semantic.vert.out +++ b/Test/baseResults/hlsl.semantic.vert.out @@ -28,13 +28,13 @@ Shader version: 500 0:? 'ins' ( temp structure{ temp float clip0, temp float clip1, temp float cull0, temp float cull1, temp int ii}) 0:10 Constant: 0:10 2 (const int) -0:? 'ins.cull0' (layout( location=2) in float) +0:? 'ins.cull0' (layout( location=0) in float) 0:10 move second child to first child ( temp float) 0:10 cull1: direct index for structure ( temp float) 0:? 'ins' ( temp structure{ temp float clip0, temp float clip1, temp float cull0, temp float cull1, temp int ii}) 0:10 Constant: 0:10 3 (const int) -0:? 'ins.cull1' (layout( location=3) in float) +0:? 'ins.cull1' (layout( location=1) in float) 0:10 move second child to first child ( temp int) 0:10 ii: direct index for structure ( temp int) 0:? 'ins' ( temp structure{ temp float clip0, temp float clip1, temp float cull0, temp float cull1, temp int ii}) @@ -97,8 +97,8 @@ Shader version: 500 0:? 'ins.ii' ( in int InstanceIndex) 0:? 'ins.clip0' (layout( location=0) in float) 0:? 'ins.clip1' (layout( location=1) in float) -0:? 'ins.cull0' (layout( location=2) in float) -0:? 'ins.cull1' (layout( location=3) in float) +0:? 'ins.cull0' (layout( location=0) in float) +0:? 'ins.cull1' (layout( location=1) in float) 0:? '@entryPointOutput.clip1' ( out 2-element array of float ClipDistance) 0:? '@entryPointOutput.cull1' ( out 2-element array of float CullDistance) @@ -135,13 +135,13 @@ Shader version: 500 0:? 'ins' ( temp structure{ temp float clip0, temp float clip1, temp float cull0, temp float cull1, temp int ii}) 0:10 Constant: 0:10 2 (const int) -0:? 'ins.cull0' (layout( location=2) in float) +0:? 'ins.cull0' (layout( location=0) in float) 0:10 move second child to first child ( temp float) 0:10 cull1: direct index for structure ( temp float) 0:? 'ins' ( temp structure{ temp float clip0, temp float clip1, temp float cull0, temp float cull1, temp int ii}) 0:10 Constant: 0:10 3 (const int) -0:? 'ins.cull1' (layout( location=3) in float) +0:? 'ins.cull1' (layout( location=1) in float) 0:10 move second child to first child ( temp int) 0:10 ii: direct index for structure ( temp int) 0:? 'ins' ( temp structure{ temp float clip0, temp float clip1, temp float cull0, temp float cull1, temp int ii}) @@ -204,8 +204,8 @@ Shader version: 500 0:? 'ins.ii' ( in int InstanceIndex) 0:? 'ins.clip0' (layout( location=0) in float) 0:? 'ins.clip1' (layout( location=1) in float) -0:? 'ins.cull0' (layout( location=2) in float) -0:? 'ins.cull1' (layout( location=3) in float) +0:? 'ins.cull0' (layout( location=0) in float) +0:? 'ins.cull1' (layout( location=1) in float) 0:? '@entryPointOutput.clip1' ( out 2-element array of float ClipDistance) 0:? '@entryPointOutput.cull1' ( out 2-element array of float CullDistance) @@ -243,8 +243,8 @@ Shader version: 500 Name 67 "@entryPointOutput.ii" Decorate 21(ins.clip0) Location 0 Decorate 26(ins.clip1) Location 1 - Decorate 30(ins.cull0) Location 2 - Decorate 34(ins.cull1) Location 3 + Decorate 30(ins.cull0) Location 0 + Decorate 34(ins.cull1) Location 1 Decorate 39(ins.ii) BuiltIn InstanceIndex Decorate 51(@entryPointOutput.clip1) BuiltIn ClipDistance Decorate 59(@entryPointOutput.cull1) BuiltIn CullDistance diff --git a/Test/hlsl.clipdistance-1.frag b/Test/hlsl.clipdistance-1.frag new file mode 100644 index 0000000..10813b3 --- /dev/null +++ b/Test/hlsl.clipdistance-1.frag @@ -0,0 +1,6 @@ +float4 main(in float4 pos : SV_Position, + in float clip : SV_ClipDistance, + in float cull : SV_CullDistance) : SV_Target0 +{ + return pos + clip + cull; +} diff --git a/Test/hlsl.clipdistance-1.geom b/Test/hlsl.clipdistance-1.geom new file mode 100644 index 0000000..d056ebd --- /dev/null +++ b/Test/hlsl.clipdistance-1.geom @@ -0,0 +1,22 @@ +struct S { + float4 pos : SV_Position; + float clip : SV_ClipDistance0; + float cull : SV_CullDistance0; +}; + +[maxvertexcount(3)] +void main(triangle in float4 pos[3] : SV_Position, + triangle in uint VertexID[3] : VertexID, + inout LineStream OutputStream, + triangle in float clip[3] : SV_ClipDistance, // scalar float + triangle in float cull[3] : SV_CullDistance) // scalar float +{ + S s; + + s.pos = pos[0]; + s.clip = clip[0]; + s.cull = cull[0]; + + OutputStream.Append(s); +} + diff --git a/Test/hlsl.clipdistance-2.frag b/Test/hlsl.clipdistance-2.frag new file mode 100644 index 0000000..b6f88d5 --- /dev/null +++ b/Test/hlsl.clipdistance-2.frag @@ -0,0 +1,7 @@ +float4 main(in float4 pos : SV_Position, + in float2 clip[2] : SV_ClipDistance, // array of vector float + in float2 cull[2] : SV_CullDistance) : SV_Target0 // array of vector float +{ + + return pos + clip[0][0] + cull[0][0]; +} diff --git a/Test/hlsl.clipdistance-2.geom b/Test/hlsl.clipdistance-2.geom new file mode 100644 index 0000000..49d2734 --- /dev/null +++ b/Test/hlsl.clipdistance-2.geom @@ -0,0 +1,19 @@ +struct S { + float4 pos : SV_Position; + float2 clip[2] : SV_ClipDistance0; +}; + +[maxvertexcount(3)] +void main(triangle in float4 pos[3] : SV_Position, + triangle in uint VertexID[3] : VertexID, + inout LineStream OutputStream, + triangle in float2 clip[3][2] : SV_ClipDistance) // scalar float +{ + S s; + + s.pos = pos[0]; + s.clip[0] = clip[0][0]; + s.clip[1] = clip[0][1]; + + OutputStream.Append(s); +} diff --git a/Test/hlsl.clipdistance-3.frag b/Test/hlsl.clipdistance-3.frag new file mode 100644 index 0000000..c590fa4 --- /dev/null +++ b/Test/hlsl.clipdistance-3.frag @@ -0,0 +1,8 @@ +float4 main(in float4 pos : SV_Position, + in float clip[2] : SV_ClipDistance, // array of scalar float + in float cull[2] : SV_CullDistance) : SV_Target0 // array of scalar float +{ + return pos + clip[0] + cull[0]; +} + + diff --git a/Test/hlsl.clipdistance-4.frag b/Test/hlsl.clipdistance-4.frag new file mode 100644 index 0000000..6144160 --- /dev/null +++ b/Test/hlsl.clipdistance-4.frag @@ -0,0 +1,9 @@ +struct VS_OUTPUT { + float4 Position : SV_Position; + float4 ClipRect : SV_ClipDistance0; // vector in split struct +}; + +float4 main(const VS_OUTPUT v) : SV_Target0 +{ + return v.Position + v.ClipRect; +} diff --git a/Test/hlsl.clipdistance-5.frag b/Test/hlsl.clipdistance-5.frag new file mode 100644 index 0000000..4722999 --- /dev/null +++ b/Test/hlsl.clipdistance-5.frag @@ -0,0 +1,9 @@ +struct VS_OUTPUT { + float4 Position : SV_Position; + float2 ClipRect[2] : SV_ClipDistance0; // array of float2 in split struct +}; + +float4 main(const VS_OUTPUT v) : SV_Target0 +{ + return v.Position + v.ClipRect[0].x + v.ClipRect[1].x; +} diff --git a/Test/hlsl.clipdistance-6.frag b/Test/hlsl.clipdistance-6.frag new file mode 100644 index 0000000..646197b --- /dev/null +++ b/Test/hlsl.clipdistance-6.frag @@ -0,0 +1,10 @@ +struct VS_OUTPUT { + float4 Position : SV_Position; + float4 clip0 : SV_ClipDistance0; // multiple semantic IDs, two vec4s (no extra packing) + float4 clip1 : SV_ClipDistance1; // ... +}; + +float4 main(VS_OUTPUT v) : SV_Target0 +{ + return v.Position + v.clip0 + v.clip1; +} diff --git a/Test/hlsl.clipdistance-7.frag b/Test/hlsl.clipdistance-7.frag new file mode 100644 index 0000000..1a26df8 --- /dev/null +++ b/Test/hlsl.clipdistance-7.frag @@ -0,0 +1,10 @@ +struct VS_OUTPUT { + float4 Position : SV_Position; + float3 clip0 : SV_ClipDistance0; // multiple semantic IDs, vec3+vec4 (skip) + float4 clip1 : SV_ClipDistance1; // ... +}; + +float4 main(VS_OUTPUT v) : SV_Target0 +{ + return v.Position + v.clip0.x + v.clip1.x; +} diff --git a/Test/hlsl.clipdistance-8.frag b/Test/hlsl.clipdistance-8.frag new file mode 100644 index 0000000..2edf194 --- /dev/null +++ b/Test/hlsl.clipdistance-8.frag @@ -0,0 +1,10 @@ +struct VS_OUTPUT { + float4 Position : SV_Position; + float3 clip0 : SV_ClipDistance0; // multiple semantic IDs, vec3+float (pack) + float clip1 : SV_ClipDistance1; // ... +}; + +float4 main(VS_OUTPUT v) : SV_Target0 +{ + return v.Position + v.clip0.x + v.clip1; +} diff --git a/Test/hlsl.clipdistance-9.frag b/Test/hlsl.clipdistance-9.frag new file mode 100644 index 0000000..cbe940a --- /dev/null +++ b/Test/hlsl.clipdistance-9.frag @@ -0,0 +1,8 @@ + +// Test packing 0 and 1 semantics into single array[4], from in fn params. +float4 main(in float4 Position : SV_Position, + in float3 clip0 : SV_ClipDistance0, + in float clip1 : SV_ClipDistance1) : SV_Target0 +{ + return Position + clip0.x + clip1; +} diff --git a/gtests/Hlsl.FromFile.cpp b/gtests/Hlsl.FromFile.cpp index 27452ab..0488eb7 100644 --- a/gtests/Hlsl.FromFile.cpp +++ b/gtests/Hlsl.FromFile.cpp @@ -97,14 +97,25 @@ INSTANTIATE_TEST_CASE_P( {"hlsl.cast.frag", "PixelShaderFunction"}, {"hlsl.charLit.vert", "main"}, {"hlsl.clip.frag", "main"}, + {"hlsl.clipdistance-1.frag", "main"}, + {"hlsl.clipdistance-1.geom", "main"}, {"hlsl.clipdistance-1.vert", "main"}, + {"hlsl.clipdistance-2.frag", "main"}, + {"hlsl.clipdistance-2.geom", "main"}, {"hlsl.clipdistance-2.vert", "main"}, + {"hlsl.clipdistance-3.frag", "main"}, {"hlsl.clipdistance-3.vert", "main"}, + {"hlsl.clipdistance-4.frag", "main"}, {"hlsl.clipdistance-4.vert", "main"}, + {"hlsl.clipdistance-5.frag", "main"}, {"hlsl.clipdistance-5.vert", "main"}, + {"hlsl.clipdistance-6.frag", "main"}, {"hlsl.clipdistance-6.vert", "main"}, + {"hlsl.clipdistance-7.frag", "main"}, {"hlsl.clipdistance-7.vert", "main"}, + {"hlsl.clipdistance-8.frag", "main"}, {"hlsl.clipdistance-8.vert", "main"}, + {"hlsl.clipdistance-9.frag", "main"}, {"hlsl.clipdistance-9.vert", "main"}, {"hlsl.comparison.vec.frag", "main"}, {"hlsl.conditional.frag", "PixelShaderFunction"}, diff --git a/hlsl/hlslParseHelper.cpp b/hlsl/hlslParseHelper.cpp index 5eb5e67..26b6f3a 100755 --- a/hlsl/hlslParseHelper.cpp +++ b/hlsl/hlslParseHelper.cpp @@ -66,8 +66,8 @@ HlslParseContext::HlslParseContext(TSymbolTable& symbolTable, TIntermediate& int entryPointFunction(nullptr), entryPointFunctionBody(nullptr), gsStreamOutput(nullptr), - clipDistanceOutput(nullptr), - cullDistanceOutput(nullptr) + clipDistanceVariable(nullptr), + cullDistanceVariable(nullptr) { globalUniformDefaults.clear(); globalUniformDefaults.layoutMatrix = ElmRowMajor; @@ -2271,25 +2271,37 @@ void HlslParseContext::handleFunctionArgument(TFunction* function, TIntermAggregate* HlslParseContext::assignClipCullDistance(const TSourceLoc& loc, TOperator op, int semanticId, TIntermTyped* left, TIntermTyped* right) { + switch (language) { + case EShLangFragment: + case EShLangVertex: + break; + default: + error(loc, "unimplemented: clip/cull not currently implemented for this stage", "", ""); + return nullptr; + } + TVariable** clipCullVar = nullptr; - const TBuiltInVariable builtInType = left->getQualifier().builtIn; + // Figure out if we are assigning to, or from, clip or cull distance. + const bool isOutput = isClipOrCullDistance(left->getType()); - // array sizes, or 1 if it's not an array: - const int rhsArraySize = (right->getType().isArray() ? right->getType().getOuterArraySize() : 1); - // vector sizes: - const int rhsVectorSize = right->getType().getVectorSize(); + // This is the rvalue or lvalue holding the clip or cull distance. + TIntermTyped* clipCullNode = isOutput ? left : right; + // This is the value going into or out of the clip or cull distance. + TIntermTyped* internalNode = isOutput ? right : left; + + const TBuiltInVariable builtInType = clipCullNode->getQualifier().builtIn; decltype(clipSemanticNSize)* semanticNSize = nullptr; // Refer to either the clip or the cull distance, depending on semantic. switch (builtInType) { case EbvClipDistance: - clipCullVar = &clipDistanceOutput; + clipCullVar = &clipDistanceVariable; semanticNSize = &clipSemanticNSize; break; case EbvCullDistance: - clipCullVar = &cullDistanceOutput; + clipCullVar = &cullDistanceVariable; semanticNSize = &cullSemanticNSize; break; @@ -2317,22 +2329,23 @@ TIntermAggregate* HlslParseContext::assignClipCullDistance(const TSourceLoc& loc arrayLoc += (*semanticNSize)[x]; } + // array sizes, or 1 if it's not an array: + const int internalNodeArraySize = (internalNode->getType().isArray() ? internalNode->getType().getOuterArraySize() : 1); + // vector sizes: + const int internalNodeVectorSize = internalNode->getType().getVectorSize(); // If we haven't created the output already, create it now. if (*clipCullVar == nullptr) { - // ClipDistance and CullDistance are handled specially in the entry point output - // copy algorithm, because they may need to be unpacked from components of vectors - // (or a scalar) into a float array. Here, we make the array the right size and type, - // which depends on the incoming data, which has several potential dimensions: - // Semantic ID - // vector size - // array size - // Of those, semantic ID and array size cannot appear simultaneously. - - const int requiredArraySize = arrayLoc * rhsArraySize; + // ClipDistance and CullDistance are handled specially in the entry point input/output copy + // algorithm, because they may need to be unpacked from components of vectors (or a scalar) + // into a float array, or vice versa. Here, we make the array the right size and type, + // which depends on the incoming data, which has several potential dimensions: Semantic ID + // vector size array size Of those, semantic ID and array size cannot appear + // simultaneously. + const int requiredArraySize = arrayLoc * internalNodeArraySize; - TType clipCullType(EbtFloat, left->getType().getQualifier().storage, 1); - clipCullType.getQualifier() = left->getType().getQualifier(); + TType clipCullType(EbtFloat, clipCullNode->getType().getQualifier().storage, 1); + clipCullType.getQualifier() = clipCullNode->getType().getQualifier(); // Create required array dimension TArraySizes arraySizes; @@ -2340,7 +2353,7 @@ TIntermAggregate* HlslParseContext::assignClipCullDistance(const TSourceLoc& loc clipCullType.newArraySizes(arraySizes); // Obtain symbol name: we'll use that for the symbol we introduce. - TIntermSymbol* sym = left->getAsSymbolNode(); + TIntermSymbol* sym = clipCullNode->getAsSymbolNode(); assert(sym != nullptr); // We are moving the semantic ID from the layout location, so it is no longer needed or @@ -2354,66 +2367,81 @@ TIntermAggregate* HlslParseContext::assignClipCullDistance(const TSourceLoc& loc } // Create symbol for the clip or cull variable. - left = intermediate.addSymbol(**clipCullVar); + TIntermSymbol* clipCullSym = intermediate.addSymbol(**clipCullVar); // array sizes, or 1 if it's not an array: - const int lhsArraySize = (left->getType().isArray() ? left->getType().getOuterArraySize() : 1); + const int clipCullSymArraySize = (clipCullSym->getType().isArray() ? clipCullSym->getType().getOuterArraySize() : 1); // vector sizes: - const int lhsVectorSize = left->getType().getVectorSize(); + const int clipCullSymVectorSize = clipCullSym->getType().getVectorSize(); - // left has got to be an array of scalar floats, per SPIR-V semantics. + // clipCullSym has got to be an array of scalar floats, per SPIR-V semantics. // fixBuiltInIoType() should have handled that upstream. - assert(left->getType().isArray()); - assert(left->getType().getVectorSize() == 1); - assert(left->getType().getBasicType() == EbtFloat); + assert(clipCullSym->getType().isArray()); + assert(clipCullSym->getType().getVectorSize() == 1); + assert(clipCullSym->getType().getBasicType() == EbtFloat); // We may be creating multiple sub-assignments. This is an aggregate to hold them. // TODO: it would be possible to be clever sometimes and avoid the sequence node if not needed. TIntermAggregate* assignList = nullptr; + // Holds individual component assignments as we make them. + TIntermTyped* clipCullAssign = nullptr; + // If the types are homomorphic, use a simple assign. No need to mess about with // individual components. - if (left->getType().isArray() == right->getType().isArray() && - lhsArraySize == rhsArraySize && - lhsVectorSize == rhsVectorSize) { - assignList = intermediate.growAggregate(assignList, intermediate.addAssign(op, left, right, loc)); + if (clipCullSym->getType().isArray() == internalNode->getType().isArray() && + clipCullSymArraySize == internalNodeArraySize && + clipCullSymVectorSize == internalNodeVectorSize) { + + if (isOutput) + clipCullAssign = intermediate.addAssign(op, clipCullSym, internalNode, loc); + else + clipCullAssign = intermediate.addAssign(op, internalNode, clipCullSym, loc); + + assignList = intermediate.growAggregate(assignList, clipCullAssign); assignList->setOperator(EOpSequence); + return assignList; } - // We are going to copy each component of the right (per array element if indicated) to sequential - // array elements of the left. This tracks the lhs element we're writing to as we go along. + // We are going to copy each component of the internal (per array element if indicated) to sequential + // array elements of the clipCullSym. This tracks the lhs element we're writing to as we go along. // We may be starting in the middle - e.g, for a non-zero semantic ID calculated above. - int lhsArrayPos = semanticOffset[semanticId]; + int clipCullArrayPos = semanticOffset[semanticId]; - // Loop through every component of every element of the RHS, and copy to LHS elements in turn. - for (int rhsArrayPos = 0; rhsArrayPos < rhsArraySize; ++rhsArrayPos) { - for (int rhsComponent = 0; rhsComponent < rhsVectorSize; ++rhsComponent) { - // LHS array member to write to: - TIntermTyped* lhsMember = intermediate.addIndex(EOpIndexDirect, left, - intermediate.addConstantUnion(lhsArrayPos++, loc), loc); + // Loop through every component of every element of the internal, and copy to or from the matching external. + for (int internalArrayPos = 0; internalArrayPos < internalNodeArraySize; ++internalArrayPos) { + for (int internalComponent = 0; internalComponent < internalNodeVectorSize; ++internalComponent) { + // array member to read from / write to: + TIntermTyped* clipCullMember = intermediate.addIndex(EOpIndexDirect, clipCullSym, + intermediate.addConstantUnion(clipCullArrayPos++, loc), loc); - TIntermTyped* rhsMember = right; + TIntermTyped* internalMember = internalNode; - // If right is an array, extract the element of interest - if (right->getType().isArray()) { - const TType derefType(rhsMember->getType(), 0); - rhsMember = intermediate.addIndex(EOpIndexDirect, rhsMember, - intermediate.addConstantUnion(rhsArrayPos, loc), loc); - rhsMember->setType(derefType); + // If internal node is an array, extract the element of interest + if (internalNode->getType().isArray()) { + const TType derefType(internalMember->getType(), 0); + internalMember = intermediate.addIndex(EOpIndexDirect, internalMember, + intermediate.addConstantUnion(internalArrayPos, loc), loc); + internalMember->setType(derefType); } - // If right is a vector, extract the component of interest. - if (right->getType().isVector()) { - const TType derefType(rhsMember->getType(), 0); - rhsMember = intermediate.addIndex(EOpIndexDirect, rhsMember, - intermediate.addConstantUnion(rhsComponent, loc), loc); - rhsMember->setType(derefType); + // If internal node is a vector, extract the component of interest. + if (internalNode->getType().isVector()) { + const TType derefType(internalMember->getType(), 0); + internalMember = intermediate.addIndex(EOpIndexDirect, internalMember, + intermediate.addConstantUnion(internalComponent, loc), loc); + internalMember->setType(derefType); } - // Assign: to the proper lhs member. - assignList = intermediate.growAggregate(assignList, - intermediate.addAssign(op, lhsMember, rhsMember, loc)); + // Create an assignment: output from internal to clip cull, or input from clip cull to internal. + if (isOutput) + clipCullAssign = intermediate.addAssign(op, clipCullMember, internalMember, loc); + else + clipCullAssign = intermediate.addAssign(op, internalMember, clipCullMember, loc); + + // Track assignment in the sequence. + assignList = intermediate.growAggregate(assignList, clipCullAssign); } } @@ -2483,8 +2511,10 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op // isn't, we fall back to a member-wise copy. if (!isFlattenLeft && !isFlattenRight && !isSplitLeft && !isSplitRight) { // Clip and cull distance requires more processing. See comment above assignClipCullDistance. - if (isClipOrCullDistance(left->getType())) { - const int semanticId = left->getType().getQualifier().layoutLocation; + if (isClipOrCullDistance(left->getType()) || isClipOrCullDistance(right->getType())) { + const bool isOutput = isClipOrCullDistance(left->getType()); + + const int semanticId = (isOutput ? left : right)->getType().getQualifier().layoutLocation; return assignClipCullDistance(loc, op, semanticId, left, right); } @@ -2664,13 +2694,15 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op TIntermTyped* subSplitRight = isSplitRight ? getMember(false, right, member, splitRight, memberR) : subRight; - if (isClipOrCullDistance(subSplitLeft->getType())) { + if (isClipOrCullDistance(subSplitLeft->getType()) || isClipOrCullDistance(subSplitRight->getType())) { // Clip and cull distance built-in assignment is complex in its own right, and is handled in // a separate function dedicated to that task. See comment above assignClipCullDistance; + const bool isOutput = isClipOrCullDistance(subSplitLeft->getType()); + // Since all clip/cull semantics boil down to the same built-in type, we need to get the // semantic ID from the dereferenced type's layout location, to avoid an N-1 mapping. - const TType derefType(left->getType(), member); + const TType derefType((isOutput ? left : right)->getType(), member); const int semanticId = derefType.getQualifier().layoutLocation; TIntermAggregate* clipCullAssign = assignClipCullDistance(loc, op, semanticId, @@ -8785,10 +8817,6 @@ void HlslParseContext::correctInput(TQualifier& qualifier) qualifier.sample = false; } - // TODO: handle clip/cull on the input side; this doesn't work, see overwrite of .layoutLocation later - if (isClipOrCullDistance(qualifier)) - qualifier.layoutLocation = TQualifier::layoutLocationEnd; - qualifier.clearStreamLayout(); qualifier.clearXfbLayout(); diff --git a/hlsl/hlslParseHelper.h b/hlsl/hlslParseHelper.h index ab62625..e545109 100755 --- a/hlsl/hlslParseHelper.h +++ b/hlsl/hlslParseHelper.h @@ -435,8 +435,8 @@ protected: TVariable* gsStreamOutput; // geometry shader stream outputs, for emit (Append method) - TVariable* clipDistanceOutput; // synthesized clip distance output variable (shader might have >1) - TVariable* cullDistanceOutput; // synthesized cull distance output variable (shader might have >1) + TVariable* clipDistanceVariable; // synthesized clip distance variable (shader might have >1) + TVariable* cullDistanceVariable; // synthesized cull distance variable (shader might have >1) static const int maxClipCullRegs = 2; std::array clipSemanticNSize; // vector, indexed by clip semantic ID -- 2.7.4