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 <marek.olsak@amd.com>
This commit is contained in:
Kenneth Graunke 2018-07-05 02:55:57 -07:00
parent be5fc0d7f1
commit c0874947f1
1 changed files with 2 additions and 1 deletions

View File

@ -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;