Mesa (master): i915g: define I915_MAX_TEXTURE_2D/3D_LEVELS

Brian Paul brianp at kemper.freedesktop.org
Mon Mar 8 23:27:29 UTC 2010


Module: Mesa
Branch: master
Commit: e0d4f3202e213ae790a272eba7e96a40f68a6822
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e0d4f3202e213ae790a272eba7e96a40f68a6822

Author: Brian Paul <brianp at vmware.com>
Date:   Mon Mar  8 13:59:39 2010 -0700

i915g: define I915_MAX_TEXTURE_2D/3D_LEVELS

---

 src/gallium/drivers/i915/i915_context.h |    7 +++++--
 src/gallium/drivers/i915/i915_screen.c  |    6 +++---
 src/gallium/drivers/i915/i915_texture.c |    4 ++--
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/i915/i915_context.h b/src/gallium/drivers/i915/i915_context.h
index da769e7..499a727 100644
--- a/src/gallium/drivers/i915/i915_context.h
+++ b/src/gallium/drivers/i915/i915_context.h
@@ -187,6 +187,9 @@ struct i915_sampler_state {
    unsigned maxlod;
 };
 
+#define I915_MAX_TEXTURE_2D_LEVELS 11  /* max 1024x1024 */
+#define I915_MAX_TEXTURE_3D_LEVELS  8  /* max 128x128x128 */
+
 struct i915_texture {
    struct pipe_texture base;
 
@@ -199,7 +202,7 @@ struct i915_texture {
    unsigned sw_tiled; /**< tiled with software flags */
    unsigned hw_tiled; /**< tiled with hardware fences */
 
-   unsigned nr_images[PIPE_MAX_TEXTURE_LEVELS];
+   unsigned nr_images[I915_MAX_TEXTURE_2D_LEVELS];
 
    /* Explicitly store the offset of each image for each cube face or
     * depth value.  Pretty much have to accept that hardware formats
@@ -207,7 +210,7 @@ struct i915_texture {
     * compute the offsets of depth/cube images within a mipmap level,
     * so have to store them as a lookup table:
     */
-   unsigned *image_offset[PIPE_MAX_TEXTURE_LEVELS];   /**< array [depth] of offsets */
+   unsigned *image_offset[I915_MAX_TEXTURE_2D_LEVELS];   /**< array [depth] of offsets */
 
    /* The data is held here:
     */
diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
index 72bd263..e5bf4a2 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -116,11 +116,11 @@ i915_get_param(struct pipe_screen *screen, int param)
    case PIPE_CAP_TEXTURE_SHADOW_MAP:
       return 1;
    case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
-      return 11; /* max 1024x1024 */
+      return I915_MAX_TEXTURE_2D_LEVELS;
    case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
-      return 8;  /* max 128x128x128 */
+      return I915_MAX_TEXTURE_3D_LEVELS;
    case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
-      return 11; /* max 1024x1024 */
+      return I915_MAX_TEXTURE_2D_LEVELS;
    case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
    case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
       return 1;
diff --git a/src/gallium/drivers/i915/i915_texture.c b/src/gallium/drivers/i915/i915_texture.c
index 334959c..5b1f423 100644
--- a/src/gallium/drivers/i915/i915_texture.c
+++ b/src/gallium/drivers/i915/i915_texture.c
@@ -96,7 +96,7 @@ i915_miptree_set_level_info(struct i915_texture *tex,
                              unsigned nr_images,
                              unsigned w, unsigned h, unsigned d)
 {
-   assert(level < PIPE_MAX_TEXTURE_LEVELS);
+   assert(level < Elements(tex->nr_images));
 
    tex->nr_images[level] = nr_images;
 
@@ -775,7 +775,7 @@ i915_texture_destroy(struct pipe_texture *pt)
 
    iws->buffer_destroy(iws, tex->buffer);
 
-   for (i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++)
+   for (i = 0; i < Elements(tex->image_offset); i++)
       if (tex->image_offset[i])
          FREE(tex->image_offset[i]);
 




More information about the mesa-commit mailing list