Previously, blorp could only blit into something that was renderable.
Thanks to recent additions to blorp, it can now blit into basically
anything so long as it isn't compressed.
---
src/mesa/drivers/dri/i965/brw_blorp.c | 64 +++++++++++++++++------------------
1 file changed, 32 insertions(+), 32 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c
b/src/mesa/drivers/dri/i965/brw_blorp.c
index 3a7cf84..624b5e8 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.c
+++ b/src/mesa/drivers/dri/i965/brw_blorp.c
@@ -274,6 +274,26 @@ blorp_surf_for_miptree(struct brw_context *brw,
(surf->aux_addr.buffer == NULL));
}
+static bool
+brw_blorp_supports_dst_format(struct brw_context *brw, mesa_format format)
+{
+ /* If it's renderable, it's definitely supported. */
+ if (brw->format_supported_as_render_target[format])
+ return true;
+
+ /* BLORP can't compress anything */
+ if (_mesa_is_format_compressed(format))
+ return false;
+
+ /* No exotic formats such as GL_LUMINANCE_ALPHA */
+ if (_mesa_get_format_bits(format, GL_RED_BITS) == 0 &&
+ _mesa_get_format_bits(format, GL_DEPTH_BITS) == 0 &&
+ _mesa_get_format_bits(format, GL_STENCIL_BITS) == 0)
+ return false;
+
+ return true;
+}
+
static enum isl_format
brw_blorp_to_isl_format(struct brw_context *brw, mesa_format format,
bool is_render_target)
@@ -291,15 +311,20 @@ brw_blorp_to_isl_format(struct brw_context *brw,
mesa_format format,
return ISL_FORMAT_R32_FLOAT;
case MESA_FORMAT_Z_UNORM16:
return ISL_FORMAT_R16_UNORM;
- default: {
+ default:
if (is_render_target) {
- assert(brw->format_supported_as_render_target[format]);
- return brw->render_target_format[format];
+ assert(brw_blorp_supports_dst_format(brw, format));
+ if (brw->format_supported_as_render_target[format]) {
+ return brw->render_target_format[format];
+ } else {
+ return brw_format_for_mesa_format(format);
+ }
} else {
+ /* Some destinations (is_render_target == true) are supported by
+ * blorp even though we technically can't render to them.
+ */
return brw_format_for_mesa_format(format);
}
- break;
- }
}
}
@@ -540,8 +565,6 @@ try_blorp_blit(struct brw_context *brw,
/* Find buffers */
struct intel_renderbuffer *src_irb;
struct intel_renderbuffer *dst_irb;
- struct intel_mipmap_tree *src_mt;
- struct intel_mipmap_tree *dst_mt;
switch (buffer_bit) {
case GL_COLOR_BUFFER_BIT:
src_irb = intel_renderbuffer(read_fb->_ColorReadBuffer);
@@ -561,16 +584,6 @@ try_blorp_blit(struct brw_context *brw,
intel_renderbuffer(read_fb->Attachment[BUFFER_DEPTH].Renderbuffer);
dst_irb =
intel_renderbuffer(draw_fb->Attachment[BUFFER_DEPTH].Renderbuffer);
- src_mt = find_miptree(buffer_bit, src_irb);
- dst_mt = find_miptree(buffer_bit, dst_irb);
-
- /* We can't handle format conversions between Z24 and other formats
- * since we have to lie about the surface format. See the comments in
- * brw_blorp_surface_info::set().
- */
- if ((src_mt->format == MESA_FORMAT_Z24_UNORM_X8_UINT) !=
- (dst_mt->format == MESA_FORMAT_Z24_UNORM_X8_UINT))
- return false;
do_blorp_blit(brw, buffer_bit, src_irb, MESA_FORMAT_NONE,
dst_irb, MESA_FORMAT_NONE, srcX0, srcY0,
@@ -627,21 +640,8 @@ brw_blorp_copytexsubimage(struct brw_context *brw,
if (brw->gen < 6)
return false;
- if (_mesa_get_format_base_format(src_rb->Format) !=
- _mesa_get_format_base_format(dst_image->TexFormat)) {
- return false;
- }
-
- /* We can't handle format conversions between Z24 and other formats since
- * we have to lie about the surface format. See the comments in
- * brw_blorp_surface_info::set().
- */
- if ((src_mt->format == MESA_FORMAT_Z24_UNORM_X8_UINT) !=
- (dst_mt->format == MESA_FORMAT_Z24_UNORM_X8_UINT)) {
- return false;
- }
-
- if (!brw->format_supported_as_render_target[dst_image->TexFormat])
+ /* BLORP can't compress anything */
+ if (!brw_blorp_supports_dst_format(brw, dst_image->TexFormat))
return false;
/* Source clipping shouldn't be necessary, since copytexsubimage (in
--
2.5.0.400.gff86faf
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev