mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
53 lines
2 KiB
Text
53 lines
2 KiB
Text
#include <metal_stdlib>
|
|
using namespace metal;
|
|
inline float4x4 _xlcast_float4x4(half4x4 v) { return float4x4(float4(v[0]), float4(v[1]), float4(v[2]), float4(v[3])); }
|
|
inline float3x3 _xlcast_float3x3(half3x3 v) { return float3x3(float3(v[0]), float3(v[1]), float3(v[2])); }
|
|
inline float2x2 _xlcast_float2x2(half2x2 v) { return float2x2(float2(v[0]), float2(v[1])); }
|
|
inline half4x4 _xlcast_half4x4(float4x4 v) { return half4x4(half4(v[0]), half4(v[1]), half4(v[2]), half4(v[3])); }
|
|
inline half3x3 _xlcast_half3x3(float3x3 v) { return half3x3(half3(v[0]), half3(v[1]), half3(v[2])); }
|
|
inline half2x2 _xlcast_half2x2(float2x2 v) { return half2x2(half2(v[0]), half2(v[1])); }
|
|
struct xlatMtlShaderInput {
|
|
};
|
|
struct xlatMtlShaderOutput {
|
|
float4 gl_Position [[position]];
|
|
};
|
|
struct xlatMtlShaderUniform {
|
|
float4x4 uniMat4F;
|
|
half4x4 uniMat4H;
|
|
half3x3 uniMat3H;
|
|
float2x2 uniMat2F;
|
|
half2x2 uniMat2H;
|
|
};
|
|
vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
|
|
{
|
|
xlatMtlShaderOutput _mtl_o;
|
|
float2x2 htof2_1;
|
|
float3x3 htof3_2;
|
|
float4x4 htof4_3;
|
|
half2x2 ftoh2_4;
|
|
half4x4 ftoh4_5;
|
|
float4 r_6;
|
|
r_6.yzw = float3(0.0, 0.0, 0.0);
|
|
ftoh4_5 = _xlcast_half4x4(_mtl_u.uniMat4F);
|
|
r_6.x = float(ftoh4_5[0].x);
|
|
r_6.x = (r_6.x + (float)ftoh4_5[0].x);
|
|
ftoh2_4 = _xlcast_half2x2(_mtl_u.uniMat2F);
|
|
r_6.x = (r_6.x + (float)ftoh2_4[0].x);
|
|
htof4_3 = _xlcast_float4x4(_mtl_u.uniMat4H);
|
|
r_6.x = (r_6.x + htof4_3[0].x);
|
|
htof3_2 = _xlcast_float3x3(_mtl_u.uniMat3H);
|
|
r_6.x = (r_6.x + htof3_2[0].x);
|
|
htof2_1 = _xlcast_float2x2(_mtl_u.uniMat2H);
|
|
r_6.x = (r_6.x + htof2_1[0].x);
|
|
_mtl_o.gl_Position = r_6;
|
|
return _mtl_o;
|
|
}
|
|
|
|
|
|
// stats: 6 alu 0 tex 0 flow
|
|
// uniforms: 5 (total size: 144)
|
|
// #0: uniMat4F (high float) 4x4 [-1] loc 0
|
|
// #1: uniMat4H (medium float) 4x4 [-1] loc 64
|
|
// #2: uniMat3H (medium float) 3x3 [-1] loc 96
|
|
// #3: uniMat2F (high float) 2x2 [-1] loc 120
|
|
// #4: uniMat2H (medium float) 2x2 [-1] loc 136
|