[gtk/wip/chergert/glproto: 302/493] handle unlinked uniforms more gracefully




commit c844a0ec791f171f085a1add5c5597f557a4efc6
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jan 28 23:41:51 2021 -0800

    handle unlinked uniforms more gracefully
    
    easiest to do it deeper here than higher up and plumb through everything.

 gsk/next/gskgluniformstate.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/gsk/next/gskgluniformstate.c b/gsk/next/gskgluniformstate.c
index 3728a10151..3006b8977d 100644
--- a/gsk/next/gskgluniformstate.c
+++ b/gsk/next/gskgluniformstate.c
@@ -211,8 +211,12 @@ get_uniform (GskGLUniformState  *state,
   g_assert (program > 0);
   g_assert (array_count < 256);
   g_assert ((int)format >= 0 && format < GSK_GL_UNIFORM_FORMAT_LAST);
-  g_assert (location < GL_MAX_UNIFORM_LOCATIONS);
   g_assert (format > 0);
+  g_assert (location < GL_MAX_UNIFORM_LOCATIONS || location == (guint)-1);
+
+  /* Handle unused uniforms gracefully */
+  if (location == (guint)-1)
+    return NULL;
 
   /* Fast path for common case (state already initialized) */
   if G_LIKELY (program < state->program_info->len &&


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