require constant committed argument in rayQueryIs{Sphere,LSS}HitNV
GlslangToSpv reads the committed operand of rayQueryIsSphereHitNV and
rayQueryIsLSSHitNV with getAsConstantUnion(), like the other ray query
intersection getters, but builtInOpCheck left both out of the list that
requires it to be a compile-time constant. A non-constant committed
argument was accepted and crashed SPIR-V generation on a null
TIntermConstantUnion.
Add the two ops to the existing check.
diff --git a/Test/baseResults/spv.nv.lss-committed.Error.rgen.out b/Test/baseResults/spv.nv.lss-committed.Error.rgen.out
new file mode 100644
index 0000000..f467800
--- /dev/null
+++ b/Test/baseResults/spv.nv.lss-committed.Error.rgen.out
@@ -0,0 +1,7 @@
+spv.nv.lss-committed.Error.rgen
+ERROR: 0:16: 'committed' : argument must be compile-time constant
+ERROR: 0:17: 'committed' : argument must be compile-time constant
+ERROR: 2 compilation errors. No code generated.
+
+
+SPIR-V is not generated for failed compile or link
diff --git a/Test/spv.nv.lss-committed.Error.rgen b/Test/spv.nv.lss-committed.Error.rgen
new file mode 100644
index 0000000..7c1c817
--- /dev/null
+++ b/Test/spv.nv.lss-committed.Error.rgen
@@ -0,0 +1,18 @@
+#version 460
+#extension GL_EXT_ray_tracing : enable
+#extension GL_NV_linear_swept_spheres : enable
+#extension GL_EXT_ray_query : enable
+
+layout(binding = 0) uniform accelerationStructureEXT rtas;
+layout(binding = 1) buffer Log { uint x; };
+
+void main()
+{
+ rayQueryEXT rq;
+ bool committed = x != 0;
+
+ rayQueryInitializeEXT(rq, rtas, gl_RayFlagsOpaqueEXT, 0xFF, vec3(0.0), 0.0, vec3(1.0), 1.0);
+
+ bool isSphereHit = rayQueryIsSphereHitNV(rq, committed);
+ bool isLSSHit = rayQueryIsLSSHitNV(rq, committed);
+}
diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp
index 35980aa..9392c5f 100644
--- a/glslang/MachineIndependent/ParseHelper.cpp
+++ b/glslang/MachineIndependent/ParseHelper.cpp
@@ -3727,6 +3727,8 @@
case EOpRayQueryGetIntersectionLSSHitValueNV:
case EOpRayQueryGetIntersectionLSSPositionsNV:
case EOpRayQueryGetIntersectionLSSRadiiNV:
+ case EOpRayQueryIsSphereHitNV:
+ case EOpRayQueryIsLSSHitNV:
if (!(*argp)[1]->getAsConstantUnion())
error(loc, "argument must be compile-time constant", "committed", "");
break;
diff --git a/gtests/Spv.FromFile.cpp b/gtests/Spv.FromFile.cpp
index 7709c2a..f276898 100644
--- a/gtests/Spv.FromFile.cpp
+++ b/gtests/Spv.FromFile.cpp
@@ -1018,6 +1018,7 @@
"spv.nv.lss-allops.frag",
"spv.nv.lss-spheregeomcap.rgen",
"spv.nv.lss-lssgeomcap.rgen",
+ "spv.nv.lss-committed.Error.rgen",
// SPV_EXT_descriptor_heap