Add slang shaders for triangle samples

This commit is contained in:
Sascha Willems 2025-02-10 19:09:19 +01:00
parent d8edd92034
commit 2846c73db0
2 changed files with 46 additions and 0 deletions

View file

@ -0,0 +1,11 @@
/* Copyright (c) 2025, Sascha Willems
*
* SPDX-License-Identifier: MIT
*
*/
[shader("fragment")]
float4 main([[vk::location(0)]] float3 Color)
{
return float4(Color, 1.0);
}

View file

@ -0,0 +1,35 @@
/* Copyright (c) 2025, Sascha Willems
*
* SPDX-License-Identifier: MIT
*
*/
struct UBO
{
float4x4 projectionMatrix;
float4x4 modelMatrix;
float4x4 viewMatrix;
};
[[vk::binding(0, 0)]]
ConstantBuffer<UBO> ubo;
struct VSInput
{
[[vk::location(0)]] float3 Pos;
[[vk::location(1)]] float3 Color;
};
struct VSOutput
{
float4 Pos : SV_POSITION;
[[vk::location(0)]] float3 Color;
};
[shader("vertex")]
VSOutput main(VSInput input)
{
VSOutput output;
output.Color = input.Color;
output.Pos = mul(ubo.projectionMatrix, mul(ubo.viewMatrix, mul(ubo.modelMatrix, float4(input.Pos.xyz, 1.0))));
return output;
}