summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2018-07-05 02:55:57 -0700
committerKenneth Graunke <[email protected]>2018-07-11 11:23:20 -0700
commitc0874947f17b22af49e77f2fb15491c98e8cfd56 (patch)
tree3e86ab3212fa64702d13023e3ac013e2507542b9 /src/mesa
parentbe5fc0d7f114250d37597b38ef53711f2f66bc4f (diff)
st/mesa: Only enable depth writes if the function isn't EQUAL.
If the depth function is EQUAL, then we'll only write the depth value when it already matches what's in the buffer, which is pointless. Skipping these writes can save bandwidth. The state tracker can easily take care of this, so all drivers benefit. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_atom_depth.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_atom_depth.c b/src/mesa/state_tracker/st_atom_depth.c
index 6ddb8f525cf..9e12361f881 100644
--- a/src/mesa/state_tracker/st_atom_depth.c
+++ b/src/mesa/state_tracker/st_atom_depth.c
@@ -107,8 +107,9 @@ st_update_depth_stencil_alpha(struct st_context *st)
if (ctx->DrawBuffer->Visual.depthBits > 0) {
if (ctx->Depth.Test) {
dsa->depth.enabled = 1;
- dsa->depth.writemask = ctx->Depth.Mask;
dsa->depth.func = st_compare_func_to_pipe(ctx->Depth.Func);
+ if (dsa->depth.func != PIPE_FUNC_EQUAL)
+ dsa->depth.writemask = ctx->Depth.Mask;
}
if (ctx->Depth.BoundsTest) {
dsa->depth.bounds_test = 1;