diff options
author | Alyssa Rosenzweig <[email protected]> | 2020-02-04 10:31:28 +0100 |
---|---|---|
committer | Tomeu Vizoso <[email protected]> | 2020-02-04 15:46:30 +0100 |
commit | 162927e43cdb5d6c184a4064fbd0799012fc297e (patch) | |
tree | 44a21f42750166776ba4fc9af411409ed5af709b /src | |
parent | 64541dd69875d043d90525769901d18fdde4b68b (diff) |
panfrost: Use size0 when calculating the offset to a depth level
Previously, we were using cubemap_stride and sometimes overwriting other
BOs such as shaders.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Signed-off-by: Tomeu Vizoso <[email protected]>
Reviewed-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3692>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/panfrost/pan_context.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/pan_resource.c | 16 |
2 files changed, 12 insertions, 7 deletions
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 585fefa7066..169e5956c2f 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -589,9 +589,8 @@ panfrost_upload_tex( for (unsigned l = first_level; l <= last_level; ++l) { for (unsigned f = first_face; f <= last_face; ++f) { pointers_and_strides[idx++] = - panfrost_get_texture_address(rsrc, l, w*face_mult + f) + panfrost_get_texture_address(rsrc, l, w * face_mult + f) + afbc_bit + view->astc_stretch; - if (has_manual_stride) { pointers_and_strides[idx++] = rsrc->slices[l].stride; diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c index aac1e8cf19d..6d5c9ab5cbd 100644 --- a/src/gallium/drivers/panfrost/pan_resource.c +++ b/src/gallium/drivers/panfrost/pan_resource.c @@ -555,6 +555,15 @@ panfrost_resource_destroy(struct pipe_screen *screen, ralloc_free(rsrc); } +static unsigned +panfrost_get_layer_stride(struct panfrost_resource *rsrc, unsigned level) +{ + if (rsrc->base.target == PIPE_TEXTURE_3D) + return rsrc->slices[level].size0; + else + return rsrc->cubemap_stride; +} + static void * panfrost_transfer_map(struct pipe_context *pctx, struct pipe_resource *resource, @@ -679,10 +688,7 @@ panfrost_transfer_map(struct pipe_context *pctx, return transfer->map; } else { transfer->base.stride = rsrc->slices[level].stride; - if (resource->target == PIPE_TEXTURE_3D) - transfer->base.layer_stride = rsrc->slices[level].size0; - else - transfer->base.layer_stride = rsrc->cubemap_stride; + transfer->base.layer_stride = panfrost_get_layer_stride(rsrc, level); /* By mapping direct-write, we're implicitly already * initialized (maybe), so be conservative */ @@ -830,7 +836,7 @@ panfrost_get_texture_address( unsigned level, unsigned face) { unsigned level_offset = rsrc->slices[level].offset; - unsigned face_offset = face * rsrc->cubemap_stride; + unsigned face_offset = face * panfrost_get_layer_stride(rsrc, level); return rsrc->bo->gpu + level_offset + face_offset; } |