panvk: Generate the earlyzs LUT at shader creation time

Do what the gallium driver does and generate the LUT when creating the
shader to avoid regenerating this LUT in the draw path.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32540>
This commit is contained in:
Boris Brezillon 2025-03-06 13:39:47 +01:00 committed by Marge Bot
parent b8174b21d2
commit d2cd5ca609
4 changed files with 15 additions and 2 deletions

View file

@ -1533,7 +1533,7 @@ prepare_dcd(struct panvk_cmd_buffer *cmdbuf)
MALI_OCCLUSION_MODE_DISABLED;
struct pan_earlyzs_state earlyzs =
pan_earlyzs_get(pan_earlyzs_analyze(&fs->info), writes_zs || oq,
pan_earlyzs_get(fs->fs.earlyzs_lut, writes_zs || oq,
alpha_to_coverage, zs_always_passes);
cfg.pixel_kill_operation = (enum mali_pixel_kill)earlyzs.kill;

View file

@ -295,7 +295,7 @@ panvk_draw_prepare_fs_rsd(struct panvk_cmd_buffer *cmdbuf,
MALI_OCCLUSION_MODE_DISABLED;
struct pan_earlyzs_state earlyzs =
pan_earlyzs_get(pan_earlyzs_analyze(fs_info), writes_zs || oq,
pan_earlyzs_get(fs->fs.earlyzs_lut, writes_zs || oq,
alpha_to_coverage, zs_always_passes);
cfg.properties.pixel_kill_operation = earlyzs.kill;

View file

@ -13,6 +13,7 @@
#include "util/pan_ir.h"
#include "pan_desc.h"
#include "pan_earlyzs.h"
#include "panvk_cmd_push_constant.h"
#include "panvk_descriptor_set.h"
@ -261,6 +262,10 @@ struct panvk_shader {
struct {
struct pan_compute_dim local_size;
} cs;
struct {
struct pan_earlyzs_lut earlyzs_lut;
} fs;
};
struct {

View file

@ -921,6 +921,10 @@ panvk_compile_nir(struct panvk_device *dev, nir_shader *nir,
shader->cs.local_size.z = nir->info.workgroup_size[2];
break;
case MESA_SHADER_FRAGMENT:
shader->fs.earlyzs_lut = pan_earlyzs_analyze(&shader->info);
break;
default:
break;
}
@ -1334,6 +1338,10 @@ panvk_deserialize_shader(struct vk_device *vk_dev, struct blob_reader *blob,
sizeof(shader->cs.local_size));
break;
case MESA_SHADER_FRAGMENT:
shader->fs.earlyzs_lut = pan_earlyzs_analyze(&shader->info);
break;
default:
break;
}