Merge pull request #2800 from mhillenbrand/string_literal_endianness
[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 CompileToSpirv16Test = GlslangTest<::testing::TestWithParam<std::string>>;
73 using CompileOpenGLToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
74 using VulkanSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
75 using OpenGLSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
76 using VulkanAstSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
77 using HlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
78 using GlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
79 using CompileVulkanToSpirvTestAMD = GlslangTest<::testing::TestWithParam<std::string>>;
80 using CompileVulkanToSpirvTestNV = GlslangTest<::testing::TestWithParam<std::string>>;
81 using CompileVulkanToSpirv14TestNV = GlslangTest<::testing::TestWithParam<std::string>>;
82 using CompileUpgradeTextureToSampledTextureAndDropSamplersTest = GlslangTest<::testing::TestWithParam<std::string>>;
83
84 // Compiling GLSL to SPIR-V under Vulkan semantics. Expected to successfully
85 // generate SPIR-V.
86 TEST_P(CompileVulkanToSpirvTest, FromFile)
87 {
88     loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
89                             Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
90                             Target::Spv);
91 }
92
93 TEST_P(CompileVulkanToSpirvDeadCodeElimTest, FromFile)
94 {
95     loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
96                             Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
97                             Target::Spv);
98 }
99
100 // Compiling GLSL to SPIR-V with debug info under Vulkan semantics. Expected
101 // to successfully generate SPIR-V.
102 TEST_P(CompileVulkanToDebugSpirvTest, FromFile)
103 {
104     loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
105                             Source::GLSL, Semantics::Vulkan,
106                             glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
107                             Target::Spv, true, "",
108                             "/baseResults/", false, true);
109 }
110
111
112 TEST_P(CompileVulkan1_1ToSpirvTest, FromFile)
113 {
114     loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
115                             Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1, glslang::EShTargetSpv_1_3,
116                             Target::Spv);
117 }
118
119 TEST_P(CompileToSpirv14Test, FromFile)
120 {
121     loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
122                             Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1, glslang::EShTargetSpv_1_4,
123                             Target::Spv);
124 }
125
126 TEST_P(CompileToSpirv16Test, FromFile)
127 {
128     loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
129                             Source::GLSL, Semantics::Vulkan, glslang::EShTargetUniversal, glslang::EShTargetSpv_1_6,
130                             Target::Spv);
131 }
132
133 // Compiling GLSL to SPIR-V under OpenGL semantics. Expected to successfully
134 // generate SPIR-V.
135 TEST_P(CompileOpenGLToSpirvTest, FromFile)
136 {
137     loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
138                             Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
139                             Target::Spv);
140 }
141
142 // GLSL-level Vulkan semantics test. Expected to error out before generating
143 // SPIR-V.
144 TEST_P(VulkanSemantics, FromFile)
145 {
146     loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
147                             Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
148                             Target::Spv, false);
149 }
150
151 // GLSL-level Vulkan semantics test. Expected to error out before generating
152 // SPIR-V.
153 TEST_P(OpenGLSemantics, FromFile)
154 {
155     loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
156                             Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
157                             Target::Spv, false);
158 }
159
160 // GLSL-level Vulkan semantics test that need to see the AST for validation.
161 TEST_P(VulkanAstSemantics, FromFile)
162 {
163     loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
164                             Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
165                             Target::AST);
166 }
167
168 // HLSL-level Vulkan semantics tests.
169 TEST_P(HlslIoMap, FromFile)
170 {
171     loadFileCompileIoMapAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
172                                  Source::HLSL, Semantics::Vulkan,
173                                  Target::Spv, GetParam().entryPoint,
174                                  GetParam().baseSamplerBinding,
175                                  GetParam().baseTextureBinding,
176                                  GetParam().baseImageBinding,
177                                  GetParam().baseUboBinding,
178                                  GetParam().baseSsboBinding,
179                                  GetParam().autoMapBindings,
180                                  GetParam().flattenUniforms);
181 }
182
183 // GLSL-level Vulkan semantics tests.
184 TEST_P(GlslIoMap, FromFile)
185 {
186     loadFileCompileIoMapAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
187                                  Source::GLSL, Semantics::Vulkan,
188                                  Target::Spv, GetParam().entryPoint,
189                                  GetParam().baseSamplerBinding,
190                                  GetParam().baseTextureBinding,
191                                  GetParam().baseImageBinding,
192                                  GetParam().baseUboBinding,
193                                  GetParam().baseSsboBinding,
194                                  GetParam().autoMapBindings,
195                                  GetParam().flattenUniforms);
196 }
197
198 // Compiling GLSL to SPIR-V under Vulkan semantics (AMD extensions enabled).
199 // Expected to successfully generate SPIR-V.
200 TEST_P(CompileVulkanToSpirvTestAMD, 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 // Compiling GLSL to SPIR-V under Vulkan semantics (NV extensions enabled).
208 // Expected to successfully generate SPIR-V.
209 TEST_P(CompileVulkanToSpirvTestNV, FromFile)
210 {
211     loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
212                             Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
213                             Target::Spv);
214 }
215
216 TEST_P(CompileVulkanToSpirv14TestNV, FromFile)
217 {
218     loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
219                             Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1, glslang::EShTargetSpv_1_4,
220                             Target::Spv);
221 }
222
223 TEST_P(CompileUpgradeTextureToSampledTextureAndDropSamplersTest, FromFile)
224 {
225     loadCompileUpgradeTextureToSampledTextureAndDropSamplersAndCheck(GlobalTestSettings.testRoot,
226                                                                      GetParam(),
227                                                                      Source::GLSL,
228                                                                      Semantics::Vulkan,
229                                                                      Target::Spv);
230 }
231
232 // clang-format off
233 INSTANTIATE_TEST_SUITE_P(
234     Glsl, CompileVulkanToSpirvTest,
235     ::testing::ValuesIn(std::vector<std::string>({
236         // Test looping constructs.
237         // No tests yet for making sure break and continue from a nested loop
238         // goes to the innermost target.
239         "spv.barrier.vert",
240         "spv.do-simple.vert",
241         "spv.do-while-continue-break.vert",
242         "spv.for-complex-condition.vert",
243         "spv.for-continue-break.vert",
244         "spv.for-simple.vert",
245         "spv.for-notest.vert",
246         "spv.for-nobody.vert",
247         "spv.while-continue-break.vert",
248         "spv.while-simple.vert",
249         // vulkan-specific tests
250         "rayQuery.rgen",
251         "rayQuery-no-cse.rgen",
252         "rayQuery-initialize.rgen",
253         "rayQuery-allOps.rgen",
254         "rayQuery-allOps.Error.rgen",
255         "rayQuery-committed.Error.rgen",
256         "rayQuery-allOps.comp",
257         "rayQuery-allOps.frag",
258         "rayQuery-initialization.Error.comp",
259         "rayQuery-global.rgen",
260         "rayQuery-types.comp",
261         "spv.set.vert",
262         "spv.double.comp",
263         "spv.100ops.frag",
264         "spv.130.frag",
265         "spv.140.frag",
266         "spv.150.geom",
267         "spv.150.vert",
268         "spv.16bitstorage.frag",
269         "spv.16bitstorage_Error.frag",
270         "spv.16bitstorage-int.frag",
271         "spv.16bitstorage_Error-int.frag",
272         "spv.16bitstorage-uint.frag",
273         "spv.16bitstorage_Error-uint.frag",
274         "spv.300BuiltIns.vert",
275         "spv.300layout.frag",
276         "spv.300layout.vert",
277         "spv.300layoutp.vert",
278         "spv.310.comp",
279         "spv.310.bitcast.frag",
280         "spv.330.geom",
281         "spv.400.frag",
282         "spv.400.tesc",
283         "spv.400.tese",
284         "spv.420.geom",
285         "spv.430.frag",
286         "spv.430.vert",
287         "spv.450.tesc",
288         "spv.450.geom",
289         "spv.450.noRedecl.tesc",
290         "spv.8bitstorage-int.frag",
291         "spv.8bitstorage_Error-int.frag",
292         "spv.8bitstorage-uint.frag",
293         "spv.8bitstorage_Error-uint.frag",
294         "spv.8bitstorage-ubo.vert",
295         "spv.8bitstorage-ssbo.vert",
296         "spv.8bit-16bit-construction.frag",
297         "spv.accessChain.frag",
298         "spv.aggOps.frag",
299         "spv.always-discard.frag",
300         "spv.always-discard2.frag",
301         "spv.arbPostDepthCoverage.frag",
302         "spv.arbPostDepthCoverage_Error.frag",
303         "spv.atomicCounter.comp",
304         "spv.bitCast.frag",
305         "spv.bool.vert",
306         "spv.boolInBlock.frag",
307         "spv.branch-return.vert",
308         "spv.bufferhandle1.frag",
309         "spv.bufferhandle10.frag",
310         "spv.bufferhandle11.frag",
311         "spv.bufferhandle12.frag",
312         "spv.bufferhandle13.frag",
313         "spv.bufferhandle14.frag",
314         "spv.bufferhandle15.frag",
315         "spv.bufferhandle16.frag",
316         "spv.bufferhandle17_Errors.frag",
317         "spv.bufferhandle18.frag",
318         "spv.bufferhandle19_Errors.frag",
319         "spv.bufferhandle2.frag",
320         "spv.bufferhandle3.frag",
321         "spv.bufferhandle4.frag",
322         "spv.bufferhandle5.frag",
323         "spv.bufferhandle6.frag",
324         "spv.bufferhandle7.frag",
325         "spv.bufferhandle8.frag",
326         "spv.bufferhandle9.frag",
327         "spv.bufferhandleUvec2.frag",
328         "spv.bufferhandle_Error.frag",
329         "spv.builtInXFB.vert",
330         "spv.conditionalDemote.frag",
331         "spv.conditionalDiscard.frag",
332         "spv.constructComposite.comp",
333         "spv.constStruct.vert",
334         "spv.constConstruct.vert",
335         "spv.controlFlowAttributes.frag",
336         "spv.conversion.frag",
337         "spv.coopmat.comp",
338         "spv.coopmat_Error.comp",
339         "spv.dataOut.frag",
340         "spv.dataOutIndirect.frag",
341         "spv.dataOutIndirect.vert",
342         "spv.debugPrintf.frag",
343         "spv.debugPrintf_Error.frag",
344         "spv.demoteDisabled.frag",
345         "spv.deepRvalue.frag",
346         "spv.depthOut.frag",
347         "spv.depthUnchanged.frag",
348         "spv.discard-dce.frag",
349         "spv.doWhileLoop.frag",
350         "spv.earlyReturnDiscard.frag",
351         "spv.extPostDepthCoverage.frag",
352         "spv.extPostDepthCoverage_Error.frag",
353         "spv.float16convertonlyarith.comp",
354         "spv.float16convertonlystorage.comp",
355         "spv.flowControl.frag",
356         "spv.forLoop.frag",
357         "spv.forwardFun.frag",
358         "spv.fragmentDensity.frag",
359         "spv.fragmentDensity.vert",
360         "spv.fragmentDensity-es.frag",
361         "spv.fragmentDensity-neg.frag",
362         "spv.fsi.frag",
363         "spv.fsi_Error.frag",
364         "spv.fullyCovered.frag",
365         "spv.functionCall.frag",
366         "spv.functionNestedOpaque.vert",
367         "spv.functionSemantics.frag",
368         "spv.functionParameterTypes.frag",
369         "spv.GeometryShaderPassthrough.geom",
370         "spv.funcall.array.frag",
371         "spv.load.bool.array.interface.block.frag",
372         "spv.interpOps.frag",
373         "spv.int64.frag",
374         "spv.intcoopmat.comp",
375         "spv.intOps.vert",
376         "spv.intrinsicsSpirvByReference.vert",
377         "spv.intrinsicsSpirvDecorate.frag",
378         "spv.intrinsicsSpirvExecutionMode.frag",
379         "spv.intrinsicsSpirvInstruction.vert",
380         "spv.intrinsicsSpirvLiteral.vert",
381         "spv.intrinsicsSpirvStorageClass.rchit",
382         "spv.intrinsicsSpirvType.rgen",
383         "spv.intrinsicsSpirvTypeLocalVar.vert",
384         "spv.invariantAll.vert",
385         "spv.layer.tese",
386         "spv.layoutNested.vert",
387         "spv.length.frag",
388         "spv.localAggregates.frag",
389         "spv.loops.frag",
390         "spv.loopsArtificial.frag",
391         "spv.matFun.vert",
392         "spv.matrix.frag",
393         "spv.matrix2.frag",
394         "spv.memoryQualifier.frag",
395         "spv.merge-unreachable.frag",
396         "spv.multiStruct.comp",
397         "spv.multiStructFuncall.frag",
398         "spv.newTexture.frag",
399         "spv.noDeadDecorations.vert",
400         "spv.nonSquare.vert",
401         "spv.nonuniform.frag",
402         "spv.nonuniform2.frag",
403         "spv.nonuniform3.frag",
404         "spv.nonuniform4.frag",
405         "spv.nonuniform5.frag",
406         "spv.noWorkgroup.comp",
407         "spv.nullInit.comp",
408         "spv.offsets.frag",
409         "spv.Operations.frag",
410         "spv.paramMemory.frag",
411         "spv.paramMemory.420.frag",
412         "spv.precision.frag",
413         "spv.precisionArgs.frag",
414         "spv.precisionNonESSamp.frag",
415         "spv.precisionTexture.frag",
416         "spv.prepost.frag",
417         "spv.privateVariableTypes.frag",
418         "spv.qualifiers.vert",
419         "spv.sample.frag",
420         "spv.sampleId.frag",
421         "spv.samplePosition.frag",
422         "spv.sampleMaskOverrideCoverage.frag",
423         "spv.scalarlayout.frag",
424         "spv.scalarlayoutfloat16.frag",
425         "spv.shaderBallot.comp",
426         "spv.shaderDrawParams.vert",
427         "spv.shaderGroupVote.comp",
428         "spv.shaderStencilExport.frag",
429         "spv.shiftOps.frag",
430         "spv.simpleFunctionCall.frag",
431         "spv.simpleMat.vert",
432         "spv.sparseTexture.frag",
433         "spv.sparseTextureClamp.frag",
434         "spv.structAssignment.frag",
435         "spv.structDeref.frag",
436         "spv.structure.frag",
437         "spv.switch.frag",
438         "spv.swizzle.frag",
439         "spv.swizzleInversion.frag",
440         "spv.test.frag",
441         "spv.test.vert",
442         "spv.texture.frag",
443         "spv.texture.vert",
444         "spv.textureBuffer.vert",
445         "spv.image.frag",
446         "spv.imageAtomic64.frag",
447         "spv.types.frag",
448         "spv.uint.frag",
449         "spv.uniformArray.frag",
450         "spv.variableArrayIndex.frag",
451         "spv.varyingArray.frag",
452         "spv.varyingArrayIndirect.frag",
453         "spv.vecMatConstruct.frag",
454         "spv.voidFunction.frag",
455         "spv.whileLoop.frag",
456         "spv.AofA.frag",
457         "spv.queryL.frag",
458         "spv.separate.frag",
459         "spv.shortCircuit.frag",
460         "spv.pushConstant.vert",
461         "spv.pushConstantAnon.vert",
462         "spv.subpass.frag",
463         "spv.specConstant.vert",
464         "spv.specConstant.comp",
465         "spv.specConstantComposite.vert",
466         "spv.specConstantOperations.vert",
467         "spv.specConstant.float16.comp",
468         "spv.specConstant.int16.comp",
469         "spv.specConstant.int8.comp",
470         "spv.storageBuffer.vert",
471         "spv.terminate.frag",
472         "spv.subgroupUniformControlFlow.vert",
473         "spv.precise.tese",
474         "spv.precise.tesc",
475         "spv.viewportindex.tese",
476         "spv.volatileAtomic.comp",
477         "spv.vulkan100.subgroupArithmetic.comp",
478         "spv.vulkan100.subgroupPartitioned.comp",
479         "spv.xfb.vert",
480         "spv.xfb2.vert",
481         "spv.xfb3.vert",
482         "spv.samplerlessTextureFunctions.frag",
483         "spv.smBuiltins.vert",
484         "spv.smBuiltins.frag",
485         "spv.builtin.PrimitiveShadingRateEXT.vert",
486         "spv.builtin.ShadingRateEXT.frag",
487         "spv.atomicAdd.bufferReference.comp"
488     })),
489     FileNameAsCustomTestSuffix
490 );
491
492 // Cases with deliberately unreachable code.
493 // By default the compiler will aggressively eliminate
494 // unreachable merges and continues.
495 INSTANTIATE_TEST_SUITE_P(
496     GlslWithDeadCode, CompileVulkanToSpirvDeadCodeElimTest,
497     ::testing::ValuesIn(std::vector<std::string>({
498         "spv.dead-after-continue.vert",
499         "spv.dead-after-discard.frag",
500         "spv.dead-after-return.vert",
501         "spv.dead-after-loop-break.vert",
502         "spv.dead-after-switch-break.vert",
503         "spv.dead-complex-continue-after-return.vert",
504         "spv.dead-complex-merge-after-return.vert",
505     })),
506     FileNameAsCustomTestSuffix
507 );
508
509 // clang-format off
510 INSTANTIATE_TEST_SUITE_P(
511     Glsl, CompileVulkanToDebugSpirvTest,
512     ::testing::ValuesIn(std::vector<std::string>({
513         "spv.pp.line.frag",
514     })),
515     FileNameAsCustomTestSuffix
516 );
517
518 // clang-format off
519 INSTANTIATE_TEST_SUITE_P(
520     Glsl, CompileVulkan1_1ToSpirvTest,
521     ::testing::ValuesIn(std::vector<std::string>({
522         "spv.1.3.8bitstorage-ubo.vert",
523         "spv.1.3.8bitstorage-ssbo.vert",
524         "spv.1.3.coopmat.comp",
525         "spv.deviceGroup.frag",
526         "spv.drawParams.vert",
527         "spv.int8.frag",
528         "spv.vulkan110.int16.frag",
529         "spv.int32.frag",
530         "spv.explicittypes.frag",
531         "spv.float32.frag",
532         "spv.float64.frag",
533         "spv.memoryScopeSemantics.comp",
534         "spv.memoryScopeSemantics_Error.comp",
535         "spv.multiView.frag",
536         "spv.queueFamilyScope.comp",
537         "spv.RayGenShader11.rgen",
538         "spv.subgroup.frag",
539         "spv.subgroup.geom",
540         "spv.subgroup.tesc",
541         "spv.subgroup.tese",
542         "spv.subgroup.vert",
543         "spv.subgroupArithmetic.comp",
544         "spv.subgroupBasic.comp",
545         "spv.subgroupBallot.comp",
546         "spv.subgroupBallotNeg.comp",
547         "spv.subgroupClustered.comp",
548         "spv.subgroupClusteredNeg.comp",
549         "spv.subgroupPartitioned.comp",
550         "spv.subgroupShuffle.comp",
551         "spv.subgroupShuffleRelative.comp",
552         "spv.subgroupQuad.comp",
553         "spv.subgroupVote.comp",
554         "spv.subgroupExtendedTypesArithmetic.comp",
555         "spv.subgroupExtendedTypesArithmeticNeg.comp",
556         "spv.subgroupExtendedTypesBallot.comp",
557         "spv.subgroupExtendedTypesBallotNeg.comp",
558         "spv.subgroupExtendedTypesClustered.comp",
559         "spv.subgroupExtendedTypesClusteredNeg.comp",
560         "spv.subgroupExtendedTypesPartitioned.comp",
561         "spv.subgroupExtendedTypesPartitionedNeg.comp",
562         "spv.subgroupExtendedTypesShuffle.comp",
563         "spv.subgroupExtendedTypesShuffleNeg.comp",
564         "spv.subgroupExtendedTypesShuffleRelative.comp",
565         "spv.subgroupExtendedTypesShuffleRelativeNeg.comp",
566         "spv.subgroupExtendedTypesQuad.comp",
567         "spv.subgroupExtendedTypesQuadNeg.comp",
568         "spv.subgroupExtendedTypesVote.comp",
569         "spv.subgroupExtendedTypesVoteNeg.comp",
570         "spv.vulkan110.storageBuffer.vert",
571     })),
572     FileNameAsCustomTestSuffix
573 );
574
575 // clang-format off
576 INSTANTIATE_TEST_SUITE_P(
577     Glsl, CompileToSpirv14Test,
578     ::testing::ValuesIn(std::vector<std::string>({
579         "spv.1.4.LoopControl.frag",
580         "spv.1.4.NonWritable.frag",
581         "spv.1.4.OpEntryPoint.frag",
582         "spv.1.4.OpEntryPoint.opaqueParams.vert",
583         "spv.1.4.OpSelect.frag",
584         "spv.1.4.OpCopyLogical.comp",
585         "spv.1.4.OpCopyLogicalBool.comp",
586         "spv.1.4.OpCopyLogical.funcall.frag",
587         "spv.1.4.funcall.array.frag",
588         "spv.1.4.load.bool.array.interface.block.frag",
589         "spv.1.4.image.frag",
590         "spv.1.4.sparseTexture.frag",
591         "spv.1.4.texture.frag",
592         "spv.1.4.constructComposite.comp",
593         "spv.ext.AnyHitShader.rahit",
594         "spv.ext.AnyHitShader_Errors.rahit",
595         "spv.ext.ClosestHitShader.rchit",
596         "spv.ext.ClosestHitShader_Subgroup.rchit",
597         "spv.ext.ClosestHitShader_Errors.rchit",
598         "spv.ext.IntersectShader.rint",
599         "spv.ext.IntersectShader_Errors.rint",
600         "spv.ext.MissShader.rmiss",
601         "spv.ext.MissShader_Errors.rmiss",
602         "spv.ext.RayPrimCull_Errors.rgen",
603         "spv.ext.RayCallable.rcall",
604         "spv.ext.RayCallable_Errors.rcall",
605         "spv.ext.RayConstants.rgen",
606         "spv.ext.RayGenShader.rgen",
607         "spv.ext.RayGenShader_Errors.rgen",
608         "spv.ext.RayGenShader11.rgen",
609         "spv.ext.RayGenShaderArray.rgen",
610         "spv.ext.RayGenSBTlayout.rgen",
611         "spv.ext.RayGenSBTlayout140.rgen",
612         "spv.ext.RayGenSBTlayout430.rgen",
613         "spv.ext.RayGenSBTlayoutscalar.rgen",
614         "spv.ext.World3x4.rahit",
615         "spv.ext.AccelDecl.frag",
616         "spv.ext.RayQueryDecl.frag",
617
618         // SPV_KHR_workgroup_memory_explicit_layout depends on SPIR-V 1.4.
619         "spv.WorkgroupMemoryExplicitLayout.SingleBlock.comp",
620         "spv.WorkgroupMemoryExplicitLayout.MultiBlock.comp",
621         "spv.WorkgroupMemoryExplicitLayout.8BitAccess.comp",
622         "spv.WorkgroupMemoryExplicitLayout.16BitAccess.comp",
623         "spv.WorkgroupMemoryExplicitLayout.NonBlock.comp",
624         "spv.WorkgroupMemoryExplicitLayout.MixBlockNonBlock_Errors.comp",
625         "spv.WorkgroupMemoryExplicitLayout.std140.comp",
626         "spv.WorkgroupMemoryExplicitLayout.std430.comp",
627         "spv.WorkgroupMemoryExplicitLayout.scalar.comp",
628     })),
629     FileNameAsCustomTestSuffix
630 );
631
632 // clang-format off
633 INSTANTIATE_TEST_SUITE_P(
634     Glsl, CompileToSpirv16Test,
635     ::testing::ValuesIn(std::vector<std::string>({
636         "spv.1.6.conditionalDiscard.frag",
637         "spv.1.6.helperInvocation.frag",
638         "spv.1.6.specConstant.comp",
639     })),
640     FileNameAsCustomTestSuffix
641 );
642
643
644 // clang-format off
645 INSTANTIATE_TEST_SUITE_P(
646     Hlsl, HlslIoMap,
647     ::testing::ValuesIn(std::vector<IoMapData>{
648         { "spv.register.autoassign.frag", "main_ep", 5, 10, 0, 20, 30, true, false },
649         { "spv.register.noautoassign.frag", "main_ep", 5, 10, 0, 15, 30, false, false },
650         { "spv.register.autoassign-2.frag", "main", 5, 10, 0, 15, 30, true, true },
651         { "spv.register.subpass.frag", "main", 0, 20, 0, 0, 0, true, true },
652         { "spv.buffer.autoassign.frag", "main", 5, 10, 0, 15, 30, true, true },
653         { "spv.ssbo.autoassign.frag", "main", 5, 10, 0, 15, 30, true, true },
654         { "spv.ssboAlias.frag", "main", 0, 0, 0, 0, 83, true, false },
655         { "spv.rw.autoassign.frag", "main", 5, 10, 20, 15, 30, true, true },
656         { "spv.register.autoassign.rangetest.frag", "main",
657                 glslang::TQualifier::layoutBindingEnd-2,
658                 glslang::TQualifier::layoutBindingEnd+5,
659                 20, 30, true, false },
660     }),
661     FileNameAsCustomTestSuffixIoMap
662 );
663
664 // clang-format off
665 INSTANTIATE_TEST_SUITE_P(
666     Hlsl, GlslIoMap,
667     ::testing::ValuesIn(std::vector<IoMapData>{
668         { "spv.glsl.register.autoassign.frag", "main", 5, 10, 0, 20, 30, true, false },
669         { "spv.glsl.register.noautoassign.frag", "main", 5, 10, 0, 15, 30, false, false },
670     }),
671     FileNameAsCustomTestSuffixIoMap
672 );
673
674 // clang-format off
675 INSTANTIATE_TEST_SUITE_P(
676     Glsl, CompileOpenGLToSpirvTest,
677     ::testing::ValuesIn(std::vector<std::string>({
678         "spv.460.frag",
679         "spv.460.vert",
680         "spv.460.comp",
681         "spv.atomic.comp",
682         "spv.atomicFloat.comp",
683         "spv.atomicFloat_Error.comp",
684         "spv.glFragColor.frag",
685         "spv.rankShift.comp",
686         "spv.specConst.vert",
687         "spv.specTexture.frag",
688         "spv.OVR_multiview.vert",
689         "spv.uniformInitializer.frag",
690         "spv.uniformInitializerSpecConstant.frag",
691         "spv.uniformInitializerStruct.frag",
692         "spv.xfbOffsetOnBlockMembersAssignment.vert",
693         "spv.xfbOffsetOnStructMembersAssignment.vert",
694         "spv.xfbOverlapOffsetCheckWithBlockAndMember.vert",
695         "spv.xfbStrideJustOnce.vert",
696     })),
697     FileNameAsCustomTestSuffix
698 );
699
700 INSTANTIATE_TEST_SUITE_P(
701     Glsl, VulkanSemantics,
702     ::testing::ValuesIn(std::vector<std::string>({
703         "vulkan.frag",
704         "vulkan.vert",
705         "vulkan.comp",
706         "samplerlessTextureFunctions.frag",
707         "spv.specConstArrayCheck.vert",
708     })),
709     FileNameAsCustomTestSuffix
710 );
711
712 INSTANTIATE_TEST_SUITE_P(
713     Glsl, OpenGLSemantics,
714     ::testing::ValuesIn(std::vector<std::string>({
715         "glspv.esversion.vert",
716         "glspv.version.frag",
717         "glspv.version.vert",
718         "glspv.frag",
719         "glspv.vert",
720     })),
721     FileNameAsCustomTestSuffix
722 );
723
724 INSTANTIATE_TEST_SUITE_P(
725     Glsl, VulkanAstSemantics,
726     ::testing::ValuesIn(std::vector<std::string>({
727         "vulkan.ast.vert",
728     })),
729     FileNameAsCustomTestSuffix
730 );
731
732 INSTANTIATE_TEST_SUITE_P(
733     Glsl, CompileVulkanToSpirvTestAMD,
734     ::testing::ValuesIn(std::vector<std::string>({
735         "spv.16bitxfb.vert",
736         "spv.float16.frag",
737         "spv.float16Fetch.frag",
738         "spv.imageLoadStoreLod.frag",
739         "spv.int16.frag",
740         "spv.int16.amd.frag",
741         "spv.shaderBallotAMD.comp",
742         "spv.shaderFragMaskAMD.frag",
743         "spv.textureGatherBiasLod.frag",
744     })),
745     FileNameAsCustomTestSuffix
746 );
747
748 INSTANTIATE_TEST_SUITE_P(
749     Glsl, CompileVulkanToSpirvTestNV,
750     ::testing::ValuesIn(std::vector<std::string>({
751     "spv.sampleMaskOverrideCoverage.frag",
752     "spv.GeometryShaderPassthrough.geom",
753     "spv.viewportArray2.vert",
754     "spv.viewportArray2.tesc",
755     "spv.stereoViewRendering.vert",
756     "spv.stereoViewRendering.tesc",
757     "spv.multiviewPerViewAttributes.vert",
758     "spv.multiviewPerViewAttributes.tesc",
759     "spv.atomicInt64.comp",
760     "spv.atomicStoreInt64.comp",
761     "spv.shadingRate.frag",
762     "spv.RayGenShader.rgen",
763     "spv.RayGenShaderArray.rgen",
764     "spv.RayGenShader_Errors.rgen",
765     "spv.RayConstants.rgen",
766     "spv.IntersectShader.rint",
767     "spv.IntersectShader_Errors.rint",
768     "spv.AnyHitShader.rahit",
769     "spv.AnyHitShader_Errors.rahit",
770     "spv.ClosestHitShader.rchit",
771     "spv.ClosestHitShader_Errors.rchit",
772     "spv.MissShader.rmiss",
773     "spv.MissShader_Errors.rmiss",
774     "spv.RayCallable.rcall",
775     "spv.RayCallable_Errors.rcall",
776     "spv.fragmentShaderBarycentric.frag",
777     "spv.fragmentShaderBarycentric2.frag",
778     "spv.computeShaderDerivatives.comp",
779     "spv.computeShaderDerivatives2.comp",
780     "spv.shaderImageFootprint.frag",
781     "spv.meshShaderBuiltins.mesh",
782     "spv.meshShaderUserDefined.mesh",
783     "spv.meshShaderPerViewBuiltins.mesh",
784     "spv.meshShaderPerViewUserDefined.mesh",
785     "spv.meshShaderPerView_Errors.mesh",
786     "spv.meshShaderSharedMem.mesh",
787     "spv.meshShaderTaskMem.mesh",
788     "spv.320.meshShaderUserDefined.mesh",
789     "spv.meshShaderRedeclBuiltins.mesh",
790     "spv.meshShaderRedeclPerViewBuiltins.mesh",
791     "spv.meshTaskShader.task",
792     "spv.perprimitiveNV.frag",
793 })),
794 FileNameAsCustomTestSuffix
795 );
796
797 INSTANTIATE_TEST_SUITE_P(
798     Glsl, CompileVulkanToSpirv14TestNV,
799     ::testing::ValuesIn(std::vector<std::string>({
800     "spv.RayGenShaderMotion.rgen",
801     "spv.IntersectShaderMotion.rint",
802     "spv.AnyHitShaderMotion.rahit",
803     "spv.ClosestHitShaderMotion.rchit",
804     "spv.MissShaderMotion.rmiss",
805 })),
806 FileNameAsCustomTestSuffix
807 );
808 INSTANTIATE_TEST_SUITE_P(
809     Glsl, CompileUpgradeTextureToSampledTextureAndDropSamplersTest,
810     ::testing::ValuesIn(std::vector<std::string>({
811       "spv.texture.sampler.transform.frag",
812     })),
813     FileNameAsCustomTestSuffix
814 );
815 // clang-format on
816
817 }  // anonymous namespace
818 }  // namespace glslangtest