HLSL: require coverage mask to be arrayed output.

SPIR-V requires the coverage mask to be an array of integers, but HLSL
allows scalar integers.  This adds the requisite type conversion and
wrapped entry point handling.

Fixes: #1202
This commit is contained in:
LoopDawg 2018-05-16 07:25:29 -06:00
parent cfb05ec702
commit 4e6d3eaf5d
5 changed files with 264 additions and 12 deletions

View file

@ -93,13 +93,16 @@ using depth_any
0:16 Constant:
0:16 1 (const int)
0:16 move second child to first child ( temp int)
0:? 'sampleMask' ( out int SampleMaskIn)
0:16 direct index ( out int SampleMaskIn)
0:? 'sampleMask' ( out 1-element array of int SampleMaskIn)
0:16 Constant:
0:16 0 (const int)
0:? 'sampleMask' ( temp int)
0:? Linker Objects
0:? '@entryPointOutput.Depth' ( out float FragDepth)
0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float)
0:? 'inpos' ( noperspective in 4-component vector of float FragCoord)
0:? 'sampleMask' ( out int SampleMaskIn)
0:? 'sampleMask' ( out 1-element array of int SampleMaskIn)
Linked fragment stage:
@ -199,22 +202,25 @@ using depth_any
0:16 Constant:
0:16 1 (const int)
0:16 move second child to first child ( temp int)
0:? 'sampleMask' ( out int SampleMaskIn)
0:16 direct index ( out int SampleMaskIn)
0:? 'sampleMask' ( out 1-element array of int SampleMaskIn)
0:16 Constant:
0:16 0 (const int)
0:? 'sampleMask' ( temp int)
0:? Linker Objects
0:? '@entryPointOutput.Depth' ( out float FragDepth)
0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float)
0:? 'inpos' ( noperspective in 4-component vector of float FragCoord)
0:? 'sampleMask' ( out int SampleMaskIn)
0:? 'sampleMask' ( out 1-element array of int SampleMaskIn)
// Module Version 10000
// Generated by (magic number): 80006
// Id's are bound by 88
// Id's are bound by 92
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 68 78 82 86
EntryPoint Fragment 4 "main" 68 78 82 88
ExecutionMode 4 OriginUpperLeft
ExecutionMode 4 DepthReplacing
Source HLSL 500
@ -246,12 +252,12 @@ using depth_any
Name 74 "param"
Name 78 "@entryPointOutput.Color"
Name 82 "@entryPointOutput.Depth"
Name 86 "sampleMask"
Name 88 "sampleMask"
Decorate 68(inpos) NoPerspective
Decorate 68(inpos) BuiltIn FragCoord
Decorate 78(@entryPointOutput.Color) Location 0
Decorate 82(@entryPointOutput.Depth) BuiltIn FragDepth
Decorate 86(sampleMask) BuiltIn SampleMask
Decorate 88(sampleMask) BuiltIn SampleMask
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -278,8 +284,11 @@ using depth_any
78(@entryPointOutput.Color): 77(ptr) Variable Output
81: TypePointer Output 6(float)
82(@entryPointOutput.Depth): 81(ptr) Variable Output
85: TypePointer Output 17(int)
86(sampleMask): 85(ptr) Variable Output
85: 42(int) Constant 1
86: TypeArray 17(int) 85
87: TypePointer Output 86
88(sampleMask): 87(ptr) Variable Output
90: TypePointer Output 17(int)
4(main): 2 Function None 3
5: Label
66(inpos): 16(ptr) Variable Function
@ -301,8 +310,9 @@ using depth_any
83: 7(ptr) AccessChain 70(flattenTemp) 59
84: 6(float) Load 83
Store 82(@entryPointOutput.Depth) 84
87: 17(int) Load 71(sampleMask)
Store 86(sampleMask) 87
89: 17(int) Load 71(sampleMask)
91: 90(ptr) AccessChain 88(sampleMask) 53
Store 91 89
Return
FunctionEnd
13(MyFunc(f1;f1;f1;f1;): 2 Function None 8