st/nine: Disable depth write when nothing gets updated
authorAxel Davy <davyaxel0@gmail.com>
Mon, 25 Feb 2019 20:02:14 +0000 (21:02 +0100)
committerAxel Davy <davyaxel0@gmail.com>
Sat, 9 Mar 2019 12:57:49 +0000 (13:57 +0100)
I do not see any perf impact on radeonsi, but it
seems iris needs this.
It seems something sensible to do.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Andre Heider <a.heider@gmail.com>
src/gallium/state_trackers/nine/nine_pipe.c

index a84a17f551f92659a0053f72d5a1381a9d24fefd..b69ddb67113859d5dd3f78b8b170fba2dfea7675 100644 (file)
@@ -36,8 +36,11 @@ nine_convert_dsa_state(struct pipe_depth_stencil_alpha_state *dsa_state,
 
     if (rs[D3DRS_ZENABLE]) {
         dsa.depth.enabled = 1;
-        dsa.depth.writemask = !!rs[D3DRS_ZWRITEENABLE];
         dsa.depth.func = d3dcmpfunc_to_pipe_func(rs[D3DRS_ZFUNC]);
+        /* Disable depth write if no change can occur */
+        dsa.depth.writemask = !!rs[D3DRS_ZWRITEENABLE] &&
+            dsa.depth.func != PIPE_FUNC_EQUAL &&
+            dsa.depth.func != PIPE_FUNC_NEVER;
     }
 
     if (rs[D3DRS_STENCILENABLE]) {