radeon: fix some wine d3d9 tests
[mesa.git] / src / mesa / drivers / dri / radeon / radeon_texture.c
index 6a8e70d47e6631f14d13d989496feb2be523c4d5..d2b190e42e0ec2e46e50aefd1cbedc2a4525266d 100644 (file)
@@ -39,6 +39,7 @@
 #include "main/texstore.h"
 #include "main/teximage.h"
 #include "main/texobj.h"
+#include "drivers/common/meta.h"
 
 #include "xmlpool.h"           /* for symbolic values of enum-type options */
 
@@ -294,9 +295,13 @@ void radeonGenerateMipmap(GLcontext* ctx, GLenum target, struct gl_texture_objec
                radeon_firevertices(rmesa);
        }
 
-       radeon_teximage_map(baseimage, GL_FALSE);
-       radeon_generate_mipmap(ctx, target, texObj);
-       radeon_teximage_unmap(baseimage);
+       if (_mesa_meta_check_generate_mipmap_fallback(ctx, target, texObj)) {
+               radeon_teximage_map(baseimage, GL_FALSE);
+               radeon_generate_mipmap(ctx, target, texObj);
+               radeon_teximage_unmap(baseimage);
+       } else {
+               _mesa_meta_GenerateMipmap(ctx, target, texObj);
+       }
 }
 
 
@@ -558,6 +563,15 @@ gl_format radeonChooseTextureFormat(GLcontext * ctx,
        case GL_COMPRESSED_SLUMINANCE_ALPHA:
                return MESA_FORMAT_SLA8;
 
+       case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
+               return MESA_FORMAT_SRGB_DXT1;
+       case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
+               return MESA_FORMAT_SRGBA_DXT1;
+       case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
+               return MESA_FORMAT_SRGBA_DXT3;
+       case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
+               return MESA_FORMAT_SRGBA_DXT5;
+
        default:
                _mesa_problem(ctx,
                              "unexpected internalFormat 0x%x in %s",
@@ -997,3 +1011,19 @@ void radeonTexSubImage3D(GLcontext * ctx, GLenum target, GLint level,
        radeon_texsubimage(ctx, 3, target, level, xoffset, yoffset, zoffset, width, height, depth, 0,
                format, type, pixels, packing, texObj, texImage, 0);
 }
+
+unsigned radeonIsFormatRenderable(gl_format mesa_format)
+{
+       if (mesa_format == _dri_texformat_argb8888 || mesa_format == _dri_texformat_rgb565 ||
+               mesa_format == _dri_texformat_argb1555 || mesa_format == _dri_texformat_argb4444)
+               return 1;
+
+       switch (mesa_format)
+       {
+               case MESA_FORMAT_Z16:
+               case MESA_FORMAT_S8_Z24:
+                       return 1;
+               default:
+                       return 0;
+       }
+}