diff options
Diffstat (limited to 'src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c')
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index 05daf1cec43..23af9aca6ce 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | |||
@@ -185,9 +185,9 @@ static void calculate_miptree_layout(radeonContextPtr rmesa, radeon_mipmap_tree | |||
185 | /** | 185 | /** |
186 | * Create a new mipmap tree, calculate its layout and allocate memory. | 186 | * Create a new mipmap tree, calculate its layout and allocate memory. |
187 | */ | 187 | */ |
188 | static radeon_mipmap_tree* radeon_miptree_create(radeonContextPtr rmesa, | 188 | radeon_mipmap_tree* radeon_miptree_create(radeonContextPtr rmesa, |
189 | GLenum target, gl_format mesaFormat, GLuint baseLevel, GLuint numLevels, | 189 | GLenum target, gl_format mesaFormat, GLuint baseLevel, GLuint numLevels, |
190 | GLuint width0, GLuint height0, GLuint depth0, GLuint tilebits) | 190 | GLuint width0, GLuint height0, GLuint depth0, GLuint tilebits) |
191 | { | 191 | { |
192 | radeon_mipmap_tree *mt = CALLOC_STRUCT(_radeon_mipmap_tree); | 192 | radeon_mipmap_tree *mt = CALLOC_STRUCT(_radeon_mipmap_tree); |
193 | 193 | ||
@@ -298,13 +298,10 @@ static void calculate_min_max_lod(struct gl_texture_object *tObj, | |||
298 | * given face and level. | 298 | * given face and level. |
299 | */ | 299 | */ |
300 | GLboolean radeon_miptree_matches_image(radeon_mipmap_tree *mt, | 300 | GLboolean radeon_miptree_matches_image(radeon_mipmap_tree *mt, |
301 | struct gl_texture_image *texImage, GLuint face, GLuint level) | 301 | struct gl_texture_image *texImage) |
302 | { | 302 | { |
303 | radeon_mipmap_level *lvl; | 303 | radeon_mipmap_level *lvl; |
304 | 304 | GLuint level = texImage->Level; | |
305 | if (face >= mt->faces) | ||
306 | return GL_FALSE; | ||
307 | |||
308 | if (texImage->TexFormat != mt->mesaFormat) | 305 | if (texImage->TexFormat != mt->mesaFormat) |
309 | return GL_FALSE; | 306 | return GL_FALSE; |
310 | 307 | ||
@@ -332,7 +329,7 @@ static GLboolean radeon_miptree_matches_texture(radeon_mipmap_tree *mt, struct g | |||
332 | 329 | ||
333 | mtBaseLevel = &mt->levels[texObj->BaseLevel - mt->baseLevel]; | 330 | mtBaseLevel = &mt->levels[texObj->BaseLevel - mt->baseLevel]; |
334 | firstImage = texObj->Image[0][texObj->BaseLevel]; | 331 | firstImage = texObj->Image[0][texObj->BaseLevel]; |
335 | numLevels = MIN2(texObj->MaxLevel - texObj->BaseLevel + 1, firstImage->MaxLog2 + 1); | 332 | numLevels = MIN2(texObj->_MaxLevel - texObj->BaseLevel + 1, firstImage->MaxLog2 + 1); |
336 | 333 | ||
337 | if (radeon_is_debug_enabled(RADEON_TEXTURE,RADEON_TRACE)) { | 334 | if (radeon_is_debug_enabled(RADEON_TEXTURE,RADEON_TRACE)) { |
338 | fprintf(stderr, "Checking if miptree %p matches texObj %p\n", mt, texObj); | 335 | fprintf(stderr, "Checking if miptree %p matches texObj %p\n", mt, texObj); |
@@ -372,7 +369,6 @@ void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t) | |||
372 | struct gl_texture_object *texObj = &t->base; | 369 | struct gl_texture_object *texObj = &t->base; |
373 | struct gl_texture_image *texImg = texObj->Image[0][texObj->BaseLevel]; | 370 | struct gl_texture_image *texImg = texObj->Image[0][texObj->BaseLevel]; |
374 | GLuint numLevels; | 371 | GLuint numLevels; |
375 | |||
376 | assert(!t->mt); | 372 | assert(!t->mt); |
377 | 373 | ||
378 | if (!texImg) { | 374 | if (!texImg) { |
@@ -544,27 +540,19 @@ int radeon_validate_texture_miptree(struct gl_context * ctx, struct gl_texture_o | |||
544 | { | 540 | { |
545 | radeonContextPtr rmesa = RADEON_CONTEXT(ctx); | 541 | radeonContextPtr rmesa = RADEON_CONTEXT(ctx); |
546 | radeonTexObj *t = radeon_tex_obj(texObj); | 542 | radeonTexObj *t = radeon_tex_obj(texObj); |
543 | radeon_mipmap_tree *dst_miptree; | ||
547 | 544 | ||
548 | if (t->validated || t->image_override) { | 545 | if (t->validated || t->image_override) { |
549 | return GL_TRUE; | 546 | return GL_TRUE; |
550 | } | 547 | } |
551 | 548 | ||
552 | if (texObj->Image[0][texObj->BaseLevel]->Border > 0) | ||
553 | return GL_FALSE; | ||
554 | |||
555 | _mesa_test_texobj_completeness(rmesa->glCtx, texObj); | ||
556 | if (!texObj->_Complete) { | ||
557 | return GL_FALSE; | ||
558 | } | ||
559 | |||
560 | calculate_min_max_lod(&t->base, &t->minLod, &t->maxLod); | 549 | calculate_min_max_lod(&t->base, &t->minLod, &t->maxLod); |
561 | 550 | ||
562 | radeon_print(RADEON_TEXTURE, RADEON_NORMAL, | 551 | radeon_print(RADEON_TEXTURE, RADEON_NORMAL, |
563 | "%s: Validating texture %p now, minLod = %d, maxLod = %d\n", | 552 | "%s: Validating texture %p now, minLod = %d, maxLod = %d\n", |
564 | __FUNCTION__, texObj ,t->minLod, t->maxLod); | 553 | __FUNCTION__, texObj ,t->minLod, t->maxLod); |
565 | 554 | ||
566 | radeon_mipmap_tree *dst_miptree; | 555 | dst_miptree = get_biggest_matching_miptree(t, t->base.BaseLevel, t->base._MaxLevel); |
567 | dst_miptree = get_biggest_matching_miptree(t, t->base.BaseLevel, t->base.MaxLevel); | ||
568 | 556 | ||
569 | radeon_miptree_unreference(&t->mt); | 557 | radeon_miptree_unreference(&t->mt); |
570 | if (!dst_miptree) { | 558 | if (!dst_miptree) { |
@@ -591,7 +579,7 @@ int radeon_validate_texture_miptree(struct gl_context * ctx, struct gl_texture_o | |||
591 | "Checking image level %d, face %d, mt %p ... ", | 579 | "Checking image level %d, face %d, mt %p ... ", |
592 | level, face, img->mt); | 580 | level, face, img->mt); |
593 | 581 | ||
594 | if (img->mt != t->mt) { | 582 | if (img->mt != t->mt && !img->used_as_render_target) { |
595 | radeon_print(RADEON_TEXTURE, RADEON_TRACE, | 583 | radeon_print(RADEON_TEXTURE, RADEON_TRACE, |
596 | "MIGRATING\n"); | 584 | "MIGRATING\n"); |
597 | 585 | ||