Drawing a textured quad
Added new assets Loaded all texture assets into game state Loaded the basic pipeline Setup a hard-coded quad to test drawing Created a very jank vertex struct Added ReadEntireFile for filesystem Added getting file size from file handle Added a descriptor pool to each in flight frame Changed Vk_BufferCreate to handle multiple uses Added shader building to the windows.bat build script
This commit is contained in:
28
code/vulkan/shaders/basic.vert
Normal file
28
code/vulkan/shaders/basic.vert
Normal file
@@ -0,0 +1,28 @@
|
||||
#version 460 core
|
||||
|
||||
#extension GL_EXT_scalar_block_layout : enable
|
||||
|
||||
struct Vertex {
|
||||
vec4 p;
|
||||
vec2 uv;
|
||||
uint c;
|
||||
uint pad;
|
||||
};
|
||||
|
||||
layout(binding = 0, scalar)
|
||||
readonly buffer Vertices {
|
||||
Vertex vtx[];
|
||||
};
|
||||
|
||||
layout(location = 0) out vec2 frag_uv;
|
||||
layout(location = 1) out vec4 frag_c;
|
||||
|
||||
void main() {
|
||||
Vertex v = vtx[gl_VertexIndex];
|
||||
|
||||
gl_Position = v.p;
|
||||
|
||||
frag_uv = v.uv;
|
||||
frag_c = vec4((v.c >> 24) & 0xFF, (v.c >> 16) & 0xFF, (v.c >> 8) & 0xFF, (v.c >> 0) & 0xFF) / 255.0f;
|
||||
frag_c = frag_c.abgr;
|
||||
}
|
||||
Reference in New Issue
Block a user