for (uint32_t j = 0; j < attachment_count; j++) {
uint32_t a;
- uint8_t mask = 0xf;
-
if (attachments[j].aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) {
a = subpass->color_attachments[attachments[j].colorAttachment].attachment;
} else {
/* also flush color to avoid losing contents from invalidate */
tu6_emit_event_write(cmd, cs, PC_CCU_FLUSH_COLOR_TS, true);
tu6_emit_event_write(cmd, cs, PC_CCU_INVALIDATE_COLOR, false);
+ }
+ if (a == VK_ATTACHMENT_UNUSED)
+ continue;
+ uint8_t mask = 0xf;
+ if (cmd->state.pass->attachments[a].format == VK_FORMAT_D24_UNORM_S8_UINT) {
if (!(attachments[j].aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT))
mask &= ~0x7;
if (!(attachments[j].aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT))
mask &= ~0x8;
}
- if (a == VK_ATTACHMENT_UNUSED)
- continue;
-
const struct tu_image_view *iview =
cmd->state.framebuffer->attachments[a].attachment;
for (unsigned j = 0; j < attachment_count; j++) {
uint32_t a;
- unsigned clear_mask = 0;
- if (attachments[j].aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) {
- clear_mask = 0xf;
+ if (attachments[j].aspectMask & VK_IMAGE_ASPECT_COLOR_BIT)
a = subpass->color_attachments[attachments[j].colorAttachment].attachment;
- } else {
+ else
a = subpass->depth_stencil_attachment.attachment;
- if (attachments[j].aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT)
- clear_mask |= 0x7;
- if (attachments[j].aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT)
- clear_mask |= 0x8;
- }
if (a == VK_ATTACHMENT_UNUSED)
continue;
+ unsigned clear_mask = 0xf;
+ if (cmd->state.pass->attachments[a].format == VK_FORMAT_D24_UNORM_S8_UINT) {
+ if (!(attachments[j].aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT))
+ clear_mask &= ~0x7;
+ if (!(attachments[j].aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT))
+ clear_mask &= ~0x8;
+ }
+
tu_emit_clear_gmem_attachment(cmd, cs, a, clear_mask,
&attachments[j].clearValue);
}
}
const struct tu_image_view *iview = fb->attachments[a].attachment;
- enum a6xx_depth_format fmt = tu6_pipe2depth(cmd->state.pass->attachments[a].format);
+ const struct tu_render_pass_attachment *attachment =
+ &cmd->state.pass->attachments[a];
+ enum a6xx_depth_format fmt = tu6_pipe2depth(attachment->format);
tu_cs_emit_pkt4(cs, REG_A6XX_RB_DEPTH_BUFFER_INFO, 6);
tu_cs_emit(cs, A6XX_RB_DEPTH_BUFFER_INFO(.depth_format = fmt).value);
tu_cs_image_ref(cs, iview, 0);
- tu_cs_emit(cs, cmd->state.pass->attachments[a].gmem_offset);
+ tu_cs_emit(cs, attachment->gmem_offset);
tu_cs_emit_regs(cs,
A6XX_GRAS_SU_DEPTH_BUFFER_INFO(.depth_format = fmt));
A6XX_GRAS_LRZ_BUFFER_PITCH(0),
A6XX_GRAS_LRZ_FAST_CLEAR_BUFFER_BASE(0));
- tu_cs_emit_regs(cs,
- A6XX_RB_STENCIL_INFO(0));
-
- /* enable zs? */
+ if (attachment->format == VK_FORMAT_S8_UINT) {
+ tu_cs_emit_pkt4(cs, REG_A6XX_RB_STENCIL_INFO, 6);
+ tu_cs_emit(cs, A6XX_RB_STENCIL_INFO(.separate_stencil = true).value);
+ tu_cs_image_ref(cs, iview, 0);
+ tu_cs_emit(cs, attachment->gmem_offset);
+ } else {
+ tu_cs_emit_regs(cs,
+ A6XX_RB_STENCIL_INFO(0));
+ }
}
static void