diff options
author | Eric Anholt <[email protected]> | 2011-06-09 10:18:36 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2011-06-14 11:17:39 -0700 |
commit | 6dcc398ac0837025cf60b4d6a056fa3b0a16466f (patch) | |
tree | 35e8ec08b2efd57a5f09b75c708132a02c9f6c61 /src | |
parent | 9c5fdbb721147f7304faaa8960f5b64e25a8f673 (diff) |
intel: Calculate compress_byte in intel_miptree_create.
One less argument and thing to get wrong.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_fbo.c | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 18 | ||||
-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 | 10 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_validate.c | 5 |
5 files changed, 18 insertions, 26 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 02f40f51dfc..fbe93c270e0 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -633,10 +633,7 @@ intel_render_texture(struct gl_context * ctx, struct intel_context *intel = intel_context(ctx); struct intel_mipmap_tree *old_mt = intel_image->mt; struct intel_mipmap_tree *new_mt; - int comp_byte = 0, texel_bytes; - - if (_mesa_is_format_compressed(intel_image->base.TexFormat)) - comp_byte = intel_compressed_num_bytes(intel_image->base.TexFormat); + int texel_bytes; texel_bytes = _mesa_get_format_bytes(intel_image->base.TexFormat); @@ -647,7 +644,7 @@ intel_render_texture(struct gl_context * ctx, intel_image->base.Width, intel_image->base.Height, intel_image->base.Depth, - texel_bytes, comp_byte, GL_TRUE); + texel_bytes, GL_TRUE); intel_miptree_image_copy(intel, new_mt, diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index be18e515df0..f9dd9f3abb7 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -29,6 +29,7 @@ #include "intel_mipmap_tree.h" #include "intel_regions.h" #include "intel_tex_layout.h" +#include "intel_tex.h" #include "main/enums.h" #include "main/formats.h" @@ -60,17 +61,21 @@ 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); + int compress_byte = 0; DBG("%s target %s format %s level %d..%d <-- %p\n", __FUNCTION__, _mesa_lookup_enum_by_nr(target), _mesa_get_format_name(format), first_level, last_level, mt); + if (_mesa_is_format_compressed(format)) + compress_byte = intel_compressed_num_bytes(format); + mt->target = target_to_target(target); mt->format = format; mt->first_level = first_level; @@ -109,14 +114,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 = I915_TILING_NONE; GLenum base_format = _mesa_get_format_base_format(format); - if (intel->use_texture_tiling && compress_byte == 0) { + if (intel->use_texture_tiling && !_mesa_is_format_compressed(format)) { if (intel->gen >= 4 && (base_format == GL_DEPTH_COMPONENT || base_format == GL_DEPTH_STENCIL_EXT)) @@ -127,7 +132,7 @@ intel_miptree_create(struct intel_context *intel, 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 @@ -158,15 +163,14 @@ intel_miptree_create_for_region(struct intel_context *intel, GLenum target, gl_format format, struct intel_region *region, - GLuint depth0, - GLuint compress_byte) + GLuint depth0) { struct intel_mipmap_tree *mt; mt = intel_miptree_create_internal(intel, target, format, 0, 0, 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 c259e514787..a531ecf6b4d 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h @@ -143,7 +143,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 * @@ -151,8 +150,7 @@ intel_miptree_create_for_region(struct intel_context *intel, GLenum target, gl_format format, 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 b7d0eb1a449..6fa5c1309df 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -54,7 +54,7 @@ intel_miptree_create_for_teximage(struct intel_context *intel, GLuint width = intelImage->base.Width; GLuint height = intelImage->base.Height; GLuint depth = intelImage->base.Depth; - GLuint i, comp_byte = 0; + GLuint i; GLuint texelBytes; DBG("%s\n", __FUNCTION__); @@ -108,9 +108,6 @@ intel_miptree_create_for_teximage(struct intel_context *intel, } } - 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); return intel_miptree_create(intel, @@ -122,7 +119,6 @@ intel_miptree_create_for_teximage(struct intel_context *intel, height, depth, texelBytes, - comp_byte, expect_accelerated_upload); } @@ -692,7 +688,7 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, } mt = intel_miptree_create_for_region(intel, target, texFormat, - rb->region, 1, 0); + rb->region, 1); if (mt == NULL) return; @@ -756,7 +752,7 @@ intel_image_target_texture_2d(struct gl_context *ctx, GLenum target, return; mt = intel_miptree_create_for_region(intel, target, image->format, - image->region, 1, 0); + image->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 e810db85c14..84facdbf27e 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_validate.c +++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c @@ -77,7 +77,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); struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, unit); - int comp_byte = 0; int cpp; GLuint face, i; GLuint nr_faces = 0; @@ -102,8 +101,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); @@ -140,7 +138,6 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit) firstImage->base.Height, firstImage->base.Depth, cpp, - comp_byte, GL_TRUE); if (!intelObj->mt) return GL_FALSE; |