summaryrefslogtreecommitdiff
path: root/contrib/SDL-3.2.8/src/render/vulkan/VULKAN_VertexShader.hlsl
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/SDL-3.2.8/src/render/vulkan/VULKAN_VertexShader.hlsl')
-rw-r--r--contrib/SDL-3.2.8/src/render/vulkan/VULKAN_VertexShader.hlsl45
1 files changed, 45 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/src/render/vulkan/VULKAN_VertexShader.hlsl b/contrib/SDL-3.2.8/src/render/vulkan/VULKAN_VertexShader.hlsl
new file mode 100644
index 0000000..373a179
--- /dev/null
+++ b/contrib/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