diff options
author | Brian Paul <brianp@vmware.com> | 2009-11-18 21:37:20 -0700 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2009-11-18 21:37:20 -0700 |
commit | 00364245c4939d5fb0c1992cead09059edde03b2 (patch) | |
tree | 39de6bae08de080dd84150a3d36e8d0c215866bc | |
parent | 4a5cf82327689b58dc2c832b80f097b9d56dd4b6 (diff) |
intel: replace miptree internal_format with gl_format
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_tex_layout.c | 4 | ||||
-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 | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_image.c | 12 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_layout.c | 26 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_layout.h | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_validate.c | 4 |
7 files changed, 39 insertions, 36 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c index e59e52ed86..2cc4d82940 100644 --- a/src/mesa/drivers/dri/i965/brw_tex_layout.c +++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c @@ -60,7 +60,7 @@ GLboolean brw_miptree_layout(struct intel_context *intel, GLuint y_pitch = 0; mt->pitch = mt->width0; - intel_get_texture_alignment_unit(mt->internal_format, &align_w, &align_h); + intel_get_texture_alignment_unit(mt->format, &align_w, &align_h); y_pitch = ALIGN(height, align_h); if (mt->compressed) { @@ -135,7 +135,7 @@ GLboolean brw_miptree_layout(struct intel_context *intel, GLuint align_w = 4; mt->total_height = 0; - intel_get_texture_alignment_unit(mt->internal_format, &align_w, &align_h); + intel_get_texture_alignment_unit(mt->format, &align_w, &align_h); if (mt->compressed) { mt->pitch = ALIGN(width, align_w); diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index abb3024bfb..40d6d3bea7 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -58,7 +58,7 @@ target_to_target(GLenum target) static struct intel_mipmap_tree * intel_miptree_create_internal(struct intel_context *intel, GLenum target, - GLenum internal_format, + gl_format format, GLuint first_level, GLuint last_level, GLuint width0, @@ -71,11 +71,11 @@ intel_miptree_create_internal(struct intel_context *intel, DBG("%s target %s format %s level %d..%d <-- %p\n", __FUNCTION__, _mesa_lookup_enum_by_nr(target), - _mesa_lookup_enum_by_nr(internal_format), + _mesa_get_format_name(format), first_level, last_level, mt); mt->target = target_to_target(target); - mt->internal_format = internal_format; + mt->format = format; mt->first_level = first_level; mt->last_level = last_level; mt->width0 = width0; @@ -109,7 +109,7 @@ struct intel_mipmap_tree * intel_miptree_create(struct intel_context *intel, GLenum target, GLenum base_format, - GLenum internal_format, + gl_format format, GLuint first_level, GLuint last_level, GLuint width0, @@ -131,7 +131,7 @@ intel_miptree_create(struct intel_context *intel, } else tiling = I915_TILING_NONE; - mt = intel_miptree_create_internal(intel, target, internal_format, + mt = intel_miptree_create_internal(intel, target, format, first_level, last_level, width0, height0, depth0, cpp, compress_byte, tiling); @@ -163,7 +163,7 @@ intel_miptree_create(struct intel_context *intel, struct intel_mipmap_tree * intel_miptree_create_for_region(struct intel_context *intel, GLenum target, - GLenum internal_format, + gl_format format, GLuint first_level, GLuint last_level, struct intel_region *region, @@ -172,7 +172,7 @@ intel_miptree_create_for_region(struct intel_context *intel, { struct intel_mipmap_tree *mt; - mt = intel_miptree_create_internal(intel, target, internal_format, + mt = intel_miptree_create_internal(intel, target, format, first_level, last_level, region->width, region->height, 1, region->cpp, compress_byte, @@ -325,7 +325,7 @@ intel_miptree_match_image(struct intel_mipmap_tree *mt, if (image->Border) return GL_FALSE; - if (image->InternalFormat != mt->internal_format || + if (image->TexFormat != mt->format || isCompressed != mt->compressed) return GL_FALSE; @@ -520,8 +520,7 @@ intel_miptree_image_copy(struct intel_context *intel, if (dst->compressed) { GLuint align_w, align_h; - intel_get_texture_alignment_unit(dst->internal_format, - &align_w, &align_h); + intel_get_texture_alignment_unit(dst->format, &align_w, &align_h); height = (height + 3) / 4; width = ALIGN(width, align_w); } diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h index b19c548def..865804f169 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h @@ -28,6 +28,7 @@ #ifndef INTEL_MIPMAP_TREE_H #define INTEL_MIPMAP_TREE_H +#include "main/formats.h" #include "intel_regions.h" /* A layer on top of the intel_regions code which adds: @@ -98,7 +99,7 @@ struct intel_mipmap_tree /* Effectively the key: */ GLenum target; - GLenum internal_format; + gl_format format; GLuint first_level; GLuint last_level; @@ -131,7 +132,7 @@ struct intel_mipmap_tree struct intel_mipmap_tree *intel_miptree_create(struct intel_context *intel, GLenum target, GLenum base_format, - GLenum internal_format, + gl_format format, GLuint first_level, GLuint last_level, GLuint width0, @@ -144,7 +145,7 @@ struct intel_mipmap_tree *intel_miptree_create(struct intel_context *intel, struct intel_mipmap_tree * intel_miptree_create_for_region(struct intel_context *intel, GLenum target, - GLenum internal_format, + gl_format format, GLuint first_level, GLuint last_level, struct intel_region *region, diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 5e515161f8..5944c0b9aa 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -135,7 +135,7 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel, intelObj->mt = intel_miptree_create(intel, intelObj->base.Target, intelImage->base._BaseFormat, - intelImage->base.InternalFormat, + intelImage->base.TexFormat, firstLevel, lastLevel, width, @@ -382,7 +382,7 @@ intelTexImage(GLcontext * ctx, */ intelImage->mt = intel_miptree_create(intel, target, baseFormat, - internalFormat, + texImage->TexFormat, level, level, width, height, depth, texelBytes, @@ -685,17 +685,17 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, else internalFormat = GL_RGBA; + texImage = _mesa_get_tex_image(&intel->ctx, texObj, target, level); + intelImage = intel_texture_image(texImage); + mt = intel_miptree_create_for_region(intel, target, - internalFormat, + texImage->TexFormat, 0, 0, rb->region, 1, 0); if (mt == NULL) return; _mesa_lock_texture(&intel->ctx, texObj); - texImage = _mesa_get_tex_image(&intel->ctx, texObj, target, level); - intelImage = intel_texture_image(texImage); - if (intelImage->mt) { intel_miptree_release(intel, &intelImage->mt); assert(!texImage->Map.Data); diff --git a/src/mesa/drivers/dri/intel/intel_tex_layout.c b/src/mesa/drivers/dri/intel/intel_tex_layout.c index 7d69ea4484..0b77add4a7 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_layout.c +++ b/src/mesa/drivers/dri/intel/intel_tex_layout.c @@ -35,23 +35,25 @@ #include "intel_context.h" #include "main/macros.h" -void intel_get_texture_alignment_unit(GLenum internalFormat, GLuint *w, GLuint *h) +void +intel_get_texture_alignment_unit(gl_format internalFormat, + GLuint *w, GLuint *h) { switch (internalFormat) { - case GL_COMPRESSED_RGB_FXT1_3DFX: - case GL_COMPRESSED_RGBA_FXT1_3DFX: + case MESA_FORMAT_RGB_FXT1: + case MESA_FORMAT_RGBA_FXT1: *w = 8; *h = 4; break; - case GL_RGB_S3TC: - case GL_RGB4_S3TC: - case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: - case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - case GL_RGBA_S3TC: - case GL_RGBA4_S3TC: - case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: - case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: + case MESA_FORMAT_RGB_DXT1: + case MESA_FORMAT_RGBA_DXT1: + case MESA_FORMAT_RGBA_DXT3: + case MESA_FORMAT_RGBA_DXT5: + case MESA_FORMAT_SRGB_DXT1: + case MESA_FORMAT_SRGBA_DXT1: + case MESA_FORMAT_SRGBA_DXT3: + case MESA_FORMAT_SRGBA_DXT5: *w = 4; *h = 4; break; @@ -75,7 +77,7 @@ void i945_miptree_layout_2d( struct intel_context *intel, GLuint height = mt->height0; mt->pitch = mt->width0; - intel_get_texture_alignment_unit(mt->internal_format, &align_w, &align_h); + intel_get_texture_alignment_unit(mt->format, &align_w, &align_h); if (mt->compressed) { mt->pitch = ALIGN(mt->width0, align_w); diff --git a/src/mesa/drivers/dri/intel/intel_tex_layout.h b/src/mesa/drivers/dri/intel/intel_tex_layout.h index a9ac9e7eb4..0846934d6e 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_layout.h +++ b/src/mesa/drivers/dri/intel/intel_tex_layout.h @@ -41,4 +41,5 @@ static INLINE GLuint minify( GLuint d ) extern void i945_miptree_layout_2d(struct intel_context *intel, struct intel_mipmap_tree *mt, uint32_t tiling); -extern void intel_get_texture_alignment_unit(GLenum, GLuint *, GLuint *); + +extern void intel_get_texture_alignment_unit(gl_format, GLuint *, GLuint *); diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c index f9e2c275fc..78fcbfa4fe 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_validate.c +++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c @@ -184,7 +184,7 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit) */ if (intelObj->mt && (intelObj->mt->target != intelObj->base.Target || - intelObj->mt->internal_format != firstImage->base.InternalFormat || + intelObj->mt->format != firstImage->base.TexFormat || intelObj->mt->first_level != intelObj->firstLevel || intelObj->mt->last_level != intelObj->lastLevel || intelObj->mt->width0 != firstImage->base.Width || @@ -202,7 +202,7 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit) intelObj->mt = intel_miptree_create(intel, intelObj->base.Target, firstImage->base._BaseFormat, - firstImage->base.InternalFormat, + firstImage->base.TexFormat, intelObj->firstLevel, intelObj->lastLevel, firstImage->base.Width, |