summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-09-27 17:01:41 -0600
committerBrian Paul <brianp@vmware.com>2009-09-27 17:01:41 -0600
commit722b76156486bbb03f8504e8f7a5db05b9257da5 (patch)
treea1f9294cd1390a01b378a79b94b6193fd306da89 /src
parent485105ed182e2e997b084f047e72d5a2c3460057 (diff)
mesa: use _mesa_get_texstore_func() to get texture image store func
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/texstore.c136
1 files changed, 82 insertions, 54 deletions
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 7f2e71585e..f457e08a5b 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -3501,15 +3501,19 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
else {
const GLint dstRowStride = 0;
GLboolean success;
- ASSERT(texImage->TexFormat->StoreImage);
- success = texImage->TexFormat->StoreImage(ctx, 1, texImage->_BaseFormat,
- texImage->TexFormat,
- texImage->Data,
- 0, 0, 0, /* dstX/Y/Zoffset */
- dstRowStride,
- texImage->ImageOffsets,
- width, 1, 1,
- format, type, pixels, packing);
+ const StoreTexImageFunc storeImage =
+ _mesa_get_texstore_func(texImage->TexFormat->MesaFormat);
+
+ ASSERT(storeImage);
+
+ success = storeImage(ctx, 1, texImage->_BaseFormat,
+ texImage->TexFormat,
+ texImage->Data,
+ 0, 0, 0, /* dstX/Y/Zoffset */
+ dstRowStride,
+ texImage->ImageOffsets,
+ width, 1, 1,
+ format, type, pixels, packing);
if (!success) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
}
@@ -3572,6 +3576,11 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
else {
GLint dstRowStride;
GLboolean success;
+ const StoreTexImageFunc storeImage =
+ _mesa_get_texstore_func(texImage->TexFormat->MesaFormat);
+
+ ASSERT(storeImage);
+
if (texImage->IsCompressed) {
dstRowStride
= _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width);
@@ -3579,15 +3588,15 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
else {
dstRowStride = texImage->RowStride * texImage->TexFormat->TexelBytes;
}
- ASSERT(texImage->TexFormat->StoreImage);
- success = 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);
+
+ success = 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);
if (!success) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
}
@@ -3646,6 +3655,11 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level,
else {
GLint dstRowStride;
GLboolean success;
+ const StoreTexImageFunc storeImage =
+ _mesa_get_texstore_func(texImage->TexFormat->MesaFormat);
+
+ ASSERT(storeImage);
+
if (texImage->IsCompressed) {
dstRowStride
= _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width);
@@ -3653,15 +3667,15 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level,
else {
dstRowStride = texImage->RowStride * texImage->TexFormat->TexelBytes;
}
- ASSERT(texImage->TexFormat->StoreImage);
- success = texImage->TexFormat->StoreImage(ctx, 3, texImage->_BaseFormat,
- texImage->TexFormat,
- texImage->Data,
- 0, 0, 0, /* dstX/Y/Zoffset */
- dstRowStride,
- texImage->ImageOffsets,
- width, height, depth,
- format, type, pixels, packing);
+
+ success = storeImage(ctx, 3, texImage->_BaseFormat,
+ texImage->TexFormat,
+ texImage->Data,
+ 0, 0, 0, /* dstX/Y/Zoffset */
+ dstRowStride,
+ texImage->ImageOffsets,
+ width, height, depth,
+ format, type, pixels, packing);
if (!success) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D");
}
@@ -3694,15 +3708,19 @@ _mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
{
const GLint dstRowStride = 0;
GLboolean success;
- ASSERT(texImage->TexFormat->StoreImage);
- success = texImage->TexFormat->StoreImage(ctx, 1, texImage->_BaseFormat,
- texImage->TexFormat,
- texImage->Data,
- xoffset, 0, 0, /* offsets */
- dstRowStride,
- texImage->ImageOffsets,
- width, 1, 1,
- format, type, pixels, packing);
+ const StoreTexImageFunc storeImage =
+ _mesa_get_texstore_func(texImage->TexFormat->MesaFormat);
+
+ ASSERT(storeImage);
+
+ success = storeImage(ctx, 1, texImage->_BaseFormat,
+ texImage->TexFormat,
+ texImage->Data,
+ xoffset, 0, 0, /* offsets */
+ dstRowStride,
+ texImage->ImageOffsets,
+ width, 1, 1,
+ format, type, pixels, packing);
if (!success) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage1D");
}
@@ -3735,6 +3753,11 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level,
{
GLint dstRowStride = 0;
GLboolean success;
+ const StoreTexImageFunc storeImage =
+ _mesa_get_texstore_func(texImage->TexFormat->MesaFormat);
+
+ ASSERT(storeImage);
+
if (texImage->IsCompressed) {
dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat,
texImage->Width);
@@ -3742,15 +3765,15 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level,
else {
dstRowStride = texImage->RowStride * texImage->TexFormat->TexelBytes;
}
- ASSERT(texImage->TexFormat->StoreImage);
- success = texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat,
- texImage->TexFormat,
- texImage->Data,
- xoffset, yoffset, 0,
- dstRowStride,
- texImage->ImageOffsets,
- width, height, 1,
- format, type, pixels, packing);
+
+ success = storeImage(ctx, 2, texImage->_BaseFormat,
+ texImage->TexFormat,
+ texImage->Data,
+ xoffset, yoffset, 0,
+ dstRowStride,
+ texImage->ImageOffsets,
+ width, height, 1,
+ format, type, pixels, packing);
if (!success) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage2D");
}
@@ -3783,6 +3806,11 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level,
{
GLint dstRowStride;
GLboolean success;
+ const StoreTexImageFunc storeImage =
+ _mesa_get_texstore_func(texImage->TexFormat->MesaFormat);
+
+ ASSERT(storeImage);
+
if (texImage->IsCompressed) {
dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat,
texImage->Width);
@@ -3790,15 +3818,15 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level,
else {
dstRowStride = texImage->RowStride * texImage->TexFormat->TexelBytes;
}
- ASSERT(texImage->TexFormat->StoreImage);
- success = texImage->TexFormat->StoreImage(ctx, 3, texImage->_BaseFormat,
- texImage->TexFormat,
- texImage->Data,
- xoffset, yoffset, zoffset,
- dstRowStride,
- texImage->ImageOffsets,
- width, height, depth,
- format, type, pixels, packing);
+
+ success = storeImage(ctx, 3, texImage->_BaseFormat,
+ texImage->TexFormat,
+ texImage->Data,
+ xoffset, yoffset, zoffset,
+ dstRowStride,
+ texImage->ImageOffsets,
+ width, height, depth,
+ format, type, pixels, packing);
if (!success) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage3D");
}