summaryrefslogtreecommitdiff
path: root/SDL-3.2.8/src/render/vulkan/VULKAN_VertexShader.hlsl
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2026-03-06 13:26:57 -0800
committer3gg <3gg@shellblade.net>2026-03-06 13:26:57 -0800
commitf5c89b3bd5d74849757fd5b4d1a300068522a3ca (patch)
treed6f6e4c81745b393d7594b334710f30c0b2df3bd /SDL-3.2.8/src/render/vulkan/VULKAN_VertexShader.hlsl
Initial commitHEADmain
Diffstat (limited to 'SDL-3.2.8/src/render/vulkan/VULKAN_VertexShader.hlsl')
-rw-r--r--SDL-3.2.8/src/render/vulkan/VULKAN_VertexShader.hlsl45
1 files changed, 45 insertions, 0 deletions
diff --git a/SDL-3.2.8/src/render/vulkan/VULKAN_VertexShader.hlsl b/SDL-3.2.8/src/render/vulkan/VULKAN_VertexShader.hlsl
new file mode 100644
index 0000000..373a179
--- /dev/null
+++ b/SDL-3.2.8/src/render/vulkan/VULKAN_VertexShader.hlsl
@@ -0,0 +1,45 @@
1#pragma pack_matrix( row_major )
2
3struct VertexShaderConstants
4{
5 matrix model;
6 matrix projectionAndView;
7};
8[[vk::push_constant]]
9ConstantBuffer<VertexShaderConstants> pushConstants;
10
11struct VertexShaderInput
12{
13 float3 pos : POSITION;
14 float2 tex : TEXCOORD0;
15 float4 color : COLOR0;
16};
17
18struct VertexShaderOutput
19{
20 float4 pos : SV_POSITION;
21 float2 tex : TEXCOORD0;
22 float4 color : COLOR0;
23 [[vk::builtin("PointSize")]] float pointSize : SV_PointSize;
24};
25
26VertexShaderOutput mainColor(VertexShaderInput input)
27{
28 VertexShaderOutput output;
29 float4 pos = float4(input.pos, 1.0f);
30
31 // Transform the vertex position into projected space.
32 pos = mul(pos, pushConstants.model);
33 pos = mul(pos, pushConstants.projectionAndView);
34 output.pos = pos;
35
36 // Pass through texture coordinates and color values without transformation
37 output.tex = input.tex;
38 output.color = input.color;
39
40 // Always output pointSize so that this VS can be used with points
41 output.pointSize = 1.0;
42
43 return output;
44}
45