mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 20:28:04 +02:00
nvk: use remaps for image copies
This helps us to get around hardware limitations on the width. Signed-off-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
parent
a39d22f246
commit
1eb63dd19a
1 changed files with 26 additions and 1 deletions
|
|
@ -31,7 +31,7 @@ struct nouveau_copy_buffer {
|
|||
struct nouveau_copy {
|
||||
struct nouveau_copy_buffer src;
|
||||
struct nouveau_copy_buffer dst;
|
||||
struct {
|
||||
struct nouveau_copy_remap {
|
||||
uint8_t comp_size;
|
||||
uint8_t dst[4];
|
||||
} remap;
|
||||
|
|
@ -97,6 +97,28 @@ nouveau_copy_rect_image(
|
|||
return buf;
|
||||
}
|
||||
|
||||
static struct nouveau_copy_remap
|
||||
nouveau_copy_remap_format(VkFormat format)
|
||||
{
|
||||
/* Pick an arbitrary component size. It doesn't matter what size we
|
||||
* pick since we're just doing a copy, as long as it's no more than 4B
|
||||
* and divides the format size.
|
||||
*/
|
||||
unsigned comp_size = vk_format_get_blocksize(format);
|
||||
if (comp_size % 3 == 0) {
|
||||
comp_size /= 3;
|
||||
assert(util_is_power_of_two_nonzero(comp_size) && comp_size <= 4);
|
||||
} else {
|
||||
assert(util_is_power_of_two_nonzero(comp_size) && comp_size <= 16);
|
||||
comp_size = MIN2(comp_size, 4);
|
||||
}
|
||||
|
||||
return (struct nouveau_copy_remap) {
|
||||
.comp_size = comp_size,
|
||||
.dst = { 0, 1, 2, 3 },
|
||||
};
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
to_90b5_remap_comp_size(uint8_t comp_size)
|
||||
{
|
||||
|
|
@ -372,6 +394,7 @@ nvk_CmdCopyBufferToImage2(VkCommandBuffer commandBuffer,
|
|||
}
|
||||
break;
|
||||
default:
|
||||
copy.remap = nouveau_copy_remap_format(dst->vk.format);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -441,6 +464,7 @@ nvk_CmdCopyImageToBuffer2(VkCommandBuffer commandBuffer,
|
|||
}
|
||||
break;
|
||||
default:
|
||||
copy.remap = nouveau_copy_remap_format(src->vk.format);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -518,6 +542,7 @@ nvk_CmdCopyImage2(VkCommandBuffer commandBuffer,
|
|||
}
|
||||
break;
|
||||
default:
|
||||
copy.remap = nouveau_copy_remap_format(src->vk.format);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue