iris: Skip repeated depth buffer disables.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 31 Jul 2019 01:49:47 +0000 (18:49 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 31 Jul 2019 02:47:41 +0000 (19:47 -0700)
Often times, the depth buffer is entirely disabled, but color render
targets change.  For example, GenerateMipmaps will change the color
render target for each miplevel, but there is no depth buffer.

In the Civilization VI benchmark, this drops the median number of
3DSTATE_DEPTH_BUFFER etc. packets emitted per frame from 472 to 34.

src/gallium/drivers/iris/iris_state.c

index d32dc4995f8ed90fbc56cecf548399a2155d9e1b..dddf50bf9214e6461ca54c2b5ea7d3e01b995d48 100644 (file)
@@ -2336,6 +2336,10 @@ iris_set_framebuffer_state(struct pipe_context *ctx,
       ice->state.dirty |= IRIS_DIRTY_SF_CL_VIEWPORT;
    }
 
+   if (cso->zsbuf || state->zsbuf) {
+      ice->state.dirty |= IRIS_DIRTY_DEPTH_BUFFER;
+   }
+
    util_copy_framebuffer_state(cso, state);
    cso->samples = samples;
    cso->layers = layers;
@@ -2401,8 +2405,6 @@ iris_set_framebuffer_state(struct pipe_context *ctx,
    ice->state.null_fb.offset +=
       iris_bo_offset_from_base_address(iris_resource_bo(ice->state.null_fb.res));
 
-   ice->state.dirty |= IRIS_DIRTY_DEPTH_BUFFER;
-
    /* Render target change */
    ice->state.dirty |= IRIS_DIRTY_BINDINGS_FS;