blob: 6ce51d6cdc3df9871386ca259fbe9a8ecd9d82f7 (
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
46
47
48
49
50
51
52
53
54
|
struct Vertex
{
float3 pos;
float4 color;
float2 texture_coords;
};
struct VertexData
{
float4 color;
float2 texture_coords;
};
struct VertexStageOutput
{
VertexData vertex_data : VertexData;
float4 sv_position : SV_Position;
};
struct Fragment
{
float4 color;
};
cbuffer Uniforms
{
float4x4 projection;
};
Sampler2D main_texture;
[shader("vertex")]
VertexStageOutput vertex_main(Vertex vertex: VERTEX)
{
VertexStageOutput stage_output;
stage_output.sv_position = mul(projection, float4(vertex.pos.xy, 0.f, 1.f));
stage_output.vertex_data.color = vertex.color;
stage_output.vertex_data.texture_coords = vertex.texture_coords;
return stage_output;
}
[shader("fragment")]
Fragment fragment_main(VertexData vertex_data: VertexData) : SV_Target
{
Fragment fragment;
fragment.color = vertex_data.color * main_texture.Sample(vertex_data.texture_coords);
return fragment;
}
|