If I have a struct in the metal shader language:
How do I access individual struct (like float2
) elements and flip their order?
const float2 sampledCameraPoint = cameraSamplePatternBuffer[vertexID]; // (has x and y)
const float2 flipped = float2(?, ?) // how to get (sampledCameraPoint.y, sampledCameraPoint.x)?
You can access the elements using x
, y
etc, so this should work:
float2 flipped = otherFloat2.yx;