From 7dcc85b46e2253c1efd425e55749e1714a260a21 Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Wed, 10 Apr 2019 23:05:58 +0200 Subject: [PATCH] st/nine: Support internal compressed format for volumes Reuse the generic path to support compressed formats. Signed-off-by: Axel Davy --- src/gallium/state_trackers/nine/volume9.c | 29 +++++++++++++---------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/gallium/state_trackers/nine/volume9.c b/src/gallium/state_trackers/nine/volume9.c index 1d562f5dd8d..ab0a82e288d 100644 --- a/src/gallium/state_trackers/nine/volume9.c +++ b/src/gallium/state_trackers/nine/volume9.c @@ -315,19 +315,22 @@ NineVolume9_LockBox( struct NineVolume9 *This, if (p_atomic_read(&This->pending_uploads_counter)) nine_csmt_process(This->base.device); - if (This->data_internal) { - /* For now we only have uncompressed formats here */ - pLockedVolume->RowPitch = This->stride_internal; - pLockedVolume->SlicePitch = This->layer_stride_internal; - pLockedVolume->pBits = This->data_internal + box.z * This->layer_stride_internal + - box.y * This->stride_internal + - util_format_get_stride(This->format_internal, box.x); - } else if (This->data) { - pLockedVolume->RowPitch = This->stride; - pLockedVolume->SlicePitch = This->layer_stride; - pLockedVolume->pBits = This->data + - NineVolume9_GetSystemMemOffset(This->info.format, This->stride, - This->layer_stride, + if (This->data_internal || This->data) { + enum pipe_format format = This->info.format; + unsigned stride = This->stride; + unsigned layer_stride = This->layer_stride; + uint8_t *data = This->data; + if (This->data_internal) { + format = This->format_internal; + stride = This->stride_internal; + layer_stride = This->layer_stride_internal; + data = This->data_internal; + } + pLockedVolume->RowPitch = stride; + pLockedVolume->SlicePitch = layer_stride; + pLockedVolume->pBits = data + + NineVolume9_GetSystemMemOffset(format, stride, + layer_stride, box.x, box.y, box.z); } else { bool no_refs = !p_atomic_read(&This->base.bind) && -- 2.30.2