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