mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 19:15:37 -05:00
34 lines
1.2 KiB
Text
34 lines
1.2 KiB
Text
|
#include <metal_stdlib>
|
||
|
using namespace metal;
|
||
|
constexpr sampler _mtl_xl_shadow_sampler(address::clamp_to_edge, filter::linear, compare_func::less);
|
||
|
struct xlatMtlShaderInput {
|
||
|
float4 uvHi;
|
||
|
half4 uvMed;
|
||
|
};
|
||
|
struct xlatMtlShaderOutput {
|
||
|
half4 _fragColor [[color(0)]];
|
||
|
};
|
||
|
struct xlatMtlShaderUniform {
|
||
|
};
|
||
|
;
|
||
|
fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]
|
||
|
, depth2d<float> shadowmap [[texture(0)]], sampler _mtlsmp_shadowmap [[sampler(0)]])
|
||
|
{
|
||
|
xlatMtlShaderOutput _mtl_o;
|
||
|
half4 r_1;
|
||
|
half4 tmpvar_2;
|
||
|
tmpvar_2 = half4((shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uvHi.xyz).xy, (float)(_mtl_i.uvHi.xyz).z) + shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uvHi).xy / (float)(_mtl_i.uvHi).w, (float)(_mtl_i.uvHi).z / (float)(_mtl_i.uvHi).w)));
|
||
|
r_1.yzw = tmpvar_2.yzw;
|
||
|
r_1.x = (tmpvar_2.x + shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uvMed.xyz).xy, (float)(_mtl_i.uvMed.xyz).z));
|
||
|
_mtl_o._fragColor = r_1;
|
||
|
return _mtl_o;
|
||
|
}
|
||
|
|
||
|
|
||
|
// stats: 2 alu 3 tex 0 flow
|
||
|
// inputs: 2
|
||
|
// #0: uvHi (high float) 4x1 [-1]
|
||
|
// #1: uvMed (medium float) 4x1 [-1]
|
||
|
// textures: 1
|
||
|
// #0: shadowmap (low 2d) 0x0 [-1] loc 0
|