mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-21 22:20:14 +01:00
panvk: Implement Z/S dependency tracking on v11+
On v11+, Z/S read flags are optionally tracked on DCD2. With v12+, this behavior is active by default. Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34032>
This commit is contained in:
parent
0bcd8f08a9
commit
9b4886d6f4
3 changed files with 24 additions and 5 deletions
|
|
@ -1359,7 +1359,11 @@ prepare_ds(struct panvk_cmd_buffer *cmdbuf, struct pan_earlyzs_state earlyzs)
|
|||
cfg.depth_clamp_mode = MALI_DEPTH_CLAMP_MODE_BOUNDS;
|
||||
|
||||
if (fs) {
|
||||
#if PAN_ARCH == 10
|
||||
cfg.shader_read_only_z_s = earlyzs.shader_readonly_zs;
|
||||
#elif PAN_ARCH == 11
|
||||
cfg.separated_dependency_tracking = true;
|
||||
#endif
|
||||
cfg.depth_source = pan_depth_source(&fs->info);
|
||||
}
|
||||
|
||||
|
|
@ -1539,7 +1543,8 @@ prepare_dcd(struct panvk_cmd_buffer *cmdbuf,
|
|||
enum pan_earlyzs_zs_tilebuf_read zs_read =
|
||||
PAN_EARLYZS_ZS_TILEBUF_NOT_READ;
|
||||
|
||||
if (zs_attachment_read(fs, &dyns->ial)) {
|
||||
if (z_attachment_read(fs, &dyns->ial) ||
|
||||
s_attachment_read(fs, &dyns->ial)) {
|
||||
if (writes_z || writes_s || PAN_ARCH != 10)
|
||||
zs_read = PAN_EARLYZS_ZS_TILEBUF_READ_NO_OPT;
|
||||
else
|
||||
|
|
@ -1614,6 +1619,12 @@ prepare_dcd(struct panvk_cmd_buffer *cmdbuf,
|
|||
pan_pack(&dcd2, DCD_FLAGS_2, cfg) {
|
||||
cfg.read_mask = rt_read;
|
||||
cfg.write_mask = rt_written;
|
||||
#if PAN_ARCH >= 11
|
||||
if (fs) {
|
||||
cfg.no_shader_depth_read = z_attachment_read(fs, &dyns->ial);
|
||||
cfg.no_shader_stencil_read = s_attachment_read(fs, &dyns->ial);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
cs_update_vt_ctx(b)
|
||||
|
|
|
|||
|
|
@ -288,7 +288,8 @@ panvk_draw_prepare_fs_rsd(struct panvk_cmd_buffer *cmdbuf,
|
|||
fs, &cmdbuf->vk.dynamic_graphics_state.cal);
|
||||
uint8_t rt_read = color_attachment_read_mask(fs, &dyns->ial, rt_mask);
|
||||
enum pan_earlyzs_zs_tilebuf_read zs_read =
|
||||
zs_attachment_read(fs, &dyns->ial)
|
||||
(z_attachment_read(fs, &dyns->ial) ||
|
||||
s_attachment_read(fs, &dyns->ial))
|
||||
? PAN_EARLYZS_ZS_TILEBUF_READ_NO_OPT
|
||||
: PAN_EARLYZS_ZS_TILEBUF_NOT_READ;
|
||||
|
||||
|
|
|
|||
|
|
@ -407,21 +407,28 @@ color_attachment_read_mask(const struct panvk_shader *fs,
|
|||
}
|
||||
|
||||
static inline bool
|
||||
zs_attachment_read(const struct panvk_shader *fs,
|
||||
const struct vk_input_attachment_location_state *ial)
|
||||
z_attachment_read(const struct panvk_shader *fs,
|
||||
const struct vk_input_attachment_location_state *ial)
|
||||
{
|
||||
uint32_t depth_mask = ial->depth_att == MESA_VK_ATTACHMENT_NO_INDEX
|
||||
? BITFIELD_BIT(0)
|
||||
: ial->depth_att != MESA_VK_ATTACHMENT_UNUSED
|
||||
? BITFIELD_BIT(ial->depth_att + 1)
|
||||
: 0;
|
||||
return depth_mask & fs->fs.input_attachment_read;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
s_attachment_read(const struct panvk_shader *fs,
|
||||
const struct vk_input_attachment_location_state *ial)
|
||||
{
|
||||
uint32_t stencil_mask = ial->stencil_att == MESA_VK_ATTACHMENT_NO_INDEX
|
||||
? BITFIELD_BIT(0)
|
||||
: ial->stencil_att != MESA_VK_ATTACHMENT_UNUSED
|
||||
? BITFIELD_BIT(ial->stencil_att + 1)
|
||||
: 0;
|
||||
|
||||
return (depth_mask | stencil_mask) & fs->fs.input_attachment_read;
|
||||
return stencil_mask & fs->fs.input_attachment_read;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue