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