Files
cell/shaders/msl/ps1.frag.msl
2025-01-09 23:20:18 -06:00

29 lines
876 B
Plaintext

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct type_Globals
{
float4 ditherPattern2x2[4];
};
struct main0_out
{
float4 out_var_SV_TARGET [[color(0)]];
};
struct main0_in
{
float2 in_var_TEXCOORD0 [[user(locn0)]];
};
fragment main0_out main0(main0_in in [[stage_in]], constant type_Globals& _Globals [[buffer(0)]], texture2d<float> diffuseTexture [[texture(0)]], sampler smp [[sampler(0)]], float4 gl_FragCoord [[position]])
{
main0_out out = {};
float4 _61 = fast::clamp(diffuseTexture.sample(smp, in.in_var_TEXCOORD0) + float4(0.03125 * _Globals.ditherPattern2x2[((int(gl_FragCoord.y) & 1) * 2) + (int(gl_FragCoord.x) & 1)].x), float4(0.0), float4(1.0));
out.out_var_SV_TARGET = float4(rint(_61.xyz * 31.0) * float3(0.0322580635547637939453125), rint(_61.w * 31.0) * 0.0322580635547637939453125);
return out;
}