glslang/Test/baseResults/hlsl.samplecmp.dualmode.frag.out
LoopDawg 73c57bbe50 HLSL: split textures used for both shadow and non-shadow modes
A single texture can statically appear in code mixed with a shadow sampler
and a non-shadow sampler.  This would be create invalid SPIR-V, unless
one of them is provably dead.

The previous detection of this happened before DCE, so some shaders would
trigger the error even though they wouldn't after DCE.  To handle that
case, this PR splits the texture into two: one with each mode.  It sets
"needsLegalization" (if that happens for any texture) to warn that this shader
will need post-compilation legalization.

If the texture is only used with one of the two modes, behavior is as it
was before.
2017-10-06 11:23:16 -06:00

158 lines
7.0 KiB
Plaintext

hlsl.samplecmp.dualmode.frag
WARNING: AST will form illegal SPIR-V; need to transform to legalize
Shader version: 500
gl_FragCoord origin is upper left
0:? Sequence
0:7 Function Definition: @main( ( temp 4-component vector of float)
0:7 Function Parameters:
0:? Sequence
0:10 texture ( temp float)
0:10 Construct combined texture-sampler ( temp sampler1DShadow)
0:10 'g_tTex' (layout( binding=3) uniform texture1DShadow)
0:10 'g_sSampCmp' (layout( binding=1) uniform sampler)
0:10 Construct vec2 ( temp 2-component vector of float)
0:10 Constant:
0:10 0.100000
0:10 Constant:
0:10 0.750000
0:11 texture ( temp 4-component vector of float)
0:11 Construct combined texture-sampler ( temp sampler1D)
0:11 'g_tTex' (layout( binding=3) uniform texture1D)
0:11 'g_sSamp' (layout( binding=0) uniform sampler)
0:11 Constant:
0:11 0.100000
0:13 Branch: Return with expression
0:13 Constant:
0:13 0.000000
0:13 0.000000
0:13 0.000000
0:13 0.000000
0:7 Function Definition: main( ( temp void)
0:7 Function Parameters:
0:? Sequence
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( ( temp 4-component vector of float)
0:? Linker Objects
0:? 'g_sSamp' (layout( binding=0) uniform sampler)
0:? 'g_sSampCmp' (layout( binding=1) uniform sampler)
0:? 'g_tTex' (layout( binding=3) uniform texture1DShadow)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:? 'g_tTex' (layout( binding=3) uniform texture1D)
Linked fragment stage:
Shader version: 500
gl_FragCoord origin is upper left
0:? Sequence
0:7 Function Definition: @main( ( temp 4-component vector of float)
0:7 Function Parameters:
0:? Sequence
0:10 texture ( temp float)
0:10 Construct combined texture-sampler ( temp sampler1DShadow)
0:10 'g_tTex' (layout( binding=3) uniform texture1DShadow)
0:10 'g_sSampCmp' (layout( binding=1) uniform sampler)
0:10 Construct vec2 ( temp 2-component vector of float)
0:10 Constant:
0:10 0.100000
0:10 Constant:
0:10 0.750000
0:11 texture ( temp 4-component vector of float)
0:11 Construct combined texture-sampler ( temp sampler1D)
0:11 'g_tTex' (layout( binding=3) uniform texture1D)
0:11 'g_sSamp' (layout( binding=0) uniform sampler)
0:11 Constant:
0:11 0.100000
0:13 Branch: Return with expression
0:13 Constant:
0:13 0.000000
0:13 0.000000
0:13 0.000000
0:13 0.000000
0:7 Function Definition: main( ( temp void)
0:7 Function Parameters:
0:? Sequence
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( ( temp 4-component vector of float)
0:? Linker Objects
0:? 'g_sSamp' (layout( binding=0) uniform sampler)
0:? 'g_sSampCmp' (layout( binding=1) uniform sampler)
0:? 'g_tTex' (layout( binding=3) uniform texture1DShadow)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:? 'g_tTex' (layout( binding=3) uniform texture1D)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 43
Capability Shader
Capability Sampled1D
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 41
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
Name 9 "@main("
Name 13 "g_tTex"
Name 17 "g_sSampCmp"
Name 29 "g_tTex"
Name 31 "g_sSamp"
Name 41 "@entryPointOutput"
Decorate 13(g_tTex) DescriptorSet 0
Decorate 13(g_tTex) Binding 3
Decorate 17(g_sSampCmp) DescriptorSet 0
Decorate 17(g_sSampCmp) Binding 1
Decorate 29(g_tTex) DescriptorSet 0
Decorate 29(g_tTex) Binding 3
Decorate 31(g_sSamp) DescriptorSet 0
Decorate 31(g_sSamp) Binding 0
Decorate 41(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypeFunction 7(fvec4)
11: TypeImage 6(float) 1D depth sampled format:Unknown
12: TypePointer UniformConstant 11
13(g_tTex): 12(ptr) Variable UniformConstant
15: TypeSampler
16: TypePointer UniformConstant 15
17(g_sSampCmp): 16(ptr) Variable UniformConstant
19: TypeSampledImage 11
21: 6(float) Constant 1036831949
22: 6(float) Constant 1061158912
23: TypeVector 6(float) 2
27: TypeImage 6(float) 1D sampled format:Unknown
28: TypePointer UniformConstant 27
29(g_tTex): 28(ptr) Variable UniformConstant
31(g_sSamp): 16(ptr) Variable UniformConstant
33: TypeSampledImage 27
36: 6(float) Constant 0
37: 7(fvec4) ConstantComposite 36 36 36 36
40: TypePointer Output 7(fvec4)
41(@entryPointOutput): 40(ptr) Variable Output
4(main): 2 Function None 3
5: Label
42: 7(fvec4) FunctionCall 9(@main()
Store 41(@entryPointOutput) 42
Return
FunctionEnd
9(@main(): 7(fvec4) Function None 8
10: Label
14: 11 Load 13(g_tTex)
18: 15 Load 17(g_sSampCmp)
20: 19 SampledImage 14 18
24: 23(fvec2) CompositeConstruct 21 22
25: 6(float) CompositeExtract 24 1
26: 6(float) ImageSampleDrefImplicitLod 20 24 25
30: 27 Load 29(g_tTex)
32: 15 Load 31(g_sSamp)
34: 33 SampledImage 30 32
35: 7(fvec4) ImageSampleImplicitLod 34 21
ReturnValue 37
FunctionEnd