diff options
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_image.c | 26 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_subimage.c | 23 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_texture.c | 40 | ||||
-rw-r--r-- | src/mesa/drivers/dri/tdfx/tdfx_tex.c | 83 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_tex.c | 21 |
5 files changed, 87 insertions, 106 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index a9f031a3cb..0e13f600a6 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -518,9 +518,6 @@ intelTexImage(GLcontext * ctx, * conversion and copy: */ if (pixels) { - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); - if (compressed) { if (intelImage->mt) { struct intel_region *dst = intelImage->mt->region; @@ -531,17 +528,20 @@ intelTexImage(GLcontext * ctx, pixels, srcRowStride, 0, 0); - } else + } + else { memcpy(texImage->Data, pixels, imageSize); - } else if (!storeImage(ctx, dims, - texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - texImage->ImageOffsets, - width, height, depth, - format, type, pixels, unpack)) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); + } + } + else if (!_mesa_texstore(ctx, dims, + texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + texImage->ImageOffsets, + width, height, depth, + format, type, pixels, unpack)) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); } } diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c index c8de38bc72..ad5c2271a1 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c +++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c @@ -105,21 +105,20 @@ intelTexSubimage(GLcontext * ctx, xoffset, yoffset / 4, (width + 3) & ~3, (height + 3) / 4, pixels, (width + 3) & ~3, 0, 0); - } else + } + else { memcpy(texImage->Data, pixels, imageSize); + } } else { - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); - - if (!storeImage(ctx, dims, texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - xoffset, yoffset, zoffset, - dstRowStride, - texImage->ImageOffsets, - width, height, depth, - format, type, pixels, packing)) { + if (!_mesa_texstore(ctx, dims, texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + xoffset, yoffset, zoffset, + dstRowStride, + texImage->ImageOffsets, + width, height, depth, + format, type, pixels, packing)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "intelTexSubImage"); } } diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 416ca1974b..3ff8cad93e 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -624,8 +624,6 @@ static void radeon_teximage( } else { GLuint dstRowStride; GLuint *dstImageOffsets; - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); if (image->mt) { radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel]; @@ -648,15 +646,16 @@ static void radeon_teximage( dstImageOffsets = texImage->ImageOffsets; } - if (!storeImage(ctx, dims, - texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - dstImageOffsets, - width, height, depth, - format, type, pixels, packing)) + if (!_mesa_texstore(ctx, dims, + texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + dstImageOffsets, + width, height, depth, + format, type, pixels, packing)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); + } if (dims == 3) _mesa_free(dstImageOffsets); @@ -779,18 +778,17 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int leve copy_rows(img_start, dstRowStride, pixels, srcRowStride, rows, bytesPerRow); - } else { - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); - - if (!storeImage(ctx, dims, texImage->_BaseFormat, - texImage->TexFormat, texImage->Data, - xoffset, yoffset, zoffset, - dstRowStride, - texImage->ImageOffsets, - width, height, depth, - format, type, pixels, packing)) + } + else { + if (!_mesa_texstore(ctx, dims, texImage->_BaseFormat, + texImage->TexFormat, texImage->Data, + xoffset, yoffset, zoffset, + dstRowStride, + texImage->ImageOffsets, + width, height, depth, + format, type, pixels, packing)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage"); + } } } diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c index e87ee9eba2..84fe6984de 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c @@ -138,18 +138,15 @@ _mesa_halve2x2_teximage2d ( GLcontext *ctx, } if (bpt) { - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); - src = _s; dst = _d; - storeImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, dstImage, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstWidth * bpt, - &dstImageOffsets, - dstWidth, dstHeight, 1, - GL_BGRA, CHAN_TYPE, dst, &ctx->DefaultPacking); + _mesa_texstore(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, dstImage, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstWidth * bpt, + &dstImageOffsets, + dstWidth, dstHeight, 1, + GL_BGRA, CHAN_TYPE, dst, &ctx->DefaultPacking); FREE(dst); FREE(src); } @@ -1231,21 +1228,19 @@ adjust2DRatio (GLcontext *ctx, if (!texImage->IsCompressed) { GLubyte *destAddr; - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); tempImage = MALLOC(width * height * texelBytes); if (!tempImage) { return GL_FALSE; } - storeImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, tempImage, - 0, 0, 0, /* dstX/Y/Zoffset */ - width * texelBytes, /* dstRowStride */ - &dstImageOffsets, - width, height, 1, - format, type, pixels, packing); + _mesa_texstore(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, tempImage, + 0, 0, 0, /* dstX/Y/Zoffset */ + width * texelBytes, /* dstRowStride */ + &dstImageOffsets, + width, height, 1, + format, type, pixels, packing); /* now rescale */ /* compute address of dest subimage within the overal tex image */ @@ -1262,8 +1257,6 @@ adjust2DRatio (GLcontext *ctx, } else { const GLint rawBytes = 4; GLvoid *rawImage = MALLOC(width * height * rawBytes); - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); if (!rawImage) { return GL_FALSE; @@ -1287,13 +1280,13 @@ adjust2DRatio (GLcontext *ctx, width, height, /* src */ newWidth, newHeight, /* dst */ rawImage /*src*/, tempImage /*dst*/ ); - storeImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, texImage->Data, - xoffset * mml->wScale, yoffset * mml->hScale, 0, /* dstX/Y/Zoffset */ - dstRowStride, - &dstImageOffsets, - newWidth, newHeight, 1, - GL_RGBA, CHAN_TYPE, tempImage, &ctx->DefaultPacking); + _mesa_texstore(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, texImage->Data, + xoffset * mml->wScale, yoffset * mml->hScale, 0, /* dstX/Y/Zoffset */ + dstRowStride, + &dstImageOffsets, + newWidth, newHeight, 1, + GL_RGBA, CHAN_TYPE, tempImage, &ctx->DefaultPacking); FREE(rawImage); } @@ -1446,16 +1439,13 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level, else { /* no rescaling needed */ /* unpack image, apply transfer ops and store in texImage->Data */ - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); - - storeImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, texImage->Data, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - texImage->ImageOffsets, - width, height, 1, - format, type, pixels, packing); + _mesa_texstore(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, texImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + texImage->ImageOffsets, + width, height, 1, + format, type, pixels, packing); } } @@ -1519,16 +1509,13 @@ tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, } else { /* no rescaling needed */ - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); - - storeImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, texImage->Data, - xoffset, yoffset, 0, - dstRowStride, - texImage->ImageOffsets, - width, height, 1, - format, type, pixels, packing); + _mesa_texstore(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, texImage->Data, + xoffset, yoffset, 0, + dstRowStride, + texImage->ImageOffsets, + width, height, 1, + format, type, pixels, packing); } ti->reloadImages = GL_TRUE; /* signal the image needs to be reloaded */ diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index 02a0043bbe..f700994025 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -792,8 +792,6 @@ static void viaTexImage(GLcontext *ctx, else { GLint dstRowStride; GLboolean success; - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); if (texImage->IsCompressed) { dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); @@ -801,16 +799,15 @@ static void viaTexImage(GLcontext *ctx, else { dstRowStride = postConvWidth * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); } - ASSERT(storeImage); - success = storeImage(ctx, dims, - texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - texImage->ImageOffsets, - width, height, 1, - format, type, pixels, packing); + success = _mesa_texstore(ctx, dims, + texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + texImage->ImageOffsets, + width, height, 1, + format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); } |