Fix GCC sign-compare warnings
[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 HlslSpv1_6CompileTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
63 using HlslCompileAndFlattenTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
64 using HlslLegalizeTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
65 using HlslDebugTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
66 using HlslDX9CompatibleTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
67 using HlslLegalDebugTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
68
69 // Compiling HLSL to pre-legalized SPIR-V under Vulkan semantics. Expected
70 // to successfully generate both AST and SPIR-V.
71 TEST_P(HlslCompileTest, FromFile)
72 {
73     loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
74                             Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,  glslang::EShTargetSpv_1_0,
75                             Target::BothASTAndSpv, true, GetParam().entryPoint);
76 }
77
78 TEST_P(HlslVulkan1_1CompileTest, FromFile)
79 {
80     loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
81                             Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1, glslang::EShTargetSpv_1_3,
82                             Target::BothASTAndSpv, true, GetParam().entryPoint);
83 }
84
85 TEST_P(HlslSpv1_6CompileTest, FromFile)
86 {
87     loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
88                             Source::HLSL, Semantics::Vulkan, glslang::EShTargetUniversal, glslang::EShTargetSpv_1_6,
89                             Target::BothASTAndSpv, true, GetParam().entryPoint);
90 }
91
92 TEST_P(HlslCompileAndFlattenTest, FromFile)
93 {
94     loadFileCompileFlattenUniformsAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
95                                            Source::HLSL, Semantics::Vulkan,
96                                            Target::BothASTAndSpv, GetParam().entryPoint);
97 }
98
99 // Compiling HLSL to legal SPIR-V under Vulkan semantics. Expected to
100 // successfully generate SPIR-V.
101 TEST_P(HlslLegalizeTest, FromFile)
102 {
103     loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
104                             Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,  glslang::EShTargetSpv_1_0,
105                             Target::Spv, true, GetParam().entryPoint,
106                             "/baseLegalResults/", true);
107 }
108
109 // Compiling HLSL to pre-legalized SPIR-V. Expected to successfully generate
110 // SPIR-V with debug instructions, particularly line info.
111 TEST_P(HlslDebugTest, FromFile)
112 {
113     loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
114                             Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
115                             Target::Spv, true, GetParam().entryPoint,
116                             "/baseResults/", false, true);
117 }
118
119 TEST_P(HlslDX9CompatibleTest, FromFile)
120 {
121     loadFileCompileAndCheckWithOptions(GlobalTestSettings.testRoot, GetParam().fileName, Source::HLSL,
122                                        Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
123                                        Target::BothASTAndSpv, true,
124                                        GetParam().entryPoint, "/baseResults/",
125                                        EShMessages::EShMsgHlslDX9Compatible);
126 }
127
128 // Compiling HLSL to legalized SPIR-V with debug instructions. Expected to
129 // successfully generate SPIR-V with debug instructions preserved through
130 // legalization, particularly line info.
131 TEST_P(HlslLegalDebugTest, FromFile)
132 {
133     loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
134                             Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
135                             Target::Spv, true, GetParam().entryPoint,
136                             "/baseResults/", true, true);
137 }
138
139 // clang-format off
140 INSTANTIATE_TEST_SUITE_P(
141     ToSpirv, HlslCompileTest,
142     ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
143         {"hlsl.amend.frag", "f1"},
144         {"hlsl.aliasOpaque.frag", "main"},
145         {"hlsl.array.frag", "PixelShaderFunction"},
146         {"hlsl.array.implicit-size.frag", "PixelShaderFunction"},
147         {"hlsl.array.multidim.frag", "main"},
148         {"hlsl.assoc.frag", "PixelShaderFunction"},
149         {"hlsl.attribute.frag", "PixelShaderFunction"},
150         {"hlsl.attribute.expression.comp", "main"},
151         {"hlsl.attributeC11.frag", "main"},
152         {"hlsl.attributeGlobalBuffer.frag", "main"},
153         {"hlsl.basic.comp", "main"},
154         {"hlsl.basic.geom", "main"},
155         {"hlsl.boolConv.vert", "main"},
156         {"hlsl.buffer.frag", "PixelShaderFunction"},
157         {"hlsl.calculatelod.dx10.frag", "main"},
158         {"hlsl.calculatelodunclamped.dx10.frag", "main"},
159         {"hlsl.cast.frag", "PixelShaderFunction"},
160         {"hlsl.cbuffer-identifier.vert", "main"},
161         {"hlsl.charLit.vert", "main"},
162         {"hlsl.clip.frag", "main"},
163         {"hlsl.clipdistance-1.frag", "main"},
164         {"hlsl.clipdistance-1.geom", "main"},
165         {"hlsl.clipdistance-1.vert", "main"},
166         {"hlsl.clipdistance-2.frag", "main"},
167         {"hlsl.clipdistance-2.geom", "main"},
168         {"hlsl.clipdistance-2.vert", "main"},
169         {"hlsl.clipdistance-3.frag", "main"},
170         {"hlsl.clipdistance-3.geom", "main"},
171         {"hlsl.clipdistance-3.vert", "main"},
172         {"hlsl.clipdistance-4.frag", "main"},
173         {"hlsl.clipdistance-4.geom", "main"},
174         {"hlsl.clipdistance-4.vert", "main"},
175         {"hlsl.clipdistance-5.frag", "main"},
176         {"hlsl.clipdistance-5.vert", "main"},
177         {"hlsl.clipdistance-6.frag", "main"},
178         {"hlsl.clipdistance-6.vert", "main"},
179         {"hlsl.clipdistance-7.frag", "main"},
180         {"hlsl.clipdistance-7.vert", "main"},
181         {"hlsl.clipdistance-8.frag", "main"},
182         {"hlsl.clipdistance-8.vert", "main"},
183         {"hlsl.clipdistance-9.frag", "main"},
184         {"hlsl.clipdistance-9.vert", "main"},
185         {"hlsl.color.hull.tesc", "main"},
186         {"hlsl.comparison.vec.frag", "main"},
187         {"hlsl.conditional.frag", "PixelShaderFunction"},
188         {"hlsl.constantbuffer.frag", "main"},
189         {"hlsl.constructArray.vert", "main"},
190         {"hlsl.constructexpr.frag", "main"},
191         {"hlsl.constructimat.frag", "main"},
192         {"hlsl.coverage.frag", "main"},
193         {"hlsl.depthGreater.frag", "PixelShaderFunction"},
194         {"hlsl.depthLess.frag", "PixelShaderFunction"},
195         {"hlsl.discard.frag", "PixelShaderFunction"},
196         {"hlsl.doLoop.frag", "PixelShaderFunction"},
197         {"hlsl.earlydepthstencil.frag", "main"},
198         {"hlsl.emptystructreturn.frag", "main"},
199         {"hlsl.emptystructreturn.vert", "main"},
200         {"hlsl.emptystruct.init.vert", "main"},
201         {"hlsl.entry-in.frag", "PixelShaderFunction"},
202         {"hlsl.entry-out.frag", "PixelShaderFunction"},
203         {"hlsl.fraggeom.frag", "main"},
204         {"hlsl.float1.frag", "PixelShaderFunction"},
205         {"hlsl.float4.frag", "PixelShaderFunction"},
206         {"hlsl.flatten.return.frag", "main"},
207         {"hlsl.flattenOpaque.frag", "main"},
208         {"hlsl.flattenOpaqueInit.vert", "main"},
209         {"hlsl.flattenOpaqueInitMix.vert", "main"},
210         {"hlsl.flattenSubset.frag", "main"},
211         {"hlsl.flattenSubset2.frag", "main"},
212         {"hlsl.forLoop.frag", "PixelShaderFunction"},
213         {"hlsl.gather.array.dx10.frag", "main"},
214         {"hlsl.gather.basic.dx10.frag", "main"},
215         {"hlsl.gather.basic.dx10.vert", "main"},
216         {"hlsl.gather.offset.dx10.frag", "main"},
217         {"hlsl.gather.offsetarray.dx10.frag", "main"},
218         {"hlsl.gathercmpRGBA.offset.dx10.frag", "main"},
219         {"hlsl.gatherRGBA.array.dx10.frag", "main"},
220         {"hlsl.gatherRGBA.basic.dx10.frag", "main"},
221         {"hlsl.gatherRGBA.offset.dx10.frag", "main"},
222         {"hlsl.gatherRGBA.offsetarray.dx10.frag", "main"},
223         {"hlsl.getdimensions.dx10.frag", "main"},
224         {"hlsl.getdimensions.rw.dx10.frag", "main"},
225         {"hlsl.getdimensions.dx10.vert", "main"},
226         {"hlsl.getsampleposition.dx10.frag", "main"},
227         {"hlsl.global-const-init.frag", "main"},
228         {"hlsl.gs-hs-mix.tesc", "HSMain"},
229         {"hlsl.domain.1.tese", "main"},
230         {"hlsl.domain.2.tese", "main"},
231         {"hlsl.domain.3.tese", "main"},
232         {"hlsl.function.frag", "main"},
233         {"hlsl.hull.1.tesc", "main"},
234         {"hlsl.hull.2.tesc", "main"},
235         {"hlsl.hull.3.tesc", "main"},
236         {"hlsl.hull.4.tesc", "main"},
237         {"hlsl.hull.5.tesc", "main"},
238         {"hlsl.hull.6.tesc", "main"},
239         {"hlsl.hull.void.tesc", "main"},
240         {"hlsl.hull.ctrlpt-1.tesc", "main"},
241         {"hlsl.hull.ctrlpt-2.tesc", "main"},
242         {"hlsl.format.rwtexture.frag", "main"},
243         {"hlsl.groupid.comp", "main"},
244         {"hlsl.identifier.sample.frag", "main"},
245         {"hlsl.if.frag", "PixelShaderFunction"},
246         {"hlsl.imageload-subvec4.comp", "main"},
247         {"hlsl.imagefetch-subvec4.comp", "main"},
248         {"hlsl.implicitBool.frag", "main"},
249         {"hlsl.inf.vert", "main"},
250         {"hlsl.inoutquals.frag", "main"},
251         {"hlsl.inoutquals.negative.frag", "main"},
252         {"hlsl.init.frag", "ShaderFunction"},
253         {"hlsl.init2.frag", "main"},
254         {"hlsl.isfinite.frag", "main"},
255         {"hlsl.intrinsics.barriers.comp", "ComputeShaderFunction"},
256         {"hlsl.intrinsics.comp", "ComputeShaderFunction"},
257         {"hlsl.intrinsics.d3dcolortoubyte4.frag", "main"},
258         {"hlsl.intrinsics.double.frag", "PixelShaderFunction"},
259         {"hlsl.intrinsics.f1632.frag", "main"},
260         {"hlsl.intrinsics.f3216.frag", "main"},
261         {"hlsl.intrinsics.frag", "main"},
262         {"hlsl.intrinsic.frexp.frag", "main"},
263         {"hlsl.intrinsics.lit.frag", "PixelShaderFunction"},
264         {"hlsl.intrinsics.negative.comp", "ComputeShaderFunction"},
265         {"hlsl.intrinsics.negative.frag", "PixelShaderFunction"},
266         {"hlsl.intrinsics.negative.vert", "VertexShaderFunction"},
267         {"hlsl.intrinsics.promote.frag", "main"},
268         {"hlsl.intrinsics.promote.down.frag", "main"},
269         {"hlsl.intrinsics.promote.outputs.frag", "main"},
270         {"hlsl.layout.frag", "main"},
271         {"hlsl.layoutOverride.vert", "main"},
272         {"hlsl.load.2dms.dx10.frag", "main"},
273         {"hlsl.load.array.dx10.frag", "main"},
274         {"hlsl.load.basic.dx10.frag", "main"},
275         {"hlsl.load.basic.dx10.vert", "main"},
276         {"hlsl.load.buffer.dx10.frag", "main"},
277         {"hlsl.load.buffer.float.dx10.frag", "main"},
278         {"hlsl.load.rwbuffer.dx10.frag", "main"},
279         {"hlsl.load.rwtexture.dx10.frag", "main"},
280         {"hlsl.load.rwtexture.array.dx10.frag", "main"},
281         {"hlsl.load.offset.dx10.frag", "main"},
282         {"hlsl.load.offsetarray.dx10.frag", "main"},
283         {"hlsl.localStructuredBuffer.comp", "main"},
284         {"hlsl.logical.binary.frag", "main"},
285         {"hlsl.logical.binary.vec.frag", "main"},
286         {"hlsl.logicalConvert.frag", "main"},
287         {"hlsl.logical.unary.frag", "main"},
288         {"hlsl.loopattr.frag", "main"},
289         {"hlsl.matpack-pragma.frag", "main"},
290         {"hlsl.matpack-pragma-global.frag", "main"},
291         {"hlsl.mip.operator.frag", "main"},
292         {"hlsl.mip.negative.frag", "main"},
293         {"hlsl.mip.negative2.frag", "main"},
294         {"hlsl.namespace.frag", "main"},
295         {"hlsl.nonint-index.frag", "main"},
296         {"hlsl.matNx1.frag", "main"},
297         {"hlsl.matpack-1.frag", "main"},
298         {"hlsl.matrixSwizzle.vert", "ShaderFunction"},
299         {"hlsl.memberFunCall.frag", "main"},
300         {"hlsl.mintypes.frag", "main"},
301         {"hlsl.mul-truncate.frag", "main"},
302         {"hlsl.multiEntry.vert", "RealEntrypoint"},
303         {"hlsl.multiReturn.frag", "main"},
304         {"hlsl.matrixindex.frag", "main"},
305         {"hlsl.nonstaticMemberFunction.frag", "main"},
306         {"hlsl.numericsuffixes.frag", "main"},
307         {"hlsl.numthreads.comp", "main_aux2"},
308         {"hlsl.overload.frag", "PixelShaderFunction"},
309         {"hlsl.opaque-type-bug.frag", "main"},
310         {"hlsl.params.default.frag", "main"},
311         {"hlsl.params.default.negative.frag", "main"},
312         {"hlsl.partialInit.frag", "PixelShaderFunction"},
313         {"hlsl.partialFlattenLocal.vert", "main"},
314         {"hlsl.PointSize.geom", "main"},
315         {"hlsl.PointSize.vert", "main"},
316         {"hlsl.pp.vert", "main"},
317         {"hlsl.pp.line.frag", "main"},
318         {"hlsl.precise.frag", "main"},
319         {"hlsl.printf.comp", "main"},
320         {"hlsl.promote.atomic.frag", "main"},
321         {"hlsl.promote.binary.frag", "main"},
322         {"hlsl.promote.vec1.frag", "main"},
323         {"hlsl.promotions.frag", "main"},
324         {"hlsl.round.dx10.frag", "main"},
325         {"hlsl.rw.atomics.frag", "main"},
326         {"hlsl.rw.bracket.frag", "main"},
327         {"hlsl.rw.register.frag", "main"},
328         {"hlsl.rw.scalar.bracket.frag", "main"},
329         {"hlsl.rw.swizzle.frag", "main"},
330         {"hlsl.rw.vec2.bracket.frag", "main"},
331         {"hlsl.sample.array.dx10.frag", "main"},
332         {"hlsl.sample.basic.dx10.frag", "main"},
333         {"hlsl.sample.offset.dx10.frag", "main"},
334         {"hlsl.sample.offsetarray.dx10.frag", "main"},
335         {"hlsl.samplebias.array.dx10.frag", "main"},
336         {"hlsl.samplebias.basic.dx10.frag", "main"},
337         {"hlsl.samplebias.offset.dx10.frag", "main"},
338         {"hlsl.samplebias.offsetarray.dx10.frag", "main"},
339         {"hlsl.samplecmp.array.dx10.frag", "main"},
340         {"hlsl.samplecmp.basic.dx10.frag", "main"},
341         {"hlsl.samplecmp.dualmode.frag", "main"},
342         {"hlsl.samplecmp.offset.dx10.frag", "main"},
343         {"hlsl.samplecmp.offsetarray.dx10.frag", "main"},
344         {"hlsl.samplecmp.negative.frag", "main"},
345         {"hlsl.samplecmp.negative2.frag", "main"},
346         {"hlsl.samplecmplevelzero.array.dx10.frag", "main"},
347         {"hlsl.samplecmplevelzero.basic.dx10.frag", "main"},
348         {"hlsl.samplecmplevelzero.offset.dx10.frag", "main"},
349         {"hlsl.samplecmplevelzero.offsetarray.dx10.frag", "main"},
350         {"hlsl.samplegrad.array.dx10.frag", "main"},
351         {"hlsl.samplegrad.basic.dx10.frag", "main"},
352         {"hlsl.samplegrad.basic.dx10.vert", "main"},
353         {"hlsl.samplegrad.offset.dx10.frag", "main"},
354         {"hlsl.samplegrad.offsetarray.dx10.frag", "main"},
355         {"hlsl.samplelevel.array.dx10.frag", "main"},
356         {"hlsl.samplelevel.basic.dx10.frag", "main"},
357         {"hlsl.samplelevel.basic.dx10.vert", "main"},
358         {"hlsl.samplelevel.offset.dx10.frag", "main"},
359         {"hlsl.samplelevel.offsetarray.dx10.frag", "main"},
360         {"hlsl.sample.sub-vec4.dx10.frag", "main"},
361         {"hlsl.scalar-length.frag", "main"},
362         {"hlsl.scalarCast.vert", "main"},
363         {"hlsl.semicolons.frag", "main"},
364         {"hlsl.shapeConv.frag", "main"},
365         {"hlsl.shapeConvRet.frag", "main"},
366         {"hlsl.singleArgIntPromo.vert", "main"},
367         {"hlsl.self_cast.frag", "main"},
368         {"hlsl.snorm.uav.comp", "main"},
369         {"hlsl.specConstant.frag", "main"},
370         {"hlsl.staticMemberFunction.frag", "main"},
371         {"hlsl.staticFuncInit.frag", "main"},
372         {"hlsl.store.rwbyteaddressbuffer.type.comp", "main"},
373         {"hlsl.stringtoken.frag", "main"},
374         {"hlsl.string.frag", "main"},
375         {"hlsl.struct.split-1.vert", "main"},
376         {"hlsl.struct.split.array.geom", "main"},
377         {"hlsl.struct.split.assign.frag", "main"},
378         {"hlsl.struct.split.call.vert", "main"},
379         {"hlsl.struct.split.nested.geom", "main"},
380         {"hlsl.struct.split.trivial.geom", "main"},
381         {"hlsl.struct.split.trivial.vert", "main"},
382         {"hlsl.structarray.flatten.frag", "main"},
383         {"hlsl.structarray.flatten.geom", "main"},
384         {"hlsl.structbuffer.frag", "main"},
385         {"hlsl.structbuffer.append.frag", "main"},
386         {"hlsl.structbuffer.append.fn.frag", "main"},
387         {"hlsl.structbuffer.atomics.frag", "main"},
388         {"hlsl.structbuffer.byte.frag", "main"},
389         {"hlsl.structbuffer.coherent.frag", "main"},
390         {"hlsl.structbuffer.floatidx.comp", "main"},
391         {"hlsl.structbuffer.incdec.frag", "main"},
392         {"hlsl.structbuffer.fn.frag", "main"},
393         {"hlsl.structbuffer.fn2.comp", "main"},
394         {"hlsl.structbuffer.rw.frag", "main"},
395         {"hlsl.structbuffer.rwbyte.frag", "main"},
396         {"hlsl.structbuffer.rwbyte2.comp", "main"},
397         {"hlsl.structin.vert", "main"},
398         {"hlsl.structIoFourWay.frag", "main"},
399         {"hlsl.structStructName.frag", "main"},
400         {"hlsl.subpass.frag", "main"},
401         {"hlsl.synthesizeInput.frag", "main"},
402         {"hlsl.texturebuffer.frag", "main"},
403         {"hlsl.texture.struct.frag", "main"},
404         {"hlsl.texture.subvec4.frag", "main"},
405         {"hlsl.this.frag", "main"},
406         {"hlsl.intrinsics.vert", "VertexShaderFunction"},
407         {"hlsl.intrinsic.frexp.vert", "VertexShaderFunction"},
408         {"hlsl.matType.frag", "PixelShaderFunction"},
409         {"hlsl.matType.bool.frag", "main"},
410         {"hlsl.matType.int.frag", "main"},
411         {"hlsl.max.frag", "PixelShaderFunction"},
412         {"hlsl.preprocessor.frag", "main"},
413         {"hlsl.precedence.frag", "PixelShaderFunction"},
414         {"hlsl.precedence2.frag", "PixelShaderFunction"},
415         {"hlsl.scalar2matrix.frag", "main"},
416         {"hlsl.semantic.geom", "main"},
417         {"hlsl.semantic.vert", "main"},
418         {"hlsl.semantic-1.vert", "main"},
419         {"hlsl.scope.frag", "PixelShaderFunction"},
420         {"hlsl.sin.frag", "PixelShaderFunction"},
421         {"hlsl.struct.frag", "PixelShaderFunction"},
422         {"hlsl.switch.frag", "PixelShaderFunction"},
423         {"hlsl.swizzle.frag", "PixelShaderFunction"},
424         {"hlsl.target.frag", "main"},
425         {"hlsl.targetStruct1.frag", "main"},
426         {"hlsl.targetStruct2.frag", "main"},
427         {"hlsl.templatetypes.frag", "PixelShaderFunction"},
428         {"hlsl.tristream-append.geom", "main"},
429         {"hlsl.tx.bracket.frag", "main"},
430         {"hlsl.tx.overload.frag", "main"},
431         {"hlsl.type.half.frag", "main"},
432         {"hlsl.type.identifier.frag", "main"},
433         {"hlsl.typeGraphCopy.vert", "main"},
434         {"hlsl.typedef.frag", "PixelShaderFunction"},
435         {"hlsl.whileLoop.frag", "PixelShaderFunction"},
436         {"hlsl.void.frag", "PixelShaderFunction"},
437         {"hlsl.type.type.conversion.all.frag", "main"}
438     }),
439     FileNameAsCustomTestSuffix
440 );
441 // clang-format on
442
443 // clang-format off
444 INSTANTIATE_TEST_SUITE_P(
445     ToSpirv, HlslVulkan1_1CompileTest,
446     ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
447         {"hlsl.wavebroadcast.comp", "CSMain"},
448         {"hlsl.waveprefix.comp", "CSMain"},
449         {"hlsl.wavequad.comp", "CSMain"},
450         {"hlsl.wavequery.comp", "CSMain"},
451         {"hlsl.wavequery.frag", "PixelShaderFunction"},
452         {"hlsl.wavereduction.comp", "CSMain"},
453         {"hlsl.wavevote.comp", "CSMain"},
454         { "hlsl.type.type.conversion.valid.frag", "main" },
455         {"hlsl.int.dot.frag", "main"}
456     }),
457     FileNameAsCustomTestSuffix
458 );
459 // clang-format on
460
461 // clang-format off
462 INSTANTIATE_TEST_SUITE_P(
463     ToSpirv, HlslSpv1_6CompileTest,
464     ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
465        {"hlsl.spv.1.6.discard.frag", "PixelShaderFunction"}
466     }),
467     FileNameAsCustomTestSuffix
468 );
469 // clang-format on
470
471 // clang-format off
472 INSTANTIATE_TEST_SUITE_P(
473     ToSpirv, HlslCompileAndFlattenTest,
474     ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
475         {"hlsl.array.flatten.frag", "main"},
476         {"hlsl.partialFlattenMixed.vert", "main"},
477     }),
478     FileNameAsCustomTestSuffix
479 );
480 // clang-format on
481
482 #if ENABLE_OPT
483 // clang-format off
484 INSTANTIATE_TEST_SUITE_P(
485     ToSpirv, HlslLegalizeTest,
486     ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
487         {"hlsl.aliasOpaque.frag", "main"},
488         {"hlsl.flattenOpaque.frag", "main"},
489         {"hlsl.flattenOpaqueInit.vert", "main"},
490         {"hlsl.flattenOpaqueInitMix.vert", "main"},
491         {"hlsl.flattenSubset.frag", "main"},
492         {"hlsl.flattenSubset2.frag", "main"},
493         {"hlsl.intrinsics.evalfns.frag", "main"},
494         {"hlsl.partialFlattenLocal.vert", "main"},
495         {"hlsl.partialFlattenMixed.vert", "main"}
496     }),
497     FileNameAsCustomTestSuffix
498 );
499 // clang-format on
500 #endif
501
502 // clang-format off
503 INSTANTIATE_TEST_SUITE_P(
504     ToSpirv, HlslDebugTest,
505     ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
506         {"hlsl.pp.line2.frag", "MainPs"}
507     }),
508     FileNameAsCustomTestSuffix
509 );
510
511 INSTANTIATE_TEST_SUITE_P(
512     ToSpirv, HlslDX9CompatibleTest,
513     ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
514         {"hlsl.round.dx9.frag", "main"},
515         {"hlsl.sample.dx9.frag", "main"},
516         {"hlsl.sample.dx9.vert", "main"},
517     }),
518     FileNameAsCustomTestSuffix
519 );
520
521 // clang-format off
522 INSTANTIATE_TEST_SUITE_P(
523     ToSpirv, HlslLegalDebugTest,
524     ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
525         {"hlsl.pp.line4.frag", "MainPs"}
526     }),
527     FileNameAsCustomTestSuffix
528 );
529
530 // clang-format on
531
532 }  // anonymous namespace
533 }  // namespace glslangtest