mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-21 07:50:35 +01:00
vk/meta: Let meta users pass the color attachment write mask explicitly
Will be needed for partial interleaved depth/stencil copies where the image is treated as a color image with some components assigned to the depth and others assigned to the stencil. If only one aspect is copies using a graphics pipeline, we need to preserve components assigned to the other aspect, and an easy way to do that is to tweak the color attachment write mask. Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Suggested-by: Faith Ekstrand <faith.ekstrand@collabora.com> Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29333>
This commit is contained in:
parent
8ddc527ba4
commit
dad5c1184f
7 changed files with 25 additions and 7 deletions
|
|
@ -124,8 +124,12 @@ hk_meta_init_render(struct hk_cmd_buffer *cmd,
|
|||
.depth_attachment_format = render->depth_att.vk_format,
|
||||
.stencil_attachment_format = render->stencil_att.vk_format,
|
||||
};
|
||||
for (uint32_t a = 0; a < render->color_att_count; a++)
|
||||
for (uint32_t a = 0; a < render->color_att_count; a++) {
|
||||
info->color_attachment_formats[a] = render->color_att[a].vk_format;
|
||||
info->color_attachment_write_masks[a] =
|
||||
VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT |
|
||||
VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -128,8 +128,12 @@ nvk_meta_init_render(struct nvk_cmd_buffer *cmd,
|
|||
.depth_attachment_format = render->depth_att.vk_format,
|
||||
.stencil_attachment_format = render->stencil_att.vk_format,
|
||||
};
|
||||
for (uint32_t a = 0; a < render->color_att_count; a++)
|
||||
for (uint32_t a = 0; a < render->color_att_count; a++) {
|
||||
info->color_attachment_formats[a] = render->color_att[a].vk_format;
|
||||
info->color_attachment_write_masks[a] =
|
||||
VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT |
|
||||
VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -440,10 +440,7 @@ vk_meta_create_graphics_pipeline(struct vk_device *device,
|
|||
for (uint32_t i = 0; i < render->color_attachment_count; i++) {
|
||||
cb_att[i] = (VkPipelineColorBlendAttachmentState) {
|
||||
.blendEnable = false,
|
||||
.colorWriteMask = VK_COLOR_COMPONENT_R_BIT |
|
||||
VK_COLOR_COMPONENT_G_BIT |
|
||||
VK_COLOR_COMPONENT_B_BIT |
|
||||
VK_COLOR_COMPONENT_A_BIT,
|
||||
.colorWriteMask = render->color_attachment_write_masks[i],
|
||||
};
|
||||
}
|
||||
cb_info = (VkPipelineColorBlendStateCreateInfo) {
|
||||
|
|
|
|||
|
|
@ -134,6 +134,7 @@ struct vk_meta_rendering_info {
|
|||
uint32_t samples;
|
||||
uint32_t color_attachment_count;
|
||||
VkFormat color_attachment_formats[MESA_VK_MAX_COLOR_ATTACHMENTS];
|
||||
VkColorComponentFlags color_attachment_write_masks[MESA_VK_MAX_COLOR_ATTACHMENTS];
|
||||
VkFormat depth_attachment_format;
|
||||
VkFormat stencil_attachment_format;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -414,6 +414,9 @@ get_blit_pipeline(struct vk_device *device,
|
|||
if (key->aspects & VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||
render.color_attachment_count = 1;
|
||||
render.color_attachment_formats[0] = key->dst_format;
|
||||
render.color_attachment_write_masks[0] =
|
||||
VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT |
|
||||
VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
|
||||
}
|
||||
if (key->aspects & VK_IMAGE_ASPECT_DEPTH_BIT) {
|
||||
ds_info.depthTestEnable = VK_TRUE;
|
||||
|
|
|
|||
|
|
@ -368,6 +368,9 @@ vk_meta_clear_rendering(struct vk_meta_device *meta,
|
|||
|
||||
VK_FROM_HANDLE(vk_image_view, iview, att_info->imageView);
|
||||
render.color_attachment_formats[i] = iview->format;
|
||||
render.color_attachment_write_masks[i] =
|
||||
VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT |
|
||||
VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
|
||||
assert(render.samples == 0 || render.samples == iview->image->samples);
|
||||
render.samples = MAX2(render.samples, iview->image->samples);
|
||||
|
||||
|
|
@ -486,6 +489,9 @@ clear_image_level_layers(struct vk_command_buffer *cmd,
|
|||
vk_render.pColorAttachments = &vk_att;
|
||||
meta_render.color_attachment_count = 1;
|
||||
meta_render.color_attachment_formats[0] = format;
|
||||
meta_render.color_attachment_write_masks[0] =
|
||||
VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT |
|
||||
VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
|
||||
}
|
||||
|
||||
if (image->aspects & VK_IMAGE_ASPECT_DEPTH_BIT) {
|
||||
|
|
|
|||
|
|
@ -47,8 +47,11 @@ vk_meta_rendering_info_copy(struct vk_meta_rendering_info *dst,
|
|||
dst->view_mask = src->view_mask;
|
||||
dst->samples = src->samples;
|
||||
dst->color_attachment_count = src->color_attachment_count;
|
||||
for (uint32_t a = 0; a < src->color_attachment_count; a++)
|
||||
for (uint32_t a = 0; a < src->color_attachment_count; a++) {
|
||||
dst->color_attachment_formats[a] = src->color_attachment_formats[a];
|
||||
dst->color_attachment_write_masks[a] =
|
||||
src->color_attachment_write_masks[a];
|
||||
}
|
||||
dst->depth_attachment_format = src->depth_attachment_format;
|
||||
dst->stencil_attachment_format = src->stencil_attachment_format;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue