mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 09:08:22 -05:00
36 lines
1.2 KiB
Text
36 lines
1.2 KiB
Text
|
#include <metal_stdlib>
|
||
|
using namespace metal;
|
||
|
struct xlatMtlShaderInput {
|
||
|
half3 uv1;
|
||
|
float3 uv2;
|
||
|
};
|
||
|
struct xlatMtlShaderOutput {
|
||
|
half4 _fragColor [[color(0)]];
|
||
|
};
|
||
|
struct xlatMtlShaderUniform {
|
||
|
};
|
||
|
;
|
||
|
fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]
|
||
|
, texture2d<half> tex [[texture(0)]], sampler _mtlsmp_tex [[sampler(0)]])
|
||
|
{
|
||
|
xlatMtlShaderOutput _mtl_o;
|
||
|
half2 tmpvar_1;
|
||
|
tmpvar_1 = dfdx(_mtl_i.uv1.xy);
|
||
|
half2 tmpvar_2;
|
||
|
tmpvar_2 = dfdy(_mtl_i.uv1.xy);
|
||
|
float2 tmpvar_3;
|
||
|
tmpvar_3 = dfdx(_mtl_i.uv2.xy);
|
||
|
float2 tmpvar_4;
|
||
|
tmpvar_4 = dfdy(_mtl_i.uv2.xy);
|
||
|
_mtl_o._fragColor = ((tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uv1.xy), gradient2d((float2)(tmpvar_1), (float2)(tmpvar_2))) + tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uv2.xy), gradient2d((float2)(tmpvar_3), (float2)(tmpvar_4)))) + tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uv2.xy), gradient2d((float2)(_mtl_i.uv1.xy), (float2)(_mtl_i.uv1.xy))));
|
||
|
return _mtl_o;
|
||
|
}
|
||
|
|
||
|
|
||
|
// stats: 6 alu 3 tex 0 flow
|
||
|
// inputs: 2
|
||
|
// #0: uv1 (medium float) 3x1 [-1]
|
||
|
// #1: uv2 (high float) 3x1 [-1]
|
||
|
// textures: 1
|
||
|
// #0: tex (low 2d) 0x0 [-1] loc 0
|