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




commit 688bcd6dedfac19f39aece88c87246e1c980e333
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]