intel: Define intel_miptree_create_for_renderbuffer()
authorChad Versace <chad.versace@linux.intel.com>
Mon, 14 Nov 2011 07:04:24 +0000 (23:04 -0800)
committerChad Versace <chad.versace@linux.intel.com>
Tue, 22 Nov 2011 00:58:34 +0000 (16:58 -0800)
This function creates a miptree that is suitable as storage for
a non-texture renderbuffer.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
src/mesa/drivers/dri/intel/intel_mipmap_tree.c
src/mesa/drivers/dri/intel/intel_mipmap_tree.h

index 19f151f..33247d2 100644 (file)
@@ -171,6 +171,27 @@ intel_miptree_create_for_region(struct intel_context *intel,
    return mt;
 }
 
+struct intel_mipmap_tree*
+intel_miptree_create_for_renderbuffer(struct intel_context *intel,
+                                      gl_format format,
+                                      uint32_t tiling,
+                                      uint32_t cpp,
+                                      uint32_t width,
+                                      uint32_t height)
+{
+   struct intel_region *region;
+   struct intel_mipmap_tree *mt;
+
+   region = intel_region_alloc(intel->intelScreen,
+                               tiling, cpp, width, height, true);
+   if (!region)
+      return NULL;
+
+   mt = intel_miptree_create_for_region(intel, GL_TEXTURE_2D, format, region);
+   intel_region_release(&region);
+   return mt;
+}
+
 void
 intel_miptree_reference(struct intel_mipmap_tree **dst,
                         struct intel_mipmap_tree *src)
index e29b943..611519d 100644 (file)
@@ -151,6 +151,21 @@ intel_miptree_create_for_region(struct intel_context *intel,
                                gl_format format,
                                struct intel_region *region);
 
+/**
+ * Create a miptree appropriate as the storage for a non-texture renderbuffer.
+ * The miptree has the following properties:
+ *     - The target is GL_TEXTURE_2D.
+ *     - There are no levels other than the base level 0.
+ *     - Depth is 1.
+ */
+struct intel_mipmap_tree*
+intel_miptree_create_for_renderbuffer(struct intel_context *intel,
+                                      gl_format format,
+                                      uint32_t tiling,
+                                      uint32_t cpp,
+                                      uint32_t width,
+                                      uint32_t height);
+
 int intel_miptree_pitch_align (struct intel_context *intel,
                               struct intel_mipmap_tree *mt,
                               uint32_t tiling,