[Mesa-dev] [PATCH] radv: disable depth writes when depth test is not enabled
Samuel Pitoiset
samuel.pitoiset at gmail.com
Fri Oct 27 16:27:11 UTC 2017
Found by inspection.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
src/amd/vulkan/radv_pipeline.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index c25642c966..f5ebcda883 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -741,8 +741,14 @@ radv_pipeline_init_depth_stencil_state(struct radv_pipeline *pipeline,
bool has_stencil_attachment = vk_format_is_stencil(attachment->format);
if (has_depth_attachment) {
+ /* Depth writes are always disabled when depthTestEnable is
+ * VK_FALSE.
+ */
+ bool z_write_enable =
+ vkds->depthTestEnable && vkds->depthWriteEnable;
+
ds->db_depth_control = S_028800_Z_ENABLE(vkds->depthTestEnable ? 1 : 0) |
- S_028800_Z_WRITE_ENABLE(vkds->depthWriteEnable ? 1 : 0) |
+ S_028800_Z_WRITE_ENABLE(z_write_enable ? 1 : 0) |
S_028800_ZFUNC(vkds->depthCompareOp) |
S_028800_DEPTH_BOUNDS_ENABLE(vkds->depthBoundsTestEnable ? 1 : 0);
}
--
2.14.3
More information about the mesa-dev
mailing list