procedural-3d-engine/shaders/slang/base/uioverlay.slang

43 lines
703 B
Text
Raw Normal View History

2025-02-09 19:17:10 +01:00
/* Copyright (c) 2025, Sascha Willems
*
* SPDX-License-Identifier: MIT
*
*/
Sampler2D fontTexture;
2025-02-09 19:17:10 +01:00
struct VSInput
{
float2 Pos : POSITION0;
float2 UV;
float4 Color;
2025-02-09 19:17:10 +01:00
};
struct VSOutput
{
float4 Pos : SV_POSITION;
float2 UV;
float4 Color;
2025-02-09 19:17:10 +01:00
};
struct PushConstants
{
float2 scale;
float2 translate;
};
2025-02-09 20:00:44 +01:00
[shader("vertex")]
VSOutput vertexMain(VSInput input, uniform PushConstants pushConstants)
2025-02-09 19:17:10 +01:00
{
VSOutput output;
output.Pos = float4(input.Pos * pushConstants.scale + pushConstants.translate, 0.0, 1.0);
output.UV = input.UV;
output.Color = input.Color;
return output;
}
[shader("fragment")]
float4 fragmentMain(VSOutput input)
{
return input.Color * fontTexture.Sample(input.UV);
2025-02-09 19:17:10 +01:00
}