#include "zink_context.h"
#include "zink_descriptors.h"
#include "zink_program.h"
+#include "zink_render_pass.h"
#include "zink_resource.h"
#include "zink_screen.h"
if (res->image_bind_count[is_compute])
return VK_IMAGE_LAYOUT_GENERAL;
if (res->aspect & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) {
+ if (!is_compute && res->fb_binds &&
+ ctx->gfx_pipeline_state.render_pass && ctx->gfx_pipeline_state.render_pass->state.rts[ctx->fb_state.nr_cbufs].mixed_zs)
+ return VK_IMAGE_LAYOUT_GENERAL;
return VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL;
}
return VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
if (state->have_zsbuf) {
struct zink_rt_attrib *rt = state->rts + state->num_cbufs;
bool has_clear = rt->clear_color || rt->clear_stencil;
- VkImageLayout layout = rt->needs_write || has_clear ? VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL : VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL;
+ VkImageLayout layout;
+ if (rt->mixed_zs)
+ layout = VK_IMAGE_LAYOUT_GENERAL;
+ else
+ layout = rt->needs_write || has_clear ? VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL : VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL;
attachments[num_attachments].flags = 0;
pstate->attachments[num_attachments].format = attachments[num_attachments].format = rt->format;
pstate->attachments[num_attachments].samples = attachments[num_attachments].samples = rt->samples;
if (state->have_zsbuf) {
struct zink_rt_attrib *rt = state->rts + state->num_cbufs;
bool has_clear = rt->clear_color || rt->clear_stencil;
- VkImageLayout layout = rt->needs_write || has_clear ? VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL : VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL;
+ VkImageLayout layout;
+ if (rt->mixed_zs)
+ layout = VK_IMAGE_LAYOUT_GENERAL;
+ else
+ layout = rt->needs_write || has_clear ? VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL : VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL;
attachments[num_attachments].sType = VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2;
attachments[num_attachments].pNext = NULL;
attachments[num_attachments].flags = 0;
assert(rp->state.have_zsbuf);
*pipeline = VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT;
+ if (rp->state.rts[idx].mixed_zs) {
+ *access |= VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
+ return VK_IMAGE_LAYOUT_GENERAL;
+ }
if (!rp->state.rts[idx].clear_color && !rp->state.rts[idx].clear_stencil)
*access |= VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT;
if (!rp->state.rts[idx].clear_color && !rp->state.rts[idx].clear_stencil && !rp->state.rts[idx].needs_write)