diff options
author | Rafael Antognolli <rafael.antognolli@intel.com> | 2019-04-18 17:47:36 -0700 |
---|---|---|
committer | Rafael Antognolli <rafael.antognolli@intel.com> | 2019-04-30 08:31:44 -0700 |
commit | 56927a8cf5c7ef6330954b3d1b1583c854974520 (patch) | |
tree | 94792fa57ccdf3ff1bf0f9c49aefbd810ae31c20 | |
parent | abb2c7c9d333dc350c1a5f2c161e48e12a6e6116 (diff) |
iris: Support sRGB fast clears even if the colorspaces differ.
We were disabling fast clears if the view format had a different
colorspace than the resource format (sRGB vs linear or vice-versa). But
we actually support them if we use the view format to decide if we
should encode the clear color into sRGB colorspace.
Also add a missing linear -> sRGB surface format conversion (we don't
want the clear color to be encoded to sRGB again during resolve).
v2: Do not track sRGB colorspace during fast clears (Nanley).
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
-rw-r--r-- | src/gallium/drivers/iris/iris_clear.c | 9 | ||||
-rw-r--r-- | src/gallium/drivers/iris/iris_resolve.c | 3 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/gallium/drivers/iris/iris_clear.c b/src/gallium/drivers/iris/iris_clear.c index 962b6fb414e..9fc242526a4 100644 --- a/src/gallium/drivers/iris/iris_clear.c +++ b/src/gallium/drivers/iris/iris_clear.c @@ -104,8 +104,10 @@ can_fast_clear_color(struct iris_context *ice, * during resolves because the resolve operations only know about the * resource and not the renderbuffer. */ - if (render_format != format) + if (isl_format_srgb_to_linear(render_format) != + isl_format_srgb_to_linear(format)) { return false; + } /* XXX: if (irb->mt->supports_fast_clear) * see intel_miptree_create_for_dri_image() @@ -120,6 +122,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, + enum isl_format render_format, const union isl_color_value color) { union isl_color_value override_color = color; @@ -184,7 +187,7 @@ convert_fast_clear_color(struct iris_context *ice, } /* Handle linear to SRGB conversion */ - if (util_format_is_srgb(format)) { + if (isl_format_is_srgb(render_format)) { for (int i = 0; i < 3; i++) { override_color.f32[i] = util_format_linear_to_srgb_float(override_color.f32[i]); @@ -208,7 +211,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); + color = convert_fast_clear_color(ice, res, format, color); bool color_changed = !!memcmp(&res->aux.clear_color, &color, sizeof(color)); diff --git a/src/gallium/drivers/iris/iris_resolve.c b/src/gallium/drivers/iris/iris_resolve.c index 6346a9b1030..db82afb3530 100644 --- a/src/gallium/drivers/iris/iris_resolve.c +++ b/src/gallium/drivers/iris/iris_resolve.c @@ -493,7 +493,8 @@ iris_mcs_partial_resolve(struct iris_context *ice, struct blorp_batch blorp_batch; blorp_batch_init(&ice->blorp, &blorp_batch, batch, 0); - blorp_mcs_partial_resolve(&blorp_batch, &surf, res->surf.format, + blorp_mcs_partial_resolve(&blorp_batch, &surf, + isl_format_srgb_to_linear(res->surf.format), start_layer, num_layers); blorp_batch_finish(&blorp_batch); } |