Mesa (master): iris: Manually apply fast clear color channel overrides.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 2 22:28:54 UTC 2019


Module: Mesa
Branch: master
Commit: c26d8a887d003d70518035e3db1ff3de260e8434
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c26d8a887d003d70518035e3db1ff3de260e8434

Author: Rafael Antognolli <rafael.antognolli at intel.com>
Date:   Wed Mar 27 10:27:18 2019 -0700

iris: Manually apply fast clear color channel overrides.

At the fast clear time, the only swizzle we have available is actually
the identity swizzle (which we use for most rendering). So the call to
swizzle_color_value() becomes simply a no-op, and doesn't properly zero
out the unused channels.

We have to manually override those channels.

Fixes: a8b5ea8ef015ed4a "iris: Add function to update clear color in surface state."
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/gallium/drivers/iris/iris_clear.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/iris/iris_clear.c b/src/gallium/drivers/iris/iris_clear.c
index 9634b4ee3d1..3a617bb7e21 100644
--- a/src/gallium/drivers/iris/iris_clear.c
+++ b/src/gallium/drivers/iris/iris_clear.c
@@ -121,8 +121,7 @@ can_fast_clear_color(struct iris_context *ice,
 static union isl_color_value
 convert_fast_clear_color(struct iris_context *ice,
                          struct iris_resource *res,
-                         const union isl_color_value color,
-                         struct isl_swizzle swizzle)
+                         const union isl_color_value color)
 {
    union isl_color_value override_color = color;
    struct pipe_resource *p_res = (void *) res;
@@ -132,7 +131,19 @@ convert_fast_clear_color(struct iris_context *ice,
       util_format_description(format);
    unsigned colormask = util_format_colormask(desc);
 
-   override_color = swizzle_color_value(color, swizzle);
+   if (util_format_is_intensity(format) ||
+       util_format_is_luminance(format) ||
+       util_format_is_luminance_alpha(format)) {
+      override_color.u32[1] = override_color.u32[0];
+      override_color.u32[2] = override_color.u32[0];
+      if (util_format_is_intensity(format))
+         override_color.u32[3] = override_color.u32[0];
+   } else {
+      for (int chan = 0; chan < 3; chan++) {
+         if (!(colormask & (1 << chan)))
+            override_color.u32[chan] = 0;
+      }
+   }
 
    if (util_format_is_unorm(format)) {
       for (int i = 0; i < 4; i++)
@@ -191,7 +202,6 @@ fast_clear_color(struct iris_context *ice,
                  const struct pipe_box *box,
                  enum isl_format format,
                  union isl_color_value color,
-                 struct isl_swizzle swizzle,
                  enum blorp_batch_flags blorp_flags)
 {
    struct iris_batch *batch = &ice->batches[IRIS_BATCH_RENDER];
@@ -199,7 +209,7 @@ fast_clear_color(struct iris_context *ice,
    const enum isl_aux_state aux_state =
       iris_resource_get_aux_state(res, level, box->z);
 
-   color = convert_fast_clear_color(ice, res, color, swizzle);
+   color = convert_fast_clear_color(ice, res, color);
 
    bool color_changed = !!memcmp(&res->aux.clear_color, &color,
                                  sizeof(color));
@@ -300,7 +310,7 @@ clear_color(struct iris_context *ice,
                                               res->surf.format, format, color);
    if (can_fast_clear) {
       fast_clear_color(ice, res, level, box, format, color,
-                       swizzle, blorp_flags);
+                       blorp_flags);
       return;
    }
 




More information about the mesa-commit mailing list