[gtk/wip/chergert/glproto: 372/493] inline draw helper
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/glproto: 372/493] inline draw helper
- Date: Fri, 19 Feb 2021 02:25:17 +0000 (UTC)
commit b617d06580cd2e8dafed6ab6910d5ed9b3aa61fe
Author: Christian Hergert <chergert redhat com>
Date: Wed Feb 3 12:14:16 2021 -0800
inline draw helper
now that we can access these pointers easily
gsk/next/gskglrenderjob.c | 55 +++++++++++++++++++++--------------------------
1 file changed, 25 insertions(+), 30 deletions(-)
---
diff --git a/gsk/next/gskglrenderjob.c b/gsk/next/gskglrenderjob.c
index 274ad92465..5af3ee3470 100644
--- a/gsk/next/gskglrenderjob.c
+++ b/gsk/next/gskglrenderjob.c
@@ -183,14 +183,37 @@ typedef struct _GskGLRenderOffscreen
guint was_offscreen : 1;
} GskGLRenderOffscreen;
-static void gsk_gl_render_job_begin_draw (GskGLRenderJob *job,
- GskGLProgram *program);
static void gsk_gl_render_job_visit_node (GskGLRenderJob *job,
GskRenderNode *node);
static gboolean gsk_gl_render_job_visit_node_with_offscreen (GskGLRenderJob *job,
GskRenderNode *node,
GskGLRenderOffscreen *offscreen);
+static inline void
+gsk_gl_render_job_begin_draw (GskGLRenderJob *job,
+ GskGLProgram *program)
+{
+ /* If the program is up to our shared state value, then we can ignore callign
+ * gsk_gl_program_begin_draw() with the initial values saving a bunch of
+ * compares. Last checked this saves about 25-35% of the compares when
+ * running widget-factory on the first page.
+ */
+ if G_LIKELY (program->last_shared_state == job->driver->last_shared_state)
+ {
+ gsk_gl_command_queue_begin_draw (job->command_queue, program->id, &job->viewport);
+ }
+ else
+ {
+ gsk_gl_program_begin_draw (program,
+ &job->viewport,
+ &job->projection,
+ &job->current_modelview->matrix,
+ &job->current_clip->rect,
+ job->alpha);
+ program->last_shared_state = job->driver->last_shared_state;
+ }
+}
+
static inline void
init_full_texture_region (GskGLRenderOffscreen *offscreen)
{
@@ -3726,31 +3749,3 @@ gsk_gl_render_job_free (GskGLRenderJob *job)
g_clear_pointer (&job->clip, g_array_unref);
g_slice_free (GskGLRenderJob, job);
}
-
-static void
-gsk_gl_render_job_begin_draw (GskGLRenderJob *job,
- GskGLProgram *program)
-{
- /* If the program is up to our shared state value,
- * then we can ignore callign gsk_gl_program_begin_draw()
- * with the initial values saving a bunch of compares.
- *
- * Last checked this saves about 25% of the compares.
- */
- if G_LIKELY (program->last_shared_state == job->driver->last_shared_state)
- {
- gsk_gl_command_queue_begin_draw (job->command_queue,
- program->id,
- &job->viewport);
- }
- else
- {
- gsk_gl_program_begin_draw (program,
- &job->viewport,
- &job->projection,
- gsk_gl_render_job_get_modelview_matrix (job),
- gsk_gl_render_job_get_clip (job),
- job->alpha);
- program->last_shared_state = job->driver->last_shared_state;
- }
-}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]