mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 09:08:22 -05:00
64 lines
2.1 KiB
Text
64 lines
2.1 KiB
Text
#include <metal_stdlib>
|
|
using namespace metal;
|
|
struct xlatMtlShaderInput {
|
|
float2 xlv_TEXCOORD0;
|
|
float4 xlv_TEXCOORD4;
|
|
};
|
|
struct xlatMtlShaderOutput {
|
|
half4 _glesFragData_0 [[color(0)]];
|
|
};
|
|
struct xlatMtlShaderUniform {
|
|
};
|
|
fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]
|
|
, texture2d<half> unity_Lightmap [[texture(0)]], sampler _mtlsmp_unity_Lightmap [[sampler(0)]]
|
|
, texture2d<half> unity_LightmapInd [[texture(1)]], sampler _mtlsmp_unity_LightmapInd [[sampler(1)]]
|
|
, texture2d<half> _MainTex [[texture(2)]], sampler _mtlsmp__MainTex [[sampler(2)]])
|
|
{
|
|
xlatMtlShaderOutput _mtl_o;
|
|
half4 c_1;
|
|
half3 tmpvar_2;
|
|
half3 tmpvar_3;
|
|
half4 c_4;
|
|
half4 tmpvar_5;
|
|
tmpvar_5 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0));
|
|
c_4 = tmpvar_5;
|
|
tmpvar_2 = c_4.xyz;
|
|
tmpvar_3 = ((c_4.xyz * (half)2.0) - (half)1.0);
|
|
half3x3 tmpvar_6;
|
|
tmpvar_6[0].x = half(0.8164966);
|
|
tmpvar_6[0].y = half(-0.4082483);
|
|
tmpvar_6[0].z = half(-0.4082483);
|
|
tmpvar_6[1].x = half(0.0);
|
|
tmpvar_6[1].y = half(0.7071068);
|
|
tmpvar_6[1].z = half(-0.7071068);
|
|
tmpvar_6[2].x = half(0.5773503);
|
|
tmpvar_6[2].y = half(0.5773503);
|
|
tmpvar_6[2].z = half(0.5773503);
|
|
half3 normal_7;
|
|
normal_7 = tmpvar_3;
|
|
half3 scalePerBasisVector_8;
|
|
half3 lm_9;
|
|
half3 tmpvar_10;
|
|
tmpvar_10 = ((half)2.0 * unity_Lightmap.sample(_mtlsmp_unity_Lightmap, (float2)(_mtl_i.xlv_TEXCOORD4.xy)).xyz);
|
|
lm_9 = tmpvar_10;
|
|
half3 tmpvar_11;
|
|
tmpvar_11 = ((half)2.0 * unity_LightmapInd.sample(_mtlsmp_unity_LightmapInd, (float2)(_mtl_i.xlv_TEXCOORD4.xy)).xyz);
|
|
scalePerBasisVector_8 = tmpvar_11;
|
|
lm_9 = (lm_9 * dot (clamp (
|
|
(tmpvar_6 * normal_7)
|
|
, (half)0.0, (half)1.0), scalePerBasisVector_8));
|
|
c_1.xyz = (tmpvar_2 * lm_9);
|
|
c_1.w = half(1.0);
|
|
_mtl_o._glesFragData_0 = c_1;
|
|
return _mtl_o;
|
|
}
|
|
|
|
|
|
// stats: 19 alu 3 tex 0 flow
|
|
// inputs: 2
|
|
// #0: xlv_TEXCOORD0 (high float) 2x1 [-1]
|
|
// #1: xlv_TEXCOORD4 (high float) 4x1 [-1]
|
|
// textures: 3
|
|
// #0: unity_Lightmap (low 2d) 0x0 [-1] loc 0
|
|
// #1: unity_LightmapInd (low 2d) 0x0 [-1] loc 1
|
|
// #2: _MainTex (low 2d) 0x0 [-1] loc 2
|