[Mesa-dev] [PATCH] i965: Stop passing num_samples to intel_miptree_alloc_hiz().

Paul Berry stereotype441 at gmail.com
Thu Apr 25 11:15:58 PDT 2013


The number of samples is already available in the miptree data
structure, so there's no need to pass it in.

I suspect this may fix a subtle bug because in one case
(intel_renderbuffer_update_wrapper) we were always passing zero for
num_samples, even though the buffer in question was not guaranteed to
be single-sampled.  But I wasn't able to find a failing test case.
---
 src/mesa/drivers/dri/intel/intel_fbo.c         | 4 ++--
 src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 7 +++----
 src/mesa/drivers/dri/intel/intel_mipmap_tree.h | 3 +--
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index d22de68..3ced223 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -532,7 +532,7 @@ intel_renderbuffer_update_wrapper(struct intel_context *intel,
 
    if (mt->hiz_mt == NULL &&
        intel->vtbl.is_hiz_depth_format(intel, rb->Format)) {
-      intel_miptree_alloc_hiz(intel, mt, 0 /* num_samples */);
+      intel_miptree_alloc_hiz(intel, mt);
       if (!mt->hiz_mt)
 	 return false;
    }
@@ -1019,7 +1019,7 @@ intel_renderbuffer_move_to_temp(struct intel_context *intel,
                                  false /* force_y_tiling */);
 
    if (intel->vtbl.is_hiz_depth_format(intel, new_mt->format)) {
-      intel_miptree_alloc_hiz(intel, new_mt, irb->mt->num_samples);
+      intel_miptree_alloc_hiz(intel, new_mt);
    }
 
    intel_miptree_copy_teximage(intel, intel_image, new_mt, invalidate);
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index 47f81b1..7d76748 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -568,7 +568,7 @@ intel_miptree_create_for_renderbuffer(struct intel_context *intel,
       goto fail;
 
    if (intel->vtbl.is_hiz_depth_format(intel, format)) {
-      ok = intel_miptree_alloc_hiz(intel, mt, num_samples);
+      ok = intel_miptree_alloc_hiz(intel, mt);
       if (!ok)
          goto fail;
    }
@@ -1061,8 +1061,7 @@ intel_miptree_slice_enable_hiz(struct intel_context *intel,
 
 bool
 intel_miptree_alloc_hiz(struct intel_context *intel,
-			struct intel_mipmap_tree *mt,
-                        GLuint num_samples)
+			struct intel_mipmap_tree *mt)
 {
    assert(mt->hiz_mt == NULL);
    mt->hiz_mt = intel_miptree_create(intel,
@@ -1074,7 +1073,7 @@ intel_miptree_alloc_hiz(struct intel_context *intel,
                                      mt->logical_height0,
                                      mt->logical_depth0,
                                      true,
-                                     num_samples,
+                                     mt->num_samples,
                                      false /* force_y_tiling */);
 
    if (!mt->hiz_mt)
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
index 29cd09d..b7376e0 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
@@ -540,8 +540,7 @@ intel_miptree_alloc_mcs(struct intel_context *intel,
 
 bool
 intel_miptree_alloc_hiz(struct intel_context *intel,
-			struct intel_mipmap_tree *mt,
-                        GLuint num_samples);
+			struct intel_mipmap_tree *mt);
 
 bool
 intel_miptree_slice_has_hiz(struct intel_mipmap_tree *mt,
-- 
1.8.2.1



More information about the mesa-dev mailing list