From 5280ca81025d42239fec492eb72d38606308751a Mon Sep 17 00:00:00 2001 From: "Harsh Aggarwal (NVIDIA)" Date: Mon, 26 May 2025 23:52:45 +0530 Subject: Fix operator precedence in OptiX ray payload pointer casting which broke due to (#6326) (#7194) * Fix operator precedence in OptiX ray payload pointer casting Added extra parentheses around the cast to ensure proper operator precedence when dereferencing the OptiX ray payload pointer. This fixes the issue where the compiler was treating the expression as (RayPayload_0 *)getOptiXRayPayloadPtr()->color_0 instead of ((RayPayload_0 *)getOptiXRayPayloadPtr())->color_0. Error: nvrtc 12.9: tests/cuda/optix-cluster.slang(17): error : expression must have pointer-to-class type but it has type "void *" nvrtc 12.9: note : (RayPayload_0 *)getOptiXRayPayloadPtr()->color_0 = color_1; nvrtc 12.9: note : ^ Tested using: ./build/Debug/bin/slangc -target ptx -Xnvrtc -I"/home/haaggarwal/NVIDIA-OptiX-SDK-9.0.0-linux64-x86_64/include" -DSLANG_CUDA_ENABLE_OPTIX -entry closestHitShaderA ./tests/cuda/optix-cluster.slang * Fix Check --- tests/cuda/optix-ignore-hit.slang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/cuda/optix-ignore-hit.slang b/tests/cuda/optix-ignore-hit.slang index 8bb128ae0..54cc301bb 100644 --- a/tests/cuda/optix-ignore-hit.slang +++ b/tests/cuda/optix-ignore-hit.slang @@ -1,6 +1,6 @@ // optix-ignore-hit.slang //TEST:SIMPLE(filecheck=CHECK): -target cuda -entry anyHitShader -//CHECK: HitBuffer_insert_0((HitBuffer_0 *)getOptiXRayPayloadPtr(), hit_0.t_0); +//CHECK: HitBuffer_insert_0(((HitBuffer_0 *)getOptiXRayPayloadPtr()), hit_0.t_0); //CHECK: optixIgnoreIntersection -- cgit v1.2.3