diff options
Diffstat (limited to 'src/mesa/drivers/dri/intel/intel_tex_image.c')
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_image.c | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 35f3d7d382..41cdbfd2cb 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -66,7 +66,6 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel, GLuint width = intelImage->base.Width; GLuint height = intelImage->base.Height; GLuint depth = intelImage->base.Depth; - GLuint l2width, l2height, l2depth; GLuint i, comp_byte = 0; GLuint texelBytes; @@ -114,10 +113,7 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel, lastLevel = firstLevel; } else { - l2width = logbase2(width); - l2height = logbase2(height); - l2depth = logbase2(depth); - lastLevel = firstLevel + MAX2(MAX2(l2width, l2height), l2depth); + lastLevel = firstLevel + logbase2(MAX2(MAX2(width, height), depth)); } assert(!intelObj->mt); @@ -347,21 +343,6 @@ intelTexImage(struct gl_context * ctx, texImage->Data = NULL; } - /* If this is the only texture image in the tree, could call - * bmBufferData with NULL data to free the old block and avoid - * waiting on any outstanding fences. - */ - if (intelObj->mt && - intelObj->mt->first_level == level && - intelObj->mt->last_level == level && - intelObj->mt->target != GL_TEXTURE_CUBE_MAP_ARB && - !intel_miptree_match_image(intelObj->mt, &intelImage->base)) { - - DBG("release it\n"); - intel_miptree_release(intel, &intelObj->mt); - assert(!intelObj->mt); - } - if (!intelObj->mt) { guess_and_alloc_mipmap_tree(intel, intelObj, intelImage, pixels == NULL); if (!intelObj->mt) { @@ -701,6 +682,7 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, struct gl_texture_object *texObj; struct gl_texture_image *texImage; int level = 0, internalFormat; + gl_format texFormat; texObj = _mesa_get_current_tex_object(ctx, target); intelObj = intel_texture_object(texObj); @@ -719,10 +701,14 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, if (rb->region == NULL) return; - if (texture_format == __DRI_TEXTURE_FORMAT_RGB) + if (texture_format == __DRI_TEXTURE_FORMAT_RGB) { internalFormat = GL_RGB; - else + texFormat = MESA_FORMAT_XRGB8888; + } + else { internalFormat = GL_RGBA; + texFormat = MESA_FORMAT_ARGB8888; + } mt = intel_miptree_create_for_region(intel, target, internalFormat, @@ -743,16 +729,13 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, intel_miptree_release(intel, &intelObj->mt); intelObj->mt = mt; + _mesa_init_teximage_fields(&intel->ctx, target, texImage, rb->region->width, rb->region->height, 1, - 0, internalFormat); + 0, internalFormat, texFormat); intelImage->face = target_to_face(target); intelImage->level = level; - if (texture_format == __DRI_TEXTURE_FORMAT_RGB) - texImage->TexFormat = MESA_FORMAT_XRGB8888; - else - texImage->TexFormat = MESA_FORMAT_ARGB8888; texImage->RowStride = rb->region->pitch; intel_miptree_reference(&intelImage->mt, intelObj->mt); @@ -808,11 +791,10 @@ intel_image_target_texture_2d(struct gl_context *ctx, GLenum target, intelObj->mt = mt; _mesa_init_teximage_fields(&intel->ctx, target, texImage, image->region->width, image->region->height, 1, - 0, image->internal_format); + 0, image->internal_format, image->format); intelImage->face = target_to_face(target); intelImage->level = 0; - texImage->TexFormat = image->format; texImage->RowStride = image->region->pitch; intel_miptree_reference(&intelImage->mt, intelObj->mt); |