summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-10-25 18:06:18 -0600
committerBrian Paul <[email protected]>2009-10-25 18:06:24 -0600
commit11caea687e3f10ae12d33e44edf84635f73047dd (patch)
tree36e411b7d118f8033aaccb5a1d148e24bc89306a /src/mesa/main
parent355b5bde5056297f4f1636850449b91626958408 (diff)
mesa: choose texture format in core mesa, not drivers
Call the ctx->Driver.ChooseTextureFormat() function from core Mesa's _mesa_[Copy]TexImage functions instead of in the driver functions. One less thing for drivers to do.
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/teximage.c48
-rw-r--r--src/mesa/main/texstore.c16
2 files changed, 48 insertions, 16 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index bd5ad562580..2555934ecaf 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -2195,6 +2195,12 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
postConvWidth, 1, 1,
border, internalFormat);
+ /* Choose actual texture format */
+ texImage->TexFormat =
+ ctx->Driver.ChooseTextureFormat(ctx, internalFormat,
+ format, type);
+ ASSERT(texImage->TexFormat != MESA_FORMAT_NONE);
+
/* Give the texture to the driver. <pixels> may be null. */
ASSERT(ctx->Driver.TexImage1D);
ctx->Driver.TexImage1D(ctx, target, level, internalFormat,
@@ -2311,6 +2317,12 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
postConvWidth, postConvHeight, 1,
border, internalFormat);
+ /* Choose actual texture format */
+ texImage->TexFormat =
+ ctx->Driver.ChooseTextureFormat(ctx, internalFormat,
+ format, type);
+ ASSERT(texImage->TexFormat != MESA_FORMAT_NONE);
+
/* Give the texture to the driver. <pixels> may be null. */
ASSERT(ctx->Driver.TexImage2D);
ctx->Driver.TexImage2D(ctx, target, level, internalFormat,
@@ -2423,6 +2435,12 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat,
width, height, depth,
border, internalFormat);
+ /* Choose actual texture format */
+ texImage->TexFormat =
+ ctx->Driver.ChooseTextureFormat(ctx, internalFormat,
+ format, type);
+ ASSERT(texImage->TexFormat != MESA_FORMAT_NONE);
+
/* Give the texture to the driver. <pixels> may be null. */
ASSERT(ctx->Driver.TexImage3D);
ctx->Driver.TexImage3D(ctx, target, level, internalFormat,
@@ -2735,6 +2753,12 @@ _mesa_CopyTexImage1D( GLenum target, GLint level,
_mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1,
border, internalFormat);
+ /* Choose actual texture format */
+ texImage->TexFormat =
+ ctx->Driver.ChooseTextureFormat(ctx, internalFormat,
+ GL_NONE, GL_NONE);
+ ASSERT(texImage->TexFormat != MESA_FORMAT_NONE);
+
ASSERT(ctx->Driver.CopyTexImage1D);
ctx->Driver.CopyTexImage1D(ctx, target, level, internalFormat,
x, y, width, border);
@@ -2812,6 +2836,12 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
postConvWidth, postConvHeight, 1,
border, internalFormat);
+ /* Choose actual texture format */
+ texImage->TexFormat =
+ ctx->Driver.ChooseTextureFormat(ctx, internalFormat,
+ GL_NONE, GL_NONE);
+ ASSERT(texImage->TexFormat != MESA_FORMAT_NONE);
+
ASSERT(ctx->Driver.CopyTexImage2D);
ctx->Driver.CopyTexImage2D(ctx, target, level, internalFormat,
x, y, width, height, border);
@@ -3290,6 +3320,12 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
_mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1,
border, internalFormat);
+ /* Choose actual texture format */
+ texImage->TexFormat =
+ ctx->Driver.ChooseTextureFormat(ctx, internalFormat,
+ GL_NONE, GL_NONE);
+ ASSERT(texImage->TexFormat != MESA_FORMAT_NONE);
+
ASSERT(ctx->Driver.CompressedTexImage1D);
ctx->Driver.CompressedTexImage1D(ctx, target, level,
internalFormat, width, border,
@@ -3396,6 +3432,12 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
_mesa_init_teximage_fields(ctx, target, texImage, width, height, 1,
border, internalFormat);
+ /* Choose actual texture format */
+ texImage->TexFormat =
+ ctx->Driver.ChooseTextureFormat(ctx, internalFormat,
+ GL_NONE, GL_NONE);
+ ASSERT(texImage->TexFormat != MESA_FORMAT_NONE);
+
ASSERT(ctx->Driver.CompressedTexImage2D);
ctx->Driver.CompressedTexImage2D(ctx, target, level,
internalFormat, width, height,
@@ -3501,6 +3543,12 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level,
width, height, depth,
border, internalFormat);
+ /* Choose actual texture format */
+ texImage->TexFormat =
+ ctx->Driver.ChooseTextureFormat(ctx, internalFormat,
+ GL_NONE, GL_NONE);
+ ASSERT(texImage->TexFormat != MESA_FORMAT_NONE);
+
ASSERT(ctx->Driver.CompressedTexImage3D);
ctx->Driver.CompressedTexImage3D(ctx, target, level,
internalFormat,
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index dd146254b4a..692923ba0a6 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -3250,10 +3250,6 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
GLuint sizeInBytes;
(void) border;
- texImage->TexFormat
- = ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type);
- ASSERT(texImage->TexFormat);
-
/* allocate memory */
sizeInBytes = texture_size(texImage);
texImage->Data = _mesa_alloc_texmemory(sizeInBytes);
@@ -3311,10 +3307,6 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
GLuint sizeInBytes;
(void) border;
- texImage->TexFormat
- = ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type);
- ASSERT(texImage->TexFormat);
-
/* allocate memory */
sizeInBytes = texture_size(texImage);
texImage->Data = _mesa_alloc_texmemory(sizeInBytes);
@@ -3368,10 +3360,6 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level,
GLuint sizeInBytes;
(void) border;
- texImage->TexFormat
- = ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type);
- ASSERT(texImage->TexFormat);
-
/* allocate memory */
sizeInBytes = texture_size(texImage);
texImage->Data = _mesa_alloc_texmemory(sizeInBytes);
@@ -3570,10 +3558,6 @@ _mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level,
ASSERT(texImage->Depth == 1);
ASSERT(texImage->Data == NULL); /* was freed in glCompressedTexImage2DARB */
- texImage->TexFormat
- = ctx->Driver.ChooseTextureFormat(ctx, internalFormat, 0, 0);
- ASSERT(texImage->TexFormat);
-
/* allocate storage */
texImage->Data = _mesa_alloc_texmemory(imageSize);
if (!texImage->Data) {