Fix missing check for purity on ray tracing builtins

This commit is contained in:
Patrick Mours 2019-03-26 14:16:38 +01:00
parent c96bab0659
commit 90c91e4f23
2 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,18 @@
#version 460
#extension GL_NV_ray_tracing : require
layout(set = 0, binding = 1) uniform accelerationStructureNV as;
layout(location = 0) rayPayloadNV float payload;
float pure_call(vec2 launchID, vec2 launchSize)
{
vec3 origin = vec3(launchID.x / launchSize.x, launchID.y / launchSize.y, 1.0);
vec3 direction = vec3(0.0, 0.0, -1.0);
traceNV(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0);
return 0.0;
}
void main()
{
pure_call(vec2(gl_LaunchIDNV.xy), vec2(gl_LaunchSizeNV.xy));
}

View File

@ -144,6 +144,14 @@ bool Compiler::block_is_pure(const SPIRBlock &block)
case OpMemoryBarrier:
return false;
// Ray tracing builtins are impure.
case OpReportIntersectionNV:
case OpIgnoreIntersectionNV:
case OpTerminateRayNV:
case OpTraceNV:
case OpExecuteCallableNV:
return false;
// OpExtInst is potentially impure depending on extension, but GLSL builtins are at least pure.
default: