I don’t understand why my RTX 2070 crashes when I cast rays in closest hit shader recursively.
rayPayloadInNV RayPayload PrimaryRay;
layout(location = 1) rayPayloadNV RayPayload PrimaryRay2;
void main() {
PrimaryRay.color = vec4(1.0);
if (PrimaryRay.depth + 1 < 5) {
const uint flags = gl_RayFlagsOpaqueNV;
const uint cullMask = 0xFF;
const uint sbtRecordOffset = 0;
const uint sbtRecordStride = 1;
const uint missIndex = 0;
const float tmin = 0.0f;
const float tmax = 1000000;
const int payloadLocation = 1;
vec3 p = gl_WorldRayOriginNV + gl_WorldRayDirectionNV * gl_HitTNV;
vec3 direction = reflect(gl_WorldRayDirectionNV, normal);
vec3 origin = p + normal * 0.01;
PrimaryRay2.depth = PrimaryRay.depth + 1;
traceNV(
Scene,
flags,
cullMask,
sbtRecordOffset,
sbtRecordStride,
missIndex,
origin,
tmin,
direction,
tmax,
payloadLocation
);
PrimaryRay.color += PrimaryRay2.color;
}
}
Can somebody help me please.