diff options
author | Brian Paul <brianp@vmware.com> | 2009-11-18 21:57:34 -0700 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2009-11-18 21:57:36 -0700 |
commit | d9d69515226983e0061b1567ff1f12cae4cf9dd0 (patch) | |
tree | 966cafe7690f33bb3e2a81382bac9d050d0a0d19 | |
parent | f3a986367957b317c840091c1454089f7b47a065 (diff) |
intel: don't pass cpp info to intel_miptree_create()
We can compute it locally.
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 10 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_mipmap_tree.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_image.c | 17 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_validate.c | 9 |
4 files changed, 9 insertions, 28 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index 6fed8e1089..5a00d3cb2d 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -64,12 +64,13 @@ intel_miptree_create_internal(struct intel_context *intel, GLuint last_level, GLuint width0, GLuint height0, - GLuint depth0, GLuint cpp, + GLuint depth0, uint32_t tiling) { GLboolean ok; struct intel_mipmap_tree *mt = calloc(sizeof(*mt), 1); const int compress_byte = intel_compressed_num_bytes(format); + const GLuint cpp = _mesa_get_format_bytes(format); DBG("%s target %s format %s level %d..%d <-- %p\n", __FUNCTION__, _mesa_lookup_enum_by_nr(target), @@ -84,7 +85,7 @@ intel_miptree_create_internal(struct intel_context *intel, mt->height0 = height0; mt->depth0 = depth0; mt->cpp = compress_byte ? compress_byte : cpp; - mt->compressed = compress_byte ? 1 : 0; + mt->compressed = _mesa_is_format_compressed(format); mt->refcount = 1; mt->pitch = 0; @@ -116,7 +117,7 @@ intel_miptree_create(struct intel_context *intel, GLuint last_level, GLuint width0, GLuint height0, - GLuint depth0, GLuint cpp, + GLuint depth0, GLboolean expect_accelerated_upload) { struct intel_mipmap_tree *mt; @@ -139,7 +140,7 @@ intel_miptree_create(struct intel_context *intel, mt = intel_miptree_create_internal(intel, target, format, first_level, last_level, width0, - height0, depth0, cpp, + height0, depth0, tiling); /* * pitch == 0 || height == 0 indicates the null texture @@ -180,7 +181,6 @@ intel_miptree_create_for_region(struct intel_context *intel, mt = intel_miptree_create_internal(intel, target, format, first_level, last_level, region->width, region->height, 1, - region->cpp, I915_TILING_NONE); if (!mt) return mt; diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h index ab386b66d6..bf5975090b 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h @@ -138,7 +138,6 @@ struct intel_mipmap_tree *intel_miptree_create(struct intel_context *intel, GLuint width0, GLuint height0, GLuint depth0, - GLuint cpp, GLboolean expect_accelerated_upload); struct intel_mipmap_tree * diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 244ebea115..b42b9aadba 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -71,7 +71,6 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel, GLuint depth = intelImage->base.Depth; GLuint l2width, l2height, l2depth; GLuint i; - GLuint texelBytes; DBG("%s\n", __FUNCTION__); @@ -128,8 +127,6 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel, assert(!intelObj->mt); - texelBytes = _mesa_get_format_bytes(intelImage->base.TexFormat); - intelObj->mt = intel_miptree_create(intel, intelObj->base.Target, intelImage->base._BaseFormat, @@ -139,7 +136,6 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel, width, height, depth, - texelBytes, expect_accelerated_upload); DBG("%s - success\n", __FUNCTION__); @@ -297,7 +293,6 @@ intelTexImage(GLcontext * ctx, struct intel_texture_image *intelImage = intel_texture_image(texImage); GLint postConvWidth = width; GLint postConvHeight = height; - GLint texelBytes; const GLuint srcRowStride = unpack->RowLength ? unpack->RowLength : width; assert(srcRowStride == texImage->Map.RowStride); @@ -313,11 +308,8 @@ intelTexImage(GLcontext * ctx, &postConvHeight); } - if (_mesa_is_format_compressed(texImage->TexFormat)) { - texelBytes = 0; - } - else { - texelBytes = _mesa_get_format_bytes(texImage->TexFormat); + if (!_mesa_is_format_compressed(texImage->TexFormat)) { + const GLint texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* Minimum pitch of 32 bytes */ if (postConvWidth * texelBytes < 32) { @@ -377,7 +369,6 @@ intelTexImage(GLcontext * ctx, texImage->TexFormat, level, level, width, height, depth, - texelBytes, pixels == NULL); } @@ -453,9 +444,9 @@ intelTexImage(GLcontext * ctx, / intelImage->mt->cpp; } - DBG("Upload image %dx%dx%d row_len %d " + DBG("Upload image %dx%dx%d " "pitch %d pixels %d compressed %d\n", - width, height, depth, width * texelBytes, texImage->Map.RowStride, + width, height, depth, texImage->Map.RowStride, pixels ? 1 : 0, compressed); /* Copy data. Would like to know when it's ok for us to eg. use diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c index 79a079d518..ca6c9e333a 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_validate.c +++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c @@ -125,7 +125,6 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit) { struct gl_texture_object *tObj = intel->ctx.Texture.Unit[unit]._Current; struct intel_texture_object *intelObj = intel_texture_object(tObj); - int cpp; GLuint face, i; GLuint nr_faces = 0; struct intel_texture_image *firstImage; @@ -165,12 +164,6 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit) intel_miptree_reference(&intelObj->mt, firstImage->mt); } - if (_mesa_is_format_compressed(firstImage->base.TexFormat)) { - cpp = intel_compressed_num_bytes(firstImage->base.TexFormat); - } - else - cpp = _mesa_get_format_bytes(firstImage->base.TexFormat); - /* Check tree can hold all active levels. Check tree matches * target, imageFormat, etc. * @@ -188,7 +181,6 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit) intelObj->mt->width0 != firstImage->base.Width || intelObj->mt->height0 != firstImage->base.Height || intelObj->mt->depth0 != firstImage->base.Depth || - intelObj->mt->cpp != cpp || intelObj->mt->compressed != _mesa_is_format_compressed(firstImage->base.TexFormat))) { intel_miptree_release(intel, &intelObj->mt); } @@ -206,7 +198,6 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit) firstImage->base.Width, firstImage->base.Height, firstImage->base.Depth, - cpp, GL_TRUE); } |