glslang/Test/rayQuery-no-cse.rgen

36 lines
978 B
Plaintext
Raw Permalink Normal View History

#version 460
#extension GL_NV_ray_tracing : enable
#extension GL_EXT_ray_query : enable
struct Ray
{
vec3 pos;
float tmin;
vec3 dir;
float tmax;
};
2020-03-26 22:51:18 +00:00
layout(binding = 0, set = 0) uniform accelerationStructureEXT rtas;
layout(std430, set = 0, binding = 2) buffer Rays { Ray rays[]; };
uint launchIndex()
{
return gl_LaunchIDNV.z*gl_LaunchSizeNV.x*gl_LaunchSizeNV.y + gl_LaunchIDNV.y*gl_LaunchSizeNV.x + gl_LaunchIDNV.x;
}
void doInitialize(rayQueryEXT rayQuery, Ray ray)
{
rayQueryInitializeEXT(rayQuery, rtas, gl_RayFlagsNoneEXT, gl_RayFlagsCullBackFacingTrianglesEXT, ray.pos, ray.tmin, ray.dir, ray.tmax);
}
void main()
{
uint index = launchIndex();
Ray ray = rays[index];
rayQueryEXT rayQuery1;
rayQueryEXT rayQuery2;
doInitialize(rayQuery1, ray);
rayQueryInitializeEXT(rayQuery1, rtas, gl_RayFlagsOpaqueEXT, gl_RayFlagsCullFrontFacingTrianglesEXT, ray.pos, ray.tmin, ray.dir, ray.tmax);
doInitialize(rayQuery2, ray);
}