SPIRV-Cross/shaders/vulkan/comp/array-of-buffer-reference.nocompat.vk.comp
Hans-Kristian Arntzen 2cc374a0c8 GLSL: Implement GL_EXT_buffer_reference.
Buffer objects can contain arbitrary pointers to blocks.
We can also implement ConvertPtrToU and ConvertUToPtr.
The latter can cast a uint64_t to any type as it pleases,
so we will need to generate fake buffer reference blocks to be able to
cast the type.
2019-04-26 11:43:51 +02:00

24 lines
401 B
Plaintext

#version 450
#extension GL_EXT_buffer_reference : require
layout(local_size_x = 1) in;
layout(buffer_reference) buffer Block
{
float v;
};
layout(std140, set = 0, binding = 0) uniform UBO
{
Block blocks[4];
} ubo;
void main()
{
Block blocks[4];
blocks[0] = ubo.blocks[0];
blocks[1] = ubo.blocks[1];
blocks[2] = ubo.blocks[2];
blocks[3] = ubo.blocks[3];
blocks[gl_WorkGroupID.x].v = 20.0;
}