panfrost: Respect constant buffer_offset
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 7 Jan 2020 01:39:58 +0000 (20:39 -0500)
committerTomeu Vizoso <tomeu.vizoso@collabora.com>
Tue, 7 Jan 2020 07:54:23 +0000 (08:54 +0100)
Fixes dEQP-GLES3.functional.ubo.multi_basic_types.single_buffer.* among
others

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
src/gallium/drivers/panfrost/pan_context.c

index 9c51f423f8612a6795f31340f5539d3173d3481c..33340cd566ca34ff07705c45f65ee1d3059fbc45 100644 (file)
@@ -797,9 +797,11 @@ panfrost_map_constant_buffer_gpu(
                                       PAN_BO_ACCESS_SHARED |
                                       PAN_BO_ACCESS_READ |
                                       panfrost_bo_access_for_stage(st));
-                return rsrc->bo->gpu;
+
+                /* Alignment gauranteed by PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT */
+                return rsrc->bo->gpu + cb->buffer_offset;
        } else if (cb->user_buffer) {
-                return panfrost_upload_transient(batch, cb->user_buffer, cb->buffer_size);
+                return panfrost_upload_transient(batch, cb->user_buffer + cb->buffer_offset, cb->buffer_size);
        } else {
                 unreachable("No constant buffer");
         }