Mesa (main): v3d,v3dv: don't disable EZ for passthrough Z writes
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Dec 3 11:14:25 UTC 2021
Module: Mesa
Branch: main
Commit: d7b79f3531de5cdee2bb61b54f3549252e7ae97a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d7b79f3531de5cdee2bb61b54f3549252e7ae97a
Author: Iago Toral Quiroga <itoral at igalia.com>
Date: Fri Dec 3 10:29:16 2021 +0100
v3d,v3dv: don't disable EZ for passthrough Z writes
The early-Z test uses Z values produced from FEP, so when
we write Z from a shader we need to disable EZ. However, there
are some instances where want to write the FEP-Z from the shader,
in which case we would not need to disable EZ.
Reviewed-by: Alejandro Piñeiro <apinheiro at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14037>
---
src/broadcom/vulkan/v3dvx_cmd_buffer.c | 3 ++-
src/broadcom/vulkan/v3dvx_pipeline.c | 1 +
src/gallium/drivers/v3d/v3dx_draw.c | 4 +++-
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/broadcom/vulkan/v3dvx_cmd_buffer.c b/src/broadcom/vulkan/v3dvx_cmd_buffer.c
index 4c2b1d4bade..02c24c338be 100644
--- a/src/broadcom/vulkan/v3dvx_cmd_buffer.c
+++ b/src/broadcom/vulkan/v3dvx_cmd_buffer.c
@@ -1429,7 +1429,8 @@ job_update_ez_state(struct v3dv_job *job,
/* If the FS writes Z, then it may update against the chosen EZ direction */
struct v3dv_shader_variant *fs_variant =
pipeline->shared_data->variants[BROADCOM_SHADER_FRAGMENT];
- if (fs_variant->prog_data.fs->writes_z) {
+ if (fs_variant->prog_data.fs->writes_z &&
+ !fs_variant->prog_data.fs->writes_z_from_fep) {
job->ez_state = V3D_EZ_DISABLED;
return;
}
diff --git a/src/broadcom/vulkan/v3dvx_pipeline.c b/src/broadcom/vulkan/v3dvx_pipeline.c
index 7c6fae22ad1..c17638754d2 100644
--- a/src/broadcom/vulkan/v3dvx_pipeline.c
+++ b/src/broadcom/vulkan/v3dvx_pipeline.c
@@ -388,6 +388,7 @@ pack_shader_state_record(struct v3dv_pipeline *pipeline)
* shader needs to write the Z value (even just discards).
*/
shader.fragment_shader_does_z_writes = prog_data_fs->writes_z;
+
/* Set if the EZ test must be disabled (due to shader side
* effects and the early_z flag not being present in the
* shader).
diff --git a/src/gallium/drivers/v3d/v3dx_draw.c b/src/gallium/drivers/v3d/v3dx_draw.c
index ae8537d8347..25ef97f888e 100644
--- a/src/gallium/drivers/v3d/v3dx_draw.c
+++ b/src/gallium/drivers/v3d/v3dx_draw.c
@@ -605,6 +605,7 @@ v3d_emit_gl_shader_state(struct v3d_context *v3d,
*/
shader.fragment_shader_does_z_writes =
v3d->prog.fs->prog_data.fs->writes_z;
+
/* Set if the EZ test must be disabled (due to shader side
* effects and the early_z flag not being present in the
* shader).
@@ -879,7 +880,8 @@ v3d_update_job_ez(struct v3d_context *v3d, struct v3d_job *job)
* the chosen EZ direction (though we could use
* ARB_conservative_depth's hints to avoid this)
*/
- if (v3d->prog.fs->prog_data.fs->writes_z) {
+ if (v3d->prog.fs->prog_data.fs->writes_z &&
+ !v3d->prog.fs->prog_data.fs->writes_z_from_fep) {
job->ez_state = V3D_EZ_DISABLED;
}
More information about the mesa-commit
mailing list