zink: respect ubo buffer alignment requirement
authorDuncan Hopkins <duncan@thefoundry.co.uk>
Thu, 11 Jul 2019 10:51:08 +0000 (11:51 +0100)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Mon, 28 Oct 2019 08:51:48 +0000 (08:51 +0000)
The driver can report a minimum alignment for UBOs, and that can be
larger than 64, which we've currently been using. Let's play ball, and
use the reported value instead.

Acked-by: Jordan Justen <jordan.l.justen@intel.com>
src/gallium/drivers/zink/zink_context.c

index a320f86067ffb65abe5c95276df4b431c9aa1ad7..f5fefa7bbbb1aa589231c25df91604b95f99402e 100644 (file)
@@ -428,9 +428,12 @@ zink_set_constant_buffer(struct pipe_context *pctx,
    if (cb) {
       struct pipe_resource *buffer = cb->buffer;
       unsigned offset = cb->buffer_offset;
-      if (cb->user_buffer)
-         u_upload_data(ctx->base.const_uploader, 0, cb->buffer_size, 64,
+      if (cb->user_buffer) {
+         struct zink_screen *screen = zink_screen(pctx->screen);
+         u_upload_data(ctx->base.const_uploader, 0, cb->buffer_size,
+                       screen->props.limits.minUniformBufferOffsetAlignment,
                        cb->user_buffer, &offset, &buffer);
+      }
 
       pipe_resource_reference(&ctx->ubos[shader][index].buffer, buffer);
       ctx->ubos[shader][index].buffer_offset = offset;