mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 12:46:12 +00:00
c/util: Fix synchronisation errors with scratch images on gfx path
This commit is contained in:
parent
7025b755d5
commit
3de7bab023
|
@ -501,7 +501,7 @@ renderer_init(struct comp_renderer *r, struct comp_compositor *c, VkExtent2D scr
|
||||||
&r->c->nr, // r
|
&r->c->nr, // r
|
||||||
VK_FORMAT_R8G8B8A8_SRGB, // format
|
VK_FORMAT_R8G8B8A8_SRGB, // format
|
||||||
VK_ATTACHMENT_LOAD_OP_CLEAR, // load_op
|
VK_ATTACHMENT_LOAD_OP_CLEAR, // load_op
|
||||||
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); // final_layout
|
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL); // final_layout
|
||||||
|
|
||||||
for (uint32_t i = 0; i < ARRAY_SIZE(r->scratch_targets); i++) {
|
for (uint32_t i = 0; i < ARRAY_SIZE(r->scratch_targets); i++) {
|
||||||
render_gfx_target_resources_init( //
|
render_gfx_target_resources_init( //
|
||||||
|
|
|
@ -31,7 +31,7 @@ struct comp_layer;
|
||||||
* which set the layout.
|
* which set the layout.
|
||||||
*
|
*
|
||||||
* The render passes of @p rsi_rtrs must be created with a final_layout of
|
* The render passes of @p rsi_rtrs must be created with a final_layout of
|
||||||
* VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL or there will be validation errors.
|
* VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL or there will be validation errors.
|
||||||
*
|
*
|
||||||
* Expected layouts:
|
* Expected layouts:
|
||||||
* * Layer images: VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL
|
* * Layer images: VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL
|
||||||
|
|
|
@ -804,6 +804,44 @@ comp_render_gfx_dispatch(struct render_gfx *rr,
|
||||||
layers, // layers
|
layers, // layers
|
||||||
layer_count); // layer_count
|
layer_count); // layer_count
|
||||||
|
|
||||||
|
|
||||||
|
VkImageSubresourceRange first_color_level_subresource_range = {
|
||||||
|
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
.baseMipLevel = 0,
|
||||||
|
.levelCount = 1,
|
||||||
|
.baseArrayLayer = 0,
|
||||||
|
.layerCount = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
VkImageLayout transition_from = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||||
|
VkImageLayout transition_to = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||||
|
|
||||||
|
vk_cmd_image_barrier_locked( //
|
||||||
|
rr->r->vk, //
|
||||||
|
rr->r->cmd, //
|
||||||
|
rsi->color[0].image, //
|
||||||
|
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, //
|
||||||
|
VK_ACCESS_SHADER_READ_BIT, //
|
||||||
|
transition_from, //
|
||||||
|
transition_to, //
|
||||||
|
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, //
|
||||||
|
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, //
|
||||||
|
first_color_level_subresource_range); //
|
||||||
|
|
||||||
|
if (rsi->color[0].image != rsi->color[1].image) {
|
||||||
|
vk_cmd_image_barrier_locked( //
|
||||||
|
rr->r->vk, //
|
||||||
|
rr->r->cmd, //
|
||||||
|
rsi->color[1].image, //
|
||||||
|
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, //
|
||||||
|
VK_ACCESS_SHADER_READ_BIT, //
|
||||||
|
transition_from, //
|
||||||
|
transition_to, //
|
||||||
|
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, //
|
||||||
|
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, //
|
||||||
|
first_color_level_subresource_range); //
|
||||||
|
}
|
||||||
|
|
||||||
VkSampler clamp_to_border_black = rr->r->samplers.clamp_to_border_black;
|
VkSampler clamp_to_border_black = rr->r->samplers.clamp_to_border_black;
|
||||||
VkSampler src_samplers[2] = {
|
VkSampler src_samplers[2] = {
|
||||||
clamp_to_border_black,
|
clamp_to_border_black,
|
||||||
|
|
Loading…
Reference in a new issue