summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-09-27 18:38:50 -0600
committerBrian Paul <[email protected]>2009-09-27 18:38:50 -0600
commitf782f90c45fc9a483483ebd36c1971ecd0c7988d (patch)
tree0c60ae3de0da87810b413ae1d13ea5df8c5e9a0f /src
parentd73cd703161dab3f2a6890bbe62d92fd548c1ed6 (diff)
mesa: use _mesa_get_texstore_func()
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_image.c20
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_subimage.c19
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texture.c9
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_tex.c73
-rw-r--r--src/mesa/drivers/dri/unichrome/via_tex.c23
5 files changed, 87 insertions, 57 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index 66201b1f465..aa363906892 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -8,6 +8,7 @@
#include "main/context.h"
#include "main/texcompress.h"
#include "main/texformat.h"
+#include "main/texstore.h"
#include "main/texgetimage.h"
#include "main/texobj.h"
#include "main/texstore.h"
@@ -513,6 +514,9 @@ 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;
@@ -525,14 +529,14 @@ intelTexImage(GLcontext * ctx,
0, 0);
} else
memcpy(texImage->Data, pixels, imageSize);
- } else if (!texImage->TexFormat->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)) {
+ } 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");
}
}
diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
index 751ec2c98c2..f75d2ae004b 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
@@ -109,14 +109,17 @@ intelTexSubimage(GLcontext * ctx,
memcpy(texImage->Data, pixels, imageSize);
}
else {
- if (!texImage->TexFormat->StoreImage(ctx, dims, texImage->_BaseFormat,
- texImage->TexFormat,
- texImage->Data,
- xoffset, yoffset, zoffset,
- dstRowStride,
- texImage->ImageOffsets,
- width, height, depth,
- format, type, pixels, packing)) {
+ 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)) {
_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 049284ef8c5..4a221314861 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -624,6 +624,8 @@ 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];
@@ -646,7 +648,7 @@ static void radeon_teximage(
dstImageOffsets = texImage->ImageOffsets;
}
- if (!texImage->TexFormat->StoreImage(ctx, dims,
+ if (!storeImage(ctx, dims,
texImage->_BaseFormat,
texImage->TexFormat,
texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */
@@ -778,7 +780,10 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int leve
copy_rows(img_start, dstRowStride, pixels, srcRowStride, rows, bytesPerRow);
} else {
- if (!texImage->TexFormat->StoreImage(ctx, dims, texImage->_BaseFormat,
+ StoreTexImageFunc storeImage =
+ _mesa_get_texstore_func(texImage->TexFormat->MesaFormat);
+
+ if (!storeImage(ctx, dims, texImage->_BaseFormat,
texImage->TexFormat, texImage->Data,
xoffset, yoffset, zoffset,
dstRowStride,
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c
index f6a48b3ae12..91650088b98 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c
@@ -138,9 +138,12 @@ _mesa_halve2x2_teximage2d ( GLcontext *ctx,
}
if (bpt) {
+ StoreTexImageFunc storeImage =
+ _mesa_get_texstore_func(texImage->TexFormat->MesaFormat);
+
src = _s;
dst = _d;
- texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat,
+ storeImage(ctx, 2, texImage->_BaseFormat,
texImage->TexFormat, dstImage,
0, 0, 0, /* dstX/Y/Zoffset */
dstWidth * bpt,
@@ -1228,18 +1231,21 @@ 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;
}
- texImage->TexFormat->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);
+ 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);
/* now rescale */
/* compute address of dest subimage within the overal tex image */
@@ -1256,6 +1262,9 @@ 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;
}
@@ -1278,13 +1287,13 @@ adjust2DRatio (GLcontext *ctx,
width, height, /* src */
newWidth, newHeight, /* dst */
rawImage /*src*/, tempImage /*dst*/ );
- texImage->TexFormat->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);
+ 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);
FREE(rawImage);
}
@@ -1437,13 +1446,16 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level,
else {
/* no rescaling needed */
/* unpack image, apply transfer ops and store in texImage->Data */
- texImage->TexFormat->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);
+ 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);
}
}
@@ -1507,13 +1519,16 @@ tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
}
else {
/* no rescaling needed */
- texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat,
- texImage->TexFormat, texImage->Data,
- xoffset, yoffset, 0,
- dstRowStride,
- texImage->ImageOffsets,
- width, height, 1,
- format, type, pixels, packing);
+ 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);
}
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 54073e76918..388fd9392cf 100644
--- a/src/mesa/drivers/dri/unichrome/via_tex.c
+++ b/src/mesa/drivers/dri/unichrome/via_tex.c
@@ -797,22 +797,25 @@ 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);
}
else {
dstRowStride = postConvWidth * texImage->TexFormat->TexelBytes;
}
- ASSERT(texImage->TexFormat->StoreImage);
- success = texImage->TexFormat->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);
+ 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);
if (!success) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage");
}