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.
FileNameAsCustomTestSuffix(const::testing::TestParamInfo<FileNameEntryPointPair> & info)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.
TEST_P(HlslCompileTest,FromFile)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
TEST_P(HlslVulkan1_1CompileTest,FromFile)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
TEST_P(HlslCompileAndFlattenTest,FromFile)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.
TEST_P(HlslLegalizeTest,FromFile)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.
TEST_P(HlslDebugTest,FromFile)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
TEST_P(HlslDX9CompatibleTest,FromFile)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.
TEST_P(HlslLegalDebugTest,FromFile)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.imagefetch-subvec4.comp", "main"},
239 {"hlsl.implicitBool.frag", "main"},
240 {"hlsl.inf.vert", "main"},
241 {"hlsl.inoutquals.frag", "main"},
242 {"hlsl.inoutquals.negative.frag", "main"},
243 {"hlsl.init.frag", "ShaderFunction"},
244 {"hlsl.init2.frag", "main"},
245 {"hlsl.isfinite.frag", "main"},
246 {"hlsl.intrinsics.barriers.comp", "ComputeShaderFunction"},
247 {"hlsl.intrinsics.comp", "ComputeShaderFunction"},
248 {"hlsl.intrinsics.evalfns.frag", "main"},
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.rw.atomics.frag", "main"},
317 {"hlsl.rw.bracket.frag", "main"},
318 {"hlsl.rw.register.frag", "main"},
319 {"hlsl.rw.scalar.bracket.frag", "main"},
320 {"hlsl.rw.swizzle.frag", "main"},
321 {"hlsl.rw.vec2.bracket.frag", "main"},
322 {"hlsl.sample.array.dx10.frag", "main"},
323 {"hlsl.sample.basic.dx10.frag", "main"},
324 {"hlsl.sample.offset.dx10.frag", "main"},
325 {"hlsl.sample.offsetarray.dx10.frag", "main"},
326 {"hlsl.samplebias.array.dx10.frag", "main"},
327 {"hlsl.samplebias.basic.dx10.frag", "main"},
328 {"hlsl.samplebias.offset.dx10.frag", "main"},
329 {"hlsl.samplebias.offsetarray.dx10.frag", "main"},
330 {"hlsl.samplecmp.array.dx10.frag", "main"},
331 {"hlsl.samplecmp.basic.dx10.frag", "main"},
332 {"hlsl.samplecmp.dualmode.frag", "main"},
333 {"hlsl.samplecmp.offset.dx10.frag", "main"},
334 {"hlsl.samplecmp.offsetarray.dx10.frag", "main"},
335 {"hlsl.samplecmp.negative.frag", "main"},
336 {"hlsl.samplecmp.negative2.frag", "main"},
337 {"hlsl.samplecmplevelzero.array.dx10.frag", "main"},
338 {"hlsl.samplecmplevelzero.basic.dx10.frag", "main"},
339 {"hlsl.samplecmplevelzero.offset.dx10.frag", "main"},
340 {"hlsl.samplecmplevelzero.offsetarray.dx10.frag", "main"},
341 {"hlsl.samplegrad.array.dx10.frag", "main"},
342 {"hlsl.samplegrad.basic.dx10.frag", "main"},
343 {"hlsl.samplegrad.basic.dx10.vert", "main"},
344 {"hlsl.samplegrad.offset.dx10.frag", "main"},
345 {"hlsl.samplegrad.offsetarray.dx10.frag", "main"},
346 {"hlsl.samplelevel.array.dx10.frag", "main"},
347 {"hlsl.samplelevel.basic.dx10.frag", "main"},
348 {"hlsl.samplelevel.basic.dx10.vert", "main"},
349 {"hlsl.samplelevel.offset.dx10.frag", "main"},
350 {"hlsl.samplelevel.offsetarray.dx10.frag", "main"},
351 {"hlsl.sample.sub-vec4.dx10.frag", "main"},
352 {"hlsl.scalar-length.frag", "main"},
353 {"hlsl.scalarCast.vert", "main"},
354 {"hlsl.semicolons.frag", "main"},
355 {"hlsl.shapeConv.frag", "main"},
356 {"hlsl.shapeConvRet.frag", "main"},
357 {"hlsl.singleArgIntPromo.vert", "main"},
358 {"hlsl.self_cast.frag", "main"},
359 {"hlsl.snorm.uav.comp", "main"},
360 {"hlsl.specConstant.frag", "main"},
361 {"hlsl.staticMemberFunction.frag", "main"},
362 {"hlsl.staticFuncInit.frag", "main"},
363 {"hlsl.store.rwbyteaddressbuffer.type.comp", "main"},
364 {"hlsl.stringtoken.frag", "main"},
365 {"hlsl.string.frag", "main"},
366 {"hlsl.struct.split-1.vert", "main"},
367 {"hlsl.struct.split.array.geom", "main"},
368 {"hlsl.struct.split.assign.frag", "main"},
369 {"hlsl.struct.split.call.vert", "main"},
370 {"hlsl.struct.split.nested.geom", "main"},
371 {"hlsl.struct.split.trivial.geom", "main"},
372 {"hlsl.struct.split.trivial.vert", "main"},
373 {"hlsl.structarray.flatten.frag", "main"},
374 {"hlsl.structarray.flatten.geom", "main"},
375 {"hlsl.structbuffer.frag", "main"},
376 {"hlsl.structbuffer.append.frag", "main"},
377 {"hlsl.structbuffer.append.fn.frag", "main"},
378 {"hlsl.structbuffer.atomics.frag", "main"},
379 {"hlsl.structbuffer.byte.frag", "main"},
380 {"hlsl.structbuffer.coherent.frag", "main"},
381 {"hlsl.structbuffer.floatidx.comp", "main"},
382 {"hlsl.structbuffer.incdec.frag", "main"},
383 {"hlsl.structbuffer.fn.frag", "main"},
384 {"hlsl.structbuffer.fn2.comp", "main"},
385 {"hlsl.structbuffer.rw.frag", "main"},
386 {"hlsl.structbuffer.rwbyte.frag", "main"},
387 {"hlsl.structin.vert", "main"},
388 {"hlsl.structIoFourWay.frag", "main"},
389 {"hlsl.structStructName.frag", "main"},
390 {"hlsl.subpass.frag", "main"},
391 {"hlsl.synthesizeInput.frag", "main"},
392 {"hlsl.texturebuffer.frag", "main"},
393 {"hlsl.texture.struct.frag", "main"},
394 {"hlsl.texture.subvec4.frag", "main"},
395 {"hlsl.this.frag", "main"},
396 {"hlsl.intrinsics.vert", "VertexShaderFunction"},
397 {"hlsl.intrinsic.frexp.vert", "VertexShaderFunction"},
398 {"hlsl.matType.frag", "PixelShaderFunction"},
399 {"hlsl.matType.bool.frag", "main"},
400 {"hlsl.matType.int.frag", "main"},
401 {"hlsl.max.frag", "PixelShaderFunction"},
402 {"hlsl.preprocessor.frag", "main"},
403 {"hlsl.precedence.frag", "PixelShaderFunction"},
404 {"hlsl.precedence2.frag", "PixelShaderFunction"},
405 {"hlsl.scalar2matrix.frag", "main"},
406 {"hlsl.semantic.geom", "main"},
407 {"hlsl.semantic.vert", "main"},
408 {"hlsl.semantic-1.vert", "main"},
409 {"hlsl.scope.frag", "PixelShaderFunction"},
410 {"hlsl.sin.frag", "PixelShaderFunction"},
411 {"hlsl.struct.frag", "PixelShaderFunction"},
412 {"hlsl.switch.frag", "PixelShaderFunction"},
413 {"hlsl.swizzle.frag", "PixelShaderFunction"},
414 {"hlsl.target.frag", "main"},
415 {"hlsl.targetStruct1.frag", "main"},
416 {"hlsl.targetStruct2.frag", "main"},
417 {"hlsl.templatetypes.frag", "PixelShaderFunction"},
418 {"hlsl.tristream-append.geom", "main"},
419 {"hlsl.tx.bracket.frag", "main"},
420 {"hlsl.tx.overload.frag", "main"},
421 {"hlsl.type.half.frag", "main"},
422 {"hlsl.type.identifier.frag", "main"},
423 {"hlsl.typeGraphCopy.vert", "main"},
424 {"hlsl.typedef.frag", "PixelShaderFunction"},
425 {"hlsl.whileLoop.frag", "PixelShaderFunction"},
426 {"hlsl.void.frag", "PixelShaderFunction"},
427 {"hlsl.type.type.conversion.all.frag", "main"}
428 }),
429 FileNameAsCustomTestSuffix
430 );
431 // clang-format on
432
433 // clang-format off
434 INSTANTIATE_TEST_SUITE_P(
435 ToSpirv, HlslVulkan1_1CompileTest,
436 ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
437 {"hlsl.wavebroadcast.comp", "CSMain"},
438 {"hlsl.waveprefix.comp", "CSMain"},
439 {"hlsl.wavequad.comp", "CSMain"},
440 {"hlsl.wavequery.comp", "CSMain"},
441 {"hlsl.wavequery.frag", "PixelShaderFunction"},
442 {"hlsl.wavereduction.comp", "CSMain"},
443 {"hlsl.wavevote.comp", "CSMain"},
444 { "hlsl.type.type.conversion.valid.frag", "main" },
445 {"hlsl.int.dot.frag", "main"}
446 }),
447 FileNameAsCustomTestSuffix
448 );
449 // clang-format on
450
451 // clang-format off
452 INSTANTIATE_TEST_SUITE_P(
453 ToSpirv, HlslCompileAndFlattenTest,
454 ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
455 {"hlsl.array.flatten.frag", "main"},
456 {"hlsl.partialFlattenMixed.vert", "main"},
457 }),
458 FileNameAsCustomTestSuffix
459 );
460 // clang-format on
461
462 #if ENABLE_OPT
463 // clang-format off
464 INSTANTIATE_TEST_SUITE_P(
465 ToSpirv, HlslLegalizeTest,
466 ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
467 {"hlsl.aliasOpaque.frag", "main"},
468 {"hlsl.flattenOpaque.frag", "main"},
469 {"hlsl.flattenOpaqueInit.vert", "main"},
470 {"hlsl.flattenOpaqueInitMix.vert", "main"},
471 {"hlsl.flattenSubset.frag", "main"},
472 {"hlsl.flattenSubset2.frag", "main"},
473 {"hlsl.partialFlattenLocal.vert", "main"},
474 {"hlsl.partialFlattenMixed.vert", "main"}
475 }),
476 FileNameAsCustomTestSuffix
477 );
478 // clang-format on
479 #endif
480
481 // clang-format off
482 INSTANTIATE_TEST_SUITE_P(
483 ToSpirv, HlslDebugTest,
484 ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
485 {"hlsl.pp.line2.frag", "MainPs"}
486 }),
487 FileNameAsCustomTestSuffix
488 );
489
490 INSTANTIATE_TEST_SUITE_P(
491 ToSpirv, HlslDX9CompatibleTest,
492 ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
493 {"hlsl.sample.dx9.frag", "main"},
494 {"hlsl.sample.dx9.vert", "main"},
495 }),
496 FileNameAsCustomTestSuffix
497 );
498
499 // clang-format off
500 INSTANTIATE_TEST_SUITE_P(
501 ToSpirv, HlslLegalDebugTest,
502 ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
503 {"hlsl.pp.line4.frag", "MainPs"}
504 }),
505 FileNameAsCustomTestSuffix
506 );
507
508 // clang-format on
509
510 } // anonymous namespace
511 } // namespace glslangtest
512