1 //
2 // Copyright (C) 2016 Google, Inc.
3 //
4 // All rights reserved.
5 //
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions
8 // are met:
9 //
10 // Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer.
12 //
13 // Redistributions in binary form must reproduce the above
14 // copyright notice, this list of conditions and the following
15 // disclaimer in the documentation and/or other materials provided
16 // with the distribution.
17 //
18 // Neither the name of Google Inc. nor the names of its
19 // contributors may be used to endorse or promote products derived
20 // from this software without specific prior written permission.
21 //
22 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 // POSSIBILITY OF SUCH DAMAGE.
34
35 #include <algorithm>
36
37 #include <gtest/gtest.h>
38
39 #include "TestFixture.h"
40
41 namespace glslangtest {
42 namespace {
43
44 struct IoMapData {
45 const char* fileName;
46 const char* entryPoint;
47 int baseSamplerBinding;
48 int baseTextureBinding;
49 int baseImageBinding;
50 int baseUboBinding;
51 int baseSsboBinding;
52 bool autoMapBindings;
53 bool flattenUniforms;
54 };
55
FileNameAsCustomTestSuffixIoMap(const::testing::TestParamInfo<IoMapData> & info)56 std::string FileNameAsCustomTestSuffixIoMap(
57 const ::testing::TestParamInfo<IoMapData>& info) {
58 std::string name = info.param.fileName;
59 // A valid test case suffix cannot have '.' and '-' inside.
60 std::replace(name.begin(), name.end(), '.', '_');
61 std::replace(name.begin(), name.end(), '-', '_');
62 return name;
63 }
64
65 using CompileVulkanToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
66 using CompileVulkanToSpirvDeadCodeElimTest = GlslangTest<::testing::TestWithParam<std::string>>;
67 using CompileVulkanToDebugSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
68 using CompileVulkan1_1ToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
69 using CompileToSpirv14Test = GlslangTest<::testing::TestWithParam<std::string>>;
70 using CompileOpenGLToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
71 using VulkanSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
72 using OpenGLSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
73 using VulkanAstSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
74 using HlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
75 using GlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
76 using CompileVulkanToSpirvTestAMD = GlslangTest<::testing::TestWithParam<std::string>>;
77 using CompileVulkanToSpirvTestNV = GlslangTest<::testing::TestWithParam<std::string>>;
78 using CompileUpgradeTextureToSampledTextureAndDropSamplersTest = GlslangTest<::testing::TestWithParam<std::string>>;
79
80 // Compiling GLSL to SPIR-V under Vulkan semantics. Expected to successfully
81 // generate SPIR-V.
TEST_P(CompileVulkanToSpirvTest,FromFile)82 TEST_P(CompileVulkanToSpirvTest, FromFile)
83 {
84 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
85 Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
86 Target::Spv);
87 }
88
TEST_P(CompileVulkanToSpirvDeadCodeElimTest,FromFile)89 TEST_P(CompileVulkanToSpirvDeadCodeElimTest, FromFile)
90 {
91 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
92 Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
93 Target::Spv);
94 }
95
96 // Compiling GLSL to SPIR-V with debug info under Vulkan semantics. Expected
97 // to successfully generate SPIR-V.
TEST_P(CompileVulkanToDebugSpirvTest,FromFile)98 TEST_P(CompileVulkanToDebugSpirvTest, FromFile)
99 {
100 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
101 Source::GLSL, Semantics::Vulkan,
102 glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
103 Target::Spv, true, "",
104 "/baseResults/", false, true);
105 }
106
TEST_P(CompileVulkan1_1ToSpirvTest,FromFile)107 TEST_P(CompileVulkan1_1ToSpirvTest, FromFile)
108 {
109 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
110 Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1, glslang::EShTargetSpv_1_3,
111 Target::Spv);
112 }
113
TEST_P(CompileToSpirv14Test,FromFile)114 TEST_P(CompileToSpirv14Test, FromFile)
115 {
116 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
117 Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1, glslang::EShTargetSpv_1_4,
118 Target::Spv);
119 }
120
121 // Compiling GLSL to SPIR-V under OpenGL semantics. Expected to successfully
122 // generate SPIR-V.
TEST_P(CompileOpenGLToSpirvTest,FromFile)123 TEST_P(CompileOpenGLToSpirvTest, FromFile)
124 {
125 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
126 Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
127 Target::Spv);
128 }
129
130 // GLSL-level Vulkan semantics test. Expected to error out before generating
131 // SPIR-V.
TEST_P(VulkanSemantics,FromFile)132 TEST_P(VulkanSemantics, FromFile)
133 {
134 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
135 Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
136 Target::Spv, false);
137 }
138
139 // GLSL-level Vulkan semantics test. Expected to error out before generating
140 // SPIR-V.
TEST_P(OpenGLSemantics,FromFile)141 TEST_P(OpenGLSemantics, FromFile)
142 {
143 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
144 Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
145 Target::Spv, false);
146 }
147
148 // GLSL-level Vulkan semantics test that need to see the AST for validation.
TEST_P(VulkanAstSemantics,FromFile)149 TEST_P(VulkanAstSemantics, FromFile)
150 {
151 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
152 Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
153 Target::AST);
154 }
155
156 // HLSL-level Vulkan semantics tests.
TEST_P(HlslIoMap,FromFile)157 TEST_P(HlslIoMap, FromFile)
158 {
159 loadFileCompileIoMapAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
160 Source::HLSL, Semantics::Vulkan,
161 Target::Spv, GetParam().entryPoint,
162 GetParam().baseSamplerBinding,
163 GetParam().baseTextureBinding,
164 GetParam().baseImageBinding,
165 GetParam().baseUboBinding,
166 GetParam().baseSsboBinding,
167 GetParam().autoMapBindings,
168 GetParam().flattenUniforms);
169 }
170
171 // GLSL-level Vulkan semantics tests.
TEST_P(GlslIoMap,FromFile)172 TEST_P(GlslIoMap, FromFile)
173 {
174 loadFileCompileIoMapAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
175 Source::GLSL, Semantics::Vulkan,
176 Target::Spv, GetParam().entryPoint,
177 GetParam().baseSamplerBinding,
178 GetParam().baseTextureBinding,
179 GetParam().baseImageBinding,
180 GetParam().baseUboBinding,
181 GetParam().baseSsboBinding,
182 GetParam().autoMapBindings,
183 GetParam().flattenUniforms);
184 }
185
186 // Compiling GLSL to SPIR-V under Vulkan semantics (AMD extensions enabled).
187 // Expected to successfully generate SPIR-V.
TEST_P(CompileVulkanToSpirvTestAMD,FromFile)188 TEST_P(CompileVulkanToSpirvTestAMD, FromFile)
189 {
190 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
191 Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
192 Target::Spv);
193 }
194
195 // Compiling GLSL to SPIR-V under Vulkan semantics (NV extensions enabled).
196 // Expected to successfully generate SPIR-V.
TEST_P(CompileVulkanToSpirvTestNV,FromFile)197 TEST_P(CompileVulkanToSpirvTestNV, FromFile)
198 {
199 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
200 Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
201 Target::Spv);
202 }
203
TEST_P(CompileUpgradeTextureToSampledTextureAndDropSamplersTest,FromFile)204 TEST_P(CompileUpgradeTextureToSampledTextureAndDropSamplersTest, FromFile)
205 {
206 loadCompileUpgradeTextureToSampledTextureAndDropSamplersAndCheck(GlobalTestSettings.testRoot,
207 GetParam(),
208 Source::GLSL,
209 Semantics::Vulkan,
210 Target::Spv);
211 }
212
213 // clang-format off
214 INSTANTIATE_TEST_CASE_P(
215 Glsl, CompileVulkanToSpirvTest,
216 ::testing::ValuesIn(std::vector<std::string>({
217 // Test looping constructs.
218 // No tests yet for making sure break and continue from a nested loop
219 // goes to the innermost target.
220 "spv.barrier.vert",
221 "spv.do-simple.vert",
222 "spv.do-while-continue-break.vert",
223 "spv.for-complex-condition.vert",
224 "spv.for-continue-break.vert",
225 "spv.for-simple.vert",
226 "spv.for-notest.vert",
227 "spv.for-nobody.vert",
228 "spv.while-continue-break.vert",
229 "spv.while-simple.vert",
230 // vulkan-specific tests
231 "spv.set.vert",
232 "spv.double.comp",
233 "spv.100ops.frag",
234 "spv.130.frag",
235 "spv.140.frag",
236 "spv.150.geom",
237 "spv.150.vert",
238 "spv.16bitstorage.frag",
239 "spv.16bitstorage_Error.frag",
240 "spv.16bitstorage-int.frag",
241 "spv.16bitstorage_Error-int.frag",
242 "spv.16bitstorage-uint.frag",
243 "spv.16bitstorage_Error-uint.frag",
244 "spv.300BuiltIns.vert",
245 "spv.300layout.frag",
246 "spv.300layout.vert",
247 "spv.300layoutp.vert",
248 "spv.310.comp",
249 "spv.310.bitcast.frag",
250 "spv.330.geom",
251 "spv.400.frag",
252 "spv.400.tesc",
253 "spv.400.tese",
254 "spv.420.geom",
255 "spv.430.frag",
256 "spv.430.vert",
257 "spv.450.tesc",
258 "spv.450.geom",
259 "spv.450.noRedecl.tesc",
260 "spv.8bitstorage-int.frag",
261 "spv.8bitstorage_Error-int.frag",
262 "spv.8bitstorage-uint.frag",
263 "spv.8bitstorage_Error-uint.frag",
264 "spv.8bitstorage-ubo.vert",
265 "spv.8bitstorage-ssbo.vert",
266 "spv.accessChain.frag",
267 "spv.aggOps.frag",
268 "spv.always-discard.frag",
269 "spv.always-discard2.frag",
270 "spv.arbPostDepthCoverage.frag",
271 "spv.arbPostDepthCoverage_Error.frag",
272 "spv.bitCast.frag",
273 "spv.bool.vert",
274 "spv.boolInBlock.frag",
275 "spv.branch-return.vert",
276 "spv.bufferhandle1.frag",
277 "spv.bufferhandle10.frag",
278 "spv.bufferhandle11.frag",
279 "spv.bufferhandle12.frag",
280 "spv.bufferhandle13.frag",
281 "spv.bufferhandle14.frag",
282 "spv.bufferhandle15.frag",
283 "spv.bufferhandle16.frag",
284 "spv.bufferhandle17_Errors.frag",
285 "spv.bufferhandle18.frag",
286 "spv.bufferhandle19_Errors.frag",
287 "spv.bufferhandle2.frag",
288 "spv.bufferhandle3.frag",
289 "spv.bufferhandle4.frag",
290 "spv.bufferhandle5.frag",
291 "spv.bufferhandle6.frag",
292 "spv.bufferhandle7.frag",
293 "spv.bufferhandle8.frag",
294 "spv.bufferhandle9.frag",
295 "spv.bufferhandleUvec2.frag",
296 "spv.bufferhandle_Error.frag",
297 "spv.builtInXFB.vert",
298 "spv.conditionalDemote.frag",
299 "spv.conditionalDiscard.frag",
300 "spv.constructComposite.comp",
301 "spv.constStruct.vert",
302 "spv.constConstruct.vert",
303 "spv.controlFlowAttributes.frag",
304 "spv.conversion.frag",
305 "spv.coopmat.comp",
306 "spv.coopmat_Error.comp",
307 "spv.dataOut.frag",
308 "spv.dataOutIndirect.frag",
309 "spv.dataOutIndirect.vert",
310 "spv.demoteDisabled.frag",
311 "spv.deepRvalue.frag",
312 "spv.depthOut.frag",
313 "spv.discard-dce.frag",
314 "spv.doWhileLoop.frag",
315 "spv.earlyReturnDiscard.frag",
316 "spv.extPostDepthCoverage.frag",
317 "spv.extPostDepthCoverage_Error.frag",
318 "spv.float16convertonlyarith.comp",
319 "spv.float16convertonlystorage.comp",
320 "spv.flowControl.frag",
321 "spv.forLoop.frag",
322 "spv.forwardFun.frag",
323 "spv.fragmentDensity.frag",
324 "spv.fragmentDensity.vert",
325 "spv.fragmentDensity-es.frag",
326 "spv.fragmentDensity-neg.frag",
327 "spv.fsi.frag",
328 "spv.fsi_Error.frag",
329 "spv.fullyCovered.frag",
330 "spv.functionCall.frag",
331 "spv.functionNestedOpaque.vert",
332 "spv.functionSemantics.frag",
333 "spv.functionParameterTypes.frag",
334 "spv.GeometryShaderPassthrough.geom",
335 "spv.interpOps.frag",
336 "spv.int64.frag",
337 "spv.intcoopmat.comp",
338 "spv.intOps.vert",
339 "spv.layoutNested.vert",
340 "spv.length.frag",
341 "spv.localAggregates.frag",
342 "spv.loops.frag",
343 "spv.loopsArtificial.frag",
344 "spv.matFun.vert",
345 "spv.matrix.frag",
346 "spv.matrix2.frag",
347 "spv.memoryQualifier.frag",
348 "spv.merge-unreachable.frag",
349 "spv.multiStruct.comp",
350 "spv.multiStructFuncall.frag",
351 "spv.newTexture.frag",
352 "spv.noDeadDecorations.vert",
353 "spv.nonSquare.vert",
354 "spv.nonuniform.frag",
355 "spv.nonuniform2.frag",
356 "spv.noWorkgroup.comp",
357 "spv.offsets.frag",
358 "spv.Operations.frag",
359 "spv.paramMemory.frag",
360 "spv.precision.frag",
361 "spv.precisionNonESSamp.frag",
362 "spv.prepost.frag",
363 "spv.privateVariableTypes.frag",
364 "spv.qualifiers.vert",
365 "spv.sample.frag",
366 "spv.sampleId.frag",
367 "spv.samplePosition.frag",
368 "spv.sampleMaskOverrideCoverage.frag",
369 "spv.scalarlayout.frag",
370 "spv.scalarlayoutfloat16.frag",
371 "spv.shaderBallot.comp",
372 "spv.shaderDrawParams.vert",
373 "spv.shaderGroupVote.comp",
374 "spv.shaderStencilExport.frag",
375 "spv.shiftOps.frag",
376 "spv.simpleFunctionCall.frag",
377 "spv.simpleMat.vert",
378 "spv.sparseTexture.frag",
379 "spv.sparseTextureClamp.frag",
380 "spv.structAssignment.frag",
381 "spv.structDeref.frag",
382 "spv.structure.frag",
383 "spv.switch.frag",
384 "spv.swizzle.frag",
385 "spv.swizzleInversion.frag",
386 "spv.test.frag",
387 "spv.test.vert",
388 "spv.texture.frag",
389 "spv.texture.vert",
390 "spv.textureBuffer.vert",
391 "spv.image.frag",
392 "spv.types.frag",
393 "spv.uint.frag",
394 "spv.uniformArray.frag",
395 "spv.variableArrayIndex.frag",
396 "spv.varyingArray.frag",
397 "spv.varyingArrayIndirect.frag",
398 "spv.vecMatConstruct.frag",
399 "spv.voidFunction.frag",
400 "spv.whileLoop.frag",
401 "spv.AofA.frag",
402 "spv.queryL.frag",
403 "spv.separate.frag",
404 "spv.shortCircuit.frag",
405 "spv.pushConstant.vert",
406 "spv.pushConstantAnon.vert",
407 "spv.subpass.frag",
408 "spv.specConstant.vert",
409 "spv.specConstant.comp",
410 "spv.specConstantComposite.vert",
411 "spv.specConstantOperations.vert",
412 "spv.storageBuffer.vert",
413 "spv.precise.tese",
414 "spv.precise.tesc",
415 "spv.volatileAtomic.comp",
416 "spv.vulkan100.subgroupArithmetic.comp",
417 "spv.vulkan100.subgroupPartitioned.comp",
418 "spv.xfb.vert",
419 "spv.xfb2.vert",
420 "spv.xfb3.vert",
421 "spv.samplerlessTextureFunctions.frag",
422 "spv.smBuiltins.vert",
423 "spv.smBuiltins.frag",
424 })),
425 FileNameAsCustomTestSuffix
426 );
427
428 // Cases with deliberately unreachable code.
429 // By default the compiler will aggressively eliminate
430 // unreachable merges and continues.
431 INSTANTIATE_TEST_CASE_P(
432 GlslWithDeadCode, CompileVulkanToSpirvDeadCodeElimTest,
433 ::testing::ValuesIn(std::vector<std::string>({
434 "spv.dead-after-continue.vert",
435 "spv.dead-after-discard.frag",
436 "spv.dead-after-return.vert",
437 "spv.dead-after-loop-break.vert",
438 "spv.dead-after-switch-break.vert",
439 "spv.dead-complex-continue-after-return.vert",
440 "spv.dead-complex-merge-after-return.vert",
441 })),
442 FileNameAsCustomTestSuffix
443 );
444
445 // clang-format off
446 INSTANTIATE_TEST_CASE_P(
447 Glsl, CompileVulkanToDebugSpirvTest,
448 ::testing::ValuesIn(std::vector<std::string>({
449 "spv.pp.line.frag",
450 })),
451 FileNameAsCustomTestSuffix
452 );
453
454 // clang-format off
455 INSTANTIATE_TEST_CASE_P(
456 Glsl, CompileVulkan1_1ToSpirvTest,
457 ::testing::ValuesIn(std::vector<std::string>({
458 "spv.1.3.8bitstorage-ubo.vert",
459 "spv.1.3.8bitstorage-ssbo.vert",
460 "spv.1.3.coopmat.comp",
461 "spv.deviceGroup.frag",
462 "spv.drawParams.vert",
463 "spv.int8.frag",
464 "spv.vulkan110.int16.frag",
465 "spv.int32.frag",
466 "spv.explicittypes.frag",
467 "spv.float32.frag",
468 "spv.float64.frag",
469 "spv.memoryScopeSemantics.comp",
470 "spv.memoryScopeSemantics_Error.comp",
471 "spv.multiView.frag",
472 "spv.RayGenShader11.rgen",
473 "spv.subgroup.frag",
474 "spv.subgroup.geom",
475 "spv.subgroup.tesc",
476 "spv.subgroup.tese",
477 "spv.subgroup.vert",
478 "spv.subgroupArithmetic.comp",
479 "spv.subgroupBasic.comp",
480 "spv.subgroupBallot.comp",
481 "spv.subgroupBallotNeg.comp",
482 "spv.subgroupClustered.comp",
483 "spv.subgroupClusteredNeg.comp",
484 "spv.subgroupPartitioned.comp",
485 "spv.subgroupShuffle.comp",
486 "spv.subgroupShuffleRelative.comp",
487 "spv.subgroupQuad.comp",
488 "spv.subgroupVote.comp",
489 "spv.subgroupExtendedTypesArithmetic.comp",
490 "spv.subgroupExtendedTypesArithmeticNeg.comp",
491 "spv.subgroupExtendedTypesBallot.comp",
492 "spv.subgroupExtendedTypesBallotNeg.comp",
493 "spv.subgroupExtendedTypesClustered.comp",
494 "spv.subgroupExtendedTypesClusteredNeg.comp",
495 "spv.subgroupExtendedTypesPartitioned.comp",
496 "spv.subgroupExtendedTypesPartitionedNeg.comp",
497 "spv.subgroupExtendedTypesShuffle.comp",
498 "spv.subgroupExtendedTypesShuffleNeg.comp",
499 "spv.subgroupExtendedTypesShuffleRelative.comp",
500 "spv.subgroupExtendedTypesShuffleRelativeNeg.comp",
501 "spv.subgroupExtendedTypesQuad.comp",
502 "spv.subgroupExtendedTypesQuadNeg.comp",
503 "spv.subgroupExtendedTypesVote.comp",
504 "spv.subgroupExtendedTypesVoteNeg.comp",
505 "spv.vulkan110.storageBuffer.vert",
506 })),
507 FileNameAsCustomTestSuffix
508 );
509
510 // clang-format off
511 INSTANTIATE_TEST_CASE_P(
512 Glsl, CompileToSpirv14Test,
513 ::testing::ValuesIn(std::vector<std::string>({
514 "spv.1.4.LoopControl.frag",
515 "spv.1.4.NonWritable.frag",
516 "spv.1.4.OpEntryPoint.frag",
517 "spv.1.4.OpSelect.frag",
518 "spv.1.4.OpCopyLogical.comp",
519 "spv.1.4.OpCopyLogicalBool.comp",
520 "spv.1.4.OpCopyLogical.funcall.frag",
521 "spv.1.4.image.frag",
522 "spv.1.4.sparseTexture.frag",
523 "spv.1.4.texture.frag",
524 "spv.1.4.constructComposite.comp",
525 })),
526 FileNameAsCustomTestSuffix
527 );
528
529 // clang-format off
530 INSTANTIATE_TEST_CASE_P(
531 Hlsl, HlslIoMap,
532 ::testing::ValuesIn(std::vector<IoMapData>{
533 { "spv.register.autoassign.frag", "main_ep", 5, 10, 0, 20, 30, true, false },
534 { "spv.register.noautoassign.frag", "main_ep", 5, 10, 0, 15, 30, false, false },
535 { "spv.register.autoassign-2.frag", "main", 5, 10, 0, 15, 30, true, true },
536 { "spv.register.subpass.frag", "main", 0, 20, 0, 0, 0, true, true },
537 { "spv.buffer.autoassign.frag", "main", 5, 10, 0, 15, 30, true, true },
538 { "spv.ssbo.autoassign.frag", "main", 5, 10, 0, 15, 30, true, true },
539 { "spv.ssboAlias.frag", "main", 0, 0, 0, 0, 83, true, false },
540 { "spv.rw.autoassign.frag", "main", 5, 10, 20, 15, 30, true, true },
541 { "spv.register.autoassign.rangetest.frag", "main",
542 glslang::TQualifier::layoutBindingEnd-2,
543 glslang::TQualifier::layoutBindingEnd+5,
544 20, 30, true, false },
545 }),
546 FileNameAsCustomTestSuffixIoMap
547 );
548
549 // clang-format off
550 INSTANTIATE_TEST_CASE_P(
551 Hlsl, GlslIoMap,
552 ::testing::ValuesIn(std::vector<IoMapData>{
553 { "spv.glsl.register.autoassign.frag", "main", 5, 10, 0, 20, 30, true, false },
554 { "spv.glsl.register.noautoassign.frag", "main", 5, 10, 0, 15, 30, false, false },
555 }),
556 FileNameAsCustomTestSuffixIoMap
557 );
558
559 // clang-format off
560 INSTANTIATE_TEST_CASE_P(
561 Glsl, CompileOpenGLToSpirvTest,
562 ::testing::ValuesIn(std::vector<std::string>({
563 "spv.460.frag",
564 "spv.460.vert",
565 "spv.460.comp",
566 "spv.atomic.comp",
567 "spv.glFragColor.frag",
568 "spv.rankShift.comp",
569 "spv.specConst.vert",
570 "spv.OVR_multiview.vert",
571 "spv.xfbOffsetOnBlockMembersAssignment.vert",
572 "spv.xfbOffsetOnStructMembersAssignment.vert",
573 "spv.xfbOverlapOffsetCheckWithBlockAndMember.vert",
574 "spv.xfbStrideJustOnce.vert",
575 })),
576 FileNameAsCustomTestSuffix
577 );
578
579 INSTANTIATE_TEST_CASE_P(
580 Glsl, VulkanSemantics,
581 ::testing::ValuesIn(std::vector<std::string>({
582 "vulkan.frag",
583 "vulkan.vert",
584 "vulkan.comp",
585 "samplerlessTextureFunctions.frag",
586 "spv.specConstArrayCheck.vert",
587 })),
588 FileNameAsCustomTestSuffix
589 );
590
591 INSTANTIATE_TEST_CASE_P(
592 Glsl, OpenGLSemantics,
593 ::testing::ValuesIn(std::vector<std::string>({
594 "glspv.esversion.vert",
595 "glspv.version.frag",
596 "glspv.version.vert",
597 "glspv.frag",
598 "glspv.vert",
599 })),
600 FileNameAsCustomTestSuffix
601 );
602
603 INSTANTIATE_TEST_CASE_P(
604 Glsl, VulkanAstSemantics,
605 ::testing::ValuesIn(std::vector<std::string>({
606 "vulkan.ast.vert",
607 })),
608 FileNameAsCustomTestSuffix
609 );
610
611 INSTANTIATE_TEST_CASE_P(
612 Glsl, CompileVulkanToSpirvTestAMD,
613 ::testing::ValuesIn(std::vector<std::string>({
614 "spv.16bitxfb.vert",
615 "spv.float16.frag",
616 "spv.float16Fetch.frag",
617 "spv.imageLoadStoreLod.frag",
618 "spv.int16.frag",
619 "spv.int16.amd.frag",
620 "spv.shaderBallotAMD.comp",
621 "spv.shaderFragMaskAMD.frag",
622 "spv.textureGatherBiasLod.frag",
623 })),
624 FileNameAsCustomTestSuffix
625 );
626
627 INSTANTIATE_TEST_CASE_P(
628 Glsl, CompileVulkanToSpirvTestNV,
629 ::testing::ValuesIn(std::vector<std::string>({
630 "spv.sampleMaskOverrideCoverage.frag",
631 "spv.GeometryShaderPassthrough.geom",
632 "spv.viewportArray2.vert",
633 "spv.viewportArray2.tesc",
634 "spv.stereoViewRendering.vert",
635 "spv.stereoViewRendering.tesc",
636 "spv.multiviewPerViewAttributes.vert",
637 "spv.multiviewPerViewAttributes.tesc",
638 "spv.atomicInt64.comp",
639 "spv.shadingRate.frag",
640 "spv.RayGenShader.rgen",
641 "spv.RayGenShaderArray.rgen",
642 "spv.RayGenShader_Errors.rgen",
643 "spv.RayConstants.rgen",
644 "spv.IntersectShader.rint",
645 "spv.IntersectShader_Errors.rint",
646 "spv.AnyHitShader.rahit",
647 "spv.AnyHitShader_Errors.rahit",
648 "spv.ClosestHitShader.rchit",
649 "spv.ClosestHitShader_Errors.rchit",
650 "spv.MissShader.rmiss",
651 "spv.MissShader_Errors.rmiss",
652 "spv.RayCallable.rcall",
653 "spv.RayCallable_Errors.rcall",
654 "spv.fragmentShaderBarycentric.frag",
655 "spv.fragmentShaderBarycentric2.frag",
656 "spv.computeShaderDerivatives.comp",
657 "spv.computeShaderDerivatives2.comp",
658 "spv.shaderImageFootprint.frag",
659 "spv.meshShaderBuiltins.mesh",
660 "spv.meshShaderUserDefined.mesh",
661 "spv.meshShaderPerViewBuiltins.mesh",
662 "spv.meshShaderPerViewUserDefined.mesh",
663 "spv.meshShaderPerView_Errors.mesh",
664 "spv.meshShaderSharedMem.mesh",
665 "spv.meshShaderTaskMem.mesh",
666 "spv.320.meshShaderUserDefined.mesh",
667 "spv.meshShaderRedeclBuiltins.mesh",
668 "spv.meshShaderRedeclPerViewBuiltins.mesh",
669 "spv.meshTaskShader.task",
670 "spv.perprimitiveNV.frag",
671 })),
672 FileNameAsCustomTestSuffix
673 );
674
675 INSTANTIATE_TEST_CASE_P(
676 Glsl, CompileUpgradeTextureToSampledTextureAndDropSamplersTest,
677 ::testing::ValuesIn(std::vector<std::string>({
678 "spv.texture.sampler.transform.frag",
679 })),
680 FileNameAsCustomTestSuffix
681 );
682 // clang-format on
683
684 } // anonymous namespace
685 } // namespace glslangtest
686