d1479f871a
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.
32 lines
703 B
GLSL
32 lines
703 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 prim = int(gl_PrimitiveID);
|
|
float2 uv0 = _19.uvs[(3 * prim) + 0];
|
|
float2 uv1 = _19.uvs[(3 * prim) + 1];
|
|
float2 uv2 = _19.uvs[(3 * prim) + 2];
|
|
out.value = ((uv0 * in.gl_BaryCoordNV.x) + (uv1 * in.gl_BaryCoordNV.y)) + (uv2 * in.gl_BaryCoordNV.z);
|
|
return out;
|
|
}
|
|
|