summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-09-28 21:52:23 -0600
committerBrian Paul <[email protected]>2009-09-28 21:52:23 -0600
commit6480210b89dc8ae0990c450d27870c7b7930f251 (patch)
tree32331aac5345f589101f71dda4291c9618db54aa /src
parent49263e08561e3380115f9e09056190f67fcb1890 (diff)
st/mesa: use _mesa_texstore()
Diffstat (limited to 'src')
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c24
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c83
2 files changed, 47 insertions, 60 deletions
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index c56f987628c..6da57e817b8 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -392,8 +392,6 @@ make_texture(struct st_context *st,
GLboolean success;
GLubyte *dest;
const GLbitfield imageTransferStateSave = ctx->_ImageTransferState;
- const StoreTexImageFunc storeImage =
- _mesa_get_texstore_func(mformat->MesaFormat);
/* we'll do pixel transfer in a fragment shader */
ctx->_ImageTransferState = 0x0;
@@ -410,17 +408,17 @@ make_texture(struct st_context *st,
* Note that the image is actually going to be upside down in
* the texture. We deal with that with texcoords.
*/
- success = storeImage(ctx, 2, /* dims */
- baseFormat, /* baseInternalFormat */
- mformat, /* gl_texture_format */
- dest, /* dest */
- 0, 0, 0, /* dstX/Y/Zoffset */
- transfer->stride, /* dstRowStride, bytes */
- &dstImageOffsets, /* dstImageOffsets */
- width, height, 1, /* size */
- format, type, /* src format/type */
- pixels, /* data source */
- unpack);
+ success = _mesa_texstore(ctx, 2, /* dims */
+ baseFormat, /* baseInternalFormat */
+ mformat, /* gl_texture_format */
+ dest, /* dest */
+ 0, 0, 0, /* dstX/Y/Zoffset */
+ transfer->stride, /* dstRowStride, bytes */
+ &dstImageOffsets, /* dstImageOffsets */
+ width, height, 1, /* size */
+ format, type, /* src format/type */
+ pixels, /* data source */
+ unpack);
/* unmap */
screen->transfer_unmap(screen, transfer);
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 8bbffc3ff61..d96484c439e 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -417,7 +417,6 @@ compress_with_blit(GLcontext * ctx,
struct pipe_surface *dst_surface;
struct pipe_transfer *tex_xfer;
void *map;
- StoreTexImageFunc storeImage;
if (!stImage->pt) {
/* XXX: Can this happen? Should we assert? */
@@ -464,18 +463,15 @@ compress_with_blit(GLcontext * ctx,
0, 0, width, height); /* x, y, w, h */
map = screen->transfer_map(screen, tex_xfer);
- storeImage = _mesa_get_texstore_func(mesa_format->MesaFormat);
-
-
- storeImage(ctx, 2, GL_RGBA, mesa_format,
- map, /* dest ptr */
- 0, 0, 0, /* dest x/y/z offset */
- tex_xfer->stride, /* dest row stride (bytes) */
- dstImageOffsets, /* image offsets (for 3D only) */
- width, height, 1, /* size */
- format, type, /* source format/type */
- pixels, /* source data */
- unpack); /* source data packing */
+ _mesa_texstore(ctx, 2, GL_RGBA, mesa_format,
+ map, /* dest ptr */
+ 0, 0, 0, /* dest x/y/z offset */
+ tex_xfer->stride, /* dest row stride (bytes) */
+ dstImageOffsets, /* image offsets (for 3D only) */
+ width, height, 1, /* size */
+ format, type, /* source format/type */
+ pixels, /* source data */
+ unpack); /* source data packing */
screen->transfer_unmap(screen, tex_xfer);
screen->tex_transfer_destroy(tex_xfer);
@@ -737,19 +733,17 @@ st_TexImage(GLcontext * ctx,
_mesa_image_image_stride(unpack, width, height, format, type);
GLint i;
const GLubyte *src = (const GLubyte *) pixels;
- StoreTexImageFunc storeImage =
- _mesa_get_texstore_func(texImage->TexFormat->MesaFormat);
for (i = 0; i < depth; i++) {
- if (!storeImage(ctx, dims,
- texImage->_BaseFormat,
- texImage->TexFormat,
- texImage->Data,
- 0, 0, 0, /* dstX/Y/Zoffset */
- dstRowStride,
- texImage->ImageOffsets,
- width, height, 1,
- format, type, src, unpack)) {
+ if (!_mesa_texstore(ctx, dims,
+ texImage->_BaseFormat,
+ texImage->TexFormat,
+ texImage->Data,
+ 0, 0, 0, /* dstX/Y/Zoffset */
+ dstRowStride,
+ texImage->ImageOffsets,
+ width, height, 1,
+ format, type, src, unpack)) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage");
}
@@ -1056,9 +1050,6 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
const GLubyte *src;
/* init to silence warning only: */
enum pipe_transfer_usage transfer_usage = PIPE_TRANSFER_WRITE;
- StoreTexImageFunc storeImage =
- _mesa_get_texstore_func(texImage->TexFormat->MesaFormat);
-
DBG("%s target %s level %d offset %d,%d %dx%d\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(target),
@@ -1115,14 +1106,14 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
dstRowStride = stImage->transfer->stride;
for (i = 0; i < depth; i++) {
- if (!storeImage(ctx, dims, texImage->_BaseFormat,
- texImage->TexFormat,
- texImage->Data,
- 0, 0, 0,
- dstRowStride,
- texImage->ImageOffsets,
- width, height, 1,
- format, type, src, packing)) {
+ if (!_mesa_texstore(ctx, dims, texImage->_BaseFormat,
+ texImage->TexFormat,
+ texImage->Data,
+ 0, 0, 0,
+ dstRowStride,
+ texImage->ImageOffsets,
+ width, height, 1,
+ format, type, src, packing)) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage");
}
@@ -1361,8 +1352,6 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level,
const GLint dstRowStride = stImage->transfer->stride;
struct gl_texture_image *texImage = &stImage->base;
struct gl_pixelstore_attrib unpack = ctx->DefaultPacking;
- StoreTexImageFunc storeImage =
- _mesa_get_texstore_func(texImage->TexFormat->MesaFormat);
if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
unpack.Invert = GL_TRUE;
@@ -1380,16 +1369,16 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level,
* is actually RGBA but the user created the texture as GL_RGB we
* need to fill-in/override the alpha channel with 1.0.
*/
- storeImage(ctx, dims,
- texImage->_BaseFormat,
- texImage->TexFormat,
- texDest,
- 0, 0, 0,
- dstRowStride,
- texImage->ImageOffsets,
- width, height, 1,
- GL_RGBA, GL_FLOAT, tempSrc, /* src */
- &unpack);
+ _mesa_texstore(ctx, dims,
+ texImage->_BaseFormat,
+ texImage->TexFormat,
+ texDest,
+ 0, 0, 0,
+ dstRowStride,
+ texImage->ImageOffsets,
+ width, height, 1,
+ GL_RGBA, GL_FLOAT, tempSrc, /* src */
+ &unpack);
}
else {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage");