summaryrefslogtreecommitdiff
path: root/Fuse/demos/fuse.slang
blob: 837a3dc4a1bf2ac6021f4af985eb258010d64124 (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
struct VertexInput {
    [[vk::location(0)]] float2 pos : POSITION;
    [[vk::location(1)]] float4 col : COLOR;
};

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

struct UBO {
    float2 viewport;
};

[[vk::binding(0, 0)]]
ConstantBuffer<UBO> ubo;

[shader("vertex")]
VertexOutput vertMain(VertexInput input)
{
    VertexOutput output;
    output.col = input.col;
    output.pos = float4(input.pos*2.0/ubo.viewport - 1.0, 0.0, 1.0);
    return output;
}

[shader("fragment")]
float4 fragMain(VertexOutput input) : SV_Target
{
    return input.col;
}