diff options
author | Brian Paul <[email protected]> | 2011-10-23 10:44:47 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2011-10-23 10:44:47 -0600 |
commit | 68da4b50e9b6aa72a9b155f650952620063e1b94 (patch) | |
tree | 369f3d98b315e6a000f3d45ad96b006aebc310e0 /src/mesa/drivers | |
parent | 66681b4c8cb1ef16f42c1591298cb30c83bca09b (diff) |
mesa: add swrast_texture_image::Buffer
In the past, swrast_texture_image::Data has been overloaded. It could
either point to malloc'd memory storing texture data, or it could point
to a current mapping of GPU memory.
Now, Buffer always points to malloc'd memory (if we're not using GPU
memory) and Data always points to mapped memory. The next step would
be to rename Data -> Map.
This change also involves adding swrast functions for mapping textures
and renderbuffers prior to rendering to setup the Data pointer. Plus,
corresponding functions to unmap texures and renderbuffers. This is
very much like similar code in the dri drivers.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex.c | 10 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_texture.c | 14 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c index 0e82e136e5a..58066598beb 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.c +++ b/src/mesa/drivers/dri/intel/intel_tex.c @@ -134,9 +134,9 @@ intel_free_texture_image_buffer(struct gl_context * ctx, intel_miptree_release(&intelImage->mt); - if (intelImage->base.Data) { - _mesa_align_free(intelImage->base.Data); - intelImage->base.Data = NULL; + if (intelImage->base.Buffer) { + _mesa_align_free(intelImage->base.Buffer); + intelImage->base.Buffer = NULL; } if (intelImage->base.ImageOffsets) { @@ -214,11 +214,11 @@ intel_map_texture_image(struct gl_context *ctx, assert(map); *stride = _mesa_format_row_stride(tex_image->TexFormat, width); - *map = intel_image->base.Data + (slice * height + y) * *stride + x * texelSize; + *map = intel_image->base.Buffer + (slice * height + y) * *stride + x * texelSize; DBG("%s: %d,%d %dx%d from data %p = %p/%d\n", __FUNCTION__, x, y, w, h, - intel_image->base.Data, *map, *stride); + intel_image->base.Buffer, *map, *stride); } } diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index abe751053e6..4f8daa72e84 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -104,7 +104,7 @@ void radeonFreeTextureImageBuffer(struct gl_context *ctx, struct gl_texture_imag if (image->mt) { radeon_miptree_unreference(&image->mt); - assert(!image->base.Data); + assert(!image->base.Buffer); } else { _swrast_free_texture_image_buffer(ctx, timage); } @@ -112,9 +112,9 @@ void radeonFreeTextureImageBuffer(struct gl_context *ctx, struct gl_texture_imag radeon_bo_unref(image->bo); image->bo = NULL; } - if (image->base.Data) { - _mesa_align_free(image->base.Data); - image->base.Data = NULL; + if (image->base.Buffer) { + _mesa_align_free(image->base.Buffer); + image->base.Buffer = NULL; } if (image->base.ImageOffsets) { @@ -314,7 +314,7 @@ radeon_map_texture_image(struct gl_context *ctx, assert(map); *stride = _mesa_format_row_stride(texImage->TexFormat, width); - *map = image->base.Data + (slice * height) * *stride; + *map = image->base.Buffer + (slice * height) * *stride; } *map += y * *stride + x * texel_size; @@ -828,12 +828,12 @@ static void radeon_teximage( texImage->Width, texImage->Height, texImage->Depth); - image->base.Data = _mesa_align_malloc(size, 512); + image->base.Buffer = _mesa_align_malloc(size, 512); radeon_print(RADEON_TEXTURE, RADEON_VERBOSE, "%s %dd: texObj %p, texImage %p, " " no miptree assigned, using local memory %p\n", - __func__, dims, texObj, texImage, image->base.Data); + __func__, dims, texObj, texImage, image->base.Buffer); } } |