diff options
| author | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
| commit | 5a079a2d114f96d4847d1ee305d5b7c16eeec50e (patch) | |
| tree | 8926ab44f168acf787d8e19608857b3af0f82758 /contrib/SDL-3.2.8/src/render/direct3d12/D3D12_VertexShader.hlsl | |
Initial commit
Diffstat (limited to 'contrib/SDL-3.2.8/src/render/direct3d12/D3D12_VertexShader.hlsl')
| -rw-r--r-- | contrib/SDL-3.2.8/src/render/direct3d12/D3D12_VertexShader.hlsl | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/src/render/direct3d12/D3D12_VertexShader.hlsl b/contrib/SDL-3.2.8/src/render/direct3d12/D3D12_VertexShader.hlsl new file mode 100644 index 0000000..c7d2433 --- /dev/null +++ b/contrib/SDL-3.2.8/src/render/direct3d12/D3D12_VertexShader.hlsl | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | #include "D3D12_Shader_Common.hlsli" | ||
| 2 | |||
| 3 | struct VertexShaderInput | ||
| 4 | { | ||
| 5 | float3 pos : POSITION; | ||
| 6 | float2 tex : TEXCOORD0; | ||
| 7 | float4 color : COLOR0; | ||
| 8 | }; | ||
| 9 | |||
| 10 | struct VertexShaderOutput | ||
| 11 | { | ||
| 12 | float4 pos : SV_POSITION; | ||
| 13 | float2 tex : TEXCOORD0; | ||
| 14 | float4 color : COLOR0; | ||
| 15 | }; | ||
| 16 | |||
| 17 | [RootSignature(ColorRS)] | ||
| 18 | VertexShaderOutput mainColor(VertexShaderInput input) | ||
| 19 | { | ||
| 20 | VertexShaderOutput output; | ||
| 21 | float4 pos = float4(input.pos, 1.0f); | ||
| 22 | |||
| 23 | // Transform the vertex position into projected space. | ||
| 24 | pos = mul(pos, model); | ||
| 25 | pos = mul(pos, projectionAndView); | ||
| 26 | output.pos = pos; | ||
| 27 | |||
| 28 | // Pass through texture coordinates and color values without transformation | ||
| 29 | output.tex = input.tex; | ||
| 30 | output.color = input.color; | ||
| 31 | |||
| 32 | return output; | ||
| 33 | } | ||
| 34 | |||
| 35 | [RootSignature(TextureRS)] | ||
| 36 | VertexShaderOutput mainTexture(VertexShaderInput input) | ||
| 37 | { | ||
| 38 | return mainColor(input); | ||
| 39 | } | ||
| 40 | |||
| 41 | [RootSignature(AdvancedRS)] | ||
| 42 | VertexShaderOutput mainAdvanced(VertexShaderInput input) | ||
| 43 | { | ||
| 44 | return mainColor(input); | ||
| 45 | } | ||
