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