[gtk/wip/chergert/glproto] inline draw helper



commit 060ca92e263d73b8a60f922813d6168cb465b34f
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]