mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-08-04 14:46:03 +00:00
gl.h functions should only be used in shaders.c
This commit is contained in:
parent
86bc2c952a
commit
e9ca3a5d82
4 changed files with 17 additions and 7 deletions
|
|
@ -1831,7 +1831,7 @@ create_os_window(PyObject UNUSED *self, PyObject *args, PyObject *kw) {
|
|||
glfwWaylandSetTitlebarHidden(glfw_window, true);
|
||||
}
|
||||
glfwMakeContextCurrent(glfw_window);
|
||||
if (is_first_window) gl_init();
|
||||
if (is_first_window) initialize_gpu();
|
||||
bool is_semi_transparent = glfwGetWindowAttrib(glfw_window, GLFW_TRANSPARENT_FRAMEBUFFER);
|
||||
// blank the window once so that there is no initial flash of color
|
||||
// changing, in case the background color is not black
|
||||
|
|
|
|||
|
|
@ -1857,6 +1857,16 @@ static PyMethodDef module_methods[] = {
|
|||
{NULL, NULL, 0, NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
void
|
||||
initialize_gpu(void) {
|
||||
gl_init();
|
||||
}
|
||||
|
||||
void
|
||||
free_vao(ssize_t vao_idx) {
|
||||
remove_vao(vao_idx);
|
||||
}
|
||||
|
||||
static void
|
||||
finalize(void) {
|
||||
default_visual_bell_animation = free_animation(default_visual_bell_animation);
|
||||
|
|
|
|||
|
|
@ -312,9 +312,9 @@ create_gpu_resources_for_window(Window *w) {
|
|||
|
||||
static void
|
||||
release_gpu_resources_for_window(Window *w) {
|
||||
if (w->render_data.vao_idx > -1) remove_vao(w->render_data.vao_idx);
|
||||
if (w->render_data.vao_idx > -1) free_vao(w->render_data.vao_idx);
|
||||
w->render_data.vao_idx = -1;
|
||||
if (w->window_title_render_data.vao_idx > -1) remove_vao(w->window_title_render_data.vao_idx);
|
||||
if (w->window_title_render_data.vao_idx > -1) free_vao(w->window_title_render_data.vao_idx);
|
||||
w->window_title_render_data.vao_idx = -1;
|
||||
Py_CLEAR(w->window_title_render_data.screen);
|
||||
}
|
||||
|
|
@ -511,7 +511,7 @@ attach_window(id_type os_window_id, id_type tab_id, id_type id) {
|
|||
static void
|
||||
destroy_tab(Tab *tab) {
|
||||
for (size_t i = tab->num_windows; i > 0; i--) remove_window_inner(tab, tab->windows[i - 1].id);
|
||||
remove_vao(tab->border_rects.vao_idx);
|
||||
free_vao(tab->border_rects.vao_idx);
|
||||
free(tab->border_rects.rect_buf); tab->border_rects.rect_buf = NULL;
|
||||
free(tab->windows); tab->windows = NULL;
|
||||
}
|
||||
|
|
@ -545,7 +545,7 @@ destroy_os_window_item(OSWindow *w) {
|
|||
remove_tab_inner(w, tab->id);
|
||||
}
|
||||
Py_CLEAR(w->window_title); Py_CLEAR(w->tab_bar_render_data.screen);
|
||||
remove_vao(w->tab_bar_render_data.vao_idx);
|
||||
free_vao(w->tab_bar_render_data.vao_idx);
|
||||
free(w->tabs); w->tabs = NULL;
|
||||
free_bgimage(&w->background_image.override, true);
|
||||
zero_at_ptr(&w->background_image);
|
||||
|
|
|
|||
|
|
@ -553,8 +553,8 @@ sprite_index_to_pos(unsigned idx, unsigned xnum, unsigned ynum, unsigned *x, uns
|
|||
}
|
||||
|
||||
|
||||
void gl_init(void);
|
||||
void remove_vao(ssize_t vao_idx);
|
||||
void initialize_gpu(void);
|
||||
void free_vao(ssize_t vao_idx);
|
||||
bool remove_os_window(id_type os_window_id);
|
||||
void* make_os_window_context_current(OSWindow *w);
|
||||
void set_os_window_size(OSWindow *os_window, int x, int y);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue