Merge pull request #2826 from amdrexu/bugfix
[platform/upstream/glslang.git] / gtests / Hlsl.FromFile.cpp
1 //
2 // Copyright (C) 2016 Google, Inc.
3 // Copyright (C) 2016 LunarG, Inc.
4 //
5 // All rights reserved.
6 //
7 // Redistribution and use in source and binary forms, with or without
8 // modification, are permitted provided that the following conditions
9 // are met:
10 //
11 //    Redistributions of source code must retain the above copyright
12 //    notice, this list of conditions and the following disclaimer.
13 //
14 //    Redistributions in binary form must reproduce the above
15 //    copyright notice, this list of conditions and the following
16 //    disclaimer in the documentation and/or other materials provided
17 //    with the distribution.
18 //
19 //    Neither the name of Google Inc. nor the names of its
20 //    contributors may be used to endorse or promote products derived
21 //    from this software without specific prior written permission.
22 //
23 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27 // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33 // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 // POSSIBILITY OF SUCH DAMAGE.
35
36 #include <gtest/gtest.h>
37
38 #include "TestFixture.h"
39
40 namespace glslangtest {
41 namespace {
42
43 struct FileNameEntryPointPair {
44   const char* fileName;
45   const char* entryPoint;
46 };
47
48 // We are using FileNameEntryPointPair objects as parameters for instantiating
49 // the template, so the global FileNameAsCustomTestSuffix() won't work since
50 // it assumes std::string as parameters. Thus, an overriding one here.
51 std::string FileNameAsCustomTestSuffix(
52     const ::testing::TestParamInfo<FileNameEntryPointPair>& info) {
53     std::string name = info.param.fileName;
54     // A valid test case suffix cannot have '.' and '-' inside.
55     std::replace(name.begin(), name.end(), '.', '_');
56     std::replace(name.begin(), name.end(), '-', '_');
57     return name;
58 }
59
60 using HlslCompileTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
61 using HlslVulkan1_1CompileTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
62 using HlslCompileAndFlattenTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
63 using HlslLegalizeTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
64 using HlslDebugTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
65 using HlslDX9CompatibleTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
66 using HlslLegalDebugTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
67
68 // Compiling HLSL to pre-legalized SPIR-V under Vulkan semantics. Expected
69 // to successfully generate both AST and SPIR-V.
70 TEST_P(HlslCompileTest, FromFile)
71 {
72     loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
73                             Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,  glslang::EShTargetSpv_1_0,
74                             Target::BothASTAndSpv, true, GetParam().entryPoint);
75 }
76
77 TEST_P(HlslVulkan1_1CompileTest, FromFile)
78 {
79     loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
80                             Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1, glslang::EShTargetSpv_1_3,
81                             Target::BothASTAndSpv, true, GetParam().entryPoint);
82 }
83
84 TEST_P(HlslCompileAndFlattenTest, FromFile)
85 {
86     loadFileCompileFlattenUniformsAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
87                                            Source::HLSL, Semantics::Vulkan,
88                                            Target::BothASTAndSpv, GetParam().entryPoint);
89 }
90
91 // Compiling HLSL to legal SPIR-V under Vulkan semantics. Expected to
92 // successfully generate SPIR-V.
93 TEST_P(HlslLegalizeTest, FromFile)
94 {
95     loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
96                             Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,  glslang::EShTargetSpv_1_0,
97                             Target::Spv, true, GetParam().entryPoint,
98                             "/baseLegalResults/", true);
99 }
100
101 // Compiling HLSL to pre-legalized SPIR-V. Expected to successfully generate
102 // SPIR-V with debug instructions, particularly line info.
103 TEST_P(HlslDebugTest, FromFile)
104 {
105     loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
106                             Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
107                             Target::Spv, true, GetParam().entryPoint,
108                             "/baseResults/", false, true);
109 }
110
111 TEST_P(HlslDX9CompatibleTest, FromFile)
112 {
113     loadFileCompileAndCheckWithOptions(GlobalTestSettings.testRoot, GetParam().fileName, Source::HLSL,
114                                        Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
115                                        Target::BothASTAndSpv, true,
116                                        GetParam().entryPoint, "/baseResults/",
117                                        EShMessages::EShMsgHlslDX9Compatible);
118 }
119
120 // Compiling HLSL to legalized SPIR-V with debug instructions. Expected to
121 // successfully generate SPIR-V with debug instructions preserved through
122 // legalization, particularly line info.
123 TEST_P(HlslLegalDebugTest, FromFile)
124 {
125     loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
126                             Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
127                             Target::Spv, true, GetParam().entryPoint,
128                             "/baseResults/", true, true);
129 }
130
131 // clang-format off
132 INSTANTIATE_TEST_SUITE_P(
133     ToSpirv, HlslCompileTest,
134     ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
135         {"hlsl.amend.frag", "f1"},
136         {"hlsl.aliasOpaque.frag", "main"},
137         {"hlsl.array.frag", "PixelShaderFunction"},
138         {"hlsl.array.implicit-size.frag", "PixelShaderFunction"},
139         {"hlsl.array.multidim.frag", "main"},
140         {"hlsl.assoc.frag", "PixelShaderFunction"},
141         {"hlsl.attribute.frag", "PixelShaderFunction"},
142         {"hlsl.attribute.expression.comp", "main"},
143         {"hlsl.attributeC11.frag", "main"},
144         {"hlsl.attributeGlobalBuffer.frag", "main"},
145         {"hlsl.basic.comp", "main"},
146         {"hlsl.basic.geom", "main"},
147         {"hlsl.boolConv.vert", "main"},
148         {"hlsl.buffer.frag", "PixelShaderFunction"},
149         {"hlsl.calculatelod.dx10.frag", "main"},
150         {"hlsl.calculatelodunclamped.dx10.frag", "main"},
151         {"hlsl.cast.frag", "PixelShaderFunction"},
152         {"hlsl.cbuffer-identifier.vert", "main"},
153         {"hlsl.charLit.vert", "main"},
154         {"hlsl.clip.frag", "main"},
155         {"hlsl.clipdistance-1.frag", "main"},
156         {"hlsl.clipdistance-1.geom", "main"},
157         {"hlsl.clipdistance-1.vert", "main"},
158         {"hlsl.clipdistance-2.frag", "main"},
159         {"hlsl.clipdistance-2.geom", "main"},
160         {"hlsl.clipdistance-2.vert", "main"},
161         {"hlsl.clipdistance-3.frag", "main"},
162         {"hlsl.clipdistance-3.geom", "main"},
163         {"hlsl.clipdistance-3.vert", "main"},
164         {"hlsl.clipdistance-4.frag", "main"},
165         {"hlsl.clipdistance-4.geom", "main"},
166         {"hlsl.clipdistance-4.vert", "main"},
167         {"hlsl.clipdistance-5.frag", "main"},
168         {"hlsl.clipdistance-5.vert", "main"},
169         {"hlsl.clipdistance-6.frag", "main"},
170         {"hlsl.clipdistance-6.vert", "main"},
171         {"hlsl.clipdistance-7.frag", "main"},
172         {"hlsl.clipdistance-7.vert", "main"},
173         {"hlsl.clipdistance-8.frag", "main"},
174         {"hlsl.clipdistance-8.vert", "main"},
175         {"hlsl.clipdistance-9.frag", "main"},
176         {"hlsl.clipdistance-9.vert", "main"},
177         {"hlsl.color.hull.tesc", "main"},
178         {"hlsl.comparison.vec.frag", "main"},
179         {"hlsl.conditional.frag", "PixelShaderFunction"},
180         {"hlsl.constantbuffer.frag", "main"},
181         {"hlsl.constructArray.vert", "main"},
182         {"hlsl.constructexpr.frag", "main"},
183         {"hlsl.constructimat.frag", "main"},
184         {"hlsl.coverage.frag", "main"},
185         {"hlsl.depthGreater.frag", "PixelShaderFunction"},
186         {"hlsl.depthLess.frag", "PixelShaderFunction"},
187         {"hlsl.discard.frag", "PixelShaderFunction"},
188         {"hlsl.doLoop.frag", "PixelShaderFunction"},
189         {"hlsl.earlydepthstencil.frag", "main"},
190         {"hlsl.emptystructreturn.frag", "main"},
191         {"hlsl.emptystructreturn.vert", "main"},
192         {"hlsl.emptystruct.init.vert", "main"},
193         {"hlsl.entry-in.frag", "PixelShaderFunction"},
194         {"hlsl.entry-out.frag", "PixelShaderFunction"},
195         {"hlsl.fraggeom.frag", "main"},
196         {"hlsl.float1.frag", "PixelShaderFunction"},
197         {"hlsl.float4.frag", "PixelShaderFunction"},
198         {"hlsl.flatten.return.frag", "main"},
199         {"hlsl.flattenOpaque.frag", "main"},
200         {"hlsl.flattenOpaqueInit.vert", "main"},
201         {"hlsl.flattenOpaqueInitMix.vert", "main"},
202         {"hlsl.flattenSubset.frag", "main"},
203         {"hlsl.flattenSubset2.frag", "main"},
204         {"hlsl.forLoop.frag", "PixelShaderFunction"},
205         {"hlsl.gather.array.dx10.frag", "main"},
206         {"hlsl.gather.basic.dx10.frag", "main"},
207         {"hlsl.gather.basic.dx10.vert", "main"},
208         {"hlsl.gather.offset.dx10.frag", "main"},
209         {"hlsl.gather.offsetarray.dx10.frag", "main"},
210         {"hlsl.gathercmpRGBA.offset.dx10.frag", "main"},
211         {"hlsl.gatherRGBA.array.dx10.frag", "main"},
212         {"hlsl.gatherRGBA.basic.dx10.frag", "main"},
213         {"hlsl.gatherRGBA.offset.dx10.frag", "main"},
214         {"hlsl.gatherRGBA.offsetarray.dx10.frag", "main"},
215         {"hlsl.getdimensions.dx10.frag", "main"},
216         {"hlsl.getdimensions.rw.dx10.frag", "main"},
217         {"hlsl.getdimensions.dx10.vert", "main"},
218         {"hlsl.getsampleposition.dx10.frag", "main"},
219         {"hlsl.global-const-init.frag", "main"},
220         {"hlsl.gs-hs-mix.tesc", "HSMain"},
221         {"hlsl.domain.1.tese", "main"},
222         {"hlsl.domain.2.tese", "main"},
223         {"hlsl.domain.3.tese", "main"},
224         {"hlsl.function.frag", "main"},
225         {"hlsl.hull.1.tesc", "main"},
226         {"hlsl.hull.2.tesc", "main"},
227         {"hlsl.hull.3.tesc", "main"},
228         {"hlsl.hull.4.tesc", "main"},
229         {"hlsl.hull.5.tesc", "main"},
230         {"hlsl.hull.6.tesc", "main"},
231         {"hlsl.hull.void.tesc", "main"},
232         {"hlsl.hull.ctrlpt-1.tesc", "main"},
233         {"hlsl.hull.ctrlpt-2.tesc", "main"},
234         {"hlsl.format.rwtexture.frag", "main"},
235         {"hlsl.groupid.comp", "main"},
236         {"hlsl.identifier.sample.frag", "main"},
237         {"hlsl.if.frag", "PixelShaderFunction"},
238         {"hlsl.imageload-subvec4.comp", "main"},
239         {"hlsl.imagefetch-subvec4.comp", "main"},
240         {"hlsl.implicitBool.frag", "main"},
241         {"hlsl.inf.vert", "main"},
242         {"hlsl.inoutquals.frag", "main"},
243         {"hlsl.inoutquals.negative.frag", "main"},
244         {"hlsl.init.frag", "ShaderFunction"},
245         {"hlsl.init2.frag", "main"},
246         {"hlsl.isfinite.frag", "main"},
247         {"hlsl.intrinsics.barriers.comp", "ComputeShaderFunction"},
248         {"hlsl.intrinsics.comp", "ComputeShaderFunction"},
249         {"hlsl.intrinsics.d3dcolortoubyte4.frag", "main"},
250         {"hlsl.intrinsics.double.frag", "PixelShaderFunction"},
251         {"hlsl.intrinsics.f1632.frag", "main"},
252         {"hlsl.intrinsics.f3216.frag", "main"},
253         {"hlsl.intrinsics.frag", "main"},
254         {"hlsl.intrinsic.frexp.frag", "main"},
255         {"hlsl.intrinsics.lit.frag", "PixelShaderFunction"},
256         {"hlsl.intrinsics.negative.comp", "ComputeShaderFunction"},
257         {"hlsl.intrinsics.negative.frag", "PixelShaderFunction"},
258         {"hlsl.intrinsics.negative.vert", "VertexShaderFunction"},
259         {"hlsl.intrinsics.promote.frag", "main"},
260         {"hlsl.intrinsics.promote.down.frag", "main"},
261         {"hlsl.intrinsics.promote.outputs.frag", "main"},
262         {"hlsl.layout.frag", "main"},
263         {"hlsl.layoutOverride.vert", "main"},
264         {"hlsl.load.2dms.dx10.frag", "main"},
265         {"hlsl.load.array.dx10.frag", "main"},
266         {"hlsl.load.basic.dx10.frag", "main"},
267         {"hlsl.load.basic.dx10.vert", "main"},
268         {"hlsl.load.buffer.dx10.frag", "main"},
269         {"hlsl.load.buffer.float.dx10.frag", "main"},
270         {"hlsl.load.rwbuffer.dx10.frag", "main"},
271         {"hlsl.load.rwtexture.dx10.frag", "main"},
272         {"hlsl.load.rwtexture.array.dx10.frag", "main"},
273         {"hlsl.load.offset.dx10.frag", "main"},
274         {"hlsl.load.offsetarray.dx10.frag", "main"},
275         {"hlsl.localStructuredBuffer.comp", "main"},
276         {"hlsl.logical.binary.frag", "main"},
277         {"hlsl.logical.binary.vec.frag", "main"},
278         {"hlsl.logicalConvert.frag", "main"},
279         {"hlsl.logical.unary.frag", "main"},
280         {"hlsl.loopattr.frag", "main"},
281         {"hlsl.matpack-pragma.frag", "main"},
282         {"hlsl.matpack-pragma-global.frag", "main"},
283         {"hlsl.mip.operator.frag", "main"},
284         {"hlsl.mip.negative.frag", "main"},
285         {"hlsl.mip.negative2.frag", "main"},
286         {"hlsl.namespace.frag", "main"},
287         {"hlsl.nonint-index.frag", "main"},
288         {"hlsl.matNx1.frag", "main"},
289         {"hlsl.matpack-1.frag", "main"},
290         {"hlsl.matrixSwizzle.vert", "ShaderFunction"},
291         {"hlsl.memberFunCall.frag", "main"},
292         {"hlsl.mintypes.frag", "main"},
293         {"hlsl.mul-truncate.frag", "main"},
294         {"hlsl.multiEntry.vert", "RealEntrypoint"},
295         {"hlsl.multiReturn.frag", "main"},
296         {"hlsl.matrixindex.frag", "main"},
297         {"hlsl.nonstaticMemberFunction.frag", "main"},
298         {"hlsl.numericsuffixes.frag", "main"},
299         {"hlsl.numthreads.comp", "main_aux2"},
300         {"hlsl.overload.frag", "PixelShaderFunction"},
301         {"hlsl.opaque-type-bug.frag", "main"},
302         {"hlsl.params.default.frag", "main"},
303         {"hlsl.params.default.negative.frag", "main"},
304         {"hlsl.partialInit.frag", "PixelShaderFunction"},
305         {"hlsl.partialFlattenLocal.vert", "main"},
306         {"hlsl.PointSize.geom", "main"},
307         {"hlsl.PointSize.vert", "main"},
308         {"hlsl.pp.vert", "main"},
309         {"hlsl.pp.line.frag", "main"},
310         {"hlsl.precise.frag", "main"},
311         {"hlsl.printf.comp", "main"},
312         {"hlsl.promote.atomic.frag", "main"},
313         {"hlsl.promote.binary.frag", "main"},
314         {"hlsl.promote.vec1.frag", "main"},
315         {"hlsl.promotions.frag", "main"},
316         {"hlsl.round.dx10.frag", "main"},
317         {"hlsl.rw.atomics.frag", "main"},
318         {"hlsl.rw.bracket.frag", "main"},
319         {"hlsl.rw.register.frag", "main"},
320         {"hlsl.rw.scalar.bracket.frag", "main"},
321         {"hlsl.rw.swizzle.frag", "main"},
322         {"hlsl.rw.vec2.bracket.frag", "main"},
323         {"hlsl.sample.array.dx10.frag", "main"},
324         {"hlsl.sample.basic.dx10.frag", "main"},
325         {"hlsl.sample.offset.dx10.frag", "main"},
326         {"hlsl.sample.offsetarray.dx10.frag", "main"},
327         {"hlsl.samplebias.array.dx10.frag", "main"},
328         {"hlsl.samplebias.basic.dx10.frag", "main"},
329         {"hlsl.samplebias.offset.dx10.frag", "main"},
330         {"hlsl.samplebias.offsetarray.dx10.frag", "main"},
331         {"hlsl.samplecmp.array.dx10.frag", "main"},
332         {"hlsl.samplecmp.basic.dx10.frag", "main"},
333         {"hlsl.samplecmp.dualmode.frag", "main"},
334         {"hlsl.samplecmp.offset.dx10.frag", "main"},
335         {"hlsl.samplecmp.offsetarray.dx10.frag", "main"},
336         {"hlsl.samplecmp.negative.frag", "main"},
337         {"hlsl.samplecmp.negative2.frag", "main"},
338         {"hlsl.samplecmplevelzero.array.dx10.frag", "main"},
339         {"hlsl.samplecmplevelzero.basic.dx10.frag", "main"},
340         {"hlsl.samplecmplevelzero.offset.dx10.frag", "main"},
341         {"hlsl.samplecmplevelzero.offsetarray.dx10.frag", "main"},
342         {"hlsl.samplegrad.array.dx10.frag", "main"},
343         {"hlsl.samplegrad.basic.dx10.frag", "main"},
344         {"hlsl.samplegrad.basic.dx10.vert", "main"},
345         {"hlsl.samplegrad.offset.dx10.frag", "main"},
346         {"hlsl.samplegrad.offsetarray.dx10.frag", "main"},
347         {"hlsl.samplelevel.array.dx10.frag", "main"},
348         {"hlsl.samplelevel.basic.dx10.frag", "main"},
349         {"hlsl.samplelevel.basic.dx10.vert", "main"},
350         {"hlsl.samplelevel.offset.dx10.frag", "main"},
351         {"hlsl.samplelevel.offsetarray.dx10.frag", "main"},
352         {"hlsl.sample.sub-vec4.dx10.frag", "main"},
353         {"hlsl.scalar-length.frag", "main"},
354         {"hlsl.scalarCast.vert", "main"},
355         {"hlsl.semicolons.frag", "main"},
356         {"hlsl.shapeConv.frag", "main"},
357         {"hlsl.shapeConvRet.frag", "main"},
358         {"hlsl.singleArgIntPromo.vert", "main"},
359         {"hlsl.self_cast.frag", "main"},
360         {"hlsl.snorm.uav.comp", "main"},
361         {"hlsl.specConstant.frag", "main"},
362         {"hlsl.staticMemberFunction.frag", "main"},
363         {"hlsl.staticFuncInit.frag", "main"},
364         {"hlsl.store.rwbyteaddressbuffer.type.comp", "main"},
365         {"hlsl.stringtoken.frag", "main"},
366         {"hlsl.string.frag", "main"},
367         {"hlsl.struct.split-1.vert", "main"},
368         {"hlsl.struct.split.array.geom", "main"},
369         {"hlsl.struct.split.assign.frag", "main"},
370         {"hlsl.struct.split.call.vert", "main"},
371         {"hlsl.struct.split.nested.geom", "main"},
372         {"hlsl.struct.split.trivial.geom", "main"},
373         {"hlsl.struct.split.trivial.vert", "main"},
374         {"hlsl.structarray.flatten.frag", "main"},
375         {"hlsl.structarray.flatten.geom", "main"},
376         {"hlsl.structbuffer.frag", "main"},
377         {"hlsl.structbuffer.append.frag", "main"},
378         {"hlsl.structbuffer.append.fn.frag", "main"},
379         {"hlsl.structbuffer.atomics.frag", "main"},
380         {"hlsl.structbuffer.byte.frag", "main"},
381         {"hlsl.structbuffer.coherent.frag", "main"},
382         {"hlsl.structbuffer.floatidx.comp", "main"},
383         {"hlsl.structbuffer.incdec.frag", "main"},
384         {"hlsl.structbuffer.fn.frag", "main"},
385         {"hlsl.structbuffer.fn2.comp", "main"},
386         {"hlsl.structbuffer.rw.frag", "main"},
387         {"hlsl.structbuffer.rwbyte.frag", "main"},
388         {"hlsl.structbuffer.rwbyte2.comp", "main"},
389         {"hlsl.structin.vert", "main"},
390         {"hlsl.structIoFourWay.frag", "main"},
391         {"hlsl.structStructName.frag", "main"},
392         {"hlsl.subpass.frag", "main"},
393         {"hlsl.synthesizeInput.frag", "main"},
394         {"hlsl.texturebuffer.frag", "main"},
395         {"hlsl.texture.struct.frag", "main"},
396         {"hlsl.texture.subvec4.frag", "main"},
397         {"hlsl.this.frag", "main"},
398         {"hlsl.intrinsics.vert", "VertexShaderFunction"},
399         {"hlsl.intrinsic.frexp.vert", "VertexShaderFunction"},
400         {"hlsl.matType.frag", "PixelShaderFunction"},
401         {"hlsl.matType.bool.frag", "main"},
402         {"hlsl.matType.int.frag", "main"},
403         {"hlsl.max.frag", "PixelShaderFunction"},
404         {"hlsl.preprocessor.frag", "main"},
405         {"hlsl.precedence.frag", "PixelShaderFunction"},
406         {"hlsl.precedence2.frag", "PixelShaderFunction"},
407         {"hlsl.scalar2matrix.frag", "main"},
408         {"hlsl.semantic.geom", "main"},
409         {"hlsl.semantic.vert", "main"},
410         {"hlsl.semantic-1.vert", "main"},
411         {"hlsl.scope.frag", "PixelShaderFunction"},
412         {"hlsl.sin.frag", "PixelShaderFunction"},
413         {"hlsl.struct.frag", "PixelShaderFunction"},
414         {"hlsl.switch.frag", "PixelShaderFunction"},
415         {"hlsl.swizzle.frag", "PixelShaderFunction"},
416         {"hlsl.target.frag", "main"},
417         {"hlsl.targetStruct1.frag", "main"},
418         {"hlsl.targetStruct2.frag", "main"},
419         {"hlsl.templatetypes.frag", "PixelShaderFunction"},
420         {"hlsl.tristream-append.geom", "main"},
421         {"hlsl.tx.bracket.frag", "main"},
422         {"hlsl.tx.overload.frag", "main"},
423         {"hlsl.type.half.frag", "main"},
424         {"hlsl.type.identifier.frag", "main"},
425         {"hlsl.typeGraphCopy.vert", "main"},
426         {"hlsl.typedef.frag", "PixelShaderFunction"},
427         {"hlsl.whileLoop.frag", "PixelShaderFunction"},
428         {"hlsl.void.frag", "PixelShaderFunction"},
429         {"hlsl.type.type.conversion.all.frag", "main"}
430     }),
431     FileNameAsCustomTestSuffix
432 );
433 // clang-format on
434
435 // clang-format off
436 INSTANTIATE_TEST_SUITE_P(
437     ToSpirv, HlslVulkan1_1CompileTest,
438     ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
439         {"hlsl.wavebroadcast.comp", "CSMain"},
440         {"hlsl.waveprefix.comp", "CSMain"},
441         {"hlsl.wavequad.comp", "CSMain"},
442         {"hlsl.wavequery.comp", "CSMain"},
443         {"hlsl.wavequery.frag", "PixelShaderFunction"},
444         {"hlsl.wavereduction.comp", "CSMain"},
445         {"hlsl.wavevote.comp", "CSMain"},
446         { "hlsl.type.type.conversion.valid.frag", "main" },
447         {"hlsl.int.dot.frag", "main"}
448     }),
449     FileNameAsCustomTestSuffix
450 );
451 // clang-format on
452
453 // clang-format off
454 INSTANTIATE_TEST_SUITE_P(
455     ToSpirv, HlslCompileAndFlattenTest,
456     ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
457         {"hlsl.array.flatten.frag", "main"},
458         {"hlsl.partialFlattenMixed.vert", "main"},
459     }),
460     FileNameAsCustomTestSuffix
461 );
462 // clang-format on
463
464 #if ENABLE_OPT
465 // clang-format off
466 INSTANTIATE_TEST_SUITE_P(
467     ToSpirv, HlslLegalizeTest,
468     ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
469         {"hlsl.aliasOpaque.frag", "main"},
470         {"hlsl.flattenOpaque.frag", "main"},
471         {"hlsl.flattenOpaqueInit.vert", "main"},
472         {"hlsl.flattenOpaqueInitMix.vert", "main"},
473         {"hlsl.flattenSubset.frag", "main"},
474         {"hlsl.flattenSubset2.frag", "main"},
475         {"hlsl.intrinsics.evalfns.frag", "main"},
476         {"hlsl.partialFlattenLocal.vert", "main"},
477         {"hlsl.partialFlattenMixed.vert", "main"}
478     }),
479     FileNameAsCustomTestSuffix
480 );
481 // clang-format on
482 #endif
483
484 // clang-format off
485 INSTANTIATE_TEST_SUITE_P(
486     ToSpirv, HlslDebugTest,
487     ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
488         {"hlsl.pp.line2.frag", "MainPs"}
489     }),
490     FileNameAsCustomTestSuffix
491 );
492
493 INSTANTIATE_TEST_SUITE_P(
494     ToSpirv, HlslDX9CompatibleTest,
495     ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
496         {"hlsl.round.dx9.frag", "main"},
497         {"hlsl.sample.dx9.frag", "main"},
498         {"hlsl.sample.dx9.vert", "main"},
499     }),
500     FileNameAsCustomTestSuffix
501 );
502
503 // clang-format off
504 INSTANTIATE_TEST_SUITE_P(
505     ToSpirv, HlslLegalDebugTest,
506     ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
507         {"hlsl.pp.line4.frag", "MainPs"}
508     }),
509     FileNameAsCustomTestSuffix
510 );
511
512 // clang-format on
513
514 }  // anonymous namespace
515 }  // namespace glslangtest