|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
radeonTexObj *t = radeon_tex_obj(texObj); |
|
|
radeonTexObj *t = radeon_tex_obj(texObj); |
|
|
const struct gl_texture_image *firstImage; |
|
|
const struct gl_texture_image *firstImage; |
|
|
int firstlevel = t->mt ? t->mt->firstLevel : 0; |
|
|
|
|
|
GLuint uTexelPitch, row_align; |
|
|
GLuint uTexelPitch, row_align; |
|
|
|
|
|
|
|
|
if (rmesa->radeon.radeonScreen->driScreen->dri2.enabled && |
|
|
if (rmesa->radeon.radeonScreen->driScreen->dri2.enabled && |
|
|
|
|
|
|
|
|
t->bo) |
|
|
t->bo) |
|
|
return; |
|
|
return; |
|
|
|
|
|
|
|
|
firstImage = t->base.Image[0][firstlevel]; |
|
|
|
|
|
|
|
|
firstImage = t->base.Image[0][t->minLod]; |
|
|
|
|
|
|
|
|
if (!t->image_override) { |
|
|
if (!t->image_override) { |
|
|
if (!r600GetTexFormat(texObj, firstImage->TexFormat)) { |
|
|
if (!r600GetTexFormat(texObj, firstImage->TexFormat)) { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
row_align = rmesa->radeon.texture_row_align - 1; |
|
|
row_align = rmesa->radeon.texture_row_align - 1; |
|
|
uTexelPitch = ((firstImage->Width * t->mt->bpp + row_align) & ~row_align) / t->mt->bpp; |
|
|
|
|
|
|
|
|
uTexelPitch = (_mesa_format_row_stride(firstImage->TexFormat, firstImage->Width) + row_align) & ~row_align; |
|
|
|
|
|
uTexelPitch = uTexelPitch / _mesa_get_format_bytes(firstImage->TexFormat); |
|
|
uTexelPitch = (uTexelPitch + R700_TEXEL_PITCH_ALIGNMENT_MASK) |
|
|
uTexelPitch = (uTexelPitch + R700_TEXEL_PITCH_ALIGNMENT_MASK) |
|
|
& ~R700_TEXEL_PITCH_ALIGNMENT_MASK; |
|
|
& ~R700_TEXEL_PITCH_ALIGNMENT_MASK; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SETfield(t->SQ_TEX_RESOURCE1, firstImage->Height - 1, |
|
|
SETfield(t->SQ_TEX_RESOURCE1, firstImage->Height - 1, |
|
|
TEX_HEIGHT_shift, TEX_HEIGHT_mask); |
|
|
TEX_HEIGHT_shift, TEX_HEIGHT_mask); |
|
|
|
|
|
|
|
|
if ((t->mt->lastLevel - t->mt->firstLevel) > 0) { |
|
|
|
|
|
t->SQ_TEX_RESOURCE3 = t->mt->levels[0].size / 256; |
|
|
|
|
|
SETfield(t->SQ_TEX_RESOURCE4, t->mt->firstLevel, BASE_LEVEL_shift, BASE_LEVEL_mask); |
|
|
|
|
|
SETfield(t->SQ_TEX_RESOURCE5, t->mt->lastLevel, LAST_LEVEL_shift, LAST_LEVEL_mask); |
|
|
|
|
|
|
|
|
if ((t->maxLod - t->minLod) > 0) { |
|
|
|
|
|
t->SQ_TEX_RESOURCE3 = t->mt->levels[t->minLod].size / 256; |
|
|
|
|
|
SETfield(t->SQ_TEX_RESOURCE4, 0, BASE_LEVEL_shift, BASE_LEVEL_mask); |
|
|
|
|
|
SETfield(t->SQ_TEX_RESOURCE5, t->maxLod - t->minLod, LAST_LEVEL_shift, LAST_LEVEL_mask); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct gl_texture_object *tObj = |
|
|
struct gl_texture_object *tObj = |
|
|
_mesa_lookup_texture(rmesa->radeon.glCtx, texname); |
|
|
_mesa_lookup_texture(rmesa->radeon.glCtx, texname); |
|
|
radeonTexObjPtr t = radeon_tex_obj(tObj); |
|
|
radeonTexObjPtr t = radeon_tex_obj(tObj); |
|
|
int firstlevel = t->mt ? t->mt->firstLevel : 0; |
|
|
|
|
|
const struct gl_texture_image *firstImage; |
|
|
const struct gl_texture_image *firstImage; |
|
|
uint32_t pitch_val, size, row_align, bpp; |
|
|
|
|
|
|
|
|
uint32_t pitch_val, size, row_align; |
|
|
|
|
|
|
|
|
if (!tObj) |
|
|
if (!tObj) |
|
|
return; |
|
|
return; |
|
|
|
|
|
|
|
|
if (!offset) |
|
|
if (!offset) |
|
|
return; |
|
|
return; |
|
|
|
|
|
|
|
|
bpp = depth / 8; |
|
|
|
|
|
if (bpp == 3) |
|
|
|
|
|
bpp = 4; |
|
|
|
|
|
|
|
|
|
|
|
firstImage = t->base.Image[0][firstlevel]; |
|
|
|
|
|
|
|
|
firstImage = t->base.Image[0][t->minLod]; |
|
|
row_align = rmesa->radeon.texture_row_align - 1; |
|
|
row_align = rmesa->radeon.texture_row_align - 1; |
|
|
size = ((firstImage->Width * bpp + row_align) & ~row_align) * firstImage->Height; |
|
|
|
|
|
|
|
|
size = ((_mesa_format_row_stride(firstImage->TexFormat, firstImage->Width) + row_align) & ~row_align) * firstImage->Height; |
|
|
if (t->bo) { |
|
|
if (t->bo) { |
|
|
radeon_bo_unref(t->bo); |
|
|
radeon_bo_unref(t->bo); |
|
|
t->bo = NULL; |
|
|
t->bo = NULL; |
|
|
|
|
|
|
|
|
radeon_bo_unref(rImage->bo); |
|
|
radeon_bo_unref(rImage->bo); |
|
|
rImage->bo = NULL; |
|
|
rImage->bo = NULL; |
|
|
} |
|
|
} |
|
|
if (t->mt) { |
|
|
|
|
|
radeon_miptree_unreference(t->mt); |
|
|
|
|
|
t->mt = NULL; |
|
|
|
|
|
} |
|
|
|
|
|
if (rImage->mt) { |
|
|
|
|
|
radeon_miptree_unreference(rImage->mt); |
|
|
|
|
|
rImage->mt = NULL; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
radeon_miptree_unreference(&t->mt); |
|
|
|
|
|
radeon_miptree_unreference(&rImage->mt); |
|
|
|
|
|
|
|
|
_mesa_init_teximage_fields(radeon->glCtx, target, texImage, |
|
|
_mesa_init_teximage_fields(radeon->glCtx, target, texImage, |
|
|
rb->base.Width, rb->base.Height, 1, 0, rb->cpp); |
|
|
rb->base.Width, rb->base.Height, 1, 0, rb->cpp); |
|
|
texImage->RowStride = rb->pitch / rb->cpp; |
|
|
texImage->RowStride = rb->pitch / rb->cpp; |