mesa/st: Add and use st_texture_image_transfer::box
Use this field to determine which parts of the compressed texture fallback resource needs updating. Drops a dependency on the st_texture_image_transfer::transfer pointer. Acked-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18257>
This commit is contained in:
@@ -507,6 +507,10 @@ st_MapTextureImage(struct gl_context *ctx,
|
|||||||
unsigned z = transfer->box.z;
|
unsigned z = transfer->box.z;
|
||||||
struct st_texture_image_transfer *itransfer = &texImage->transfer[z];
|
struct st_texture_image_transfer *itransfer = &texImage->transfer[z];
|
||||||
|
|
||||||
|
assert(itransfer->box.depth == 0);
|
||||||
|
if (transfer_flags & PIPE_MAP_WRITE)
|
||||||
|
u_box_2d_zslice(x, y, z, w, h, &itransfer->box);
|
||||||
|
|
||||||
unsigned blk_w, blk_h;
|
unsigned blk_w, blk_h;
|
||||||
_mesa_get_format_block_size(texImage->TexFormat, &blk_w, &blk_h);
|
_mesa_get_format_block_size(texImage->TexFormat, &blk_w, &blk_h);
|
||||||
|
|
||||||
@@ -551,7 +555,9 @@ st_UnmapTextureImage(struct gl_context *ctx,
|
|||||||
|
|
||||||
assert(z == transfer->box.z);
|
assert(z == transfer->box.z);
|
||||||
|
|
||||||
if (transfer->usage & PIPE_MAP_WRITE) {
|
if (itransfer->box.depth != 0) {
|
||||||
|
assert(itransfer->box.depth == 1);
|
||||||
|
|
||||||
if (util_format_is_compressed(texImage->pt->format)) {
|
if (util_format_is_compressed(texImage->pt->format)) {
|
||||||
/* Transcode into a different compressed format. */
|
/* Transcode into a different compressed format. */
|
||||||
unsigned size =
|
unsigned size =
|
||||||
@@ -631,6 +637,8 @@ st_UnmapTextureImage(struct gl_context *ctx,
|
|||||||
unreachable("unexpected format for a compressed format fallback");
|
unreachable("unexpected format for a compressed format fallback");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memset(&itransfer->box, 0, sizeof(struct pipe_box));
|
||||||
}
|
}
|
||||||
|
|
||||||
itransfer->temp_data = NULL;
|
itransfer->temp_data = NULL;
|
||||||
|
@@ -47,6 +47,7 @@ struct st_texture_image_transfer
|
|||||||
GLubyte *temp_data; /**< Temporary compressed texture storage. */
|
GLubyte *temp_data; /**< Temporary compressed texture storage. */
|
||||||
unsigned temp_stride; /**< Stride of the compressed texture storage. */
|
unsigned temp_stride; /**< Stride of the compressed texture storage. */
|
||||||
GLubyte *map; /**< Saved map pointer of the uncompressed transfer. */
|
GLubyte *map; /**< Saved map pointer of the uncompressed transfer. */
|
||||||
|
struct pipe_box box; /**< Region of the transfer's resource to write. */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user