diff options
author | Chad Versace <[email protected]> | 2011-11-13 23:04:24 -0800 |
---|---|---|
committer | Chad Versace <[email protected]> | 2011-11-21 16:58:34 -0800 |
commit | 005149d5860ad55c5e58e2de8a138e3a763f2036 (patch) | |
tree | 6177b56188e6867726613bd33d3d98be73faa4fb | |
parent | c3c7cbd15418293208034e8970d626b5998abd4b (diff) |
intel: Define intel_miptree_create_for_renderbuffer()
This function creates a miptree that is suitable as storage for
a non-texture renderbuffer.
Reviewed-by: Eric Anholt <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Signed-off-by: Chad Versace <[email protected]>
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 21 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_mipmap_tree.h | 15 |
2 files changed, 36 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index 19f151f4fa3..33247d2ced0 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -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(®ion); + return mt; +} + void intel_miptree_reference(struct intel_mipmap_tree **dst, struct intel_mipmap_tree *src) diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h index e29b9431939..611519d18d5 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h @@ -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, |