Add slang shaders for UI overlay
This commit is contained in:
parent
6912366c45
commit
e9673f1ac3
2 changed files with 58 additions and 0 deletions
20
shaders/slang/base/uioverlay.frag.slang
Normal file
20
shaders/slang/base/uioverlay.frag.slang
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/* Copyright (c) 2025, Sascha Willems
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
[[vk::binding(0, 0)]]
|
||||
Sampler2D fontTexture;
|
||||
|
||||
struct VSOutput
|
||||
{
|
||||
[[vk::location(0)]]float2 UV : TEXCOORD0;
|
||||
[[vk::location(1)]]float4 Color : COLOR0;
|
||||
};
|
||||
|
||||
[shader("fragment")]
|
||||
float4 main(VSOutput input) : SV_TARGET
|
||||
{
|
||||
return input.Color * fontTexture.Sample(input.UV);
|
||||
}
|
||||
38
shaders/slang/base/uioverlay.vert.slang
Normal file
38
shaders/slang/base/uioverlay.vert.slang
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/* Copyright (c) 2025, Sascha Willems
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
struct VSInput
|
||||
{
|
||||
[[vk::location(0)]]float2 Pos : POSITION0;
|
||||
[[vk::location(1)]]float2 UV : TEXCOORD0;
|
||||
[[vk::location(2)]]float4 Color : COLOR0;
|
||||
};
|
||||
|
||||
struct VSOutput
|
||||
{
|
||||
float4 Pos : SV_POSITION;
|
||||
[[vk::location(0)]]float2 UV : TEXCOORD0;
|
||||
[[vk::location(1)]]float4 Color : COLOR0;
|
||||
};
|
||||
|
||||
struct PushConstants
|
||||
{
|
||||
float2 scale;
|
||||
float2 translate;
|
||||
};
|
||||
|
||||
[[vk::push_constant]]
|
||||
PushConstants pushConstants;
|
||||
|
||||
[shader("fragment")]
|
||||
VSOutput main(VSInput input)
|
||||
{
|
||||
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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue