[Mesa-dev] [PATCH 08/15] intel: Refactor intel_miptree_map/unmap

Chad Versace chad.versace at linux.intel.com
Mon Aug 6 17:19:15 PDT 2012


Move the body of intel_miptree_map into a new function,
intel_miptree_map_singlesample. Now intel_miptree_map dispatches to the
new function. A future commit adds a multisample variant.

Ditto for intel_miptree_unmap.

CC: Paul Berry <stereotype441 at gmail.com>
CC: Eric Anholt <eric at anholt.net>
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
 src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 67 +++++++++++++++++++-------
 1 file changed, 50 insertions(+), 17 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index b424e4d..2a00c78 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -1448,21 +1448,23 @@ intel_miptree_unmap_depthstencil(struct intel_context *intel,
    free(map->buffer);
 }
 
-void
-intel_miptree_map(struct intel_context *intel,
-		  struct intel_mipmap_tree *mt,
-		  unsigned int level,
-		  unsigned int slice,
-		  unsigned int x,
-		  unsigned int y,
-		  unsigned int w,
-		  unsigned int h,
-		  GLbitfield mode,
-		  void **out_ptr,
-		  int *out_stride)
+static void
+intel_miptree_map_singlesample(struct intel_context *intel,
+                               struct intel_mipmap_tree *mt,
+                               unsigned int level,
+                               unsigned int slice,
+                               unsigned int x,
+                               unsigned int y,
+                               unsigned int w,
+                               unsigned int h,
+                               GLbitfield mode,
+                               void **out_ptr,
+                               int *out_stride)
 {
    struct intel_miptree_map *map;
 
+   assert(mt->num_samples == 0);
+
    map = calloc(1, sizeof(struct intel_miptree_map));
    if (!map){
       *out_ptr = NULL;
@@ -1507,14 +1509,16 @@ intel_miptree_map(struct intel_context *intel,
    }
 }
 
-void
-intel_miptree_unmap(struct intel_context *intel,
-		    struct intel_mipmap_tree *mt,
-		    unsigned int level,
-		    unsigned int slice)
+static void
+intel_miptree_unmap_singlesample(struct intel_context *intel,
+                                 struct intel_mipmap_tree *mt,
+                                 unsigned int level,
+                                 unsigned int slice)
 {
    struct intel_miptree_map *map = mt->level[level].slice[slice].map;
 
+   assert(mt->num_samples == 0);
+
    if (!map)
       return;
 
@@ -1536,3 +1540,32 @@ intel_miptree_unmap(struct intel_context *intel,
    mt->level[level].slice[slice].map = NULL;
    free(map);
 }
+
+void
+intel_miptree_map(struct intel_context *intel,
+		  struct intel_mipmap_tree *mt,
+		  unsigned int level,
+		  unsigned int slice,
+		  unsigned int x,
+		  unsigned int y,
+		  unsigned int w,
+		  unsigned int h,
+		  GLbitfield mode,
+		  void **out_ptr,
+		  int *out_stride)
+{
+   intel_miptree_map_singlesample(intel, mt,
+                                  level, slice,
+                                  x, y, w, h,
+                                  mode,
+                                  out_ptr, out_stride);
+}
+
+void
+intel_miptree_unmap(struct intel_context *intel,
+		    struct intel_mipmap_tree *mt,
+		    unsigned int level,
+		    unsigned int slice)
+{
+   intel_miptree_unmap_singlesample(intel, mt, level, slice);
+}
-- 
1.7.11.4



More information about the mesa-dev mailing list