summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTopi Pohjolainen <[email protected]>2016-04-06 11:38:59 +0300
committerTopi Pohjolainen <[email protected]>2016-04-21 10:20:03 +0300
commit69c364f2dcd65bb5b5e7fa075f40a2be9e45bff0 (patch)
treea40a955785611f32f2ee4913bfe4ad6ced4b5a74 /src
parent8a696e75d87da4f40e7ae26cb7fc47421b841455 (diff)
i965/meta: Move check for srgb into is_color_fast_clear_compatible()
Signed-off-by: Topi Pohjolainen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_meta_fast_clear.c34
-rw-r--r--src/mesa/drivers/dri/i965/brw_meta_util.h2
2 files changed, 19 insertions, 17 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c b/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c
index ac8bbecccf1..f4da5f3fd1f 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c
+++ b/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c
@@ -367,9 +367,11 @@ brw_meta_get_buffer_rect(const struct gl_framebuffer *fb,
*/
bool
brw_is_color_fast_clear_compatible(struct brw_context *brw,
- mesa_format format,
+ const struct intel_mipmap_tree *mt,
const union gl_color_union *color)
{
+ const struct gl_context *ctx = &brw->ctx;
+
/* If we're mapping the render format to a different format than the
* format we use for texturing then it is a bit questionable whether it
* should be possible to use a fast clear. Although we only actually
@@ -379,11 +381,22 @@ brw_is_color_fast_clear_compatible(struct brw_context *brw,
* this case. At least on Gen9 this really does seem to cause problems.
*/
if (brw->gen >= 9 &&
- brw_format_for_mesa_format(format) !=
- brw->render_target_format[format])
+ brw_format_for_mesa_format(mt->format) !=
+ brw->render_target_format[mt->format])
+ return false;
+
+ /* Gen9 doesn't support fast clear on single-sampled SRGB buffers. When
+ * GL_FRAMEBUFFER_SRGB is enabled any color renderbuffers will be
+ * resolved in intel_update_state. In that case it's pointless to do a
+ * fast clear because it's very likely to be immediately resolved.
+ */
+ if (brw->gen >= 9 &&
+ mt->num_samples <= 1 &&
+ ctx->Color.sRGBEnabled &&
+ _mesa_get_srgb_format_linear(mt->format) != mt->format)
return false;
- format = _mesa_get_render_format(&brw->ctx, format);
+ const mesa_format format = _mesa_get_render_format(ctx, mt->format);
if (_mesa_is_format_integer_color(format)) {
if (brw->gen >= 8) {
perf_debug("Integer fast clear not enabled for (%s)",
@@ -606,17 +619,6 @@ brw_meta_fast_clear(struct brw_context *brw, struct gl_framebuffer *fb,
if (brw->gen < 7)
clear_type = REP_CLEAR;
- /* Gen9 doesn't support fast clear on single-sampled SRGB buffers. When
- * GL_FRAMEBUFFER_SRGB is enabled any color renderbuffers will be
- * resolved in intel_update_state. In that case it's pointless to do a
- * fast clear because it's very likely to be immediately resolved.
- */
- if (brw->gen >= 9 &&
- irb->mt->num_samples <= 1 &&
- brw->ctx.Color.sRGBEnabled &&
- _mesa_get_srgb_format_linear(irb->mt->format) != irb->mt->format)
- clear_type = REP_CLEAR;
-
if (irb->mt->fast_clear_state == INTEL_FAST_CLEAR_STATE_NO_MCS)
clear_type = REP_CLEAR;
@@ -629,7 +631,7 @@ brw_meta_fast_clear(struct brw_context *brw, struct gl_framebuffer *fb,
/* Fast clear is only supported for colors where all components are
* either 0 or 1.
*/
- if (!brw_is_color_fast_clear_compatible(brw, irb->mt->format,
+ if (!brw_is_color_fast_clear_compatible(brw, irb->mt,
&ctx->Color.ClearColor))
clear_type = REP_CLEAR;
diff --git a/src/mesa/drivers/dri/i965/brw_meta_util.h b/src/mesa/drivers/dri/i965/brw_meta_util.h
index 4a7ce6b6251..550a46a146b 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_util.h
+++ b/src/mesa/drivers/dri/i965/brw_meta_util.h
@@ -67,7 +67,7 @@ brw_meta_set_fast_clear_color(struct brw_context *brw,
bool
brw_is_color_fast_clear_compatible(struct brw_context *brw,
- mesa_format format,
+ const struct intel_mipmap_tree *mt,
const union gl_color_union *color);
#ifdef __cplusplus