SPIRV-Cross/reference/shaders/vulkan/rgen/ray_tracing.khr.spv14.nocompat.vk.rgen.vk

18 lines
629 B
Plaintext
Raw Normal View History

#version 460
#extension GL_EXT_ray_tracing : require
layout(set = 0, binding = 1) uniform accelerationStructureEXT as;
layout(location = 0) rayPayloadEXT float payload;
layout(set = 0, binding = 0, rgba8) uniform writeonly image2D image;
void main()
{
vec4 col = vec4(0.0, 0.0, 0.0, 1.0);
vec3 origin = vec3(float(gl_LaunchIDEXT.x) / float(gl_LaunchSizeEXT.x), float(gl_LaunchIDEXT.y) / float(gl_LaunchSizeEXT.y), 1.0);
vec3 direction = vec3(0.0, 0.0, -1.0);
traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0);
col.y = payload;
imageStore(image, ivec2(gl_LaunchIDEXT.xy), col);
}