OSDN Git Service

vc4: Fix UBO allocation when no uniforms are used.
authorEric Anholt <eric@anholt.net>
Fri, 18 Jul 2014 23:29:18 +0000 (16:29 -0700)
committerEric Anholt <eric@anholt.net>
Sat, 9 Aug 2014 01:59:46 +0000 (18:59 -0700)
We do rely on a real BO getting allocated, so make sure we ask for a non-zero size.

src/gallium/drivers/vc4/vc4_program.c

index 2107ef7..4755ea0 100644 (file)
@@ -606,7 +606,8 @@ vc4_get_uniform_bo(struct vc4_context *vc4, struct vc4_shader_state *shader,
                    uint32_t *out_offset)
 {
         struct vc4_shader_uniform_info *uinfo = &shader->uniforms[shader_index];
-        struct vc4_bo *ubo = vc4_bo_alloc(vc4->screen, uinfo->count * 4, "ubo");
+        struct vc4_bo *ubo = vc4_bo_alloc(vc4->screen,
+                                          MAX2(1, uinfo->count * 4), "ubo");
         uint32_t *map = vc4_bo_map(ubo);
 
         for (int i = 0; i < uinfo->count; i++) {