Skip to content

Commit 6a6e311

Browse files
authored
Merge pull request KhronosGroup#2388 from Tobski/rq-initialization-error
Error when initializing rayQuery with assignment
2 parents dc1b976 + 395bce6 commit 6a6e311

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
rayQuery-initialization.Error.comp
2+
ERROR: 0:7: '=' : ray queries can only be initialized by using the rayQueryInitializeEXT intrinsic: bar
3+
ERROR: 1 compilation errors. No code generated.
4+
5+
6+
SPIR-V is not generated for failed compile or link
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#version 460
2+
3+
#extension GL_EXT_ray_query : enable
4+
5+
void main () {
6+
rayQueryEXT foo;
7+
rayQueryEXT bar = foo;
8+
}

glslang/MachineIndependent/ParseHelper.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6561,6 +6561,12 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden
65616561
type.copyArrayInnerSizes(publicType.arraySizes);
65626562
arrayOfArrayVersionCheck(loc, type.getArraySizes());
65636563

6564+
if (initializer) {
6565+
if (type.getBasicType() == EbtRayQuery) {
6566+
error(loc, "ray queries can only be initialized by using the rayQueryInitializeEXT intrinsic:", "=", identifier.c_str());
6567+
}
6568+
}
6569+
65646570
if (type.isCoopMat()) {
65656571
intermediate.setUseVulkanMemoryModel();
65666572
intermediate.setUseStorageBuffer();

gtests/Spv.FromFile.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//
22
// Copyright (C) 2016 Google, Inc.
33
// Copyright (C) 2019 ARM Limited.
4+
// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
45
//
56
// All rights reserved.
67
//
@@ -238,6 +239,7 @@ INSTANTIATE_TEST_SUITE_P(
238239
"rayQuery-committed.Error.rgen",
239240
"rayQuery-allOps.comp",
240241
"rayQuery-allOps.frag",
242+
"rayQuery-initialization.Error.comp",
241243
"spv.set.vert",
242244
"spv.double.comp",
243245
"spv.100ops.frag",

0 commit comments

Comments
 (0)