power_play/res/shaders/triangle.hlsl
2025-05-23 00:40:51 -05:00

43 lines
838 B
HLSL

struct {
SamplerState sampler0;
Texture2D texture0;
} globals;
cbuffer constants : register(b0)
{
float4x4 projection;
};
struct vs_input {
float4 pos : POSITION;
float2 uv : TEXCOORD;
float4 tint_srgb : COLOR;
};
struct ps_input {
float4 pos : SV_POSITION;
float2 uv : TEXCOORD;
float4 tint_lin : COLOR;
};
float4 linear_from_srgb(float4 srgb)
{
return float4(pow(srgb.rgb, 2.2), srgb.a);
}
ps_input vs_main(vs_input input)
{
ps_input output;
output.pos = mul(projection, float4(input.pos.xy, 0.f, 1.f));
output.uv = input.uv;
output.tint_lin = linear_from_srgb(input.tint_srgb);
return output;
}
float4 ps_main(ps_input input) : SV_TARGET
{
return globals.texture0.Sample(globals.sampler0, input.uv) * input.tint_lin;
}