summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2011-11-16 22:42:44 -0800
committerChad Versace <[email protected]>2011-11-22 10:35:42 -0800
commit73540690f71280a2bdda51b45203fd4ed43a1760 (patch)
treeaf8f453dd8d0d791a29f99beb30b2b899c0db5ad
parent3b38b33c1648b07e75dc4d8340758171e109c598 (diff)
intel: Define intel_miptree_check_level_layer()
This is a small helper function that asserts that a given level and layer are valid for a miptree. I will be extensively using it in the future miptree HiZ functions. Reviewed-by: Eric Anholt <[email protected]> Signed-off-by: Chad Versace <[email protected]>
-rw-r--r--src/mesa/drivers/dri/intel/intel_mipmap_tree.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
index 8f024f9524f..d6134f8c780 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
@@ -28,6 +28,8 @@
#ifndef INTEL_MIPMAP_TREE_H
#define INTEL_MIPMAP_TREE_H
+#include <assert.h>
+
#include "intel_regions.h"
/* A layer on top of the intel_regions code which adds:
@@ -188,6 +190,17 @@ intel_miptree_create_for_renderbuffer(struct intel_context *intel,
uint32_t width,
uint32_t height);
+/** \brief Assert that the level and layer are valid for the miptree. */
+static inline void
+intel_miptree_check_level_layer(struct intel_mipmap_tree *mt,
+ uint32_t level,
+ uint32_t layer)
+{
+ assert(level >= mt->first_level);
+ assert(level <= mt->last_level);
+ assert(layer < mt->level[level].depth);
+}
+
int intel_miptree_pitch_align (struct intel_context *intel,
struct intel_mipmap_tree *mt,
uint32_t tiling,