Mesa (master): iris: Use the linear version of the surface format during fast clears.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 30 15:32:43 UTC 2019


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

Author: Rafael Antognolli <rafael.antognolli at intel.com>
Date:   Tue Apr 23 15:18:01 2019 -0700

iris: Use the linear version of the surface format during fast clears.

Newer gens (> 9) will start doing the linear -> sRGB conversion of the
clear color for us, if we use a sRGB surface format. So let's make sure
that doesn't happen and keep the same semantics as before.

Even though the hardware could convert the clear color for us during
fast clear, that converted color is only used for sampling. For resolve,
the original color would be used (without the conversion). So we convert
it ourselves and the same converted color gets used for both sampling
and resolving, simplifying the whole logic.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/gallium/drivers/iris/iris_clear.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/iris/iris_clear.c b/src/gallium/drivers/iris/iris_clear.c
index 9fc242526a4..6b0e665c3b3 100644
--- a/src/gallium/drivers/iris/iris_clear.c
+++ b/src/gallium/drivers/iris/iris_clear.c
@@ -269,7 +269,13 @@ fast_clear_color(struct iris_context *ice,
    iris_blorp_surf_for_resource(&ice->vtbl, &surf, p_res, res->aux.usage,
                                 level, true);
 
-   blorp_fast_clear(&blorp_batch, &surf, format,
+   /* In newer gens (> 9), the hardware will do a linear -> sRGB conversion of
+    * the clear color during the fast clear, if the surface format is of sRGB
+    * type. We use the linear version of the surface format here to prevent
+    * that from happening, since we already do our own linear -> sRGB
+    * conversion in convert_fast_clear_color().
+    */
+   blorp_fast_clear(&blorp_batch, &surf, isl_format_srgb_to_linear(format),
                     level, box->z, box->depth,
                     box->x, box->y, box->x + box->width,
                     box->y + box->height);




More information about the mesa-commit mailing list