aboutsummaryrefslogtreecommitdiff
path: root/src/shaders/shader.slang
blob: 24d99465f29f2f286f689836bd2e8c7f23707326 (plain) (blame)
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
struct VertexInput {
    float2 pos;
    float3 col;
};

struct UniformBuffer {
    float4x4 model, view, proj;
};

ConstantBuffer<UniformBuffer> ubo;

struct VertexOutput {
    float4 pos : SV_Position;
    float3 col;
};

[shader("vertex")]
VertexOutput vert_main(VertexInput vi) {
    VertexOutput vo;
    // vo.pos = float4(vi.pos, 0., 1.);
    vo.pos = mul(ubo.proj, mul(ubo.view, mul(ubo.model, float4(vi.pos, 0., 1.))));
    vo.col = vi.col;
    return vo;
}

[shader("fragment")]
float4 frag_main(VertexOutput vo) : SV_Target {
    return float4(vo.col, 1.);
}