mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
37 lines
1,015 B
Text
37 lines
1,015 B
Text
#include <metal_stdlib>
|
|
using namespace metal;
|
|
struct xlatMtlShaderInput {
|
|
float2 gl_PointCoord [[point_coord]];
|
|
bool gl_FrontFacing [[front_facing]];
|
|
float4 gl_FragCoord [[position]];
|
|
half4 uv;
|
|
};
|
|
struct xlatMtlShaderOutput {
|
|
half4 _fragData [[color(0)]];
|
|
};
|
|
struct xlatMtlShaderUniform {
|
|
};
|
|
fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
|
|
{
|
|
xlatMtlShaderOutput _mtl_o;
|
|
half4 c_1;
|
|
c_1 = half4(((float4)_mtl_i.uv + _mtl_i.gl_FragCoord));
|
|
float tmpvar_2;
|
|
if (_mtl_i.gl_FrontFacing) {
|
|
tmpvar_2 = 1.0;
|
|
} else {
|
|
tmpvar_2 = 0.0;
|
|
};
|
|
c_1.x = (c_1.x + (half)tmpvar_2);
|
|
c_1.xy = half2(((float2)c_1.xy + _mtl_i.gl_PointCoord));
|
|
_mtl_o._fragData = c_1;
|
|
return _mtl_o;
|
|
}
|
|
|
|
|
|
// stats: 5 alu 0 tex 1 flow
|
|
// inputs: 4
|
|
// #0: gl_PointCoord (high float) 2x1 [-1] loc 23
|
|
// #1: gl_FrontFacing (low bool) 1x1 [-1] loc 22
|
|
// #2: gl_FragCoord (high float) 4x1 [-1] loc 0
|
|
// #3: uv (medium float) 4x1 [-1]
|