mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 08:40:11 +01:00
turnip: enable VK_FORMAT_S8_UINT as stencil format
Signed-off-by: Jonathan Marek <jonathan@marek.ca> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4588>
This commit is contained in:
parent
44c6c145da
commit
a5cce95280
4 changed files with 33 additions and 20 deletions
|
|
@ -1777,8 +1777,6 @@ tu_clear_sysmem_attachments_2d(struct tu_cmd_buffer *cmd,
|
|||
|
||||
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 {
|
||||
|
|
@ -1789,17 +1787,19 @@ tu_clear_sysmem_attachments_2d(struct tu_cmd_buffer *cmd,
|
|||
/* 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;
|
||||
|
||||
|
|
@ -2071,21 +2071,22 @@ tu_clear_gmem_attachments(struct tu_cmd_buffer *cmd,
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -387,12 +387,14 @@ tu6_emit_zs(struct tu_cmd_buffer *cmd,
|
|||
}
|
||||
|
||||
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));
|
||||
|
|
@ -405,10 +407,15 @@ tu6_emit_zs(struct tu_cmd_buffer *cmd,
|
|||
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
|
||||
|
|
|
|||
|
|
@ -354,6 +354,7 @@ tu6_pipe2depth(VkFormat format)
|
|||
case VK_FORMAT_D24_UNORM_S8_UINT:
|
||||
return DEPTH6_24_8;
|
||||
case VK_FORMAT_D32_SFLOAT:
|
||||
case VK_FORMAT_S8_UINT:
|
||||
return DEPTH6_32;
|
||||
default:
|
||||
return ~0;
|
||||
|
|
|
|||
|
|
@ -100,6 +100,10 @@ tu_image_create(VkDevice _device,
|
|||
if (image->vk_format == VK_FORMAT_E5B9G9R9_UFLOAT_PACK32)
|
||||
ubwc_enabled = false;
|
||||
|
||||
/* separate stencil doesn't have a UBWC enable bit */
|
||||
if (image->vk_format == VK_FORMAT_S8_UINT)
|
||||
ubwc_enabled = false;
|
||||
|
||||
if (image->extent.depth > 1) {
|
||||
tu_finishme("UBWC with 3D textures");
|
||||
ubwc_enabled = false;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue