mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-12 10:47:05 +02:00
Add a sanity check to ensure the attribute location binding worked
This commit is contained in:
@@ -13,10 +13,10 @@ layout(std140) uniform CellRenderData {
|
||||
};
|
||||
|
||||
// Have to use fixed locations here as all variants of the cell program share the same VAO
|
||||
// locations after 2 are used in the graphics program which also shares the same VAO
|
||||
layout(location=0) in uvec3 colors;
|
||||
layout(location=1) in uvec4 sprite_coords;
|
||||
layout(location=2) in float is_selected;
|
||||
// location 0 is used in the graphics program which uses the same VAO
|
||||
layout(location=1) in uvec3 colors;
|
||||
layout(location=2) in uvec4 sprite_coords;
|
||||
layout(location=3) in float is_selected;
|
||||
|
||||
#if defined(FOREGROUND) || defined(ALL)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#version GLSL_VERSION
|
||||
|
||||
layout(location=3) in vec4 src;
|
||||
layout(location=0) in vec4 src;
|
||||
out vec2 texcoord;
|
||||
|
||||
void main() {
|
||||
|
||||
@@ -191,6 +191,14 @@ init_cell_program() {
|
||||
cell_program_layouts[i].color_table.offset = get_uniform_information(i, "color_table[0]", GL_UNIFORM_OFFSET);
|
||||
cell_program_layouts[i].color_table.stride = get_uniform_information(i, "color_table[0]", GL_UNIFORM_ARRAY_STRIDE);
|
||||
}
|
||||
// Sanity check to ensure the attribute location binding worked
|
||||
#define C(p, name, expected) { int aloc = attrib_location(p, #name); if (aloc != expected && aloc != -1) fatal("The attribute location for %s is %d != %d in program: %d", #name, aloc, expected, p); }
|
||||
for (int p = CELL_PROGRAM; p <= CELL_FOREGROUND_PROGRAM; p++) {
|
||||
C(p, colors, 1); C(p, sprite_coords, 2); C(p, is_selected, 3);
|
||||
}
|
||||
C(GRAPHICS_PROGRAM, src, 0);
|
||||
#undef C
|
||||
|
||||
}
|
||||
|
||||
#define CELL_BUFFERS enum { cell_data_buffer, selection_buffer, uniform_buffer, graphics_buffer };
|
||||
|
||||
@@ -53,6 +53,7 @@ def calculate_gl_geometry(window_geometry, viewport_width, viewport_height, cell
|
||||
|
||||
def load_shader_programs():
|
||||
v, f = load_shaders('cell')
|
||||
compile_program(GRAPHICS_PROGRAM, *load_shaders('graphics'))
|
||||
for which, p in {
|
||||
'ALL': CELL_PROGRAM, 'BACKGROUND': CELL_BACKGROUND_PROGRAM, 'SPECIAL': CELL_SPECIAL_PROGRAM,
|
||||
'FOREGROUND': CELL_FOREGROUND_PROGRAM
|
||||
@@ -62,7 +63,6 @@ def load_shader_programs():
|
||||
init_cell_program()
|
||||
compile_program(CURSOR_PROGRAM, *load_shaders('cursor'))
|
||||
init_cursor_program()
|
||||
compile_program(GRAPHICS_PROGRAM, *load_shaders('graphics'))
|
||||
|
||||
|
||||
class Window:
|
||||
|
||||
Reference in New Issue
Block a user