i965/blorp: Add support for disabling color blending
authorTopi Pohjolainen <topi.pohjolainen@intel.com>
Sun, 3 Apr 2016 15:51:43 +0000 (18:51 +0300)
committerTopi Pohjolainen <topi.pohjolainen@intel.com>
Thu, 21 Apr 2016 07:20:02 +0000 (10:20 +0300)
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_blorp.cpp
src/mesa/drivers/dri/i965/brw_blorp.h
src/mesa/drivers/dri/i965/gen6_blorp.cpp
src/mesa/drivers/dri/i965/gen8_blorp.cpp

index 18296237efdac588f39e1c73ecb529273174fc77..618949c72a89e229fd8c465d60c4a831fb3983de 100644 (file)
@@ -170,6 +170,10 @@ brw_blorp_params::brw_blorp_params(unsigned num_varyings,
      num_draw_buffers(num_draw_buffers),
      num_layers(num_layers)
 {
+   color_write_disable[0] = false;
+   color_write_disable[1] = false;
+   color_write_disable[2] = false;
+   color_write_disable[3] = false;
 }
 
 extern "C" {
index a291aff4525e396828012c47438c75b288780116..ef92fdc2459e9de387028d9bfad0ac7ce05d6b15 100644 (file)
@@ -242,6 +242,7 @@ public:
    brw_blorp_surface_info dst;
    enum gen6_hiz_op hiz_op;
    unsigned fast_clear_op;
+   bool color_write_disable[4];
    bool use_wm_prog;
    brw_blorp_wm_push_constants wm_push_consts;
    const unsigned num_varyings;
index d635962e7b38b538f343b52a52e41a9592d02ceb..cbb435578eb2310e24a48f93425c48b8df03b998 100644 (file)
@@ -260,6 +260,11 @@ gen6_blorp_emit_blend_state(struct brw_context *brw,
       blend[i].blend1.pre_blend_clamp_enable = 1;
       blend[i].blend1.post_blend_clamp_enable = 1;
       blend[i].blend1.clamp_range = BRW_RENDERTARGET_CLAMPRANGE_FORMAT;
+
+      blend[i].blend1.write_disable_r = params->color_write_disable[0];
+      blend[i].blend1.write_disable_g = params->color_write_disable[1];
+      blend[i].blend1.write_disable_b = params->color_write_disable[2];
+      blend[i].blend1.write_disable_a = params->color_write_disable[3];
    }
 
    return cc_blend_state_offset;
index 65ebf5ba44cf4cf39e9347ae76a9d8292404935b..3c0276fa0e1d041f0ea510cb0c2ab92758bb1135 100644 (file)
@@ -138,6 +138,15 @@ gen8_blorp_emit_blend_state(struct brw_context *brw,
    memset(blend, 0, size);
 
    for (unsigned i = 0; i < params->num_draw_buffers; ++i) {
+      if (params->color_write_disable[0])
+         blend[1 + 2 * i] |= GEN8_BLEND_WRITE_DISABLE_RED;
+      if (params->color_write_disable[1])
+         blend[1 + 2 * i] |= GEN8_BLEND_WRITE_DISABLE_GREEN;
+      if (params->color_write_disable[2])
+         blend[1 + 2 * i] |= GEN8_BLEND_WRITE_DISABLE_BLUE;
+      if (params->color_write_disable[3])
+         blend[1 + 2 * i] |= GEN8_BLEND_WRITE_DISABLE_ALPHA;
+
       blend[1 + 2 * i + 1] = GEN8_BLEND_PRE_BLEND_COLOR_CLAMP_ENABLE |
                              GEN8_BLEND_POST_BLEND_COLOR_CLAMP_ENABLE |
                              GEN8_BLEND_COLOR_CLAMP_RANGE_RTFORMAT;