mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 17:18:12 -05:00
174 lines
5.7 KiB
Text
174 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);
|
|
half2 coord_7;
|
|
coord_7 = half2(tmpvar_6);
|
|
half4 tmpvar_8;
|
|
tmpvar_8.zw = half2(float2(0.0, 0.0));
|
|
tmpvar_8.xy = (coord_7 / _mtl_u._DynLampInfo_bufferSize);
|
|
half4 tmpvar_9;
|
|
half4 tmpvar_10;
|
|
tmpvar_10 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_8.xy), level(0.0));
|
|
tmpvar_9 = tmpvar_10;
|
|
float2 tmpvar_11;
|
|
tmpvar_11.y = 2.0;
|
|
tmpvar_11.x = float(tmpvar_5.x);
|
|
half2 coord_12;
|
|
coord_12 = half2(tmpvar_11);
|
|
half4 tmpvar_13;
|
|
tmpvar_13.zw = half2(float2(0.0, 0.0));
|
|
tmpvar_13.xy = (coord_12 / _mtl_u._DynLampInfo_bufferSize);
|
|
half4 tmpvar_14;
|
|
half4 tmpvar_15;
|
|
tmpvar_15 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_13.xy), level(0.0));
|
|
tmpvar_14 = tmpvar_15;
|
|
float2 tmpvar_16;
|
|
tmpvar_16.y = 1.0;
|
|
tmpvar_16.x = float(tmpvar_5.y);
|
|
half2 coord_17;
|
|
coord_17 = half2(tmpvar_16);
|
|
half4 tmpvar_18;
|
|
tmpvar_18.zw = half2(float2(0.0, 0.0));
|
|
tmpvar_18.xy = (coord_17 / _mtl_u._DynLampInfo_bufferSize);
|
|
half4 tmpvar_19;
|
|
half4 tmpvar_20;
|
|
tmpvar_20 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_18.xy), level(0.0));
|
|
tmpvar_19 = tmpvar_20;
|
|
float2 tmpvar_21;
|
|
tmpvar_21.y = 2.0;
|
|
tmpvar_21.x = float(tmpvar_5.y);
|
|
half2 coord_22;
|
|
coord_22 = half2(tmpvar_21);
|
|
half4 tmpvar_23;
|
|
tmpvar_23.zw = half2(float2(0.0, 0.0));
|
|
tmpvar_23.xy = (coord_22 / _mtl_u._DynLampInfo_bufferSize);
|
|
half4 tmpvar_24;
|
|
half4 tmpvar_25;
|
|
tmpvar_25 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_23.xy), level(0.0));
|
|
tmpvar_24 = tmpvar_25;
|
|
float2 tmpvar_26;
|
|
tmpvar_26.y = 1.0;
|
|
tmpvar_26.x = float(tmpvar_5.z);
|
|
half2 coord_27;
|
|
coord_27 = half2(tmpvar_26);
|
|
half4 tmpvar_28;
|
|
tmpvar_28.zw = half2(float2(0.0, 0.0));
|
|
tmpvar_28.xy = (coord_27 / _mtl_u._DynLampInfo_bufferSize);
|
|
half4 tmpvar_29;
|
|
half4 tmpvar_30;
|
|
tmpvar_30 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_28.xy), level(0.0));
|
|
tmpvar_29 = tmpvar_30;
|
|
float2 tmpvar_31;
|
|
tmpvar_31.y = 2.0;
|
|
tmpvar_31.x = float(tmpvar_5.z);
|
|
half2 coord_32;
|
|
coord_32 = half2(tmpvar_31);
|
|
half4 tmpvar_33;
|
|
tmpvar_33.zw = half2(float2(0.0, 0.0));
|
|
tmpvar_33.xy = (coord_32 / _mtl_u._DynLampInfo_bufferSize);
|
|
half4 tmpvar_34;
|
|
half4 tmpvar_35;
|
|
tmpvar_35 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_33.xy), level(0.0));
|
|
tmpvar_34 = tmpvar_35;
|
|
float2 tmpvar_36;
|
|
tmpvar_36.y = 1.0;
|
|
tmpvar_36.x = float(tmpvar_5.w);
|
|
half2 coord_37;
|
|
coord_37 = half2(tmpvar_36);
|
|
half4 tmpvar_38;
|
|
tmpvar_38.zw = half2(float2(0.0, 0.0));
|
|
tmpvar_38.xy = (coord_37 / _mtl_u._DynLampInfo_bufferSize);
|
|
half4 tmpvar_39;
|
|
half4 tmpvar_40;
|
|
tmpvar_40 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_38.xy), level(0.0));
|
|
tmpvar_39 = tmpvar_40;
|
|
float2 tmpvar_41;
|
|
tmpvar_41.y = 2.0;
|
|
tmpvar_41.x = float(tmpvar_5.w);
|
|
half2 coord_42;
|
|
coord_42 = half2(tmpvar_41);
|
|
half4 tmpvar_43;
|
|
tmpvar_43.zw = half2(float2(0.0, 0.0));
|
|
tmpvar_43.xy = (coord_42 / _mtl_u._DynLampInfo_bufferSize);
|
|
half4 tmpvar_44;
|
|
half4 tmpvar_45;
|
|
tmpvar_45 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_43.xy), level(0.0));
|
|
tmpvar_44 = tmpvar_45;
|
|
half3 hybridCol_46;
|
|
half4 atten_47;
|
|
float3 tmpvar_48;
|
|
tmpvar_48 = ((float3)tmpvar_9.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_9.w));
|
|
float3 tmpvar_51;
|
|
tmpvar_51 = ((float3)tmpvar_19.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_19.w));
|
|
float3 tmpvar_54;
|
|
tmpvar_54 = ((float3)tmpvar_29.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_29.w));
|
|
float3 tmpvar_57;
|
|
tmpvar_57 = ((float3)tmpvar_39.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_39.w));
|
|
atten_47 = tmpvar_59;
|
|
hybridCol_46 = (hybridCol_4 + (tmpvar_14.xyz * tmpvar_50.x));
|
|
hybridCol_46 = (hybridCol_46 + (tmpvar_24.xyz * tmpvar_53.y));
|
|
hybridCol_46 = (hybridCol_46 + (tmpvar_34.xyz * tmpvar_56.z));
|
|
hybridCol_46 = (hybridCol_46 + (tmpvar_44.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
|