vulkan: store fill vertices in buffer
This commit is contained in:
parent
f84934bd9a
commit
10be846e4c
7 changed files with 160 additions and 54 deletions
|
|
@ -1,4 +1,12 @@
|
|||
#extension GL_EXT_buffer_reference : require
|
||||
|
||||
layout(buffer_reference, buffer_reference_align = 8, std430) buffer Vertices {
|
||||
vec2 pos[][4];
|
||||
};
|
||||
|
||||
layout(push_constant, std430) uniform Data {
|
||||
layout(offset = 0) vec2 pos[4];
|
||||
layout(offset = 32) vec4 color;
|
||||
vec4 color;
|
||||
Vertices vertices;
|
||||
uint padding1;
|
||||
uint padding2;
|
||||
} data;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#version 450
|
||||
|
||||
#include "frag_spec_const.glsl"
|
||||
#include "fill.common.glsl"
|
||||
|
||||
layout(location = 0) out vec4 out_color;
|
||||
|
|
|
|||
|
|
@ -1,16 +1,8 @@
|
|||
#version 450
|
||||
//#extension GL_EXT_debug_printf : enable
|
||||
|
||||
#include "fill.common.glsl"
|
||||
|
||||
void main() {
|
||||
vec2 pos;
|
||||
switch (gl_VertexIndex) {
|
||||
case 0: pos = data.pos[0]; break;
|
||||
case 1: pos = data.pos[1]; break;
|
||||
case 2: pos = data.pos[2]; break;
|
||||
case 3: pos = data.pos[3]; break;
|
||||
}
|
||||
vec2 pos = data.vertices.pos[gl_InstanceIndex][gl_VertexIndex];
|
||||
gl_Position = vec4(pos, 0.0, 1.0);
|
||||
// debugPrintfEXT("gl_Position = %v4f", gl_Position);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue