yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

ArielG-NVDrain sink when single-argument constructor call fail (#7883)8a15efb37

master
1.1 KiB28 linesraw
1//TEST:SIMPLE(filecheck=GLSL):-target glsl -entry computeMain
2//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -compute -emit-spirv-via-glsl
3
4// Test that pointer casts in GLSL generate constructor-style casts instead of C-style casts
5// This addresses issue https://github.com/shader-slang/slang/issues/7838
6
7//TEST_INPUT: set address = ubuffer(data=[1 2 3 4 5 6 7 8], stride=4);
8uniform uint64_t address;
9//TEST_INPUT: set pointer = ubuffer(data=[1 2 3 4 5 6 7 8], stride=4);
10uniform int* pointer;
11//TEST_INPUT: set outputBuffer = out ubuffer(data=[0 0 0 0 0 0 0 0], stride=4);
12RWStructuredBuffer<int> outputBuffer;
13
14// Ensure we have a proper GLSL supported ctor call for BDA
15//GLSL: BufferPointer__{{[a-zA-Z0-9_]+}}({{[a-zA-Z0-9_]+}}_0)
16
17// Ensure our GLSL code compiles and runs
18//BUF: 2
19
20[shader("compute")]
21[numthreads(1,1,1)]
22void computeMain() : SV_Position
23{
24    // This should generate BufferPointer(address) instead of (BufferPointer)address in GLSL
25    let buffer1 = ConstBufferPointer<int>(address);
26    let buffer2 = ConstBufferPointer<int>(pointer);
27    outputBuffer[0] = buffer1[0] + buffer2[0];
28}