i965: Make the miptree clear color setter take a gl_color_union
authorNanley Chery <nanley.g.chery@intel.com>
Thu, 29 Mar 2018 01:06:58 +0000 (18:06 -0700)
committerNanley Chery <nanley.g.chery@intel.com>
Mon, 9 Apr 2018 17:56:48 +0000 (10:56 -0700)
We want to hide the internal details of how the miptree's clear color
is calculated.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/mesa/drivers/dri/i965/brw_blorp.c
src/mesa/drivers/dri/i965/intel_mipmap_tree.c
src/mesa/drivers/dri/i965/intel_mipmap_tree.h

index 0ccfa2125472f0467aa8b7c2fa0d594e5318b741..5dcd95e9f448c51613d7ca2db36a661e2c125ec1 100644 (file)
@@ -1235,12 +1235,9 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,
    if (can_fast_clear) {
       const enum isl_aux_state aux_state =
          intel_miptree_get_aux_state(irb->mt, irb->mt_level, irb->mt_layer);
-      union isl_color_value clear_color =
-         brw_meta_convert_fast_clear_color(brw, irb->mt,
-                                           &ctx->Color.ClearColor);
 
       bool same_clear_color =
-         !intel_miptree_set_clear_color(brw, irb->mt, clear_color);
+         !intel_miptree_set_clear_color(brw, irb->mt, &ctx->Color.ClearColor);
 
       /* If the buffer is already in INTEL_FAST_CLEAR_STATE_CLEAR, the clear
        * is redundant and can be skipped.
index 32be4b033ebc36b70bf5e33b83db0eb6aedb33fd..8d3ddd5654406bba791e5ec089abd082b1fe4940 100644 (file)
@@ -36,6 +36,7 @@
 
 #include "brw_blorp.h"
 #include "brw_context.h"
+#include "brw_meta_util.h"
 #include "brw_state.h"
 
 #include "main/enums.h"
@@ -3808,8 +3809,11 @@ intel_miptree_get_aux_isl_usage(const struct brw_context *brw,
 bool
 intel_miptree_set_clear_color(struct brw_context *brw,
                               struct intel_mipmap_tree *mt,
-                              union isl_color_value clear_color)
+                              const union gl_color_union *color)
 {
+   const union isl_color_value clear_color =
+      brw_meta_convert_fast_clear_color(brw, mt, color);
+
    if (memcmp(&mt->fast_clear_color, &clear_color, sizeof(clear_color)) != 0) {
       mt->fast_clear_color = clear_color;
       brw->ctx.NewDriverState |= BRW_NEW_AUX_STATE;
index ff6ce4ecf9e63d0299349771e3c3bbb6a35148b9..4136c6586b630a2b6cb060e3e4fceef88714279d 100644 (file)
@@ -734,7 +734,7 @@ intel_miptree_sample_with_hiz(struct brw_context *brw,
 bool
 intel_miptree_set_clear_color(struct brw_context *brw,
                               struct intel_mipmap_tree *mt,
-                              union isl_color_value clear_color);
+                              const union gl_color_union *color);
 
 bool
 intel_miptree_set_depth_clear_value(struct brw_context *brw,