From a77d22bf3bfc3098b01e4886c3a63fb751edc704 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Mon, 21 Jul 2025 09:31:31 -0700 Subject: Fix C-style casts in GLSL pointer cast operations (#7841) * Initial plan * Fix C-style casts in GLSL pointer cast operations Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> --- tests/language-feature/pointer-cast-glsl.slang | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/language-feature/pointer-cast-glsl.slang (limited to 'tests') diff --git a/tests/language-feature/pointer-cast-glsl.slang b/tests/language-feature/pointer-cast-glsl.slang new file mode 100644 index 000000000..9e51c4328 --- /dev/null +++ b/tests/language-feature/pointer-cast-glsl.slang @@ -0,0 +1,14 @@ +//TEST:SIMPLE(filecheck=GLSL):-target glsl -entry main + +// Test that pointer casts in GLSL generate constructor-style casts instead of C-style casts +// This addresses issue https://github.com/shader-slang/slang/issues/7838 + +//GLSL: BufferPointer__S1_2(address_0) + +[shader("vertex")] +float4 main(uint vertexID : SV_VertexID, uint64_t address) : SV_Position +{ + // This should generate BufferPointer(address) instead of (BufferPointer)address in GLSL + let buffer = ConstBufferPointer(address); + return buffer[vertexID]; +} \ No newline at end of file -- cgit v1.2.3