iris: Track blend enables, save outbound for resolve code
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 11 Dec 2018 07:22:54 +0000 (23:22 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:11 +0000 (10:26 -0800)
src/gallium/drivers/iris/iris_context.h
src/gallium/drivers/iris/iris_state.c

index 5753a0864c9b94d8a7bceb61594df3be5d3f0d74..ac5bdaf26e3b33030305550983e60e7d50f2db3f 100644 (file)
@@ -482,6 +482,9 @@ struct iris_context {
       /** Reference to the SURFACE_STATE for the compute grid resource */
       struct iris_state_ref grid_surf_state;
 
+      /** Bitfield of whether color blending is enabled for RT[i] */
+      uint8_t blend_enables;
+
       /** Are depth writes enabled?  (Depth buffer may or may not exist.) */
       bool depth_writes_enabled;
 
index e4c95f2e06c166c388ff5d30771a12e1611cfc98..e08f90973f70121eb4b0c87512ac235c333a8019 100644 (file)
@@ -801,6 +801,9 @@ struct iris_blend_state {
                         BRW_MAX_DRAW_BUFFERS * GENX(BLEND_STATE_ENTRY_length)];
 
    bool alpha_to_coverage; /* for shader key */
+
+   /** Bitfield of whether blending is enabled for RT[i] - for aux resolves */
+   uint8_t blend_enables;
 };
 
 static enum pipe_blendfactor
@@ -829,6 +832,9 @@ iris_create_blend_state(struct pipe_context *ctx,
    struct iris_blend_state *cso = malloc(sizeof(struct iris_blend_state));
    uint32_t *blend_entry = cso->blend_state + GENX(BLEND_STATE_length);
 
+   cso->blend_enables = 0;
+   STATIC_ASSERT(BRW_MAX_DRAW_BUFFERS <= 8);
+
    cso->alpha_to_coverage = state->alpha_to_coverage;
 
    bool indep_alpha_blend = false;
@@ -850,6 +856,9 @@ iris_create_blend_state(struct pipe_context *ctx,
           src_rgb != src_alpha || dst_rgb != dst_alpha)
          indep_alpha_blend = true;
 
+      if (rt->blend_enable)
+         cso->blend_enables |= 1u << i;
+
       iris_pack_state(GENX(BLEND_STATE_ENTRY), blend_entry, be) {
          be.LogicOpEnable = state->logicop_enable;
          be.LogicOpFunction = state->logicop_func;
@@ -916,7 +925,11 @@ static void
 iris_bind_blend_state(struct pipe_context *ctx, void *state)
 {
    struct iris_context *ice = (struct iris_context *) ctx;
-   ice->state.cso_blend = state;
+   struct iris_blend_state *cso = state;
+
+   ice->state.cso_blend = cso;
+   ice->state.blend_enables = cso ? cso->blend_enables : 0;
+
    ice->state.dirty |= IRIS_DIRTY_PS_BLEND;
    ice->state.dirty |= IRIS_DIRTY_BLEND_STATE;
    ice->state.dirty |= ice->state.dirty_for_nos[IRIS_NOS_BLEND];