Mesa (master): vc4: Fix handling of UBO range offsets.

Eric Anholt anholt at kemper.freedesktop.org
Wed Aug 3 17:59:15 UTC 2016


Module: Mesa
Branch: master
Commit: 02f8c444e853ddb1db4f5354c613a172f6a98ef5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=02f8c444e853ddb1db4f5354c613a172f6a98ef5

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Jul 27 14:58:43 2016 -0700

vc4: Fix handling of UBO range offsets.

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 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_uniforms.c b/src/gallium/drivers/vc4/vc4_uniforms.c
index c9d6b53..528f10e 100644
--- a/src/gallium/drivers/vc4/vc4_uniforms.c
+++ b/src/gallium/drivers/vc4/vc4_uniforms.c
@@ -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);
         }
 




More information about the mesa-commit mailing list