From 019c9ee2204723a9a041316e055e0602e514cad4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 31 Jul 2011 21:02:46 -0700 Subject: [PATCH] intel: Drop our custom glGetTexImage() code. The mesa core code uses MapTextureImage() like we need now. v2: Drop mapping around _mesa_generate_mipmap for compressed, since the whole path ends up going through MapTextureImage(), and the meta decompression code ended up causing us to lose track of the region that was originally mapped and assertion fail. --- src/mesa/drivers/dri/intel/intel_tex.c | 10 +++- src/mesa/drivers/dri/intel/intel_tex_image.c | 60 -------------------- 2 files changed, 7 insertions(+), 63 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c index 61e705c7d25..55b3e349b4c 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.c +++ b/src/mesa/drivers/dri/intel/intel_tex.c @@ -170,9 +170,13 @@ intelGenerateMipmap(struct gl_context *ctx, GLenum target, fallback_debug("%s - fallback to swrast\n", __FUNCTION__); - intel_tex_map_level_images(intel, intelObj, texObj->BaseLevel); - _mesa_generate_mipmap(ctx, target, texObj); - intel_tex_unmap_level_images(intel, intelObj, texObj->BaseLevel); + if (_mesa_is_format_compressed(first_image->TexFormat)) { + _mesa_generate_mipmap(ctx, target, texObj); + } else { + intel_tex_map_level_images(intel, intelObj, texObj->BaseLevel); + _mesa_generate_mipmap(ctx, target, texObj); + intel_tex_unmap_level_images(intel, intelObj, texObj->BaseLevel); + } if (!_mesa_is_format_compressed(first_image->TexFormat)) { GLuint nr_faces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1; diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 96717d31717..fb91e40a6d6 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -510,65 +510,6 @@ intelTexImage1D(struct gl_context * ctx, format, type, pixels, unpack, texObj, texImage, 0); } -static void -intelGetTexImage(struct gl_context * ctx, GLenum target, GLint level, - GLenum format, GLenum type, GLvoid * pixels, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage) -{ - struct intel_context *intel = intel_context(ctx); - struct intel_texture_image *intelImage = intel_texture_image(texImage); - - /* If we're reading from a texture that has been rendered to, need to - * make sure rendering is complete. - * We could probably predicate this on texObj->_RenderToTexture - */ - intel_flush(ctx); - - /* Map */ - if (intelImage->mt) { - /* Image is stored in hardware format in a buffer managed by the - * kernel. Need to explicitly map and unmap it. - */ - intelImage->base.Base.Data = - intel_miptree_image_map(intel, - intelImage->mt, - intelImage->base.Base.Face, - intelImage->base.Base.Level, - &intelImage->base.Base.RowStride, - intelImage->base.Base.ImageOffsets); - intelImage->base.Base.RowStride /= intelImage->mt->cpp; - } - else { - /* Otherwise, the image should actually be stored in - * intelImage->base.Base.Data. This is pretty confusing for - * everybody, I'd much prefer to separate the two functions of - * texImage->Data - storage for texture images in main memory - * and access (ie mappings) of images. In other words, we'd - * create a new texImage->Map field and leave Data simply for - * storage. - */ - assert(intelImage->base.Base.Data); - } - - if (intelImage->stencil_rb) { - /* - * The texture has packed depth/stencil format, but uses separate - * stencil. The texture's embedded stencil buffer contains the real - * stencil data, so copy that into the miptree. - */ - intel_tex_image_s8z24_gather(intel, intelImage); - } - - _mesa_get_teximage(ctx, target, level, format, type, pixels, - texObj, texImage); - - /* Unmap */ - if (intelImage->mt) { - intel_miptree_image_unmap(intel, intelImage->mt); - intelImage->base.Base.Data = NULL; - } -} /** * Binds a region to a texture image, like it was uploaded by glTexImage2D(). @@ -686,7 +627,6 @@ intelInitTextureImageFuncs(struct dd_function_table *functions) functions->TexImage1D = intelTexImage1D; functions->TexImage2D = intelTexImage2D; functions->TexImage3D = intelTexImage3D; - functions->GetTexImage = intelGetTexImage; #if FEATURE_OES_EGL_image functions->EGLImageTargetTexture2D = intel_image_target_texture_2d; -- 2.30.2