* except they're less useful because you can't texture with
* them.
*/
- rb->Format = intel->ctx.Driver.ChooseTextureFormat(ctx, internalFormat,
+ rb->Format = intel->ctx.Driver.ChooseTextureFormat(ctx, GL_TEXTURE_2D,
+ internalFormat,
GL_NONE, GL_NONE);
break;
case GL_STENCIL_INDEX:
}
static gl_format
-nouveau_choose_tex_format(struct gl_context *ctx, GLint internalFormat,
+nouveau_choose_tex_format(struct gl_context *ctx, GLenum target,
+ GLint internalFormat,
GLenum srcFormat, GLenum srcType)
{
switch (internalFormat) {
}
gl_format radeonChooseTextureFormat_mesa(struct gl_context * ctx,
+ GLenum target,
GLint internalFormat,
GLenum format,
GLenum type)
void radeon_swrast_unmap_texture_images(struct gl_context *ctx, struct gl_texture_object *texObj);
gl_format radeonChooseTextureFormat_mesa(struct gl_context * ctx,
+ GLenum target,
GLint internalFormat,
GLenum format,
GLenum type);
}
static gl_format swrastChooseTextureFormat(struct gl_context * ctx,
+ GLenum target,
GLint internalFormat,
GLenum format,
GLenum type)
{
if (internalFormat == GL_RGB)
return MESA_FORMAT_XRGB8888;
- return _mesa_choose_tex_format(ctx, internalFormat, format, type);
+ return _mesa_choose_tex_format(ctx, target, internalFormat, format, type);
}
static void
/*@{*/
/**
- * 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 );
/**
* 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;
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
/* 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;
}
/* 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;
}
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 */
* Called via ctx->Driver.ChooseTextureFormat().
*/
gl_format
-st_ChooseTextureFormat(struct gl_context *ctx, GLint internalFormat,
- GLenum format, GLenum type)
+st_ChooseTextureFormat(struct gl_context *ctx, GLenum target,
+ GLint internalFormat, GLenum format, GLenum type)
{
boolean want_renderable =
internalFormat == 3 || internalFormat == 4 ||
GLenum format, GLenum type, GLboolean renderable);
extern gl_format
-st_ChooseTextureFormat(struct gl_context * ctx, GLint internalFormat,
+st_ChooseTextureFormat(struct gl_context * ctx, GLenum target,
+ GLint internalFormat,
GLenum format, GLenum type);
else
internalFormat = GL_RGB;
- texFormat = st_ChooseTextureFormat(ctx, internalFormat,
+ texFormat = st_ChooseTextureFormat(ctx, target, internalFormat,
GL_BGRA, GL_UNSIGNED_BYTE);
_mesa_init_teximage_fields(ctx, texImage,