SPIRV-Cross/shaders-msl/vert/resource-arrays.ios.vert
Chip Davis 3a9af9681c MSL: Expand arrays of buffers passed as input.
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.
2018-09-26 20:48:09 -05:00

22 lines
382 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 main()
{
storage[0].baz = uvec4(constants[3].foo);
storage[1].quux = imageLoad(images[2], ivec2(constants[1].bar)).xy;
}