47 lines
902 B
HLSL
47 lines
902 B
HLSL
#include "shaders/common.hlsl"
|
|
|
|
SamplerState G_sampler0;
|
|
Texture2D G_texture0;
|
|
|
|
cbuffer constants : register(b0)
|
|
{
|
|
float4x4 G_projection;
|
|
};
|
|
|
|
struct vs_input {
|
|
DECL(float4, pos);
|
|
DECL(float2, uv);
|
|
DECL(float4, tint_srgb);
|
|
};
|
|
|
|
struct ps_input {
|
|
DESV(float4, screen_pos, SV_POSITION);
|
|
DECL(float2, uv);
|
|
DECL(float4, tint_lin);
|
|
};
|
|
|
|
/* ========================== *
|
|
* Vertex shader
|
|
* ========================== */
|
|
|
|
ps_input vs_main(vs_input input)
|
|
{
|
|
ps_input output;
|
|
|
|
output.screen_pos = mul(G_projection, float4(input.pos.xy, 0.f, 1.f));
|
|
output.uv = input.uv;
|
|
output.tint_lin = linear_from_srgb(input.tint_srgb);
|
|
|
|
return output;
|
|
}
|
|
|
|
/* ========================== *
|
|
* Pixel shader
|
|
* ========================== */
|
|
|
|
float4 ps_main(ps_input input) : SV_TARGET
|
|
{
|
|
float4 color = G_texture0.Sample(G_sampler0, input.uv) * input.tint_lin;
|
|
return color;
|
|
}
|