diff --git a/src/imagination/vulkan/pvr_arch_g5p_gfx.c b/src/imagination/vulkan/pvr_arch_g5p_gfx.c index 3b3ca02a343..c7782af9854 100644 --- a/src/imagination/vulkan/pvr_arch_g5p_gfx.c +++ b/src/imagination/vulkan/pvr_arch_g5p_gfx.c @@ -1920,6 +1920,8 @@ PVR_PER_ARCH(g5p_clear_attachments)(struct pvr_cmd_buffer *cmd_buffer, uint32_t * dirty for it and again for the application's state put back */ const bool a7 = PVR_HAS_FEATURE(&cmd_buffer->device->pdevice->dev_info, apple_g3); const struct pvr_g5p_draw draw = { .count = 3, .instances = 1 }; + /* the driver's own draws (g5p_mrt_draw_check() lets a clear into a colour attachment that is not stored) */ + pvr_g5p_internal_pipeline++; for (uint32_t r = 0; r < rect_count && result == VK_SUCCESS; r++) { /* the scissor: the rectangle (within the render area: the draw intersects it) */ dyn->vp.scissors[0] = rects[r].rect; @@ -1931,6 +1933,7 @@ PVR_PER_ARCH(g5p_clear_attachments)(struct pvr_cmd_buffer *cmd_buffer, uint32_t result = pvr_arch_g5p_cmd_draw(cmd_buffer, &draw); } } + pvr_g5p_internal_pipeline--; cs->gfx_pipeline = saved_pipeline; cs->vertex_bindings[0] = saved_binding; diff --git a/src/imagination/vulkan/pvr_arch_g5p_mrt.c b/src/imagination/vulkan/pvr_arch_g5p_mrt.c index bf6d34ca220..3fb19cf6ed2 100644 --- a/src/imagination/vulkan/pvr_arch_g5p_mrt.c +++ b/src/imagination/vulkan/pvr_arch_g5p_mrt.c @@ -24,6 +24,8 @@ #include "pvr_g5p_mrt.h" #include "pvr_hw_pass.h" #include "pvr_image.h" +#include "pvr_pass.h" +#include "pvr_g5p_shader_dump.h" /* Two 32-bit integer targets of one format (dEQP's ShaderExecutor: a mat2xN @@ -184,5 +186,30 @@ PVR_PER_ARCH(g5p_mrt_draw_check)(struct pvr_cmd_buffer *cmd_buffer, unsigned pip const unsigned rn = hw_render->eot_surface_count == 3 ? 4 : hw_render->eot_surface_count; if ((rn > 1 || pn > 1) && pn != rn) return G5P_REFUSE(cmd_buffer, "the pipeline writes %u colour targets, the pass has %u", pn, rn); + + /* The pipeline's outputs go to the render's end-of-tile targets, so each colour attachment of the + * subpass has to be one (or resolve into one). An attachment that is not stored (store op DONT_CARE) + * is not: the draw would write it through another attachment's end-of-tile setup, and with a 32-bit + * channel format (R32, R32G32) the fragment job never finishes. The driver's own clear quads + * (vkCmdClearAttachments) are left alone: they write a constant and have not hung. So is a render + * with no end-of-tile target at all: the outputs go nowhere (occlusion queries draw like that). */ + if (info->pass && !info->dr_info && !pvr_g5p_internal_pipeline && hw_render->eot_surface_count) { + const struct pvr_render_subpass *sp = &info->pass->subpasses[info->subpass_idx]; + + for (unsigned c = 0; c < sp->color_count; c++) { + const uint32_t a = sp->color_attachments[c]; + const uint32_t r = sp->resolve_attachments ? sp->resolve_attachments[c] : VK_ATTACHMENT_UNUSED; + bool eot = false; + + if (a == VK_ATTACHMENT_UNUSED) + continue; + for (unsigned t = 0; t < hw_render->eot_surface_count && !eot; t++) + eot = hw_render->eot_surfaces[t].attachment_idx == a || + (r != VK_ATTACHMENT_UNUSED && hw_render->eot_surfaces[t].attachment_idx == r); + if (!eot) + return G5P_REFUSE(cmd_buffer, "colour attachment %u of subpass %u is not stored (no end-of-tile " + "target)", c, info->subpass_idx); + } + } return VK_SUCCESS; }