From ed7a097d194bfdedf5fbf65ba2a42263c3f71e0b Mon Sep 17 00:00:00 2001 From: Tobias Hector Date: Thu, 3 Sep 2020 15:14:14 +0100 Subject: [PATCH 1/2] Error when initializing rayQuery with assignment --- Test/baseResults/rayQuery-initialization.Error.comp.out | 6 ++++++ Test/rayQuery-initialization.Error.comp | 8 ++++++++ glslang/MachineIndependent/ParseHelper.cpp | 6 ++++++ gtests/Spv.FromFile.cpp | 1 + 4 files changed, 21 insertions(+) create mode 100644 Test/baseResults/rayQuery-initialization.Error.comp.out create mode 100644 Test/rayQuery-initialization.Error.comp diff --git a/Test/baseResults/rayQuery-initialization.Error.comp.out b/Test/baseResults/rayQuery-initialization.Error.comp.out new file mode 100644 index 00000000..6ce7fac7 --- /dev/null +++ b/Test/baseResults/rayQuery-initialization.Error.comp.out @@ -0,0 +1,6 @@ +rayQuery-initialization.Error.comp +ERROR: 0:7: '=' : ray queries can only be initialized by using the rayQueryInitializeEXT intrinsic: bar +ERROR: 1 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/Test/rayQuery-initialization.Error.comp b/Test/rayQuery-initialization.Error.comp new file mode 100644 index 00000000..1c7757cf --- /dev/null +++ b/Test/rayQuery-initialization.Error.comp @@ -0,0 +1,8 @@ +#version 460 + +#extension GL_EXT_ray_query : enable + +void main () { + rayQueryEXT foo; + rayQueryEXT bar = foo; +} \ No newline at end of file diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 045c8f3e..4d202260 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -6561,6 +6561,12 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden type.copyArrayInnerSizes(publicType.arraySizes); arrayOfArrayVersionCheck(loc, type.getArraySizes()); + if (initializer) { + if (type.getBasicType() == EbtRayQuery) { + error(loc, "ray queries can only be initialized by using the rayQueryInitializeEXT intrinsic:", "=", identifier.c_str()); + } + } + if (type.isCoopMat()) { intermediate.setUseVulkanMemoryModel(); intermediate.setUseStorageBuffer(); diff --git a/gtests/Spv.FromFile.cpp b/gtests/Spv.FromFile.cpp index 0efa77c3..b4231223 100644 --- a/gtests/Spv.FromFile.cpp +++ b/gtests/Spv.FromFile.cpp @@ -238,6 +238,7 @@ INSTANTIATE_TEST_SUITE_P( "rayQuery-committed.Error.rgen", "rayQuery-allOps.comp", "rayQuery-allOps.frag", + "rayQuery-initialization.Error.comp", "spv.set.vert", "spv.double.comp", "spv.100ops.frag", From 395bce6c859e80e8587fd0ba2eb4a4a991f28b51 Mon Sep 17 00:00:00 2001 From: Tobias Hector Date: Tue, 8 Sep 2020 11:10:27 +0100 Subject: [PATCH 2/2] Added missing copyright amendment --- gtests/Spv.FromFile.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/gtests/Spv.FromFile.cpp b/gtests/Spv.FromFile.cpp index b4231223..309fe756 100644 --- a/gtests/Spv.FromFile.cpp +++ b/gtests/Spv.FromFile.cpp @@ -1,6 +1,7 @@ // // Copyright (C) 2016 Google, Inc. // Copyright (C) 2019 ARM Limited. +// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved. // // All rights reserved. //