From 46e07313f9d02f2b887955f24241e07df87a5d8d Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Tue, 24 Apr 2018 13:29:12 -0600 Subject: [PATCH] GLSL/Vulkan: Warn about arrays of arrays of resources that need bindings. Initial way of addressing #1362. --- Test/baseResults/spv.AofA.frag.out | 2 ++ glslang/MachineIndependent/ParseHelper.cpp | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/Test/baseResults/spv.AofA.frag.out b/Test/baseResults/spv.AofA.frag.out index 88a313bd..aaa9a49c 100644 --- a/Test/baseResults/spv.AofA.frag.out +++ b/Test/baseResults/spv.AofA.frag.out @@ -1,4 +1,6 @@ spv.AofA.frag +WARNING: 0:6: '[][]' : Generating SPIR-V array-of-arrays, but Vulkan only supports single array level for this resource + // Module Version 10000 // Generated by (magic number): 80006 // Id's are bound by 104 diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 4f81e215..cf808f11 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -4791,6 +4791,14 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) } } + // some things can't have arrays of arrays + if (type.isArrayOfArrays()) { + if (spvVersion.vulkan > 0) { + if (type.isOpaque() || (type.getQualifier().isUniformOrBuffer() && type.getBasicType() == EbtBlock)) + warn(loc, "Generating SPIR-V array-of-arrays, but Vulkan only supports single array level for this resource", "[][]", ""); + } + } + // "The offset qualifier can only be used on block members of blocks..." if (qualifier.hasOffset()) { if (type.getBasicType() == EbtBlock)