I am using [[clip_distance]] in the VertexOut as below in a metal shader:
struct VertexOut {
float4 position [[position]];
float4 color;
float clip_distance [[clip_distance]];
};
It is working fine for single plane. But my requirement is multiple planes, I want to clip from 2 sides.
In this reference post https://developer.apple.com/forums/thread/69701, that we can have multiple clip planes as array as below:
float clip_distance [[clip_distance]] [2];
But when I use it, xcode gives error regards to structure of Vertex Out in the fragment function as below
Type 'VertexOut' is not valid for attribute 'stage_in'
Is there any structure change for this? Can anyone please help with a solution for using multiple clip planes?