[gtk/wip/chergert/glproto: 710/920] move fallback out of shader node




commit 06eefddd8218ff5e25353698b6e1cbca46bb682a
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jan 14 14:48:38 2021 -0800

    move fallback out of shader node

 gsk/next/gskglrenderjob.c | 35 ++++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 15 deletions(-)
---
diff --git a/gsk/next/gskglrenderjob.c b/gsk/next/gskglrenderjob.c
index 62d356e361..f74b4e9ad0 100644
--- a/gsk/next/gskglrenderjob.c
+++ b/gsk/next/gskglrenderjob.c
@@ -2311,6 +2311,25 @@ gsk_gl_render_job_visit_color_matrix_node (GskGLRenderJob *job,
   gsk_gl_program_end_draw (job->driver->color_matrix);
 }
 
+static void
+gsk_gl_render_job_visit_gl_shader_node_fallback (GskGLRenderJob *job,
+                                                 GskRenderNode  *node)
+{
+  static const GdkRGBA pink = { 255 / 255., 105 / 255., 180 / 255., 1.0 };
+
+  gsk_gl_program_begin_draw (job->driver->color,
+                             &job->viewport,
+                             &job->projection,
+                             gsk_gl_render_job_get_modelview_matrix (job),
+                             gsk_gl_render_job_get_clip (job),
+                             job->alpha);
+  gsk_gl_program_set_uniform_color (job->driver->color,
+                                    UNIFORM_COLOR_COLOR,
+                                    &pink);
+  gsk_gl_render_job_draw_rect (job, &node->bounds);
+  gsk_gl_program_end_draw (job->driver->color);
+}
+
 static void
 gsk_gl_render_job_visit_gl_shader_node (GskGLRenderJob *job,
                                         GskRenderNode  *node)
@@ -2326,27 +2345,13 @@ gsk_gl_render_job_visit_gl_shader_node (GskGLRenderJob *job,
 
   if G_UNLIKELY (program == NULL)
     {
-      static const GdkRGBA pink = { 255 / 255., 105 / 255., 180 / 255., 1.0 };
-
       if (g_object_get_data (G_OBJECT (shader), "gsk-did-warn") == NULL)
         {
           g_object_set_data (G_OBJECT (shader), "gsk-did-warn", GUINT_TO_POINTER (1));
           g_warning ("Failed to compile gl shader: %s", error->message);
         }
-
+      gsk_gl_render_job_visit_gl_shader_node_fallback (job, node);
       g_clear_error (&error);
-
-      gsk_gl_program_begin_draw (job->driver->color,
-                                 &job->viewport,
-                                 &job->projection,
-                                 gsk_gl_render_job_get_modelview_matrix (job),
-                                 gsk_gl_render_job_get_clip (job),
-                                 job->alpha);
-      gsk_gl_program_set_uniform_color (job->driver->color,
-                                        UNIFORM_COLOR_COLOR,
-                                        &pink);
-      gsk_gl_render_job_draw_rect (job, &node->bounds);
-      gsk_gl_program_end_draw (job->driver->color);
     }
   else
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]