Add slang shaders for additional samples
This commit is contained in:
parent
0e975064d9
commit
b3c032ef68
18 changed files with 1425 additions and 0 deletions
51
shaders/slang/descriptorbuffer/cube.slang
Normal file
51
shaders/slang/descriptorbuffer/cube.slang
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/* Copyright (c) 2025, Sascha Willems
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
struct VSInput
|
||||
{
|
||||
float3 Pos;
|
||||
float3 Normal;
|
||||
float2 UV;
|
||||
float3 Color;
|
||||
};
|
||||
|
||||
struct VSOutput
|
||||
{
|
||||
float4 Pos : SV_POSITION;
|
||||
float3 Normal;
|
||||
float3 Color;
|
||||
float2 UV;
|
||||
};
|
||||
|
||||
struct UBOCamera {
|
||||
float4x4 projection;
|
||||
float4x4 view;
|
||||
};
|
||||
ConstantBuffer<UBOCamera> uboCamera;
|
||||
|
||||
struct UBOModel {
|
||||
float4x4 local;
|
||||
};
|
||||
[[vk::binding(0, 1)]] ConstantBuffer<UBOModel> uboModel;
|
||||
|
||||
[[vk::binding(0, 2)]] Sampler2D samplerColorMap;
|
||||
|
||||
[shader("vertex")]
|
||||
VSOutput vertexMain(VSInput input)
|
||||
{
|
||||
VSOutput output;
|
||||
output.Normal = input.Normal;
|
||||
output.Color = input.Color;
|
||||
output.UV = input.UV;
|
||||
output.Pos = mul(uboCamera.projection, mul(uboCamera.view, mul(uboModel.local, float4(input.Pos.xyz, 1.0))));
|
||||
return output;
|
||||
}
|
||||
|
||||
[shader("fragment")]
|
||||
float4 fragmentMain(VSOutput input)
|
||||
{
|
||||
return samplerColorMap.Sample(input.UV) * float4(input.Color, 1.0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue