[Mesa-dev] [PATCH 02/11] intel: Add the MESA_FORMAT as a field of the miptree.
Eric Anholt
eric at anholt.net
Fri Jun 10 13:38:14 PDT 2011
We only had internal_format before, which is way more irritating to work with.
---
src/mesa/drivers/dri/intel/intel_fbo.c | 1 +
src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 8 ++++++--
src/mesa/drivers/dri/intel/intel_mipmap_tree.h | 3 +++
src/mesa/drivers/dri/intel/intel_tex_image.c | 5 +++--
src/mesa/drivers/dri/intel/intel_tex_validate.c | 1 +
5 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index c0d001c..0520386 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -641,6 +641,7 @@ intel_render_texture(struct gl_context * ctx,
texel_bytes = _mesa_get_format_bytes(intel_image->base.TexFormat);
new_mt = intel_miptree_create(intel, image->TexObject->Target,
+ intel_image->base.TexFormat,
intel_image->base._BaseFormat,
intel_image->base.InternalFormat,
intel_image->level,
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index d63f56e..aa6fc5b 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -55,6 +55,7 @@ target_to_target(GLenum target)
static struct intel_mipmap_tree *
intel_miptree_create_internal(struct intel_context *intel,
GLenum target,
+ gl_format format,
GLenum internal_format,
GLuint first_level,
GLuint last_level,
@@ -72,6 +73,7 @@ intel_miptree_create_internal(struct intel_context *intel,
first_level, last_level, mt);
mt->target = target_to_target(target);
+ mt->format = format;
mt->internal_format = internal_format;
mt->first_level = first_level;
mt->last_level = last_level;
@@ -104,6 +106,7 @@ intel_miptree_create_internal(struct intel_context *intel,
struct intel_mipmap_tree *
intel_miptree_create(struct intel_context *intel,
GLenum target,
+ gl_format format,
GLenum base_format,
GLenum internal_format,
GLuint first_level,
@@ -125,7 +128,7 @@ intel_miptree_create(struct intel_context *intel,
tiling = I915_TILING_X;
}
- mt = intel_miptree_create_internal(intel, target, internal_format,
+ mt = intel_miptree_create_internal(intel, target, format, internal_format,
first_level, last_level, width0,
height0, depth0, cpp, compress_byte,
tiling);
@@ -156,6 +159,7 @@ intel_miptree_create(struct intel_context *intel,
struct intel_mipmap_tree *
intel_miptree_create_for_region(struct intel_context *intel,
GLenum target,
+ gl_format format,
GLenum internal_format,
struct intel_region *region,
GLuint depth0,
@@ -163,7 +167,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, internal_format,
0, 0,
region->width, region->height, 1,
region->cpp, compress_byte,
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
index 325e391..0ce8c09 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
@@ -91,6 +91,7 @@ struct intel_mipmap_tree
/* Effectively the key:
*/
GLenum target;
+ gl_format format;
GLenum internal_format;
GLuint first_level;
@@ -136,6 +137,7 @@ struct intel_mipmap_tree
struct intel_mipmap_tree *intel_miptree_create(struct intel_context *intel,
GLenum target,
+ gl_format format,
GLenum base_format,
GLenum internal_format,
GLuint first_level,
@@ -150,6 +152,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,
+ gl_format format,
GLenum internal_format,
struct intel_region *region,
GLuint depth0,
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index bc39f4a..b5084e8 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -115,6 +115,7 @@ intel_miptree_create_for_teximage(struct intel_context *intel,
return intel_miptree_create(intel,
intelObj->base.Target,
+ intelImage->base.TexFormat,
intelImage->base._BaseFormat,
intelImage->base.InternalFormat,
firstLevel,
@@ -692,7 +693,7 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
texFormat = MESA_FORMAT_ARGB8888;
}
- mt = intel_miptree_create_for_region(intel, target,
+ mt = intel_miptree_create_for_region(intel, target, texFormat,
internalFormat, rb->region, 1, 0);
if (mt == NULL)
return;
@@ -756,7 +757,7 @@ intel_image_target_texture_2d(struct gl_context *ctx, GLenum target,
if (image == NULL)
return;
- mt = intel_miptree_create_for_region(intel, target,
+ mt = intel_miptree_create_for_region(intel, target, image->format,
image->internal_format,
image->region, 1, 0);
if (mt == NULL)
diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c
index 27f2646..fea6162 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_validate.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c
@@ -135,6 +135,7 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
if (!intelObj->mt) {
intelObj->mt = intel_miptree_create(intel,
intelObj->base.Target,
+ firstImage->base.TexFormat,
firstImage->base._BaseFormat,
firstImage->base.InternalFormat,
tObj->BaseLevel,
--
1.7.5.3
More information about the mesa-dev
mailing list