summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/radeonsi/si_texture.c
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>2022-01-07 09:01:27 +0100
committerMarge Bot <emma+marge@anholt.net>2022-01-12 11:39:53 +0000
commit86262b6eac0c232f4b3085cfc86cff9b7de7d11b (patch)
treea3d20dacc6fd50e6376d1882a56da0b6c24441a6 /src/gallium/drivers/radeonsi/si_texture.c
parent2f8982df0e7705e1a43e218dd67b684d70c05d31 (diff)
radeonsi,radv: fix usages of surf_pitch
For linear textures, pitch[level] should be used instead. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14454>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_texture.c')
-rw-r--r--src/gallium/drivers/radeonsi/si_texture.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/gallium/drivers/radeonsi/si_texture.c b/src/gallium/drivers/radeonsi/si_texture.c
index 9a21fbde988..65c7f99fd9a 100644
--- a/src/gallium/drivers/radeonsi/si_texture.c
+++ b/src/gallium/drivers/radeonsi/si_texture.c
@@ -593,15 +593,17 @@ static bool si_resource_get_param(struct pipe_screen *screen, struct pipe_contex
*value = 0;
else
*value = ac_surface_get_plane_stride(sscreen->info.chip_class,
- &tex->surface, plane);
+ &tex->surface, plane, level);
return true;
case PIPE_RESOURCE_PARAM_OFFSET:
- if (resource->target == PIPE_BUFFER)
+ if (resource->target == PIPE_BUFFER) {
*value = 0;
- else
+ } else {
+ uint64_t level_offset = tex->surface.is_linear ? tex->surface.u.gfx9.offset[level] : 0;
*value = ac_surface_get_plane_offset(sscreen->info.chip_class,
- &tex->surface, plane, layer);
+ &tex->surface, plane, layer) + level_offset;
+ }
return true;
case PIPE_RESOURCE_PARAM_MODIFIER:
@@ -685,7 +687,7 @@ static bool si_texture_get_handle(struct pipe_screen *screen, struct pipe_contex
whandle->offset = ac_surface_get_plane_offset(sscreen->info.chip_class,
&tex->surface, plane, 0);
whandle->stride = ac_surface_get_plane_stride(sscreen->info.chip_class,
- &tex->surface, plane);
+ &tex->surface, plane, 0);
whandle->modifier = tex->surface.modifier;
return sscreen->ws->buffer_get_handle(sscreen->ws, res->buf, whandle);
}
@@ -1586,7 +1588,7 @@ static struct pipe_resource *si_texture_from_winsys_buffer(struct si_screen *ssc
ptex->offset != ac_surface_get_plane_offset(sscreen->info.chip_class,
&tex->surface, plane, 0) ||
ptex->stride != ac_surface_get_plane_stride(sscreen->info.chip_class,
- &tex->surface, plane)) {
+ &tex->surface, plane, 0)) {
si_texture_reference(&tex, NULL);
return NULL;
}