Add slang shaders for triangle samples
This commit is contained in:
parent
d8edd92034
commit
2846c73db0
2 changed files with 46 additions and 0 deletions
11
shaders/slang/triangle/triangle.frag.slang
Normal file
11
shaders/slang/triangle/triangle.frag.slang
Normal 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);
|
||||
}
|
||||
35
shaders/slang/triangle/triangle.vert.slang
Normal file
35
shaders/slang/triangle/triangle.vert.slang
Normal 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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue