static const struct gl_texture_format *
brwChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
- GLenum format, GLenum type )
+ GLenum srcFormat, GLenum srcType )
{
switch ( internalFormat ) {
case 4:
case GL_RGBA:
case GL_COMPRESSED_RGBA:
+ if (srcFormat == GL_BGRA && srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV)
+ return &_mesa_texformat_argb4444;
+ else if (srcFormat == GL_BGRA && srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV)
+ return &_mesa_texformat_argb1555;
+ else if ((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8_REV) ||
+ (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE) ||
+ (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_INT_8_8_8_8))
+ return &_mesa_texformat_rgba8888_rev;
+ else
+ return &_mesa_texformat_argb8888;
+
case GL_RGBA8:
case GL_RGB10_A2:
case GL_RGBA12:
case 3:
case GL_COMPRESSED_RGB:
case GL_RGB:
- if (format == GL_RGB &&
- type == GL_UNSIGNED_SHORT_5_6_5)
+ if (srcFormat == GL_RGB &&
+ srcType == GL_UNSIGNED_SHORT_5_6_5)
return &_mesa_texformat_rgb565;
else
return &_mesa_texformat_argb8888;
return &_mesa_texformat_i8;
case GL_YCBCR_MESA:
- if (type == GL_UNSIGNED_SHORT_8_8_MESA ||
- type == GL_UNSIGNED_BYTE)
+ if (srcType == GL_UNSIGNED_SHORT_8_8_MESA ||
+ srcType == GL_UNSIGNED_BYTE)
return &_mesa_texformat_ycbcr;
else
return &_mesa_texformat_ycbcr_rev;