From d3a339a03e320c397696d3d0f49567670146a7a4 Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Sat, 19 Aug 2023 21:39:57 -0400 Subject: renderer: Drop buffer binding --- render/gles2/renderer.c | 112 ------------------------------------------------ 1 file changed, 112 deletions(-) (limited to 'render/gles2') diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c index 93fe292c..92e80709 100644 --- a/render/gles2/renderer.c +++ b/render/gles2/renderer.c @@ -42,14 +42,6 @@ struct wlr_gles2_renderer *gles2_get_renderer( return renderer; } -static struct wlr_gles2_renderer *gles2_get_renderer_in_context( - struct wlr_renderer *wlr_renderer) { - struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer); - assert(wlr_egl_is_current(renderer->egl)); - assert(renderer->current_buffer != NULL); - return renderer; -} - bool wlr_render_timer_is_gles2(struct wlr_render_timer *timer) { return timer->impl == &render_timer_impl; } @@ -175,101 +167,6 @@ error_buffer: return NULL; } -static bool gles2_bind_buffer(struct wlr_renderer *wlr_renderer, - struct wlr_buffer *wlr_buffer) { - struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer); - - if (renderer->current_buffer != NULL) { - assert(wlr_egl_is_current(renderer->egl)); - - push_gles2_debug(renderer); - glFlush(); - glBindFramebuffer(GL_FRAMEBUFFER, 0); - pop_gles2_debug(renderer); - - wlr_buffer_unlock(renderer->current_buffer->buffer); - renderer->current_buffer = NULL; - } - - if (wlr_buffer == NULL) { - wlr_egl_unset_current(renderer->egl); - return true; - } - - wlr_egl_make_current(renderer->egl); - - GLint fbo = gles2_buffer_get_fbo(renderer->current_buffer); - if (!fbo) { - return false; - } - - struct wlr_gles2_buffer *buffer = gles2_buffer_get_or_create(renderer, wlr_buffer); - if (buffer == NULL) { - return false; - } - - wlr_buffer_lock(wlr_buffer); - renderer->current_buffer = buffer; - - push_gles2_debug(renderer); - glBindFramebuffer(GL_FRAMEBUFFER, fbo); - pop_gles2_debug(renderer); - - return true; -} - -static const char *reset_status_str(GLenum status) { - switch (status) { - case GL_GUILTY_CONTEXT_RESET_KHR: - return "guilty"; - case GL_INNOCENT_CONTEXT_RESET_KHR: - return "innocent"; - case GL_UNKNOWN_CONTEXT_RESET_KHR: - return "unknown"; - default: - return ""; - } -} - -static bool gles2_begin(struct wlr_renderer *wlr_renderer, uint32_t width, - uint32_t height) { - struct wlr_gles2_renderer *renderer = - gles2_get_renderer_in_context(wlr_renderer); - - push_gles2_debug(renderer); - - if (renderer->procs.glGetGraphicsResetStatusKHR) { - GLenum status = renderer->procs.glGetGraphicsResetStatusKHR(); - if (status != GL_NO_ERROR) { - wlr_log(WLR_ERROR, "GPU reset (%s)", reset_status_str(status)); - wl_signal_emit_mutable(&wlr_renderer->events.lost, NULL); - return false; - } - } - - glViewport(0, 0, width, height); - renderer->viewport_width = width; - renderer->viewport_height = height; - - // refresh projection matrix - matrix_projection(renderer->projection, width, height, - WL_OUTPUT_TRANSFORM_FLIPPED_180); - - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - - // XXX: maybe we should save output projection and remove some of the need - // for users to sling matricies themselves - - pop_gles2_debug(renderer); - - return true; -} - -static void gles2_end(struct wlr_renderer *wlr_renderer) { - gles2_get_renderer_in_context(wlr_renderer); - // no-op -} - static const uint32_t *gles2_get_shm_texture_formats( struct wlr_renderer *wlr_renderer, size_t *len) { struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer); @@ -446,9 +343,6 @@ static void gles2_render_timer_destroy(struct wlr_render_timer *wlr_timer) { static const struct wlr_renderer_impl renderer_impl = { .destroy = gles2_destroy, - .bind_buffer = gles2_bind_buffer, - .begin = gles2_begin, - .end = gles2_end, .get_shm_texture_formats = gles2_get_shm_texture_formats, .get_dmabuf_texture_formats = gles2_get_dmabuf_texture_formats, .get_render_formats = gles2_get_render_formats, @@ -799,9 +693,3 @@ bool wlr_gles2_renderer_check_ext(struct wlr_renderer *wlr_renderer, struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer); return check_gl_ext(renderer->exts_str, ext); } - -GLuint wlr_gles2_renderer_get_current_fbo(struct wlr_renderer *wlr_renderer) { - struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer); - assert(renderer->current_buffer); - return gles2_buffer_get_fbo(renderer->current_buffer); -} -- cgit v1.2.3