mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-02 20:58:04 +02:00
nvk/copy: Implement CopyImage2 between R and D/S
Following VK_KHR_maintenance8: > Allow copies between depth/stencil and “matching” color attachments Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36950>
This commit is contained in:
parent
81e37e9c67
commit
bde5e39b41
1 changed files with 33 additions and 1 deletions
|
|
@ -830,6 +830,7 @@ nvk_CmdCopyImage2(VkCommandBuffer commandBuffer,
|
|||
uint8_t dst_plane = nvk_image_aspects_to_plane(dst, dst_aspects);
|
||||
|
||||
const struct nil_format src_format = src->planes[src_plane].nil.format;
|
||||
const struct nil_format dst_format = dst->planes[dst_plane].nil.format;
|
||||
const enum nil_sample_layout src_sample_layout =
|
||||
src->planes[src_plane].nil.sample_layout;
|
||||
|
||||
|
|
@ -843,10 +844,41 @@ nvk_CmdCopyImage2(VkCommandBuffer commandBuffer,
|
|||
.extent_el = nil_extent4d_px_to_el(extent4d_px, src_format,
|
||||
src_sample_layout),
|
||||
};
|
||||
struct nouveau_copy copy2 = { 0 };
|
||||
|
||||
nvk_remap_copy_aspect(©, src_format.p_format, src_aspects);
|
||||
bool src_zs = util_format_is_depth_and_stencil(src_format.p_format);
|
||||
bool dst_zs = util_format_is_depth_and_stencil(dst_format.p_format);
|
||||
|
||||
if (src_zs && dst_zs) {
|
||||
assert(src_format.p_format == dst_format.p_format);
|
||||
nvk_remap_copy_aspect(©, src_format.p_format, src_aspects);
|
||||
} else if (src_zs && !dst_zs) {
|
||||
nvk_remap_extract_aspect(©, ©2,
|
||||
src_format.p_format, src_aspects);
|
||||
if (copy2.extent_el.width > 0) {
|
||||
copy2.dst = copy.dst;
|
||||
copy.dst = copy2.src =
|
||||
nouveau_copy_rect_image(src, &src->stencil_copy_temp,
|
||||
region->srcOffset,
|
||||
®ion->srcSubresource);
|
||||
}
|
||||
} else if (!src_zs && dst_zs) {
|
||||
nvk_remap_insert_aspect(©, ©2,
|
||||
dst_format.p_format, dst_aspects);
|
||||
if (copy2.extent_el.width > 0) {
|
||||
copy2.dst = copy.dst;
|
||||
copy.dst = copy2.src =
|
||||
nouveau_copy_rect_image(dst, &dst->stencil_copy_temp,
|
||||
region->dstOffset,
|
||||
®ion->dstSubresource);
|
||||
}
|
||||
} else {
|
||||
copy.remap = nouveau_copy_remap_format(src_format.p_format);
|
||||
}
|
||||
|
||||
nouveau_copy_rect(cmd, ©);
|
||||
if (copy2.extent_el.width > 0)
|
||||
nouveau_copy_rect(cmd, ©2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue