SPIRV-Cross/shaders-msl/tesc/load-control-point-array-of-struct.tesc
Hans-Kristian Arntzen 27d6d45671 MSL: Rewrite tessellation_access_chain.
To support loading array of array properly in tessellation, we need a
rewrite of how tessellation access chains are handled.

The major change is to remove the implicit unflatten step inside
access_chain which does not take into account the case where you load
directly from a control point array variable.

We defer unflatten step until OpLoad time instead.
This fixes cases where we load array of {array,matrix,struct}.

Removes the hacky path for MSL access chain index workaround.
2019-10-26 16:10:12 +02:00

22 lines
448 B
GLSL

#version 450
layout(vertices = 4) out;
struct VertexData
{
mat4 a;
vec4 b[2];
vec4 c;
};
layout(location = 0) in VertexData vInputs[gl_MaxPatchVertices];
layout(location = 0) out vec4 vOutputs[4];
void main()
{
VertexData tmp[gl_MaxPatchVertices] = vInputs;
VertexData tmp_single = vInputs[gl_InvocationID ^ 1];
vOutputs[gl_InvocationID] = tmp[gl_InvocationID].a[1] + tmp[gl_InvocationID].b[1] + tmp[gl_InvocationID].c + tmp_single.c;
}