SPIRV-Cross/reference/opt/shaders/vulkan/rgen/execute_callable.nocompat.vk.rgen.vk
Hans-Kristian Arntzen 03d93abc1a Deal with case where a variable is dominated by inner part of a loop.
There is a risk that we try to preserve a loop variable through multiple
iterations, even though the dominating block is inside a loop.

Fix this by analyzing if a block starts off by writing to a variable. In
that case, there cannot be any preservation going on. If we don't, pretend the
loop header is reading the variable, which moves the variable to an
appropriate scope.
2019-06-06 11:11:44 +02:00

16 lines
492 B
Plaintext

#version 460
#extension GL_NV_ray_tracing : require
layout(set = 0, binding = 0) uniform accelerationStructureNV as;
layout(set = 0, binding = 1, rgba32f) uniform writeonly image2D image;
layout(location = 0) rayPayloadNV vec4 payload;
layout(location = 0) callableDataNV float blend;
void main()
{
traceNV(as, 1u, 255u, 0u, 0u, 0u, vec3(0.0), 0.0, vec3(0.0, 0.0, -1.0), 100.0, 0);
executeCallableNV(0u, 0);
imageStore(image, ivec2(gl_LaunchIDNV.xy), payload + vec4(blend));
}