summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-10-11 14:10:56 -0400
committerMatthias Clasen <mclasen@redhat.com>2019-10-11 14:45:06 -0400
commit843537c8e767bf6b8a352e3cc6cbad917632b904 (patch)
treebb1d91fa69651e6e1328000ea398f2f18fd5799e
parent0acb26a076b89d95f3258f539f8defe59808bd98 (diff)
downloadgtk+-wip/matthiasc/vao-in-place.tar.gz
gl: Drop buffer_sizewip/matthiasc/vao-in-place
No need to maintain buffer_size separately. It is always vertices->len * sizeof (GskQuadVertex).
-rw-r--r--gsk/gl/gskglrenderer.c8
-rw-r--r--gsk/gl/gskglrenderops.c6
-rw-r--r--gsk/gl/gskglrenderopsprivate.h2
3 files changed, 4 insertions, 12 deletions
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index 78338db358..5d5fa94a64 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -2988,10 +2988,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;
@@ -3189,7 +3189,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;
@@ -3266,7 +3265,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);*/
@@ -3294,7 +3292,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;