[Mesa-dev] [PATCH 16/40] i965/blorp: Add check for supported sample numbers

Topi Pohjolainen topi.pohjolainen at intel.com
Sat Apr 16 13:42:44 UTC 2016


Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/mesa/drivers/dri/i965/brw_blorp_blit.cpp  | 10 ++++++++++
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c |  9 +++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
index abbef8b..073767c 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
@@ -247,6 +247,11 @@ brw_blorp_copytexsubimage(struct brw_context *brw,
    struct intel_mipmap_tree *src_mt = src_irb->mt;
    struct intel_mipmap_tree *dst_mt = intel_image->mt;
 
+   /* There is support only for four and eight samples. */
+   if (src_mt->num_samples == 2 || dst_mt->num_samples == 2 ||
+       src_mt->num_samples > 8 || dst_mt->num_samples > 8)
+      return false;
+
    /* BLORP is only supported for Gen6-7. */
    if (brw->gen < 6 || brw->gen > 7)
       return false;
@@ -352,6 +357,11 @@ brw_blorp_framebuffer(struct brw_context *brw,
    if (brw->gen < 6 || brw->gen >= 8)
       return mask;
 
+   /* There is support only for four and eight samples. */
+   if (readFb->Visual.samples == 2 || drawFb->Visual.samples == 2 ||
+       readFb->Visual.samples > 8 || drawFb->Visual.samples > 8)
+      return mask;
+
    static GLbitfield buffer_bits[] = {
       GL_COLOR_BUFFER_BIT,
       GL_DEPTH_BUFFER_BIT,
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 7f8b3c1..9f754e7 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -2164,7 +2164,12 @@ intel_miptree_updownsample(struct brw_context *brw,
                            struct intel_mipmap_tree *src,
                            struct intel_mipmap_tree *dst)
 {
-   if (brw->gen < 8) {
+   /* There is support only for four and eight samples. */
+   const bool use_blorp = brw->gen < 8 &&
+                          src->num_samples != 2 && dst->num_samples != 2 &&
+                          src->num_samples <= 8 && dst->num_samples <= 8;
+
+   if (use_blorp) {
       brw_blorp_blit_miptrees(brw,
                               src, 0 /* level */, 0 /* layer */,
                               src->format, SWIZZLE_XYZW,
@@ -2182,7 +2187,7 @@ intel_miptree_updownsample(struct brw_context *brw,
    }
 
    if (src->stencil_mt) {
-      if (brw->gen >= 8) {
+      if (use_blorp) {
          brw_meta_stencil_updownsample(brw, src->stencil_mt, dst);
          return;
       }
-- 
2.5.5



More information about the mesa-dev mailing list