summaryrefslogtreecommitdiff
path: root/contrib/SDL-3.2.8/src/render/direct3d12/D3D12_VertexShader.hlsl
blob: c7d24335260fa5a53b7b8e654836b3533f52abda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "D3D12_Shader_Common.hlsli"

struct VertexShaderInput
{
    float3 pos : POSITION;
    float2 tex : TEXCOORD0;
    float4 color : COLOR0;
};

struct VertexShaderOutput
{
    float4 pos : SV_POSITION;
    float2 tex : TEXCOORD0;
    float4 color : COLOR0;
};

[RootSignature(ColorRS)]
VertexShaderOutput mainColor(VertexShaderInput input)
{
    VertexShaderOutput output;
    float4 pos = float4(input.pos, 1.0f);

    // Transform the vertex position into projected space.
    pos = mul(pos, model);
    pos = mul(pos, projectionAndView);
    output.pos = pos;

    // Pass through texture coordinates and color values without transformation
    output.tex = input.tex;
    output.color = input.color;

    return output;
}

[RootSignature(TextureRS)]
VertexShaderOutput mainTexture(VertexShaderInput input)
{
    return mainColor(input);
}

[RootSignature(AdvancedRS)]
VertexShaderOutput mainAdvanced(VertexShaderInput input)
{
    return mainColor(input);
}