Debian Codegraph @

third_party/glslang/gtests/Spv.FromFile.cpp

raw
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 "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.imageAtomic64.frag",
415 "spv.types.frag",
416 "spv.uint.frag",
417 "spv.uniformArray.frag",
418 "spv.variableArrayIndex.frag",
419 "spv.varyingArray.frag",
420 "spv.varyingArrayIndirect.frag",
421 "spv.vecMatConstruct.frag",
422 "spv.voidFunction.frag",
423 "spv.whileLoop.frag",
424 "spv.AofA.frag",
425 "spv.queryL.frag",
426 "spv.separate.frag",
427 "spv.shortCircuit.frag",
428 "spv.pushConstant.vert",
429 "spv.pushConstantAnon.vert",
430 "spv.subpass.frag",
431 "spv.specConstant.vert",
432 "spv.specConstant.comp",
433 "spv.specConstantComposite.vert",
434 "spv.specConstantOperations.vert",
435 "spv.specConstant.float16.comp",
436 "spv.specConstant.int16.comp",
437 "spv.specConstant.int8.comp",
438 "spv.storageBuffer.vert",
439 "spv.terminate.frag",
440 "spv.precise.tese",
441 "spv.precise.tesc",
442 "spv.volatileAtomic.comp",
443 "spv.vulkan100.subgroupArithmetic.comp",
444 "spv.vulkan100.subgroupPartitioned.comp",
445 "spv.xfb.vert",
446 "spv.xfb2.vert",
447 "spv.xfb3.vert",
448 "spv.samplerlessTextureFunctions.frag",
449 "spv.smBuiltins.vert",
450 "spv.smBuiltins.frag",
451 "spv.builtin.PrimitiveShadingRateEXT.vert",
452 "spv.builtin.ShadingRateEXT.frag",
453 })),
454 FileNameAsCustomTestSuffix
455 );
456
457 // Cases with deliberately unreachable code.
458 // By default the compiler will aggressively eliminate
459 // unreachable merges and continues.
460 INSTANTIATE_TEST_SUITE_P(
461 GlslWithDeadCode, CompileVulkanToSpirvDeadCodeElimTest,
462 ::testing::ValuesIn(std::vector<std::string>({
463 "spv.dead-after-continue.vert",
464 "spv.dead-after-discard.frag",
465 "spv.dead-after-return.vert",
466 "spv.dead-after-loop-break.vert",
467 "spv.dead-after-switch-break.vert",
468 "spv.dead-complex-continue-after-return.vert",
469 "spv.dead-complex-merge-after-return.vert",
470 })),
471 FileNameAsCustomTestSuffix
472 );
473
474 // clang-format off
475 INSTANTIATE_TEST_SUITE_P(
476 Glsl, CompileVulkanToDebugSpirvTest,
477 ::testing::ValuesIn(std::vector<std::string>({
478 "spv.pp.line.frag",
479 })),
480 FileNameAsCustomTestSuffix
481 );
482
483 // clang-format off
484 INSTANTIATE_TEST_SUITE_P(
485 Glsl, CompileVulkan1_1ToSpirvTest,
486 ::testing::ValuesIn(std::vector<std::string>({
487 "spv.1.3.8bitstorage-ubo.vert",
488 "spv.1.3.8bitstorage-ssbo.vert",
489 "spv.1.3.coopmat.comp",
490 "spv.deviceGroup.frag",
491 "spv.drawParams.vert",
492 "spv.int8.frag",
493 "spv.vulkan110.int16.frag",
494 "spv.int32.frag",
495 "spv.explicittypes.frag",
496 "spv.float32.frag",
497 "spv.float64.frag",
498 "spv.memoryScopeSemantics.comp",
499 "spv.memoryScopeSemantics_Error.comp",
500 "spv.multiView.frag",
501 "spv.RayGenShader11.rgen",
502 "spv.subgroup.frag",
503 "spv.subgroup.geom",
504 "spv.subgroup.tesc",
505 "spv.subgroup.tese",
506 "spv.subgroup.vert",
507 "spv.subgroupArithmetic.comp",
508 "spv.subgroupBasic.comp",
509 "spv.subgroupBallot.comp",
510 "spv.subgroupBallotNeg.comp",
511 "spv.subgroupClustered.comp",
512 "spv.subgroupClusteredNeg.comp",
513 "spv.subgroupPartitioned.comp",
514 "spv.subgroupShuffle.comp",
515 "spv.subgroupShuffleRelative.comp",
516 "spv.subgroupQuad.comp",
517 "spv.subgroupVote.comp",
518 "spv.subgroupExtendedTypesArithmetic.comp",
519 "spv.subgroupExtendedTypesArithmeticNeg.comp",
520 "spv.subgroupExtendedTypesBallot.comp",
521 "spv.subgroupExtendedTypesBallotNeg.comp",
522 "spv.subgroupExtendedTypesClustered.comp",
523 "spv.subgroupExtendedTypesClusteredNeg.comp",
524 "spv.subgroupExtendedTypesPartitioned.comp",
525 "spv.subgroupExtendedTypesPartitionedNeg.comp",
526 "spv.subgroupExtendedTypesShuffle.comp",
527 "spv.subgroupExtendedTypesShuffleNeg.comp",
528 "spv.subgroupExtendedTypesShuffleRelative.comp",
529 "spv.subgroupExtendedTypesShuffleRelativeNeg.comp",
530 "spv.subgroupExtendedTypesQuad.comp",
531 "spv.subgroupExtendedTypesQuadNeg.comp",
532 "spv.subgroupExtendedTypesVote.comp",
533 "spv.subgroupExtendedTypesVoteNeg.comp",
534 "spv.vulkan110.storageBuffer.vert",
535 })),
536 FileNameAsCustomTestSuffix
537 );
538
539 // clang-format off
540 INSTANTIATE_TEST_SUITE_P(
541 Glsl, CompileToSpirv14Test,
542 ::testing::ValuesIn(std::vector<std::string>({
543 "spv.1.4.LoopControl.frag",
544 "spv.1.4.NonWritable.frag",
545 "spv.1.4.OpEntryPoint.frag",
546 "spv.1.4.OpEntryPoint.opaqueParams.vert",
547 "spv.1.4.OpSelect.frag",
548 "spv.1.4.OpCopyLogical.comp",
549 "spv.1.4.OpCopyLogicalBool.comp",
550 "spv.1.4.OpCopyLogical.funcall.frag",
551 "spv.1.4.image.frag",
552 "spv.1.4.sparseTexture.frag",
553 "spv.1.4.texture.frag",
554 "spv.1.4.constructComposite.comp",
555 "spv.ext.AnyHitShader.rahit",
556 "spv.ext.AnyHitShader_Errors.rahit",
557 "spv.ext.ClosestHitShader.rchit",
558 "spv.ext.ClosestHitShader_Errors.rchit",
559 "spv.ext.IntersectShader.rint",
560 "spv.ext.IntersectShader_Errors.rint",
561 "spv.ext.MissShader.rmiss",
562 "spv.ext.MissShader_Errors.rmiss",
563 "spv.ext.RayPrimCull_Errors.rgen",
564 "spv.ext.RayCallable.rcall",
565 "spv.ext.RayCallable_Errors.rcall",
566 "spv.ext.RayConstants.rgen",
567 "spv.ext.RayGenShader.rgen",
568 "spv.ext.RayGenShader11.rgen",
569 "spv.ext.RayGenShaderArray.rgen",
570 "spv.ext.World3x4.rahit",
571 })),
572 FileNameAsCustomTestSuffix
573 );
574
575 // clang-format off
576 INSTANTIATE_TEST_SUITE_P(
577 Hlsl, HlslIoMap,
578 ::testing::ValuesIn(std::vector<IoMapData>{
579 { "spv.register.autoassign.frag", "main_ep", 5, 10, 0, 20, 30, true, false },
580 { "spv.register.noautoassign.frag", "main_ep", 5, 10, 0, 15, 30, false, false },
581 { "spv.register.autoassign-2.frag", "main", 5, 10, 0, 15, 30, true, true },
582 { "spv.register.subpass.frag", "main", 0, 20, 0, 0, 0, true, true },
583 { "spv.buffer.autoassign.frag", "main", 5, 10, 0, 15, 30, true, true },
584 { "spv.ssbo.autoassign.frag", "main", 5, 10, 0, 15, 30, true, true },
585 { "spv.ssboAlias.frag", "main", 0, 0, 0, 0, 83, true, false },
586 { "spv.rw.autoassign.frag", "main", 5, 10, 20, 15, 30, true, true },
587 { "spv.register.autoassign.rangetest.frag", "main",
588 glslang::TQualifier::layoutBindingEnd-2,
589 glslang::TQualifier::layoutBindingEnd+5,
590 20, 30, true, false },
591 }),
592 FileNameAsCustomTestSuffixIoMap
593 );
594
595 // clang-format off
596 INSTANTIATE_TEST_SUITE_P(
597 Hlsl, GlslIoMap,
598 ::testing::ValuesIn(std::vector<IoMapData>{
599 { "spv.glsl.register.autoassign.frag", "main", 5, 10, 0, 20, 30, true, false },
600 { "spv.glsl.register.noautoassign.frag", "main", 5, 10, 0, 15, 30, false, false },
601 }),
602 FileNameAsCustomTestSuffixIoMap
603 );
604
605 // clang-format off
606 INSTANTIATE_TEST_SUITE_P(
607 Glsl, CompileOpenGLToSpirvTest,
608 ::testing::ValuesIn(std::vector<std::string>({
609 "spv.460.frag",
610 "spv.460.vert",
611 "spv.460.comp",
612 "spv.atomic.comp",
613 "spv.atomicFloat.comp",
614 "spv.atomicFloat_Error.comp",
615 "spv.glFragColor.frag",
616 "spv.rankShift.comp",
617 "spv.specConst.vert",
618 "spv.specTexture.frag",
619 "spv.OVR_multiview.vert",
620 "spv.uniformInitializer.frag",
621 "spv.uniformInitializerSpecConstant.frag",
622 "spv.uniformInitializerStruct.frag",
623 "spv.xfbOffsetOnBlockMembersAssignment.vert",
624 "spv.xfbOffsetOnStructMembersAssignment.vert",
625 "spv.xfbOverlapOffsetCheckWithBlockAndMember.vert",
626 "spv.xfbStrideJustOnce.vert",
627 })),
628 FileNameAsCustomTestSuffix
629 );
630
631 INSTANTIATE_TEST_SUITE_P(
632 Glsl, VulkanSemantics,
633 ::testing::ValuesIn(std::vector<std::string>({
634 "vulkan.frag",
635 "vulkan.vert",
636 "vulkan.comp",
637 "samplerlessTextureFunctions.frag",
638 "spv.specConstArrayCheck.vert",
639 })),
640 FileNameAsCustomTestSuffix
641 );
642
643 INSTANTIATE_TEST_SUITE_P(
644 Glsl, OpenGLSemantics,
645 ::testing::ValuesIn(std::vector<std::string>({
646 "glspv.esversion.vert",
647 "glspv.version.frag",
648 "glspv.version.vert",
649 "glspv.frag",
650 "glspv.vert",
651 })),
652 FileNameAsCustomTestSuffix
653 );
654
655 INSTANTIATE_TEST_SUITE_P(
656 Glsl, VulkanAstSemantics,
657 ::testing::ValuesIn(std::vector<std::string>({
658 "vulkan.ast.vert",
659 })),
660 FileNameAsCustomTestSuffix
661 );
662
663 INSTANTIATE_TEST_SUITE_P(
664 Glsl, CompileVulkanToSpirvTestAMD,
665 ::testing::ValuesIn(std::vector<std::string>({
666 "spv.16bitxfb.vert",
667 "spv.float16.frag",
668 "spv.float16Fetch.frag",
669 "spv.imageLoadStoreLod.frag",
670 "spv.int16.frag",
671 "spv.int16.amd.frag",
672 "spv.shaderBallotAMD.comp",
673 "spv.shaderFragMaskAMD.frag",
674 "spv.textureGatherBiasLod.frag",
675 })),
676 FileNameAsCustomTestSuffix
677 );
678
679 INSTANTIATE_TEST_SUITE_P(
680 Glsl, CompileVulkanToSpirvTestNV,
681 ::testing::ValuesIn(std::vector<std::string>({
682 "spv.sampleMaskOverrideCoverage.frag",
683 "spv.GeometryShaderPassthrough.geom",
684 "spv.viewportArray2.vert",
685 "spv.viewportArray2.tesc",
686 "spv.stereoViewRendering.vert",
687 "spv.stereoViewRendering.tesc",
688 "spv.multiviewPerViewAttributes.vert",
689 "spv.multiviewPerViewAttributes.tesc",
690 "spv.atomicInt64.comp",
691 "spv.shadingRate.frag",
692 "spv.RayGenShader.rgen",
693 "spv.RayGenShaderArray.rgen",
694 "spv.RayGenShader_Errors.rgen",
695 "spv.RayConstants.rgen",
696 "spv.IntersectShader.rint",
697 "spv.IntersectShader_Errors.rint",
698 "spv.AnyHitShader.rahit",
699 "spv.AnyHitShader_Errors.rahit",
700 "spv.ClosestHitShader.rchit",
701 "spv.ClosestHitShader_Errors.rchit",
702 "spv.MissShader.rmiss",
703 "spv.MissShader_Errors.rmiss",
704 "spv.RayCallable.rcall",
705 "spv.RayCallable_Errors.rcall",
706 "spv.fragmentShaderBarycentric.frag",
707 "spv.fragmentShaderBarycentric2.frag",
708 "spv.computeShaderDerivatives.comp",
709 "spv.computeShaderDerivatives2.comp",
710 "spv.shaderImageFootprint.frag",
711 "spv.meshShaderBuiltins.mesh",
712 "spv.meshShaderUserDefined.mesh",
713 "spv.meshShaderPerViewBuiltins.mesh",
714 "spv.meshShaderPerViewUserDefined.mesh",
715 "spv.meshShaderPerView_Errors.mesh",
716 "spv.meshShaderSharedMem.mesh",
717 "spv.meshShaderTaskMem.mesh",
718 "spv.320.meshShaderUserDefined.mesh",
719 "spv.meshShaderRedeclBuiltins.mesh",
720 "spv.meshShaderRedeclPerViewBuiltins.mesh",
721 "spv.meshTaskShader.task",
722 "spv.perprimitiveNV.frag",
723 })),
724 FileNameAsCustomTestSuffix
725 );
726
727 INSTANTIATE_TEST_SUITE_P(
728 Glsl, CompileUpgradeTextureToSampledTextureAndDropSamplersTest,
729 ::testing::ValuesIn(std::vector<std::string>({
730 "spv.texture.sampler.transform.frag",
731 })),
732 FileNameAsCustomTestSuffix
733 );
734 // clang-format on
735
736 } // anonymous namespace
737 } // namespace glslangtest