yum-mirror/glslang

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

Diego NovilloAdd semantic check for cooperative vector loads/stores. (#4071)1d47ffa8

main
1.1 KiB40 linesraw
1#version 450 core
2#extension GL_NV_gpu_shader5 : require
3#extension GL_NV_cooperative_vector : require
4
5layout(local_size_x = 8, local_size_y = 8) in;
6layout(binding = 0, rgba8) uniform image2D image;
7
8layout(std430, binding = 1) buffer MatrixBuffer
9{
10    float matrix[];
11};
12
13shared float sharedArray[16];
14
15void main()
16{
17    // Test error: storing to local variable (should fail)
18    float vecOut[4];
19    coopvecNV<float, 4> coopVecOut;
20    coopVecStoreNV(coopVecOut, vecOut, 0);  // ERROR: vecOut is local
21
22    // Test error: loading from local variable (should fail)
23    float vecIn[4];
24    coopvecNV<float, 4> coopVecIn;
25    coopVecLoadNV(coopVecIn, vecIn, 0);     // ERROR: vecIn is local
26
27    // These should work correctly:
28    // Store to buffer storage
29    coopVecStoreNV(coopVecOut, matrix, 0);
30
31    // Load from buffer storage
32    coopVecLoadNV(coopVecIn, matrix, 0);
33
34    // Store to shared storage
35    coopVecStoreNV(coopVecOut, sharedArray, 0);
36
37    // Load from shared storage
38    coopVecLoadNV(coopVecIn, sharedArray, 0);
39}
40