mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
35 lines
1.2 KiB
Text
35 lines
1.2 KiB
Text
|
#include <metal_stdlib>
|
||
|
using namespace metal;
|
||
|
struct xlatMtlShaderInput {
|
||
|
half3 uv;
|
||
|
};
|
||
|
struct xlatMtlShaderOutput {
|
||
|
half4 outColor [[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)]]
|
||
|
, texture3d<half> vol [[texture(1)]], sampler _mtlsmp_vol [[sampler(1)]])
|
||
|
{
|
||
|
xlatMtlShaderOutput _mtl_o;
|
||
|
half4 c_1;
|
||
|
c_1 = (tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uv.xy)) + tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uv.xy), bias(0.5)));
|
||
|
c_1 = (c_1 + vol.sample(_mtlsmp_vol, (float3)(_mtl_i.uv)));
|
||
|
c_1 = (c_1 + vol.sample(_mtlsmp_vol, (float3)(_mtl_i.uv), bias(-0.5)));
|
||
|
c_1 = (c_1 + tex.sample(_mtlsmp_tex, (float2)(int2(1, 2))));
|
||
|
c_1 = (c_1 + vol.sample(_mtlsmp_vol, (float3)(int3(1, 2, 3))));
|
||
|
c_1 = (c_1 + tex.sample(_mtlsmp_tex, (float2)(int2(1, 2))));
|
||
|
c_1 = (c_1 + vol.sample(_mtlsmp_vol, (float3)(int3(1, 2, 3))));
|
||
|
_mtl_o.outColor = c_1;
|
||
|
return _mtl_o;
|
||
|
}
|
||
|
|
||
|
|
||
|
// stats: 7 alu 8 tex 0 flow
|
||
|
// inputs: 1
|
||
|
// #0: uv (medium float) 3x1 [-1]
|
||
|
// textures: 2
|
||
|
// #0: tex (low 2d) 0x0 [-1] loc 0
|
||
|
// #1: vol (low 3d) 0x0 [-1] loc 1
|