38 lines
661 B
Plaintext
38 lines
661 B
Plaintext
struct VertexIn {
|
|
[[vk::layout(0)]] float2 pos;
|
|
[[vk::layout(1)]] float4 color;
|
|
}
|
|
struct VertexOut {
|
|
[[vk::layout(0)]] float4 color;
|
|
float4 position : SV_Position;
|
|
}
|
|
|
|
struct PushConstant {
|
|
float4x4 mvp;
|
|
}
|
|
|
|
[[vk::push_constant]]
|
|
ConstantBuffer<PushConstant> push_constant;
|
|
|
|
[shader("vertex")]
|
|
VertexOut vertex(VertexIn vertex) {
|
|
VertexOut output;
|
|
|
|
output.position = mul(push_constant.mvp, float4(vertex.pos, 1.0));
|
|
output.color = vertex.color;
|
|
|
|
return output;
|
|
}
|
|
|
|
struct FragmentOut {
|
|
float4 color : SV_Target;
|
|
}
|
|
|
|
[shader("fragment")]
|
|
FragmentOut fragment(VertexOut input) {
|
|
FragmentOut output;
|
|
|
|
output.color = input.color;
|
|
return output;
|
|
}
|