[gtk/wip/chergert/glproto: 60/69] always allocate some space




commit 594f37e4e9c82c0868145eea1389d86a327d8477
Author: Christian Hergert <chergert redhat com>
Date:   Sat Dec 26 11:18:15 2020 -0800

    always allocate some space

 gsk/next/gskgluniformstate.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gsk/next/gskgluniformstate.c b/gsk/next/gskgluniformstate.c
index 0176df3a52..da16550065 100644
--- a/gsk/next/gskgluniformstate.c
+++ b/gsk/next/gskgluniformstate.c
@@ -214,7 +214,9 @@ setup_info:
   if (location >= program_info->uniform_info->len)
     g_array_set_size (program_info->uniform_info, location + 1);
 
-  alloc_uniform_data (state->uniform_data, uniform_sizes[format] * array_count, &offset);
+  alloc_uniform_data (state->uniform_data,
+                      uniform_sizes[format] * MAX (1, array_count),
+                      &offset);
 
   info = &g_array_index (program_info->uniform_info, GskGLUniformInfo, location);
   info->changed = TRUE;
@@ -735,7 +737,7 @@ gsk_gl_uniform_state_end_frame (GskGLUniformState *state)
       for (guint j = 0; j < program_info->uniform_info->len; j++)
         {
           GskGLUniformInfo *info = &g_array_index (program_info->uniform_info, GskGLUniformInfo, j);
-          guint size = uniform_sizes[info->format] * info->array_count;
+          guint size = uniform_sizes[info->format] * MAX (1, info->array_count);
           guint offset;
 
           alloc_uniform_data (buffer, size, &offset);


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