SPIRV-Cross/reference/opt/shaders-msl/frag/barycentric-nv.msl22.frag
Hans-Kristian Arntzen d1479f871a MSL: Do not generate UnsafeArray<> for any array inside buffer objects.
This avoids a lot of huge code changes.
Arrays generally cannot be copied in and out of buffers, at least no
compiler frontend seems to do it.

Also avoids a lot of issues surrounding packed vectors and matrices.
2019-10-24 12:22:30 +02:00

29 lines
615 B
GLSL

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct Vertices
{
float2 uvs[1];
};
struct main0_out
{
float2 value [[color(0)]];
};
struct main0_in
{
float3 gl_BaryCoordNV [[barycentric_coord, center_perspective]];
};
fragment main0_out main0(main0_in in [[stage_in]], const device Vertices& _19 [[buffer(0)]], uint gl_PrimitiveID [[primitive_id]])
{
main0_out out = {};
int _23 = 3 * int(gl_PrimitiveID);
out.value = ((_19.uvs[_23] * in.gl_BaryCoordNV.x) + (_19.uvs[_23 + 1] * in.gl_BaryCoordNV.y)) + (_19.uvs[_23 + 2] * in.gl_BaryCoordNV.z);
return out;
}