Draw a quad

This commit is contained in:
David Gonzalez Martin 2024-11-08 09:18:47 -06:00 committed by David
parent 496fac59bd
commit ea56f55629
5 changed files with 862 additions and 209 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,12 @@
#version 450
//shader input
layout (location = 0) in vec4 inColor;
//output write
layout (location = 0) out vec4 outFragColor;
void main()
{
outFragColor = inColor;
}

Binary file not shown.

View File

@ -0,0 +1,32 @@
#version 450
#extension GL_EXT_buffer_reference : require
#extension GL_EXT_debug_printf : require
layout (location = 0) out vec4 outColor;
struct Vertex {
vec4 position;
vec4 color;
};
layout(buffer_reference, std430) readonly buffer VertexBuffer{
Vertex vertices[];
};
//push constants block
layout( push_constant ) uniform constants
{
VertexBuffer vertexBuffer;
} PushConstants;
void main()
{
//load vertex data from device address
Vertex v = PushConstants.vertexBuffer.vertices[gl_VertexIndex];
//output data
gl_Position = v.position;
outColor = v.color;
//debugPrintfEXT("Position: (%f, %f, %f)\n", v.position.x, v.position.y, v.position.z);
//debugPrintfEXT("Color: (%f, %f, %f)\n", v.color.x, v.color.y, v.color.z);
}

Binary file not shown.