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