GLSL: Add binding map tests

This PR adds a GLSL equivalent to the HLSL binding mapping tests for offsets and auto-numbering.
The shaders are as equivalent as possible.  The bindings of the base results match exactly
between the two.
This commit is contained in:
steve-lunarg 2016-09-26 17:02:44 -06:00
parent 10f7fc739c
commit ad0752e8fa
5 changed files with 614 additions and 4 deletions

View File

@ -0,0 +1,228 @@
spv.glsl.register.autoassign.frag
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 142
Capability Shader
Capability Sampled1D
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 137
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
Name 4 "main"
Name 9 "Func1("
Name 11 "Func2("
Name 13 "Func2_unused("
Name 17 "g_tTex1"
Name 21 "g_sSamp1"
Name 27 "g_tTex2"
Name 29 "g_sSamp2"
Name 39 "g_tTex3"
Name 46 "g_sSamp3"
Name 64 "g_tTex4"
Name 69 "g_sSamp4"
Name 84 "g_tTex5"
Name 86 "g_sSamp5"
Name 93 "MyStruct_t"
MemberName 93(MyStruct_t) 0 "a"
MemberName 93(MyStruct_t) 1 "b"
MemberName 93(MyStruct_t) 2 "c"
Name 95 "myblock"
MemberName 95(myblock) 0 "mystruct"
MemberName 95(myblock) 1 "myvec4_a"
MemberName 95(myblock) 2 "myvec4_b"
MemberName 95(myblock) 3 "myint4_a"
Name 97 ""
Name 119 "g_tTex_unused1"
Name 121 "g_sSamp_unused1"
Name 126 "g_tTex_unused2"
Name 128 "g_sSamp_unused2"
Name 137 "FragColor"
Name 141 "g_tTex_unused3"
Decorate 17(g_tTex1) DescriptorSet 0
Decorate 17(g_tTex1) Binding 11
Decorate 21(g_sSamp1) DescriptorSet 0
Decorate 21(g_sSamp1) Binding 5
Decorate 27(g_tTex2) DescriptorSet 0
Decorate 27(g_tTex2) Binding 1
Decorate 29(g_sSamp2) DescriptorSet 0
Decorate 29(g_sSamp2) Binding 2
Decorate 39(g_tTex3) DescriptorSet 0
Decorate 39(g_tTex3) Binding 13
Decorate 46(g_sSamp3) DescriptorSet 0
Decorate 46(g_sSamp3) Binding 7
Decorate 64(g_tTex4) DescriptorSet 0
Decorate 64(g_tTex4) Binding 3
Decorate 69(g_sSamp4) DescriptorSet 0
Decorate 69(g_sSamp4) Binding 4
Decorate 84(g_tTex5) DescriptorSet 0
Decorate 84(g_tTex5) Binding 6
Decorate 86(g_sSamp5) DescriptorSet 0
Decorate 86(g_sSamp5) Binding 8
MemberDecorate 93(MyStruct_t) 0 Offset 0
MemberDecorate 93(MyStruct_t) 1 Offset 4
MemberDecorate 93(MyStruct_t) 2 Offset 16
MemberDecorate 95(myblock) 0 Offset 0
MemberDecorate 95(myblock) 1 Offset 32
MemberDecorate 95(myblock) 2 Offset 48
MemberDecorate 95(myblock) 3 Offset 64
Decorate 95(myblock) Block
Decorate 97 DescriptorSet 0
Decorate 97 Binding 19
Decorate 119(g_tTex_unused1) DescriptorSet 0
Decorate 119(g_tTex_unused1) Binding 10
Decorate 121(g_sSamp_unused1) DescriptorSet 0
Decorate 126(g_tTex_unused2) DescriptorSet 0
Decorate 126(g_tTex_unused2) Binding 12
Decorate 128(g_sSamp_unused2) DescriptorSet 0
Decorate 141(g_tTex_unused3) DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypeFunction 7(fvec4)
15: TypeImage 6(float) 1D sampled format:Unknown
16: TypePointer UniformConstant 15
17(g_tTex1): 16(ptr) Variable UniformConstant
19: TypeSampler
20: TypePointer UniformConstant 19
21(g_sSamp1): 20(ptr) Variable UniformConstant
23: TypeSampledImage 15
25: 6(float) Constant 1036831949
27(g_tTex2): 16(ptr) Variable UniformConstant
29(g_sSamp2): 20(ptr) Variable UniformConstant
32: 6(float) Constant 1045220557
35: TypeInt 32 0
36: 35(int) Constant 2
37: TypeArray 15 36
38: TypePointer UniformConstant 37
39(g_tTex3): 38(ptr) Variable UniformConstant
40: TypeInt 32 1
41: 40(int) Constant 0
44: TypeArray 19 36
45: TypePointer UniformConstant 44
46(g_sSamp3): 45(ptr) Variable UniformConstant
50: 6(float) Constant 1050253722
53: 40(int) Constant 1
61: 35(int) Constant 3
62: TypeArray 15 61
63: TypePointer UniformConstant 62
64(g_tTex4): 63(ptr) Variable UniformConstant
67: TypeArray 19 61
68: TypePointer UniformConstant 67
69(g_sSamp4): 68(ptr) Variable UniformConstant
73: 6(float) Constant 1053609165
76: 40(int) Constant 2
84(g_tTex5): 16(ptr) Variable UniformConstant
86(g_sSamp5): 20(ptr) Variable UniformConstant
89: 6(float) Constant 1056964608
92: TypeVector 6(float) 3
93(MyStruct_t): TypeStruct 40(int) 6(float) 92(fvec3)
94: TypeVector 40(int) 4
95(myblock): TypeStruct 93(MyStruct_t) 7(fvec4) 7(fvec4) 94(ivec4)
96: TypePointer Uniform 95(myblock)
97: 96(ptr) Variable Uniform
98: 35(int) Constant 1
99: TypePointer Uniform 6(float)
119(g_tTex_unused1): 16(ptr) Variable UniformConstant
121(g_sSamp_unused1): 20(ptr) Variable UniformConstant
124: 6(float) Constant 1066192077
126(g_tTex_unused2): 16(ptr) Variable UniformConstant
128(g_sSamp_unused2): 20(ptr) Variable UniformConstant
131: 6(float) Constant 1067030938
136: TypePointer Output 7(fvec4)
137(FragColor): 136(ptr) Variable Output
141(g_tTex_unused3): 16(ptr) Variable UniformConstant
4(main): 2 Function None 3
5: Label
138: 7(fvec4) FunctionCall 9(Func1()
139: 7(fvec4) FunctionCall 11(Func2()
140: 7(fvec4) FAdd 138 139
Store 137(FragColor) 140
Return
FunctionEnd
9(Func1(): 7(fvec4) Function None 8
10: Label
18: 15 Load 17(g_tTex1)
22: 19 Load 21(g_sSamp1)
24: 23 SampledImage 18 22
26: 7(fvec4) ImageSampleImplicitLod 24 25
28: 15 Load 27(g_tTex2)
30: 19 Load 29(g_sSamp2)
31: 23 SampledImage 28 30
33: 7(fvec4) ImageSampleImplicitLod 31 32
34: 7(fvec4) FAdd 26 33
42: 16(ptr) AccessChain 39(g_tTex3) 41
43: 15 Load 42
47: 20(ptr) AccessChain 46(g_sSamp3) 41
48: 19 Load 47
49: 23 SampledImage 43 48
51: 7(fvec4) ImageSampleImplicitLod 49 50
52: 7(fvec4) FAdd 34 51
54: 16(ptr) AccessChain 39(g_tTex3) 53
55: 15 Load 54
56: 20(ptr) AccessChain 46(g_sSamp3) 53
57: 19 Load 56
58: 23 SampledImage 55 57
59: 7(fvec4) ImageSampleImplicitLod 58 50
60: 7(fvec4) FAdd 52 59
65: 16(ptr) AccessChain 64(g_tTex4) 53
66: 15 Load 65
70: 20(ptr) AccessChain 69(g_sSamp4) 53
71: 19 Load 70
72: 23 SampledImage 66 71
74: 7(fvec4) ImageSampleImplicitLod 72 73
75: 7(fvec4) FAdd 60 74
77: 16(ptr) AccessChain 64(g_tTex4) 76
78: 15 Load 77
79: 20(ptr) AccessChain 69(g_sSamp4) 76
80: 19 Load 79
81: 23 SampledImage 78 80
82: 7(fvec4) ImageSampleImplicitLod 81 73
83: 7(fvec4) FAdd 75 82
85: 15 Load 84(g_tTex5)
87: 19 Load 86(g_sSamp5)
88: 23 SampledImage 85 87
90: 7(fvec4) ImageSampleImplicitLod 88 89
91: 7(fvec4) FAdd 83 90
100: 99(ptr) AccessChain 97 41 76 98
101: 6(float) Load 100
102: 7(fvec4) CompositeConstruct 101 101 101 101
103: 7(fvec4) FAdd 91 102
ReturnValue 103
FunctionEnd
11(Func2(): 7(fvec4) Function None 8
12: Label
106: 15 Load 17(g_tTex1)
107: 19 Load 21(g_sSamp1)
108: 23 SampledImage 106 107
109: 7(fvec4) ImageSampleImplicitLod 108 25
110: 16(ptr) AccessChain 39(g_tTex3) 53
111: 15 Load 110
112: 20(ptr) AccessChain 46(g_sSamp3) 53
113: 19 Load 112
114: 23 SampledImage 111 113
115: 7(fvec4) ImageSampleImplicitLod 114 50
116: 7(fvec4) FAdd 109 115
ReturnValue 116
FunctionEnd
13(Func2_unused(): 7(fvec4) Function None 8
14: Label
120: 15 Load 119(g_tTex_unused1)
122: 19 Load 121(g_sSamp_unused1)
123: 23 SampledImage 120 122
125: 7(fvec4) ImageSampleImplicitLod 123 124
127: 15 Load 126(g_tTex_unused2)
129: 19 Load 128(g_sSamp_unused2)
130: 23 SampledImage 127 129
132: 7(fvec4) ImageSampleImplicitLod 130 131
133: 7(fvec4) FAdd 125 132
ReturnValue 133
FunctionEnd

View File

@ -0,0 +1,222 @@
spv.glsl.register.noautoassign.frag
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 142
Capability Shader
Capability Sampled1D
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 137
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
Name 4 "main"
Name 9 "Func1("
Name 11 "Func2("
Name 13 "Func2_unused("
Name 17 "g_tTex1"
Name 21 "g_sSamp1"
Name 27 "g_tTex2"
Name 29 "g_sSamp2"
Name 39 "g_tTex3"
Name 46 "g_sSamp3"
Name 64 "g_tTex4"
Name 69 "g_sSamp4"
Name 84 "g_tTex5"
Name 86 "g_sSamp5"
Name 93 "MyStruct_t"
MemberName 93(MyStruct_t) 0 "a"
MemberName 93(MyStruct_t) 1 "b"
MemberName 93(MyStruct_t) 2 "c"
Name 95 "myblock"
MemberName 95(myblock) 0 "mystruct"
MemberName 95(myblock) 1 "myvec4_a"
MemberName 95(myblock) 2 "myvec4_b"
MemberName 95(myblock) 3 "myint4_a"
Name 97 ""
Name 119 "g_tTex_unused1"
Name 121 "g_sSamp_unused1"
Name 126 "g_tTex_unused2"
Name 128 "g_sSamp_unused2"
Name 137 "FragColor"
Name 141 "g_tTex_unused3"
Decorate 17(g_tTex1) DescriptorSet 0
Decorate 17(g_tTex1) Binding 11
Decorate 21(g_sSamp1) DescriptorSet 0
Decorate 21(g_sSamp1) Binding 5
Decorate 27(g_tTex2) DescriptorSet 0
Decorate 29(g_sSamp2) DescriptorSet 0
Decorate 39(g_tTex3) DescriptorSet 0
Decorate 39(g_tTex3) Binding 13
Decorate 46(g_sSamp3) DescriptorSet 0
Decorate 46(g_sSamp3) Binding 7
Decorate 64(g_tTex4) DescriptorSet 0
Decorate 69(g_sSamp4) DescriptorSet 0
Decorate 84(g_tTex5) DescriptorSet 0
Decorate 86(g_sSamp5) DescriptorSet 0
MemberDecorate 93(MyStruct_t) 0 Offset 0
MemberDecorate 93(MyStruct_t) 1 Offset 4
MemberDecorate 93(MyStruct_t) 2 Offset 16
MemberDecorate 95(myblock) 0 Offset 0
MemberDecorate 95(myblock) 1 Offset 32
MemberDecorate 95(myblock) 2 Offset 48
MemberDecorate 95(myblock) 3 Offset 64
Decorate 95(myblock) Block
Decorate 97 DescriptorSet 0
Decorate 97 Binding 19
Decorate 119(g_tTex_unused1) DescriptorSet 0
Decorate 119(g_tTex_unused1) Binding 10
Decorate 121(g_sSamp_unused1) DescriptorSet 0
Decorate 126(g_tTex_unused2) DescriptorSet 0
Decorate 126(g_tTex_unused2) Binding 12
Decorate 128(g_sSamp_unused2) DescriptorSet 0
Decorate 141(g_tTex_unused3) DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypeFunction 7(fvec4)
15: TypeImage 6(float) 1D sampled format:Unknown
16: TypePointer UniformConstant 15
17(g_tTex1): 16(ptr) Variable UniformConstant
19: TypeSampler
20: TypePointer UniformConstant 19
21(g_sSamp1): 20(ptr) Variable UniformConstant
23: TypeSampledImage 15
25: 6(float) Constant 1036831949
27(g_tTex2): 16(ptr) Variable UniformConstant
29(g_sSamp2): 20(ptr) Variable UniformConstant
32: 6(float) Constant 1045220557
35: TypeInt 32 0
36: 35(int) Constant 2
37: TypeArray 15 36
38: TypePointer UniformConstant 37
39(g_tTex3): 38(ptr) Variable UniformConstant
40: TypeInt 32 1
41: 40(int) Constant 0
44: TypeArray 19 36
45: TypePointer UniformConstant 44
46(g_sSamp3): 45(ptr) Variable UniformConstant
50: 6(float) Constant 1050253722
53: 40(int) Constant 1
61: 35(int) Constant 3
62: TypeArray 15 61
63: TypePointer UniformConstant 62
64(g_tTex4): 63(ptr) Variable UniformConstant
67: TypeArray 19 61
68: TypePointer UniformConstant 67
69(g_sSamp4): 68(ptr) Variable UniformConstant
73: 6(float) Constant 1053609165
76: 40(int) Constant 2
84(g_tTex5): 16(ptr) Variable UniformConstant
86(g_sSamp5): 20(ptr) Variable UniformConstant
89: 6(float) Constant 1056964608
92: TypeVector 6(float) 3
93(MyStruct_t): TypeStruct 40(int) 6(float) 92(fvec3)
94: TypeVector 40(int) 4
95(myblock): TypeStruct 93(MyStruct_t) 7(fvec4) 7(fvec4) 94(ivec4)
96: TypePointer Uniform 95(myblock)
97: 96(ptr) Variable Uniform
98: 35(int) Constant 1
99: TypePointer Uniform 6(float)
119(g_tTex_unused1): 16(ptr) Variable UniformConstant
121(g_sSamp_unused1): 20(ptr) Variable UniformConstant
124: 6(float) Constant 1066192077
126(g_tTex_unused2): 16(ptr) Variable UniformConstant
128(g_sSamp_unused2): 20(ptr) Variable UniformConstant
131: 6(float) Constant 1067030938
136: TypePointer Output 7(fvec4)
137(FragColor): 136(ptr) Variable Output
141(g_tTex_unused3): 16(ptr) Variable UniformConstant
4(main): 2 Function None 3
5: Label
138: 7(fvec4) FunctionCall 9(Func1()
139: 7(fvec4) FunctionCall 11(Func2()
140: 7(fvec4) FAdd 138 139
Store 137(FragColor) 140
Return
FunctionEnd
9(Func1(): 7(fvec4) Function None 8
10: Label
18: 15 Load 17(g_tTex1)
22: 19 Load 21(g_sSamp1)
24: 23 SampledImage 18 22
26: 7(fvec4) ImageSampleImplicitLod 24 25
28: 15 Load 27(g_tTex2)
30: 19 Load 29(g_sSamp2)
31: 23 SampledImage 28 30
33: 7(fvec4) ImageSampleImplicitLod 31 32
34: 7(fvec4) FAdd 26 33
42: 16(ptr) AccessChain 39(g_tTex3) 41
43: 15 Load 42
47: 20(ptr) AccessChain 46(g_sSamp3) 41
48: 19 Load 47
49: 23 SampledImage 43 48
51: 7(fvec4) ImageSampleImplicitLod 49 50
52: 7(fvec4) FAdd 34 51
54: 16(ptr) AccessChain 39(g_tTex3) 53
55: 15 Load 54
56: 20(ptr) AccessChain 46(g_sSamp3) 53
57: 19 Load 56
58: 23 SampledImage 55 57
59: 7(fvec4) ImageSampleImplicitLod 58 50
60: 7(fvec4) FAdd 52 59
65: 16(ptr) AccessChain 64(g_tTex4) 53
66: 15 Load 65
70: 20(ptr) AccessChain 69(g_sSamp4) 53
71: 19 Load 70
72: 23 SampledImage 66 71
74: 7(fvec4) ImageSampleImplicitLod 72 73
75: 7(fvec4) FAdd 60 74
77: 16(ptr) AccessChain 64(g_tTex4) 76
78: 15 Load 77
79: 20(ptr) AccessChain 69(g_sSamp4) 76
80: 19 Load 79
81: 23 SampledImage 78 80
82: 7(fvec4) ImageSampleImplicitLod 81 73
83: 7(fvec4) FAdd 75 82
85: 15 Load 84(g_tTex5)
87: 19 Load 86(g_sSamp5)
88: 23 SampledImage 85 87
90: 7(fvec4) ImageSampleImplicitLod 88 89
91: 7(fvec4) FAdd 83 90
100: 99(ptr) AccessChain 97 41 76 98
101: 6(float) Load 100
102: 7(fvec4) CompositeConstruct 101 101 101 101
103: 7(fvec4) FAdd 91 102
ReturnValue 103
FunctionEnd
11(Func2(): 7(fvec4) Function None 8
12: Label
106: 15 Load 17(g_tTex1)
107: 19 Load 21(g_sSamp1)
108: 23 SampledImage 106 107
109: 7(fvec4) ImageSampleImplicitLod 108 25
110: 16(ptr) AccessChain 39(g_tTex3) 53
111: 15 Load 110
112: 20(ptr) AccessChain 46(g_sSamp3) 53
113: 19 Load 112
114: 23 SampledImage 111 113
115: 7(fvec4) ImageSampleImplicitLod 114 50
116: 7(fvec4) FAdd 109 115
ReturnValue 116
FunctionEnd
13(Func2_unused(): 7(fvec4) Function None 8
14: Label
120: 15 Load 119(g_tTex_unused1)
122: 19 Load 121(g_sSamp_unused1)
123: 23 SampledImage 120 122
125: 7(fvec4) ImageSampleImplicitLod 123 124
127: 15 Load 126(g_tTex_unused2)
129: 19 Load 128(g_sSamp_unused2)
130: 23 SampledImage 127 129
132: 7(fvec4) ImageSampleImplicitLod 130 131
133: 7(fvec4) FAdd 125 132
ReturnValue 133
FunctionEnd

View File

@ -0,0 +1,68 @@
#version 450
uniform layout(binding=0) sampler g_sSamp1;
uniform sampler g_sSamp2;
uniform layout(binding=2) sampler g_sSamp3[2];
uniform sampler g_sSamp4[3];
uniform sampler g_sSamp5;
uniform sampler g_sSamp_unused1;
uniform sampler g_sSamp_unused2;
uniform layout(binding=1) texture1D g_tTex1;
uniform texture1D g_tTex2;
uniform layout(binding=3) texture1D g_tTex3[2];
uniform texture1D g_tTex4[3];
uniform texture1D g_tTex5;
uniform layout(binding=0) texture1D g_tTex_unused1;
uniform layout(binding=2) texture1D g_tTex_unused2;
uniform texture1D g_tTex_unused3;
struct MyStruct_t {
int a;
float b;
vec3 c;
};
uniform layout(binding=4) myblock {
MyStruct_t mystruct;
vec4 myvec4_a;
vec4 myvec4_b;
ivec4 myint4_a;
};
vec4 Func1()
{
return
texture(sampler1D(g_tTex1, g_sSamp1), 0.1) +
texture(sampler1D(g_tTex2, g_sSamp2), 0.2) +
texture(sampler1D(g_tTex3[0], g_sSamp3[0]), 0.3) +
texture(sampler1D(g_tTex3[1], g_sSamp3[1]), 0.3) +
texture(sampler1D(g_tTex4[1], g_sSamp4[1]), 0.4) +
texture(sampler1D(g_tTex4[2], g_sSamp4[2]), 0.4) +
texture(sampler1D(g_tTex5, g_sSamp5), 0.5) +
mystruct.c[1];
}
vec4 Func2()
{
return
texture(sampler1D(g_tTex1, g_sSamp1), 0.1) +
texture(sampler1D(g_tTex3[1], g_sSamp3[1]), 0.3);
}
// Not called from entry point:
vec4 Func2_unused()
{
return
texture(sampler1D(g_tTex_unused1, g_sSamp_unused1), 1.1) +
texture(sampler1D(g_tTex_unused2, g_sSamp_unused2), 1.2);
}
out vec4 FragColor;
void main()
{
FragColor = Func1() + Func2();
}

View File

@ -0,0 +1,68 @@
#version 450
uniform layout(binding=0) sampler g_sSamp1;
uniform sampler g_sSamp2;
uniform layout(binding=2) sampler g_sSamp3[2];
uniform sampler g_sSamp4[3];
uniform sampler g_sSamp5;
uniform sampler g_sSamp_unused1;
uniform sampler g_sSamp_unused2;
uniform layout(binding=1) texture1D g_tTex1;
uniform texture1D g_tTex2;
uniform layout(binding=3) texture1D g_tTex3[2];
uniform texture1D g_tTex4[3];
uniform texture1D g_tTex5;
uniform layout(binding=0) texture1D g_tTex_unused1;
uniform layout(binding=2) texture1D g_tTex_unused2;
uniform texture1D g_tTex_unused3;
struct MyStruct_t {
int a;
float b;
vec3 c;
};
uniform layout(binding=4) myblock {
MyStruct_t mystruct;
vec4 myvec4_a;
vec4 myvec4_b;
ivec4 myint4_a;
};
vec4 Func1()
{
return
texture(sampler1D(g_tTex1, g_sSamp1), 0.1) +
texture(sampler1D(g_tTex2, g_sSamp2), 0.2) +
texture(sampler1D(g_tTex3[0], g_sSamp3[0]), 0.3) +
texture(sampler1D(g_tTex3[1], g_sSamp3[1]), 0.3) +
texture(sampler1D(g_tTex4[1], g_sSamp4[1]), 0.4) +
texture(sampler1D(g_tTex4[2], g_sSamp4[2]), 0.4) +
texture(sampler1D(g_tTex5, g_sSamp5), 0.5) +
mystruct.c[1];
}
vec4 Func2()
{
return
texture(sampler1D(g_tTex1, g_sSamp1), 0.1) +
texture(sampler1D(g_tTex3[1], g_sSamp3[1]), 0.3);
}
// Not called from entry point:
vec4 Func2_unused()
{
return
texture(sampler1D(g_tTex_unused1, g_sSamp_unused1), 1.1) +
texture(sampler1D(g_tTex_unused2, g_sSamp_unused2), 1.2);
}
out vec4 FragColor;
void main()
{
FragColor = Func1() + Func2();
}

View File

@ -1,4 +1,4 @@
//
//
// Copyright (C) 2016 Google, Inc.
//
// All rights reserved.
@ -65,7 +65,8 @@ using CompileOpenGLToSpirvTest = GlslangTest<::testing::TestWithParam<std::strin
using VulkanSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
using OpenGLSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
using VulkanAstSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
using HlslSemantics = GlslangTest<::testing::TestWithParam<IoMapData>>;
using HlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
using GlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
// Compiling GLSL to SPIR-V under Vulkan semantics. Expected to successfully
// generate SPIR-V.
@ -112,7 +113,7 @@ TEST_P(VulkanAstSemantics, FromFile)
}
// HLSL-level Vulkan semantics tests.
TEST_P(HlslSemantics, FromFile)
TEST_P(HlslIoMap, FromFile)
{
loadFileCompileIoMapAndCheck(GLSLANG_TEST_DIRECTORY, GetParam().fileName,
Source::HLSL, Semantics::Vulkan,
@ -124,6 +125,19 @@ TEST_P(HlslSemantics, FromFile)
GetParam().flattenUniforms);
}
// GLSL-level Vulkan semantics tests.
TEST_P(GlslIoMap, FromFile)
{
loadFileCompileIoMapAndCheck(GLSLANG_TEST_DIRECTORY, GetParam().fileName,
Source::GLSL, Semantics::Vulkan,
Target::Spv, GetParam().entryPoint,
GetParam().baseSamplerBinding,
GetParam().baseTextureBinding,
GetParam().baseUboBinding,
GetParam().autoMapBindings,
GetParam().flattenUniforms);
}
// clang-format off
INSTANTIATE_TEST_CASE_P(
Glsl, CompileVulkanToSpirvTest,
@ -251,7 +265,7 @@ INSTANTIATE_TEST_CASE_P(
// clang-format off
INSTANTIATE_TEST_CASE_P(
Hlsl, HlslSemantics,
Hlsl, HlslIoMap,
::testing::ValuesIn(std::vector<IoMapData>{
{ "spv.register.autoassign.frag", "main_ep", 5, 10, 15, true, false },
{ "spv.register.noautoassign.frag", "main_ep", 5, 10, 15, false, false },
@ -260,6 +274,16 @@ INSTANTIATE_TEST_CASE_P(
FileNameAsCustomTestSuffixIoMap
);
// clang-format off
INSTANTIATE_TEST_CASE_P(
Hlsl, GlslIoMap,
::testing::ValuesIn(std::vector<IoMapData>{
{ "spv.glsl.register.autoassign.frag", "main", 5, 10, 15, true, false },
{ "spv.glsl.register.noautoassign.frag", "main", 5, 10, 15, false, false },
}),
FileNameAsCustomTestSuffixIoMap
);
// clang-format off
INSTANTIATE_TEST_CASE_P(
Glsl, CompileOpenGLToSpirvTest,