From 58d57e1087c9f705fc647522c99be3e4d9dc683a Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 11 Oct 2019 14:10:56 -0400 Subject: [PATCH] gl: Drop buffer_size No need to maintain buffer_size separately. It is always vertices->len * sizeof (GskQuadVertex). --- gsk/gl/gskglrenderer.c | 8 +++----- gsk/gl/gskglrenderops.c | 6 +----- gsk/gl/gskglrenderopsprivate.h | 2 -- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c index 999a57e467..a52b940311 100644 --- a/gsk/gl/gskglrenderer.c +++ b/gsk/gl/gskglrenderer.c @@ -2972,10 +2972,10 @@ add_offscreen_ops (GskGLRenderer *self, } static void -gsk_gl_renderer_render_ops (GskGLRenderer *self, - gsize vertex_data_size) +gsk_gl_renderer_render_ops (GskGLRenderer *self) { const Program *program = NULL; + gsize vertex_data_size = self->op_builder.vertices->len * sizeof (GskQuadVertex); float *vertex_data = (float*)self->op_builder.vertices->data; OpBufferIter iter; OpKind kind; @@ -3173,7 +3173,6 @@ gsk_gl_renderer_do_render (GskRenderer *renderer, { GskGLRenderer *self = GSK_GL_RENDERER (renderer); graphene_matrix_t projection; - gsize buffer_size; #ifdef G_ENABLE_DEBUG GskProfiler *profiler; gint64 gpu_time, cpu_time, start_time; @@ -3253,7 +3252,6 @@ gsk_gl_renderer_do_render (GskRenderer *renderer, g_assert_cmpint (self->op_builder.current_render_target, ==, fbo_id); ops_pop_modelview (&self->op_builder); ops_pop_clip (&self->op_builder); - buffer_size = self->op_builder.buffer_size; ops_finish (&self->op_builder); /*g_message ("Ops: %u", self->render_ops->len);*/ @@ -3281,7 +3279,7 @@ gsk_gl_renderer_do_render (GskRenderer *renderer, glBlendEquation (GL_FUNC_ADD); gdk_gl_context_push_debug_group (self->gl_context, "Rendering ops"); - gsk_gl_renderer_render_ops (self, buffer_size); + gsk_gl_renderer_render_ops (self); gdk_gl_context_pop_debug_group (self->gl_context); #ifdef G_ENABLE_DEBUG diff --git a/gsk/gl/gskglrenderops.c b/gsk/gl/gskglrenderops.c index 724aacfa42..4c6e2a7b35 100644 --- a/gsk/gl/gskglrenderops.c +++ b/gsk/gl/gskglrenderops.c @@ -28,7 +28,6 @@ ops_finish (RenderOpBuilder *builder) g_array_free (builder->clip_stack, TRUE); builder->clip_stack = NULL; - builder->buffer_size = 0; builder->dx = 0; builder->dy = 0; builder->current_modelview = NULL; @@ -690,15 +689,12 @@ ops_draw (RenderOpBuilder *builder, } else { - gsize offset = builder->buffer_size / sizeof (GskQuadVertex); - op = op_buffer_add (&builder->render_ops, OP_DRAW); - op->vao_offset = offset; + op->vao_offset = builder->vertices->len; op->vao_size = GL_N_VERTICES; } g_array_append_vals (builder->vertices, vertex_data, GL_N_VERTICES); - builder->buffer_size += sizeof (GskQuadVertex) * GL_N_VERTICES; } /* The offset is only valid for the current modelview. diff --git a/gsk/gl/gskglrenderopsprivate.h b/gsk/gl/gskglrenderopsprivate.h index f01097b65f..e555653617 100644 --- a/gsk/gl/gskglrenderopsprivate.h +++ b/gsk/gl/gskglrenderopsprivate.h @@ -153,8 +153,6 @@ typedef struct float current_opacity; float dx, dy; - gsize buffer_size; - OpBuffer render_ops; GArray *vertices;