vulkan: store out vertices in buffer
This commit is contained in:
parent
10be846e4c
commit
73611fd287
4 changed files with 34 additions and 31 deletions
|
|
@ -1,3 +1,9 @@
|
|||
#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];
|
||||
Vertices vertices;
|
||||
} data;
|
||||
|
|
|
|||
|
|
@ -1,16 +1,8 @@
|
|||
#version 450
|
||||
//#extension GL_EXT_debug_printf : enable
|
||||
|
||||
#include "out.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("X gl_Position = %v4f, pos = %v2f", gl_Position, pos);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue