aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-08-24 08:31:37 -0600
committerBrian Paul <[email protected]>2012-08-24 14:08:57 -0600
commitd47a6ada9ca9670c60fc141fabadf40c63031c08 (patch)
treef39bc5068fec91606b1e03c7c602a864c1e89762 /src/mesa/main
parentba7218061b6a6c09d5d20f12de6267673276e094 (diff)
mesa: add texture target field to ChooseTextureFormat() driver hook
This will let us choose the actual hardware format depending on the type of texture. v2: fixup radeon, nouveau, intel and swrast drivers too Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/dd.h11
-rw-r--r--src/mesa/main/texformat.c4
-rw-r--r--src/mesa/main/texformat.h4
-rw-r--r--src/mesa/main/teximage.c5
-rw-r--r--src/mesa/main/texobj.c3
5 files changed, 16 insertions, 11 deletions
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 226897b1915..a91e8083f21 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -189,12 +189,15 @@ struct dd_function_table {
/*@{*/
/**
- * Choose actual hardware texture format given the user-provided source
- * image format and type and the desired internal format. In some
- * cases, srcFormat and srcType can be GL_NONE.
+ * Choose actual hardware texture format given the texture target, the
+ * user-provided source image format and type and the desired internal
+ * format. In some cases, srcFormat and srcType can be GL_NONE.
+ * Note: target may be GL_TEXTURE_CUBE_MAP, but never
+ * GL_TEXTURE_CUBE_MAP_[POSITIVE/NEGATIVE]_[XYZ].
* Called by glTexImage(), etc.
*/
- gl_format (*ChooseTextureFormat)( struct gl_context *ctx, GLint internalFormat,
+ gl_format (*ChooseTextureFormat)( struct gl_context *ctx,
+ GLenum target, GLint internalFormat,
GLenum srcFormat, GLenum srcType );
/**
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index 275e69e31ec..57f53529717 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -61,8 +61,8 @@
* will typically override this function with a specialized version.
*/
gl_format
-_mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
- GLenum format, GLenum type )
+_mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
+ GLint internalFormat, GLenum format, GLenum type)
{
(void) format;
(void) type;
diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h
index 3cf09213ac4..71af9ca223e 100644
--- a/src/mesa/main/texformat.h
+++ b/src/mesa/main/texformat.h
@@ -32,8 +32,8 @@
struct gl_context;
extern gl_format
-_mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
- GLenum format, GLenum type );
+_mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
+ GLint internalFormat, GLenum format, GLenum type);
#endif
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 8ec48eb62a6..59b38dee4aa 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -2035,7 +2035,7 @@ compressed_texture_error_check(struct gl_context *ctx, GLint dimensions,
/* check image size against compression block size */
{
gl_format texFormat =
- ctx->Driver.ChooseTextureFormat(ctx, proxy_format,
+ ctx->Driver.ChooseTextureFormat(ctx, target, proxy_format,
choose_format, choose_type);
GLuint bw, bh;
@@ -2797,7 +2797,8 @@ _mesa_choose_texture_format(struct gl_context *ctx,
}
/* choose format from scratch */
- f = ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type);
+ f = ctx->Driver.ChooseTextureFormat(ctx, texObj->Target, internalFormat,
+ format, type);
ASSERT(f != MESA_FORMAT_NONE);
return f;
}
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 2b2dccfbc1f..638e418dab4 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -783,7 +783,8 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex)
texObj->Sampler.MinFilter = GL_NEAREST;
texObj->Sampler.MagFilter = GL_NEAREST;
- texFormat = ctx->Driver.ChooseTextureFormat(ctx, GL_RGBA, GL_RGBA,
+ texFormat = ctx->Driver.ChooseTextureFormat(ctx, target,
+ GL_RGBA, GL_RGBA,
GL_UNSIGNED_BYTE);
/* need a loop here just for cube maps */