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