HLSL: Tests: Add subset of flattened opaque test to legalize results.

This commit is contained in:
John Kessenich 2017-10-06 21:01:07 -06:00
parent 908813c25d
commit 592e8f0441
4 changed files with 192 additions and 108 deletions

View File

@ -0,0 +1,48 @@
hlsl.flattenSubset.frag
WARNING: AST will form illegal SPIR-V; need to transform to legalize
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 85
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 54 57
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
Name 17 "samp"
Name 41 "tex"
Name 54 "vpos"
Name 57 "@entryPointOutput"
Decorate 17(samp) DescriptorSet 0
Decorate 41(tex) DescriptorSet 0
Decorate 54(vpos) Location 0
Decorate 57(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
13: TypeSampler
16: TypePointer UniformConstant 13
17(samp): 16(ptr) Variable UniformConstant
39: TypeImage 6(float) 2D sampled format:Unknown
40: TypePointer UniformConstant 39
41(tex): 40(ptr) Variable UniformConstant
44: TypeSampledImage 39
46: TypeVector 6(float) 2
47: 6(float) Constant 1056964608
48: 46(fvec2) ConstantComposite 47 47
53: TypePointer Input 7(fvec4)
54(vpos): 53(ptr) Variable Input
56: TypePointer Output 7(fvec4)
57(@entryPointOutput): 56(ptr) Variable Output
4(main): 2 Function None 3
5: Label
74: 13 Load 17(samp)
81: 39 Load 41(tex)
83: 44 SampledImage 81 74
84: 7(fvec4) ImageSampleImplicitLod 83 48
Store 57(@entryPointOutput) 84
Return
FunctionEnd

View File

@ -3,46 +3,53 @@ WARNING: AST will form illegal SPIR-V; need to transform to legalize
Shader version: 500 Shader version: 500
gl_FragCoord origin is upper left gl_FragCoord origin is upper left
0:? Sequence 0:? Sequence
0:27 Function Definition: @main(vf4; ( temp 4-component vector of float) 0:30 Function Definition: @main(vf4; ( temp 4-component vector of float)
0:27 Function Parameters: 0:30 Function Parameters:
0:27 'vpos' ( in 4-component vector of float) 0:30 'vpos' ( in 4-component vector of float)
0:? Sequence 0:? Sequence
0:30 Sequence 0:33 move second child to first child ( temp sampler)
0:30 move second child to first child ( temp float) 0:? 's1.s0.ss' ( temp sampler)
0:33 'samp' ( uniform sampler)
0:34 Sequence
0:34 move second child to first child ( temp float)
0:? 's2.resources.b' ( temp float) 0:? 's2.resources.b' ( temp float)
0:? 's1.b' ( temp float) 0:? 's1.b' ( temp float)
0:30 move second child to first child ( temp sampler) 0:34 move second child to first child ( temp sampler)
0:? 's2.resources.samplerState' ( temp sampler) 0:? 's2.resources.samplerState' ( temp sampler)
0:? 's1.samplerState' ( temp sampler) 0:? 's1.samplerState' ( temp sampler)
0:30 move second child to first child ( temp int) 0:34 move second child to first child ( temp int)
0:? 's2.resources.s0.x' ( temp int) 0:? 's2.resources.s0.x' ( temp int)
0:? 's1.s0.x' ( temp int) 0:? 's1.s0.x' ( temp int)
0:30 move second child to first child ( temp int) 0:34 move second child to first child ( temp int)
0:? 's2.resources.s0.y' ( temp int) 0:? 's2.resources.s0.y' ( temp int)
0:? 's1.s0.y' ( temp int) 0:? 's1.s0.y' ( temp int)
0:30 move second child to first child ( temp sampler) 0:34 move second child to first child ( temp sampler)
0:? 's2.resources.s0.ss' ( temp sampler) 0:? 's2.resources.s0.ss' ( temp sampler)
0:? 's1.s0.ss' ( temp sampler) 0:? 's1.s0.ss' ( temp sampler)
0:30 move second child to first child ( temp int) 0:34 move second child to first child ( temp int)
0:? 's2.resources.a' ( temp int) 0:? 's2.resources.a' ( temp int)
0:? 's1.a' ( temp int) 0:? 's1.a' ( temp int)
0:31 Branch: Return with expression 0:35 Branch: Return with expression
0:? Constant: 0:35 texture ( temp 4-component vector of float)
0:? 0.000000 0:35 Construct combined texture-sampler ( temp sampler2D)
0:? 0.000000 0:35 'tex' ( uniform texture2D)
0:? 0.000000 0:? 's2.resources.s0.ss' ( temp sampler)
0:? 0.000000 0:35 Constant:
0:27 Function Definition: main( ( temp void) 0:35 0.500000
0:27 Function Parameters: 0:35 0.500000
0:30 Function Definition: main( ( temp void)
0:30 Function Parameters:
0:? Sequence 0:? Sequence
0:27 move second child to first child ( temp 4-component vector of float) 0:30 move second child to first child ( temp 4-component vector of float)
0:? 'vpos' ( temp 4-component vector of float) 0:? 'vpos' ( temp 4-component vector of float)
0:? 'vpos' (layout( location=0) in 4-component vector of float) 0:? 'vpos' (layout( location=0) in 4-component vector of float)
0:27 move second child to first child ( temp 4-component vector of float) 0:30 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:27 Function Call: @main(vf4; ( temp 4-component vector of float) 0:30 Function Call: @main(vf4; ( temp 4-component vector of float)
0:? 'vpos' ( temp 4-component vector of float) 0:? 'vpos' ( temp 4-component vector of float)
0:? Linker Objects 0:? Linker Objects
0:? 'samp' ( uniform sampler)
0:? 'tex' ( uniform texture2D)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:? 'vpos' (layout( location=0) in 4-component vector of float) 0:? 'vpos' (layout( location=0) in 4-component vector of float)
@ -53,135 +60,159 @@ Linked fragment stage:
Shader version: 500 Shader version: 500
gl_FragCoord origin is upper left gl_FragCoord origin is upper left
0:? Sequence 0:? Sequence
0:27 Function Definition: @main(vf4; ( temp 4-component vector of float) 0:30 Function Definition: @main(vf4; ( temp 4-component vector of float)
0:27 Function Parameters: 0:30 Function Parameters:
0:27 'vpos' ( in 4-component vector of float) 0:30 'vpos' ( in 4-component vector of float)
0:? Sequence 0:? Sequence
0:30 Sequence 0:33 move second child to first child ( temp sampler)
0:30 move second child to first child ( temp float) 0:? 's1.s0.ss' ( temp sampler)
0:33 'samp' ( uniform sampler)
0:34 Sequence
0:34 move second child to first child ( temp float)
0:? 's2.resources.b' ( temp float) 0:? 's2.resources.b' ( temp float)
0:? 's1.b' ( temp float) 0:? 's1.b' ( temp float)
0:30 move second child to first child ( temp sampler) 0:34 move second child to first child ( temp sampler)
0:? 's2.resources.samplerState' ( temp sampler) 0:? 's2.resources.samplerState' ( temp sampler)
0:? 's1.samplerState' ( temp sampler) 0:? 's1.samplerState' ( temp sampler)
0:30 move second child to first child ( temp int) 0:34 move second child to first child ( temp int)
0:? 's2.resources.s0.x' ( temp int) 0:? 's2.resources.s0.x' ( temp int)
0:? 's1.s0.x' ( temp int) 0:? 's1.s0.x' ( temp int)
0:30 move second child to first child ( temp int) 0:34 move second child to first child ( temp int)
0:? 's2.resources.s0.y' ( temp int) 0:? 's2.resources.s0.y' ( temp int)
0:? 's1.s0.y' ( temp int) 0:? 's1.s0.y' ( temp int)
0:30 move second child to first child ( temp sampler) 0:34 move second child to first child ( temp sampler)
0:? 's2.resources.s0.ss' ( temp sampler) 0:? 's2.resources.s0.ss' ( temp sampler)
0:? 's1.s0.ss' ( temp sampler) 0:? 's1.s0.ss' ( temp sampler)
0:30 move second child to first child ( temp int) 0:34 move second child to first child ( temp int)
0:? 's2.resources.a' ( temp int) 0:? 's2.resources.a' ( temp int)
0:? 's1.a' ( temp int) 0:? 's1.a' ( temp int)
0:31 Branch: Return with expression 0:35 Branch: Return with expression
0:? Constant: 0:35 texture ( temp 4-component vector of float)
0:? 0.000000 0:35 Construct combined texture-sampler ( temp sampler2D)
0:? 0.000000 0:35 'tex' ( uniform texture2D)
0:? 0.000000 0:? 's2.resources.s0.ss' ( temp sampler)
0:? 0.000000 0:35 Constant:
0:27 Function Definition: main( ( temp void) 0:35 0.500000
0:27 Function Parameters: 0:35 0.500000
0:30 Function Definition: main( ( temp void)
0:30 Function Parameters:
0:? Sequence 0:? Sequence
0:27 move second child to first child ( temp 4-component vector of float) 0:30 move second child to first child ( temp 4-component vector of float)
0:? 'vpos' ( temp 4-component vector of float) 0:? 'vpos' ( temp 4-component vector of float)
0:? 'vpos' (layout( location=0) in 4-component vector of float) 0:? 'vpos' (layout( location=0) in 4-component vector of float)
0:27 move second child to first child ( temp 4-component vector of float) 0:30 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:27 Function Call: @main(vf4; ( temp 4-component vector of float) 0:30 Function Call: @main(vf4; ( temp 4-component vector of float)
0:? 'vpos' ( temp 4-component vector of float) 0:? 'vpos' ( temp 4-component vector of float)
0:? Linker Objects 0:? Linker Objects
0:? 'samp' ( uniform sampler)
0:? 'tex' ( uniform texture2D)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:? 'vpos' (layout( location=0) in 4-component vector of float) 0:? 'vpos' (layout( location=0) in 4-component vector of float)
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 49 // Id's are bound by 61
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 42 45 EntryPoint Fragment 4 "main" 54 57
ExecutionMode 4 OriginUpperLeft ExecutionMode 4 OriginUpperLeft
Source HLSL 500 Source HLSL 500
Name 4 "main" Name 4 "main"
Name 11 "@main(vf4;" Name 11 "@main(vf4;"
Name 10 "vpos" Name 10 "vpos"
Name 14 "s2.resources.b" Name 15 "s1.s0.ss"
Name 15 "s1.b" Name 17 "samp"
Name 19 "s2.resources.samplerState" Name 20 "s2.resources.b"
Name 20 "s1.samplerState" Name 21 "s1.b"
Name 24 "s2.resources.s0.x" Name 23 "s2.resources.samplerState"
Name 25 "s1.s0.x" Name 24 "s1.samplerState"
Name 27 "s2.resources.s0.y" Name 28 "s2.resources.s0.x"
Name 28 "s1.s0.y" Name 29 "s1.s0.x"
Name 30 "s2.resources.s0.ss" Name 31 "s2.resources.s0.y"
Name 31 "s1.s0.ss" Name 32 "s1.s0.y"
Name 33 "s2.resources.a" Name 34 "s2.resources.s0.ss"
Name 34 "s1.a" Name 36 "s2.resources.a"
Name 40 "vpos" Name 37 "s1.a"
Name 42 "vpos" Name 41 "tex"
Name 45 "@entryPointOutput" Name 52 "vpos"
Name 46 "param" Name 54 "vpos"
Decorate 42(vpos) Location 0 Name 57 "@entryPointOutput"
Decorate 45(@entryPointOutput) Location 0 Name 58 "param"
Decorate 17(samp) DescriptorSet 0
Decorate 41(tex) DescriptorSet 0
Decorate 54(vpos) Location 0
Decorate 57(@entryPointOutput) Location 0
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
7: TypeVector 6(float) 4 7: TypeVector 6(float) 4
8: TypePointer Function 7(fvec4) 8: TypePointer Function 7(fvec4)
9: TypeFunction 7(fvec4) 8(ptr) 9: TypeFunction 7(fvec4) 8(ptr)
13: TypePointer Function 6(float) 13: TypeSampler
17: TypeSampler 14: TypePointer Function 13
18: TypePointer Function 17 16: TypePointer UniformConstant 13
22: TypeInt 32 1 17(samp): 16(ptr) Variable UniformConstant
23: TypePointer Function 22(int) 19: TypePointer Function 6(float)
36: 6(float) Constant 0 26: TypeInt 32 1
37: 7(fvec4) ConstantComposite 36 36 36 36 27: TypePointer Function 26(int)
41: TypePointer Input 7(fvec4) 39: TypeImage 6(float) 2D sampled format:Unknown
42(vpos): 41(ptr) Variable Input 40: TypePointer UniformConstant 39
44: TypePointer Output 7(fvec4) 41(tex): 40(ptr) Variable UniformConstant
45(@entryPointOutput): 44(ptr) Variable Output 44: TypeSampledImage 39
46: TypeVector 6(float) 2
47: 6(float) Constant 1056964608
48: 46(fvec2) ConstantComposite 47 47
53: TypePointer Input 7(fvec4)
54(vpos): 53(ptr) Variable Input
56: TypePointer Output 7(fvec4)
57(@entryPointOutput): 56(ptr) Variable Output
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
40(vpos): 8(ptr) Variable Function 52(vpos): 8(ptr) Variable Function
46(param): 8(ptr) Variable Function 58(param): 8(ptr) Variable Function
43: 7(fvec4) Load 42(vpos) 55: 7(fvec4) Load 54(vpos)
Store 40(vpos) 43 Store 52(vpos) 55
47: 7(fvec4) Load 40(vpos) 59: 7(fvec4) Load 52(vpos)
Store 46(param) 47 Store 58(param) 59
48: 7(fvec4) FunctionCall 11(@main(vf4;) 46(param) 60: 7(fvec4) FunctionCall 11(@main(vf4;) 58(param)
Store 45(@entryPointOutput) 48 Store 57(@entryPointOutput) 60
Return Return
FunctionEnd FunctionEnd
11(@main(vf4;): 7(fvec4) Function None 9 11(@main(vf4;): 7(fvec4) Function None 9
10(vpos): 8(ptr) FunctionParameter 10(vpos): 8(ptr) FunctionParameter
12: Label 12: Label
14(s2.resources.b): 13(ptr) Variable Function 15(s1.s0.ss): 14(ptr) Variable Function
15(s1.b): 13(ptr) Variable Function 20(s2.resources.b): 19(ptr) Variable Function
19(s2.resources.samplerState): 18(ptr) Variable Function 21(s1.b): 19(ptr) Variable Function
20(s1.samplerState): 18(ptr) Variable Function 23(s2.resources.samplerState): 14(ptr) Variable Function
24(s2.resources.s0.x): 23(ptr) Variable Function 24(s1.samplerState): 14(ptr) Variable Function
25(s1.s0.x): 23(ptr) Variable Function 28(s2.resources.s0.x): 27(ptr) Variable Function
27(s2.resources.s0.y): 23(ptr) Variable Function 29(s1.s0.x): 27(ptr) Variable Function
28(s1.s0.y): 23(ptr) Variable Function 31(s2.resources.s0.y): 27(ptr) Variable Function
30(s2.resources.s0.ss): 18(ptr) Variable Function 32(s1.s0.y): 27(ptr) Variable Function
31(s1.s0.ss): 18(ptr) Variable Function 34(s2.resources.s0.ss): 14(ptr) Variable Function
33(s2.resources.a): 23(ptr) Variable Function 36(s2.resources.a): 27(ptr) Variable Function
34(s1.a): 23(ptr) Variable Function 37(s1.a): 27(ptr) Variable Function
16: 6(float) Load 15(s1.b) 18: 13 Load 17(samp)
Store 14(s2.resources.b) 16 Store 15(s1.s0.ss) 18
21: 17 Load 20(s1.samplerState) 22: 6(float) Load 21(s1.b)
Store 19(s2.resources.samplerState) 21 Store 20(s2.resources.b) 22
26: 22(int) Load 25(s1.s0.x) 25: 13 Load 24(s1.samplerState)
Store 24(s2.resources.s0.x) 26 Store 23(s2.resources.samplerState) 25
29: 22(int) Load 28(s1.s0.y) 30: 26(int) Load 29(s1.s0.x)
Store 27(s2.resources.s0.y) 29 Store 28(s2.resources.s0.x) 30
32: 17 Load 31(s1.s0.ss) 33: 26(int) Load 32(s1.s0.y)
Store 30(s2.resources.s0.ss) 32 Store 31(s2.resources.s0.y) 33
35: 22(int) Load 34(s1.a) 35: 13 Load 15(s1.s0.ss)
Store 33(s2.resources.a) 35 Store 34(s2.resources.s0.ss) 35
ReturnValue 37 38: 26(int) Load 37(s1.a)
Store 36(s2.resources.a) 38
42: 39 Load 41(tex)
43: 13 Load 34(s2.resources.s0.ss)
45: 44 SampledImage 42 43
49: 7(fvec4) ImageSampleImplicitLod 45 48
ReturnValue 49
FunctionEnd FunctionEnd

View File

@ -23,10 +23,14 @@ struct S2
S1 resources; S1 resources;
}; };
SamplerState samp;
Texture2D tex;
float4 main(float4 vpos : VPOS) : COLOR0 float4 main(float4 vpos : VPOS) : COLOR0
{ {
S1 s1; S1 s1;
S2 s2; S2 s2;
s1.s0.ss = samp;
s2.resources = s1; s2.resources = s1;
return float4(0,0,0,0); return tex.Sample(s2.resources.s0.ss, float2(0.5));
} }

View File

@ -379,7 +379,8 @@ INSTANTIATE_TEST_CASE_P(
{"hlsl.aliasOpaque.frag", "main"}, {"hlsl.aliasOpaque.frag", "main"},
{"hlsl.flattenOpaque.frag", "main"}, {"hlsl.flattenOpaque.frag", "main"},
{"hlsl.flattenOpaqueInit.vert", "main"}, {"hlsl.flattenOpaqueInit.vert", "main"},
{"hlsl.flattenOpaqueInitMix.vert", "main"} {"hlsl.flattenOpaqueInitMix.vert", "main"},
{"hlsl.flattenSubset.frag", "main"}
}), }),
FileNameAsCustomTestSuffix FileNameAsCustomTestSuffix
); );