diff options
author | Brian Paul <brianp@vmware.com> | 2009-11-18 18:06:03 -0700 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2009-11-18 18:06:03 -0700 |
commit | 9eccdfc7d5a10a8e2942c55b00d08efb9406c29a (patch) | |
tree | dea6c49ef926ab04f62f3d520001d128b317246c | |
parent | 7c8b8d4ee90249e25ecbd39842a1868473be419b (diff) |
intel: simplify image mapping/unmapping in intelTexSubImage()
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_subimage.c | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c index 9653d069c8..b7d2af1691 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c +++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c @@ -54,7 +54,6 @@ intelTexSubimage(GLcontext * ctx, { struct intel_context *intel = intel_context(ctx); struct intel_texture_image *intelImage = intel_texture_image(texImage); - GLuint dstRowStride = 0; DBG("%s target %s level %d offset %d,%d %dx%d\n", __FUNCTION__, _mesa_lookup_enum_by_nr(target), @@ -71,26 +70,16 @@ intelTexSubimage(GLcontext * ctx, /* Map buffer if necessary. Need to lock to prevent other contexts * from uploading the buffer under us. */ - if (intelImage->mt) - texImage->Map.Data = intel_miptree_image_map(intel, - intelImage->mt, - intelImage->face, - intelImage->level, - &dstRowStride, - texImage->Map.ImageOffsets); + if (intelImage->mt) { + intel_tex_map_level_image(intel, intelImage); + } else { - if (_mesa_is_format_compressed(texImage->TexFormat)) { - dstRowStride = - _mesa_format_row_stride(texImage->TexFormat, width); - assert(dims != 3); - } - else { - dstRowStride = texImage->Map.RowStride * _mesa_get_format_bytes(texImage->TexFormat); - } + /* XXX we'll add a "map texture image" call here */ + texImage->Map.RowStride = + _mesa_format_row_stride(texImage->TexFormat, width) + / intelImage->mt->cpp; } - assert(dstRowStride); - if (compressed) { if (intelImage->mt) { struct intel_region *dst = intelImage->mt->region; @@ -109,7 +98,7 @@ intelTexSubimage(GLcontext * ctx, texImage->TexFormat, texImage->Map.Data, xoffset, yoffset, zoffset, - dstRowStride, + texImage->Map.RowStride * intelImage->mt->cpp, texImage->Map.ImageOffsets, width, height, depth, format, type, pixels, packing)) { @@ -119,10 +108,7 @@ intelTexSubimage(GLcontext * ctx, _mesa_unmap_pbo_source(ctx, packing); - if (intelImage->mt) { - intel_miptree_image_unmap(intel, intelImage->mt); - texImage->Map.Data = NULL; - } + intel_tex_unmap_level_image(intel, intelImage); UNLOCK_HARDWARE(intel); } |