summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_context.c
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2016-07-01 13:45:22 -0700
committerFrancisco Jerez <currojerez@riseup.net>2016-08-25 18:36:07 -0700
commit99fb167839c8c9888f8de78e3b96de23f92a1012 (patch)
tree9b32c0e7aac9e3e2db779b362db63f0b65e81f3b /src/mesa/drivers/dri/i965/brw_context.c
parent071665c16191e3738f4ee173398da45c008e005a (diff)
downloadexternal_mesa3d-99fb167839c8c9888f8de78e3b96de23f92a1012.zip
external_mesa3d-99fb167839c8c9888f8de78e3b96de23f92a1012.tar.gz
external_mesa3d-99fb167839c8c9888f8de78e3b96de23f92a1012.tar.bz2
i965: Resolve color for non-coherent FB fetch at UpdateState time.
This is required because the sampler unit used to fetch from the framebuffer is unable to interpret non-color-compressed fast-cleared single-sample texture data. Roughly the same limitation applies for surfaces bound to texture or image units, but unlike texture sampling, non-coherent framebuffer fetch is by definition non-coherent with previous rendering, so the brw_render_cache_set_check_flush() call can be omitted except after resolve. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_context.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index cb74200..d6f0d7b 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -262,6 +262,23 @@ intel_update_state(struct gl_context * ctx, GLuint new_state)
}
}
+ /* Resolve color buffers for non-coherent framebufer fetch. */
+ if (!ctx->Extensions.MESA_shader_framebuffer_fetch &&
+ ctx->FragmentProgram._Current &&
+ ctx->FragmentProgram._Current->Base.OutputsRead) {
+ const struct gl_framebuffer *fb = ctx->DrawBuffer;
+
+ for (unsigned i = 0; i < fb->_NumColorDrawBuffers; i++) {
+ const struct intel_renderbuffer *irb =
+ intel_renderbuffer(fb->_ColorDrawBuffers[i]);
+
+ if (irb &&
+ intel_miptree_resolve_color(brw, irb->mt,
+ INTEL_MIPTREE_IGNORE_CCS_E))
+ brw_render_cache_set_check_flush(brw, irb->mt->bo);
+ }
+ }
+
/* If FRAMEBUFFER_SRGB is used on Gen9+ then we need to resolve any of the
* single-sampled color renderbuffers because the CCS buffer isn't
* supported for SRGB formats. This only matters if FRAMEBUFFER_SRGB is