[gtk/wip/chergert/glproto: 565/920] only setup viewport uniform if location is > -1




commit e52b79395827ccf074563f9da8f0586aaf998068
Author: Christian Hergert <chergert redhat com>
Date:   Sat Dec 26 11:13:05 2020 -0800

    only setup viewport uniform if location is > -1
    
    it will be -1 if not used in the compiled program

 gsk/next/gskglprogram.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/gsk/next/gskglprogram.c b/gsk/next/gskglprogram.c
index 0f1a6af5ed..b459022037 100644
--- a/gsk/next/gskglprogram.c
+++ b/gsk/next/gskglprogram.c
@@ -327,16 +327,21 @@ void
 gsk_gl_program_begin_draw (GskGLProgram          *self,
                            const graphene_rect_t *viewport)
 {
+  int viewport_location;
+
   g_assert (GSK_IS_GL_PROGRAM (self));
   g_assert (viewport != NULL);
 
-  gsk_gl_command_queue_set_uniform4f (self->command_queue,
-                                      self->id,
-                                      get_uniform_location (self, UNIFORM_SHARED_VIEWPORT),
-                                      viewport->origin.x,
-                                      viewport->origin.y,
-                                      viewport->size.width,
-                                      viewport->size.height);
+  viewport_location = get_uniform_location (self, UNIFORM_SHARED_VIEWPORT);
+  if (viewport_location >= 0)
+    gsk_gl_command_queue_set_uniform4f (self->command_queue,
+                                        self->id,
+                                        viewport_location,
+                                        viewport->origin.x,
+                                        viewport->origin.y,
+                                        viewport->size.width,
+                                        viewport->size.height);
+
   gsk_gl_command_queue_begin_draw (self->command_queue, self->id, viewport);
 }
 


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