diff --git a/src/asahi/vulkan/hk_cmd_meta.c b/src/asahi/vulkan/hk_cmd_meta.c index ee70d9d0d3c..b94bc88692c 100644 --- a/src/asahi/vulkan/hk_cmd_meta.c +++ b/src/asahi/vulkan/hk_cmd_meta.c @@ -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 diff --git a/src/nouveau/vulkan/nvk_cmd_meta.c b/src/nouveau/vulkan/nvk_cmd_meta.c index 3a9e8f310fb..adc03f0a589 100644 --- a/src/nouveau/vulkan/nvk_cmd_meta.c +++ b/src/nouveau/vulkan/nvk_cmd_meta.c @@ -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 diff --git a/src/vulkan/runtime/vk_meta.c b/src/vulkan/runtime/vk_meta.c index 06e869fd080..b7f93b08b6f 100644 --- a/src/vulkan/runtime/vk_meta.c +++ b/src/vulkan/runtime/vk_meta.c @@ -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) { diff --git a/src/vulkan/runtime/vk_meta.h b/src/vulkan/runtime/vk_meta.h index f96b9ff9edf..6ca9a4e85f7 100644 --- a/src/vulkan/runtime/vk_meta.h +++ b/src/vulkan/runtime/vk_meta.h @@ -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; }; diff --git a/src/vulkan/runtime/vk_meta_blit_resolve.c b/src/vulkan/runtime/vk_meta_blit_resolve.c index 5ac8643813f..6ad80f680f1 100644 --- a/src/vulkan/runtime/vk_meta_blit_resolve.c +++ b/src/vulkan/runtime/vk_meta_blit_resolve.c @@ -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; diff --git a/src/vulkan/runtime/vk_meta_clear.c b/src/vulkan/runtime/vk_meta_clear.c index 638db130403..0afd5e83711 100644 --- a/src/vulkan/runtime/vk_meta_clear.c +++ b/src/vulkan/runtime/vk_meta_clear.c @@ -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) { diff --git a/src/vulkan/runtime/vk_meta_private.h b/src/vulkan/runtime/vk_meta_private.h index a8b2a97d91b..d10f9c7622f 100644 --- a/src/vulkan/runtime/vk_meta_private.h +++ b/src/vulkan/runtime/vk_meta_private.h @@ -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; }