diff options
author | Brian Paul <brianp@vmware.com> | 2009-11-18 21:31:32 -0700 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2009-11-18 21:37:27 -0700 |
commit | f3a986367957b317c840091c1454089f7b47a065 (patch) | |
tree | b91e325380b652580123bb6cc35b6e7dddc62bee | |
parent | 00364245c4939d5fb0c1992cead09059edde03b2 (diff) |
intel: being cleaning up the comp_byte stuff
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 19 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_mipmap_tree.h | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_image.c | 14 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_validate.c | 5 |
4 files changed, 17 insertions, 25 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index 40d6d3bea7..6fed8e1089 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -28,6 +28,7 @@ #include "intel_context.h" #include "intel_mipmap_tree.h" #include "intel_regions.h" +#include "intel_tex.h" #include "intel_tex_layout.h" #include "intel_chipset.h" #ifndef I915 @@ -63,11 +64,12 @@ intel_miptree_create_internal(struct intel_context *intel, GLuint last_level, GLuint width0, GLuint height0, - GLuint depth0, GLuint cpp, GLuint compress_byte, + GLuint depth0, GLuint cpp, uint32_t tiling) { GLboolean ok; struct intel_mipmap_tree *mt = calloc(sizeof(*mt), 1); + const int compress_byte = intel_compressed_num_bytes(format); DBG("%s target %s format %s level %d..%d <-- %p\n", __FUNCTION__, _mesa_lookup_enum_by_nr(target), @@ -114,12 +116,14 @@ intel_miptree_create(struct intel_context *intel, GLuint last_level, GLuint width0, GLuint height0, - GLuint depth0, GLuint cpp, GLuint compress_byte, + GLuint depth0, GLuint cpp, GLboolean expect_accelerated_upload) { struct intel_mipmap_tree *mt; uint32_t tiling; + const int compress_byte = intel_compressed_num_bytes(format); + /* Determine tiling mode, if any */ if (intel->use_texture_tiling && compress_byte == 0 && intel->intelScreen->kernel_exec_fencing) { if (intel->gen >= 4 && @@ -128,12 +132,14 @@ intel_miptree_create(struct intel_context *intel, tiling = I915_TILING_Y; else tiling = I915_TILING_X; - } else + } + else { tiling = I915_TILING_NONE; + } mt = intel_miptree_create_internal(intel, target, format, first_level, last_level, width0, - height0, depth0, cpp, compress_byte, + height0, depth0, cpp, tiling); /* * pitch == 0 || height == 0 indicates the null texture @@ -167,15 +173,14 @@ intel_miptree_create_for_region(struct intel_context *intel, GLuint first_level, GLuint last_level, struct intel_region *region, - GLuint depth0, - GLuint compress_byte) + GLuint depth0) { struct intel_mipmap_tree *mt; mt = intel_miptree_create_internal(intel, target, format, first_level, last_level, region->width, region->height, 1, - region->cpp, compress_byte, + 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 865804f169..ab386b66d6 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h @@ -139,7 +139,6 @@ struct intel_mipmap_tree *intel_miptree_create(struct intel_context *intel, GLuint height0, GLuint depth0, GLuint cpp, - GLuint compress_byte, GLboolean expect_accelerated_upload); struct intel_mipmap_tree * @@ -149,8 +148,7 @@ intel_miptree_create_for_region(struct intel_context *intel, GLuint first_level, GLuint last_level, struct intel_region *region, - GLuint depth0, - GLuint compress_byte); + GLuint depth0); int intel_miptree_pitch_align (struct intel_context *intel, struct intel_mipmap_tree *mt, diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 5944c0b9aa..244ebea115 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -70,7 +70,7 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel, GLuint height = intelImage->base.Height; GLuint depth = intelImage->base.Depth; GLuint l2width, l2height, l2depth; - GLuint i, comp_byte = 0; + GLuint i; GLuint texelBytes; DBG("%s\n", __FUNCTION__); @@ -127,8 +127,6 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel, } assert(!intelObj->mt); - if (_mesa_is_format_compressed(intelImage->base.TexFormat)) - comp_byte = intel_compressed_num_bytes(intelImage->base.TexFormat); texelBytes = _mesa_get_format_bytes(intelImage->base.TexFormat); @@ -142,7 +140,6 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel, height, depth, texelBytes, - comp_byte, expect_accelerated_upload); DBG("%s - success\n", __FUNCTION__); @@ -369,13 +366,8 @@ intelTexImage(GLcontext * ctx, assert(intelImage->mt); } else if (intelImage->base.Border == 0) { - int comp_byte = 0; GLenum baseFormat = _mesa_get_format_base_format(intelImage->base.TexFormat); - if (_mesa_is_format_compressed(intelImage->base.TexFormat)) { - comp_byte = intel_compressed_num_bytes(intelImage->base.TexFormat); - } - /* Didn't fit in the object miptree, but it's suitable for inclusion in * a miptree, so create one just for our level and store it in the image. * It'll get moved into the object miptree at validate time. @@ -386,7 +378,7 @@ intelTexImage(GLcontext * ctx, level, level, width, height, depth, texelBytes, - comp_byte, pixels == NULL); + pixels == NULL); } /* PBO fastpaths: @@ -690,7 +682,7 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, mt = intel_miptree_create_for_region(intel, target, texImage->TexFormat, - 0, 0, rb->region, 1, 0); + 0, 0, rb->region, 1); if (mt == NULL) return; diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c index 78fcbfa4fe..79a079d518 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 comp_byte = 0; int cpp; GLuint face, i; GLuint nr_faces = 0; @@ -167,8 +166,7 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit) } if (_mesa_is_format_compressed(firstImage->base.TexFormat)) { - comp_byte = intel_compressed_num_bytes(firstImage->base.TexFormat); - cpp = comp_byte; + cpp = intel_compressed_num_bytes(firstImage->base.TexFormat); } else cpp = _mesa_get_format_bytes(firstImage->base.TexFormat); @@ -209,7 +207,6 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit) firstImage->base.Height, firstImage->base.Depth, cpp, - comp_byte, GL_TRUE); } |