This commit is contained in:
Maciej Cencora 2009-11-09 23:01:35 +01:00
parent 7255a5486d
commit cd5f167353
2 changed files with 25 additions and 9 deletions

View file

@ -424,10 +424,16 @@ GLboolean r300_blit(struct r300_context *r300,
unsigned dst_width,
unsigned dst_height)
{
assert(src_width == dst_width);
assert(src_height == dst_height);
//assert(src_width == dst_width);
//assert(src_height == dst_height);
if (0) {
if (src_bo == dst_bo) {
return GL_FALSE;
}
//return GL_FALSE;
if (1) {
fprintf(stderr, "src: width %d, height %d, pitch %d vs %d, format %s\n",
src_width, src_height, src_pitch,
_mesa_format_row_stride(src_mesaformat, src_width),
@ -441,6 +447,8 @@ GLboolean r300_blit(struct r300_context *r300,
if (!validate_buffers(r300, src_bo, dst_bo))
return GL_FALSE;
rcommonEnsureCmdBufSpace(&r300->radeon, 200, __FUNCTION__);
other_stuff(r300);
r300_emit_tx_setup(r300, src_mesaformat, src_bo, src_offset, src_width, src_height, src_pitch);
@ -463,6 +471,7 @@ GLboolean r300_blit(struct r300_context *r300,
r300EmitCacheFlush(r300);
radeonFlush(r300->radeon.glCtx);
//r300ResetHwState(r300);
return GL_TRUE;
}

View file

@ -57,29 +57,38 @@ do_copy_texsubimage(GLcontext *ctx,
rrb = radeon_get_colorbuffer(&r300->radeon);
}
if (!timg->mt) {
radeon_validate_texture_miptree(ctx, &tobj->base);
}
assert(rrb && rrb->bo);
assert(timg->mt && timg->mt->bo);
assert(timg->mt->bo);
assert(timg->base.Width >= dstx + width);
assert(timg->base.Height >= dsty + height);
assert(tobj->mt == timg->mt);
//assert(tobj->mt == timg->mt);
intptr_t src_offset = rrb->draw_offset + x * rrb->cpp + y * rrb->pitch;
intptr_t dst_offset = radeon_miptree_image_offset(timg->mt, _mesa_tex_target_to_face(target), level);
dst_offset += dstx * _mesa_get_format_bytes(timg->base.TexFormat) +
dsty * _mesa_format_row_stride(timg->base.TexFormat, timg->base.Width);
if (0) {
if (src_offset % 32 || dst_offset % 32) {
return GL_FALSE;
}
if (1) {
fprintf(stderr, "%s: copying to face %d, level %d\n",
__FUNCTION__, _mesa_tex_target_to_face(target), level);
fprintf(stderr, "to: x %d, y %d, offset %d\n", dstx, dsty, (uint32_t) dst_offset);
fprintf(stderr, "from (%dx%d) width %d, height %d, offset %d, pitch %d, width %d\n",
x, y, width, height, (uint32_t) src_offset, rrb->pitch, rrb->pitch/rrb->cpp);
fprintf(stderr, "src size %d, dst size %d\n", rrb->bo->size, timg->mt->bo->size);
}
/* blit from src buffer to texture */
return r300_blit(r300, rrb->bo, src_offset, rrb->base.Format, rrb->pitch,
width, height, timg->mt->bo, dst_offset,
rrb->base.Width, rrb->base.Height, timg->mt->bo ? timg->mt->bo : timg->bo, dst_offset,
timg->base.TexFormat, width, height);
}
@ -141,8 +150,6 @@ r300CopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
struct gl_texture_object *texObj = _mesa_select_tex_object(ctx, texUnit, target);
struct gl_texture_image *texImage = _mesa_select_tex_image(ctx, texObj, target, level);
assert(target == GL_TEXTURE_2D);
if (!do_copy_texsubimage(ctx, target, level,
radeon_tex_obj(texObj), (radeon_texture_image *)texImage,
xoffset, yoffset, x, y, width, height)) {