3a9af9681c
Even as of Metal 2.1, MSL still doesn't support arrays of buffers directly. Therefore, we must manually expand them. In the prologue, we define arrays holding the argument pointers; these arrays are what the transpiled code ends up referencing. We might be able to do similar things for textures and samplers prior to MSL 2.0. Speaking of which, also enable texture arrays on iOS MSL 1.2.
27 lines
412 B
GLSL
27 lines
412 B
GLSL
#version 450
|
|
|
|
layout(constant_id = 0) const int arraySize = 3;
|
|
|
|
layout(binding = 0, rgba32i) uniform iimage2D images[arraySize];
|
|
uniform constant_block
|
|
{
|
|
vec4 foo;
|
|
int bar;
|
|
} constants[4];
|
|
buffer storage_block
|
|
{
|
|
uvec4 baz;
|
|
ivec2 quux;
|
|
} storage[2];
|
|
|
|
void doWork()
|
|
{
|
|
storage[0].baz = uvec4(constants[3].foo);
|
|
storage[1].quux = imageLoad(images[2], ivec2(constants[1].bar)).xy;
|
|
}
|
|
|
|
void main()
|
|
{
|
|
doWork();
|
|
}
|