vc4: Fix handling of UBO range offsets.
authorEric Anholt <eric@anholt.net>
Wed, 27 Jul 2016 21:58:43 +0000 (14:58 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 3 Aug 2016 17:25:08 +0000 (10:25 -0700)
The ranges are in units of bytes, not dwords.  This wasn't caught by
piglit tests because ttn tends to make one big uniform file, so we only
had one UBO range with a src and dst offset of 0.

src/gallium/drivers/vc4/vc4_uniforms.c

index c9d6b5377205747dd97dfd5bdbd3431db5af55d8..528f10eb25af897bd94b361b7f2cb687e364446f 100644 (file)
@@ -182,10 +182,11 @@ vc4_upload_ubo(struct vc4_context *vc4,
                 return NULL;
 
         struct vc4_bo *ubo = vc4_bo_alloc(vc4->screen, shader->ubo_size, "ubo");
-        uint32_t *data = vc4_bo_map(ubo);
+        void *data = vc4_bo_map(ubo);
         for (uint32_t i = 0; i < shader->num_ubo_ranges; i++) {
                 memcpy(data + shader->ubo_ranges[i].dst_offset,
-                       gallium_uniforms + shader->ubo_ranges[i].src_offset,
+                       ((const void *)gallium_uniforms +
+                        shader->ubo_ranges[i].src_offset),
                        shader->ubo_ranges[i].size);
         }