Merge pull request #2513 from jeffbolznv/missingcap
[platform/upstream/glslang.git] / gtests / Spv.FromFile.cpp
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
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.
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
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.
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
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
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.
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.
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.
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.
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.
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.
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.
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.
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
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         "rayQuery-global.rgen",
244         "rayQuery-types.comp",
245         "spv.set.vert",
246         "spv.double.comp",
247         "spv.100ops.frag",
248         "spv.130.frag",
249         "spv.140.frag",
250         "spv.150.geom",
251         "spv.150.vert",
252         "spv.16bitstorage.frag",
253         "spv.16bitstorage_Error.frag",
254         "spv.16bitstorage-int.frag",
255         "spv.16bitstorage_Error-int.frag",
256         "spv.16bitstorage-uint.frag",
257         "spv.16bitstorage_Error-uint.frag",
258         "spv.300BuiltIns.vert",
259         "spv.300layout.frag",
260         "spv.300layout.vert",
261         "spv.300layoutp.vert",
262         "spv.310.comp",
263         "spv.310.bitcast.frag",
264         "spv.330.geom",
265         "spv.400.frag",
266         "spv.400.tesc",
267         "spv.400.tese",
268         "spv.420.geom",
269         "spv.430.frag",
270         "spv.430.vert",
271         "spv.450.tesc",
272         "spv.450.geom",
273         "spv.450.noRedecl.tesc",
274         "spv.8bitstorage-int.frag",
275         "spv.8bitstorage_Error-int.frag",
276         "spv.8bitstorage-uint.frag",
277         "spv.8bitstorage_Error-uint.frag",
278         "spv.8bitstorage-ubo.vert",
279         "spv.8bitstorage-ssbo.vert",
280         "spv.8bit-16bit-construction.frag",
281         "spv.accessChain.frag",
282         "spv.aggOps.frag",
283         "spv.always-discard.frag",
284         "spv.always-discard2.frag",
285         "spv.arbPostDepthCoverage.frag",
286         "spv.arbPostDepthCoverage_Error.frag",
287         "spv.atomicCounter.comp",
288         "spv.bitCast.frag",
289         "spv.bool.vert",
290         "spv.boolInBlock.frag",
291         "spv.branch-return.vert",
292         "spv.bufferhandle1.frag",
293         "spv.bufferhandle10.frag",
294         "spv.bufferhandle11.frag",
295         "spv.bufferhandle12.frag",
296         "spv.bufferhandle13.frag",
297         "spv.bufferhandle14.frag",
298         "spv.bufferhandle15.frag",
299         "spv.bufferhandle16.frag",
300         "spv.bufferhandle17_Errors.frag",
301         "spv.bufferhandle18.frag",
302         "spv.bufferhandle19_Errors.frag",
303         "spv.bufferhandle2.frag",
304         "spv.bufferhandle3.frag",
305         "spv.bufferhandle4.frag",
306         "spv.bufferhandle5.frag",
307         "spv.bufferhandle6.frag",
308         "spv.bufferhandle7.frag",
309         "spv.bufferhandle8.frag",
310         "spv.bufferhandle9.frag",
311         "spv.bufferhandleUvec2.frag",
312         "spv.bufferhandle_Error.frag",
313         "spv.builtInXFB.vert",
314         "spv.conditionalDemote.frag",
315         "spv.conditionalDiscard.frag",
316         "spv.constructComposite.comp",
317         "spv.constStruct.vert",
318         "spv.constConstruct.vert",
319         "spv.controlFlowAttributes.frag",
320         "spv.conversion.frag",
321         "spv.coopmat.comp",
322         "spv.coopmat_Error.comp",
323         "spv.dataOut.frag",
324         "spv.dataOutIndirect.frag",
325         "spv.dataOutIndirect.vert",
326         "spv.debugPrintf.frag",
327         "spv.debugPrintf_Error.frag",
328         "spv.demoteDisabled.frag",
329         "spv.deepRvalue.frag",
330         "spv.depthOut.frag",
331         "spv.discard-dce.frag",
332         "spv.doWhileLoop.frag",
333         "spv.earlyReturnDiscard.frag",
334         "spv.extPostDepthCoverage.frag",
335         "spv.extPostDepthCoverage_Error.frag",
336         "spv.float16convertonlyarith.comp",
337         "spv.float16convertonlystorage.comp",
338         "spv.flowControl.frag",
339         "spv.forLoop.frag",
340         "spv.forwardFun.frag",
341         "spv.fragmentDensity.frag",
342         "spv.fragmentDensity.vert",
343         "spv.fragmentDensity-es.frag",
344         "spv.fragmentDensity-neg.frag",
345         "spv.fsi.frag",
346         "spv.fsi_Error.frag",
347         "spv.fullyCovered.frag",
348         "spv.functionCall.frag",
349         "spv.functionNestedOpaque.vert",
350         "spv.functionSemantics.frag",
351         "spv.functionParameterTypes.frag",
352         "spv.GeometryShaderPassthrough.geom",
353         "spv.interpOps.frag",
354         "spv.int64.frag",
355         "spv.intcoopmat.comp",
356         "spv.intOps.vert",
357         "spv.layer.tese",
358         "spv.layoutNested.vert",
359         "spv.length.frag",
360         "spv.localAggregates.frag",
361         "spv.loops.frag",
362         "spv.loopsArtificial.frag",
363         "spv.matFun.vert",
364         "spv.matrix.frag",
365         "spv.matrix2.frag",
366         "spv.memoryQualifier.frag",
367         "spv.merge-unreachable.frag",
368         "spv.multiStruct.comp",
369         "spv.multiStructFuncall.frag",
370         "spv.newTexture.frag",
371         "spv.noDeadDecorations.vert",
372         "spv.nonSquare.vert",
373         "spv.nonuniform.frag",
374         "spv.nonuniform2.frag",
375         "spv.nonuniform3.frag",
376         "spv.nonuniform4.frag",
377         "spv.nonuniform5.frag",
378         "spv.noWorkgroup.comp",
379         "spv.nullInit.comp",
380         "spv.offsets.frag",
381         "spv.Operations.frag",
382         "spv.paramMemory.frag",
383         "spv.paramMemory.420.frag",
384         "spv.precision.frag",
385         "spv.precisionArgs.frag",
386         "spv.precisionNonESSamp.frag",
387         "spv.precisionTexture.frag",
388         "spv.prepost.frag",
389         "spv.privateVariableTypes.frag",
390         "spv.qualifiers.vert",
391         "spv.sample.frag",
392         "spv.sampleId.frag",
393         "spv.samplePosition.frag",
394         "spv.sampleMaskOverrideCoverage.frag",
395         "spv.scalarlayout.frag",
396         "spv.scalarlayoutfloat16.frag",
397         "spv.shaderBallot.comp",
398         "spv.shaderDrawParams.vert",
399         "spv.shaderGroupVote.comp",
400         "spv.shaderStencilExport.frag",
401         "spv.shiftOps.frag",
402         "spv.simpleFunctionCall.frag",
403         "spv.simpleMat.vert",
404         "spv.sparseTexture.frag",
405         "spv.sparseTextureClamp.frag",
406         "spv.structAssignment.frag",
407         "spv.structDeref.frag",
408         "spv.structure.frag",
409         "spv.switch.frag",
410         "spv.swizzle.frag",
411         "spv.swizzleInversion.frag",
412         "spv.test.frag",
413         "spv.test.vert",
414         "spv.texture.frag",
415         "spv.texture.vert",
416         "spv.textureBuffer.vert",
417         "spv.image.frag",
418         "spv.imageAtomic64.frag",
419         "spv.types.frag",
420         "spv.uint.frag",
421         "spv.uniformArray.frag",
422         "spv.variableArrayIndex.frag",
423         "spv.varyingArray.frag",
424         "spv.varyingArrayIndirect.frag",
425         "spv.vecMatConstruct.frag",
426         "spv.voidFunction.frag",
427         "spv.whileLoop.frag",
428         "spv.AofA.frag",
429         "spv.queryL.frag",
430         "spv.separate.frag",
431         "spv.shortCircuit.frag",
432         "spv.pushConstant.vert",
433         "spv.pushConstantAnon.vert",
434         "spv.subpass.frag",
435         "spv.specConstant.vert",
436         "spv.specConstant.comp",
437         "spv.specConstantComposite.vert",
438         "spv.specConstantOperations.vert",
439         "spv.specConstant.float16.comp",
440         "spv.specConstant.int16.comp",
441         "spv.specConstant.int8.comp",
442         "spv.storageBuffer.vert",
443         "spv.terminate.frag",
444         "spv.precise.tese",
445         "spv.precise.tesc",
446         "spv.viewportindex.tese",
447         "spv.volatileAtomic.comp",
448         "spv.vulkan100.subgroupArithmetic.comp",
449         "spv.vulkan100.subgroupPartitioned.comp",
450         "spv.xfb.vert",
451         "spv.xfb2.vert",
452         "spv.xfb3.vert",
453         "spv.samplerlessTextureFunctions.frag",
454         "spv.smBuiltins.vert",
455         "spv.smBuiltins.frag",
456         "spv.builtin.PrimitiveShadingRateEXT.vert",
457         "spv.builtin.ShadingRateEXT.frag",
458     })),
459     FileNameAsCustomTestSuffix
460 );
461
462 // Cases with deliberately unreachable code.
463 // By default the compiler will aggressively eliminate
464 // unreachable merges and continues.
465 INSTANTIATE_TEST_SUITE_P(
466     GlslWithDeadCode, CompileVulkanToSpirvDeadCodeElimTest,
467     ::testing::ValuesIn(std::vector<std::string>({
468         "spv.dead-after-continue.vert",
469         "spv.dead-after-discard.frag",
470         "spv.dead-after-return.vert",
471         "spv.dead-after-loop-break.vert",
472         "spv.dead-after-switch-break.vert",
473         "spv.dead-complex-continue-after-return.vert",
474         "spv.dead-complex-merge-after-return.vert",
475     })),
476     FileNameAsCustomTestSuffix
477 );
478
479 // clang-format off
480 INSTANTIATE_TEST_SUITE_P(
481     Glsl, CompileVulkanToDebugSpirvTest,
482     ::testing::ValuesIn(std::vector<std::string>({
483         "spv.pp.line.frag",
484     })),
485     FileNameAsCustomTestSuffix
486 );
487
488 // clang-format off
489 INSTANTIATE_TEST_SUITE_P(
490     Glsl, CompileVulkan1_1ToSpirvTest,
491     ::testing::ValuesIn(std::vector<std::string>({
492         "spv.1.3.8bitstorage-ubo.vert",
493         "spv.1.3.8bitstorage-ssbo.vert",
494         "spv.1.3.coopmat.comp",
495         "spv.deviceGroup.frag",
496         "spv.drawParams.vert",
497         "spv.int8.frag",
498         "spv.vulkan110.int16.frag",
499         "spv.int32.frag",
500         "spv.explicittypes.frag",
501         "spv.float32.frag",
502         "spv.float64.frag",
503         "spv.memoryScopeSemantics.comp",
504         "spv.memoryScopeSemantics_Error.comp",
505         "spv.multiView.frag",
506         "spv.queueFamilyScope.comp",
507         "spv.RayGenShader11.rgen",
508         "spv.subgroup.frag",
509         "spv.subgroup.geom",
510         "spv.subgroup.tesc",
511         "spv.subgroup.tese",
512         "spv.subgroup.vert",
513         "spv.subgroupArithmetic.comp",
514         "spv.subgroupBasic.comp",
515         "spv.subgroupBallot.comp",
516         "spv.subgroupBallotNeg.comp",
517         "spv.subgroupClustered.comp",
518         "spv.subgroupClusteredNeg.comp",
519         "spv.subgroupPartitioned.comp",
520         "spv.subgroupShuffle.comp",
521         "spv.subgroupShuffleRelative.comp",
522         "spv.subgroupQuad.comp",
523         "spv.subgroupVote.comp",
524         "spv.subgroupExtendedTypesArithmetic.comp",
525         "spv.subgroupExtendedTypesArithmeticNeg.comp",
526         "spv.subgroupExtendedTypesBallot.comp",
527         "spv.subgroupExtendedTypesBallotNeg.comp",
528         "spv.subgroupExtendedTypesClustered.comp",
529         "spv.subgroupExtendedTypesClusteredNeg.comp",
530         "spv.subgroupExtendedTypesPartitioned.comp",
531         "spv.subgroupExtendedTypesPartitionedNeg.comp",
532         "spv.subgroupExtendedTypesShuffle.comp",
533         "spv.subgroupExtendedTypesShuffleNeg.comp",
534         "spv.subgroupExtendedTypesShuffleRelative.comp",
535         "spv.subgroupExtendedTypesShuffleRelativeNeg.comp",
536         "spv.subgroupExtendedTypesQuad.comp",
537         "spv.subgroupExtendedTypesQuadNeg.comp",
538         "spv.subgroupExtendedTypesVote.comp",
539         "spv.subgroupExtendedTypesVoteNeg.comp",
540         "spv.vulkan110.storageBuffer.vert",
541     })),
542     FileNameAsCustomTestSuffix
543 );
544
545 // clang-format off
546 INSTANTIATE_TEST_SUITE_P(
547     Glsl, CompileToSpirv14Test,
548     ::testing::ValuesIn(std::vector<std::string>({
549         "spv.1.4.LoopControl.frag",
550         "spv.1.4.NonWritable.frag",
551         "spv.1.4.OpEntryPoint.frag",
552         "spv.1.4.OpEntryPoint.opaqueParams.vert",
553         "spv.1.4.OpSelect.frag",
554         "spv.1.4.OpCopyLogical.comp",
555         "spv.1.4.OpCopyLogicalBool.comp",
556         "spv.1.4.OpCopyLogical.funcall.frag",
557         "spv.1.4.image.frag",
558         "spv.1.4.sparseTexture.frag",
559         "spv.1.4.texture.frag",
560         "spv.1.4.constructComposite.comp",
561         "spv.ext.AnyHitShader.rahit",
562         "spv.ext.AnyHitShader_Errors.rahit",
563         "spv.ext.ClosestHitShader.rchit",
564         "spv.ext.ClosestHitShader_Subgroup.rchit",
565         "spv.ext.ClosestHitShader_Errors.rchit",
566         "spv.ext.IntersectShader.rint",
567         "spv.ext.IntersectShader_Errors.rint",
568         "spv.ext.MissShader.rmiss",
569         "spv.ext.MissShader_Errors.rmiss",
570         "spv.ext.RayPrimCull_Errors.rgen",
571         "spv.ext.RayCallable.rcall",
572         "spv.ext.RayCallable_Errors.rcall",
573         "spv.ext.RayConstants.rgen",
574         "spv.ext.RayGenShader.rgen",
575         "spv.ext.RayGenShader_Errors.rgen",
576         "spv.ext.RayGenShader11.rgen",
577         "spv.ext.RayGenShaderArray.rgen",
578         "spv.ext.RayGenSBTlayout.rgen",
579         "spv.ext.RayGenSBTlayout140.rgen",
580         "spv.ext.RayGenSBTlayout430.rgen",
581         "spv.ext.RayGenSBTlayoutscalar.rgen",
582         "spv.ext.World3x4.rahit",
583         "spv.ext.AccelDecl.frag",
584         "spv.ext.RayQueryDecl.frag",
585     })),
586     FileNameAsCustomTestSuffix
587 );
588
589 // clang-format off
590 INSTANTIATE_TEST_SUITE_P(
591     Hlsl, HlslIoMap,
592     ::testing::ValuesIn(std::vector<IoMapData>{
593         { "spv.register.autoassign.frag", "main_ep", 5, 10, 0, 20, 30, true, false },
594         { "spv.register.noautoassign.frag", "main_ep", 5, 10, 0, 15, 30, false, false },
595         { "spv.register.autoassign-2.frag", "main", 5, 10, 0, 15, 30, true, true },
596         { "spv.register.subpass.frag", "main", 0, 20, 0, 0, 0, true, true },
597         { "spv.buffer.autoassign.frag", "main", 5, 10, 0, 15, 30, true, true },
598         { "spv.ssbo.autoassign.frag", "main", 5, 10, 0, 15, 30, true, true },
599         { "spv.ssboAlias.frag", "main", 0, 0, 0, 0, 83, true, false },
600         { "spv.rw.autoassign.frag", "main", 5, 10, 20, 15, 30, true, true },
601         { "spv.register.autoassign.rangetest.frag", "main",
602                 glslang::TQualifier::layoutBindingEnd-2,
603                 glslang::TQualifier::layoutBindingEnd+5,
604                 20, 30, true, false },
605     }),
606     FileNameAsCustomTestSuffixIoMap
607 );
608
609 // clang-format off
610 INSTANTIATE_TEST_SUITE_P(
611     Hlsl, GlslIoMap,
612     ::testing::ValuesIn(std::vector<IoMapData>{
613         { "spv.glsl.register.autoassign.frag", "main", 5, 10, 0, 20, 30, true, false },
614         { "spv.glsl.register.noautoassign.frag", "main", 5, 10, 0, 15, 30, false, false },
615     }),
616     FileNameAsCustomTestSuffixIoMap
617 );
618
619 // clang-format off
620 INSTANTIATE_TEST_SUITE_P(
621     Glsl, CompileOpenGLToSpirvTest,
622     ::testing::ValuesIn(std::vector<std::string>({
623         "spv.460.frag",
624         "spv.460.vert",
625         "spv.460.comp",
626         "spv.atomic.comp",
627         "spv.atomicFloat.comp",
628         "spv.atomicFloat_Error.comp",
629         "spv.glFragColor.frag",
630         "spv.rankShift.comp",
631         "spv.specConst.vert",
632         "spv.specTexture.frag",
633         "spv.OVR_multiview.vert",
634         "spv.uniformInitializer.frag",
635         "spv.uniformInitializerSpecConstant.frag",
636         "spv.uniformInitializerStruct.frag",
637         "spv.xfbOffsetOnBlockMembersAssignment.vert",
638         "spv.xfbOffsetOnStructMembersAssignment.vert",
639         "spv.xfbOverlapOffsetCheckWithBlockAndMember.vert",
640         "spv.xfbStrideJustOnce.vert",
641     })),
642     FileNameAsCustomTestSuffix
643 );
644
645 INSTANTIATE_TEST_SUITE_P(
646     Glsl, VulkanSemantics,
647     ::testing::ValuesIn(std::vector<std::string>({
648         "vulkan.frag",
649         "vulkan.vert",
650         "vulkan.comp",
651         "samplerlessTextureFunctions.frag",
652         "spv.specConstArrayCheck.vert",
653     })),
654     FileNameAsCustomTestSuffix
655 );
656
657 INSTANTIATE_TEST_SUITE_P(
658     Glsl, OpenGLSemantics,
659     ::testing::ValuesIn(std::vector<std::string>({
660         "glspv.esversion.vert",
661         "glspv.version.frag",
662         "glspv.version.vert",
663         "glspv.frag",
664         "glspv.vert",
665     })),
666     FileNameAsCustomTestSuffix
667 );
668
669 INSTANTIATE_TEST_SUITE_P(
670     Glsl, VulkanAstSemantics,
671     ::testing::ValuesIn(std::vector<std::string>({
672         "vulkan.ast.vert",
673     })),
674     FileNameAsCustomTestSuffix
675 );
676
677 INSTANTIATE_TEST_SUITE_P(
678     Glsl, CompileVulkanToSpirvTestAMD,
679     ::testing::ValuesIn(std::vector<std::string>({
680         "spv.16bitxfb.vert",
681         "spv.float16.frag",
682         "spv.float16Fetch.frag",
683         "spv.imageLoadStoreLod.frag",
684         "spv.int16.frag",
685         "spv.int16.amd.frag",
686         "spv.shaderBallotAMD.comp",
687         "spv.shaderFragMaskAMD.frag",
688         "spv.textureGatherBiasLod.frag",
689     })),
690     FileNameAsCustomTestSuffix
691 );
692
693 INSTANTIATE_TEST_SUITE_P(
694     Glsl, CompileVulkanToSpirvTestNV,
695     ::testing::ValuesIn(std::vector<std::string>({
696     "spv.sampleMaskOverrideCoverage.frag",
697     "spv.GeometryShaderPassthrough.geom",
698     "spv.viewportArray2.vert",
699     "spv.viewportArray2.tesc",
700     "spv.stereoViewRendering.vert",
701     "spv.stereoViewRendering.tesc",
702     "spv.multiviewPerViewAttributes.vert",
703     "spv.multiviewPerViewAttributes.tesc",
704     "spv.atomicInt64.comp",
705     "spv.shadingRate.frag",
706     "spv.RayGenShader.rgen",
707     "spv.RayGenShaderArray.rgen",
708     "spv.RayGenShader_Errors.rgen",
709     "spv.RayConstants.rgen",
710     "spv.IntersectShader.rint",
711     "spv.IntersectShader_Errors.rint",
712     "spv.AnyHitShader.rahit",
713     "spv.AnyHitShader_Errors.rahit",
714     "spv.ClosestHitShader.rchit",
715     "spv.ClosestHitShader_Errors.rchit",
716     "spv.MissShader.rmiss",
717     "spv.MissShader_Errors.rmiss",
718     "spv.RayCallable.rcall",
719     "spv.RayCallable_Errors.rcall",
720     "spv.fragmentShaderBarycentric.frag",
721     "spv.fragmentShaderBarycentric2.frag",
722     "spv.computeShaderDerivatives.comp",
723     "spv.computeShaderDerivatives2.comp",
724     "spv.shaderImageFootprint.frag",
725     "spv.meshShaderBuiltins.mesh",
726     "spv.meshShaderUserDefined.mesh",
727     "spv.meshShaderPerViewBuiltins.mesh",
728     "spv.meshShaderPerViewUserDefined.mesh",
729     "spv.meshShaderPerView_Errors.mesh",
730     "spv.meshShaderSharedMem.mesh",
731     "spv.meshShaderTaskMem.mesh",
732     "spv.320.meshShaderUserDefined.mesh",
733     "spv.meshShaderRedeclBuiltins.mesh",
734     "spv.meshShaderRedeclPerViewBuiltins.mesh",
735     "spv.meshTaskShader.task",
736     "spv.perprimitiveNV.frag",
737 })),
738 FileNameAsCustomTestSuffix
739 );
740
741 INSTANTIATE_TEST_SUITE_P(
742     Glsl, CompileUpgradeTextureToSampledTextureAndDropSamplersTest,
743     ::testing::ValuesIn(std::vector<std::string>({
744       "spv.texture.sampler.transform.frag",
745     })),
746     FileNameAsCustomTestSuffix
747 );
748 // clang-format on
749
750 }  // anonymous namespace
751 }  // namespace glslangtest