v3dv: move early-Z update to pre-draw
This needs to be updated everytime we bind a new pipeline, but we can
bind a pipeline and not have an actual job yet, so we want to postpone
this until we actually need to emit CFG_BITS, during the pre-draw
setup.
Also, rename the update helper to be about the job rather the command
buffer, since it is updating state that we track per job.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
diff --git a/src/broadcom/vulkan/v3dv_cmd_buffer.c b/src/broadcom/vulkan/v3dv_cmd_buffer.c
index ee90bae..aacf554 100644
--- a/src/broadcom/vulkan/v3dv_cmd_buffer.c
+++ b/src/broadcom/vulkan/v3dv_cmd_buffer.c
@@ -1951,12 +1951,8 @@
}
static void
-cmd_buffer_update_ez_state(struct v3dv_cmd_buffer *cmd_buffer,
- struct v3dv_pipeline *pipeline)
+job_update_ez_state(struct v3dv_job *job, struct v3dv_pipeline *pipeline)
{
- struct v3dv_job *job = cmd_buffer->state.job;
- assert(job);
-
switch (pipeline->ez_state) {
case VC5_EZ_UNDECIDED:
/* If the pipeline didn't pick a direction but didn't disable, then go
@@ -2181,7 +2177,6 @@
cmd_buffer->state.pipeline = pipeline;
cmd_buffer_bind_pipeline_static_state(cmd_buffer, &pipeline->dynamic_state);
- cmd_buffer_update_ez_state(cmd_buffer, pipeline);
if (cmd_buffer->state.dirty & V3DV_CMD_DIRTY_SHADER_VARIANTS) {
if (update_pipeline_variants(cmd_buffer))
@@ -2633,7 +2628,12 @@
emit_configuration_bits(struct v3dv_cmd_buffer *cmd_buffer)
{
struct v3dv_job *job = cmd_buffer->state.job;
+ assert(job);
+
struct v3dv_pipeline *pipeline = cmd_buffer->state.pipeline;
+ assert(pipeline);
+
+ job_update_ez_state(job, pipeline);
cl_emit_with_prepacked(&job->bcl, CFG_BITS, pipeline->cfg_bits, config) {
config.early_z_updates_enable = job->ez_state != VC5_EZ_DISABLED;