mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-04 13:21:06 -05:00
175 lines
5.7 KiB
Text
175 lines
5.7 KiB
Text
|
#include <metal_stdlib>
|
||
|
using namespace metal;
|
||
|
struct xlatMtlShaderInput {
|
||
|
float4 _glesVertex [[attribute(0)]];
|
||
|
};
|
||
|
struct xlatMtlShaderOutput {
|
||
|
float4 gl_Position [[position]];
|
||
|
half3 xlv_TEXCOORD2;
|
||
|
};
|
||
|
struct xlatMtlShaderUniform {
|
||
|
float4x4 glstate_matrix_mvp;
|
||
|
float4x4 _Object2World;
|
||
|
half2 _DynLampInfo_bufferSize;
|
||
|
};
|
||
|
vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]
|
||
|
, texture2d<half> _DynLampInfo [[texture(0)]], sampler _mtlsmp__DynLampInfo [[sampler(0)]])
|
||
|
{
|
||
|
xlatMtlShaderOutput _mtl_o;
|
||
|
half3 tmpvar_1;
|
||
|
float3 tmpvar_2;
|
||
|
tmpvar_2 = (_mtl_u._Object2World * _mtl_i._glesVertex).xyz;
|
||
|
float3 tmpvar_3;
|
||
|
half3 hybridCol_4;
|
||
|
int4 tmpvar_5;
|
||
|
tmpvar_5.xyz = int3(tmpvar_2);
|
||
|
tmpvar_5.w = int(-(tmpvar_2.x));
|
||
|
float2 tmpvar_6;
|
||
|
tmpvar_6.y = 1.0;
|
||
|
tmpvar_6.x = float(tmpvar_5.x);
|
||
|
half4 tmpvar_7;
|
||
|
half2 coord_8;
|
||
|
coord_8 = half2(tmpvar_6);
|
||
|
half4 tmpvar_9;
|
||
|
tmpvar_9.zw = half2(float2(0.0, 0.0));
|
||
|
tmpvar_9.xy = (coord_8 / _mtl_u._DynLampInfo_bufferSize);
|
||
|
half4 tmpvar_10;
|
||
|
tmpvar_10 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_9.xy), level(0.0));
|
||
|
tmpvar_7 = tmpvar_10;
|
||
|
float2 tmpvar_11;
|
||
|
tmpvar_11.y = 2.0;
|
||
|
tmpvar_11.x = float(tmpvar_5.x);
|
||
|
half4 tmpvar_12;
|
||
|
half2 coord_13;
|
||
|
coord_13 = half2(tmpvar_11);
|
||
|
half4 tmpvar_14;
|
||
|
tmpvar_14.zw = half2(float2(0.0, 0.0));
|
||
|
tmpvar_14.xy = (coord_13 / _mtl_u._DynLampInfo_bufferSize);
|
||
|
half4 tmpvar_15;
|
||
|
tmpvar_15 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_14.xy), level(0.0));
|
||
|
tmpvar_12 = tmpvar_15;
|
||
|
float2 tmpvar_16;
|
||
|
tmpvar_16.y = 1.0;
|
||
|
tmpvar_16.x = float(tmpvar_5.y);
|
||
|
half4 tmpvar_17;
|
||
|
half2 coord_18;
|
||
|
coord_18 = half2(tmpvar_16);
|
||
|
half4 tmpvar_19;
|
||
|
tmpvar_19.zw = half2(float2(0.0, 0.0));
|
||
|
tmpvar_19.xy = (coord_18 / _mtl_u._DynLampInfo_bufferSize);
|
||
|
half4 tmpvar_20;
|
||
|
tmpvar_20 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_19.xy), level(0.0));
|
||
|
tmpvar_17 = tmpvar_20;
|
||
|
float2 tmpvar_21;
|
||
|
tmpvar_21.y = 2.0;
|
||
|
tmpvar_21.x = float(tmpvar_5.y);
|
||
|
half4 tmpvar_22;
|
||
|
half2 coord_23;
|
||
|
coord_23 = half2(tmpvar_21);
|
||
|
half4 tmpvar_24;
|
||
|
tmpvar_24.zw = half2(float2(0.0, 0.0));
|
||
|
tmpvar_24.xy = (coord_23 / _mtl_u._DynLampInfo_bufferSize);
|
||
|
half4 tmpvar_25;
|
||
|
tmpvar_25 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_24.xy), level(0.0));
|
||
|
tmpvar_22 = tmpvar_25;
|
||
|
float2 tmpvar_26;
|
||
|
tmpvar_26.y = 1.0;
|
||
|
tmpvar_26.x = float(tmpvar_5.z);
|
||
|
half4 tmpvar_27;
|
||
|
half2 coord_28;
|
||
|
coord_28 = half2(tmpvar_26);
|
||
|
half4 tmpvar_29;
|
||
|
tmpvar_29.zw = half2(float2(0.0, 0.0));
|
||
|
tmpvar_29.xy = (coord_28 / _mtl_u._DynLampInfo_bufferSize);
|
||
|
half4 tmpvar_30;
|
||
|
tmpvar_30 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_29.xy), level(0.0));
|
||
|
tmpvar_27 = tmpvar_30;
|
||
|
float2 tmpvar_31;
|
||
|
tmpvar_31.y = 2.0;
|
||
|
tmpvar_31.x = float(tmpvar_5.z);
|
||
|
half4 tmpvar_32;
|
||
|
half2 coord_33;
|
||
|
coord_33 = half2(tmpvar_31);
|
||
|
half4 tmpvar_34;
|
||
|
tmpvar_34.zw = half2(float2(0.0, 0.0));
|
||
|
tmpvar_34.xy = (coord_33 / _mtl_u._DynLampInfo_bufferSize);
|
||
|
half4 tmpvar_35;
|
||
|
tmpvar_35 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_34.xy), level(0.0));
|
||
|
tmpvar_32 = tmpvar_35;
|
||
|
float2 tmpvar_36;
|
||
|
tmpvar_36.y = 1.0;
|
||
|
tmpvar_36.x = float(tmpvar_5.w);
|
||
|
half4 tmpvar_37;
|
||
|
half2 coord_38;
|
||
|
coord_38 = half2(tmpvar_36);
|
||
|
half4 tmpvar_39;
|
||
|
tmpvar_39.zw = half2(float2(0.0, 0.0));
|
||
|
tmpvar_39.xy = (coord_38 / _mtl_u._DynLampInfo_bufferSize);
|
||
|
half4 tmpvar_40;
|
||
|
tmpvar_40 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_39.xy), level(0.0));
|
||
|
tmpvar_37 = tmpvar_40;
|
||
|
float2 tmpvar_41;
|
||
|
tmpvar_41.y = 2.0;
|
||
|
tmpvar_41.x = float(tmpvar_5.w);
|
||
|
half4 tmpvar_42;
|
||
|
half2 coord_43;
|
||
|
coord_43 = half2(tmpvar_41);
|
||
|
half4 tmpvar_44;
|
||
|
tmpvar_44.zw = half2(float2(0.0, 0.0));
|
||
|
tmpvar_44.xy = (coord_43 / _mtl_u._DynLampInfo_bufferSize);
|
||
|
half4 tmpvar_45;
|
||
|
tmpvar_45 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_44.xy), level(0.0));
|
||
|
tmpvar_42 = tmpvar_45;
|
||
|
half3 hybridCol_46;
|
||
|
half4 atten_47;
|
||
|
float3 tmpvar_48;
|
||
|
tmpvar_48 = ((float3)tmpvar_7.xyz - tmpvar_2);
|
||
|
float tmpvar_49;
|
||
|
tmpvar_49 = dot (tmpvar_48, tmpvar_48);
|
||
|
half4 tmpvar_50;
|
||
|
tmpvar_50.yzw = atten_47.yzw;
|
||
|
tmpvar_50.x = half((tmpvar_49 * (float)tmpvar_7.w));
|
||
|
float3 tmpvar_51;
|
||
|
tmpvar_51 = ((float3)tmpvar_17.xyz - tmpvar_2);
|
||
|
float tmpvar_52;
|
||
|
tmpvar_52 = dot (tmpvar_51, tmpvar_51);
|
||
|
half4 tmpvar_53;
|
||
|
tmpvar_53.xzw = tmpvar_50.xzw;
|
||
|
tmpvar_53.y = half((tmpvar_52 * (float)tmpvar_17.w));
|
||
|
float3 tmpvar_54;
|
||
|
tmpvar_54 = ((float3)tmpvar_27.xyz - tmpvar_2);
|
||
|
float tmpvar_55;
|
||
|
tmpvar_55 = dot (tmpvar_54, tmpvar_54);
|
||
|
half4 tmpvar_56;
|
||
|
tmpvar_56.xyw = tmpvar_53.xyw;
|
||
|
tmpvar_56.z = half((tmpvar_55 * (float)tmpvar_27.w));
|
||
|
float3 tmpvar_57;
|
||
|
tmpvar_57 = ((float3)tmpvar_37.xyz - tmpvar_2);
|
||
|
float tmpvar_58;
|
||
|
tmpvar_58 = dot (tmpvar_57, tmpvar_57);
|
||
|
half4 tmpvar_59;
|
||
|
tmpvar_59.xyz = tmpvar_56.xyz;
|
||
|
tmpvar_59.w = half((tmpvar_58 * (float)tmpvar_37.w));
|
||
|
atten_47 = tmpvar_59;
|
||
|
hybridCol_46 = (hybridCol_4 + (tmpvar_12.xyz * tmpvar_50.x));
|
||
|
hybridCol_46 = (hybridCol_46 + (tmpvar_22.xyz * tmpvar_53.y));
|
||
|
hybridCol_46 = (hybridCol_46 + (tmpvar_32.xyz * tmpvar_56.z));
|
||
|
hybridCol_46 = (hybridCol_46 + (tmpvar_42.xyz * tmpvar_59.w));
|
||
|
tmpvar_3 = float3(hybridCol_46);
|
||
|
tmpvar_1 = half3(tmpvar_3);
|
||
|
_mtl_o.gl_Position = (_mtl_u.glstate_matrix_mvp * _mtl_i._glesVertex);
|
||
|
_mtl_o.xlv_TEXCOORD2 = tmpvar_1;
|
||
|
return _mtl_o;
|
||
|
}
|
||
|
|
||
|
|
||
|
// stats: 57 alu 8 tex 0 flow
|
||
|
// inputs: 1
|
||
|
// #0: _glesVertex (high float) 4x1 [-1] loc 0
|
||
|
// uniforms: 3 (total size: 132)
|
||
|
// #0: glstate_matrix_mvp (high float) 4x4 [-1] loc 0
|
||
|
// #1: _Object2World (high float) 4x4 [-1] loc 64
|
||
|
// #2: _DynLampInfo_bufferSize (medium float) 2x1 [-1] loc 128
|
||
|
// textures: 1
|
||
|
// #0: _DynLampInfo (low 2d) 0x0 [-1] loc 0
|