From d39abb766797de0c3a13e9f3dd2890590d5fd3ff Mon Sep 17 00:00:00 2001 From: Roderick Colenbrander <thunderbird2k@gmx.net> Date: Sat, 3 Nov 2007 15:14:03 +0100 Subject: [PATCH] wined3d: Only use p8 conversion on render targets. --- dlls/wined3d/surface.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 510d1aae061..b74a2671c12 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -1386,6 +1386,8 @@ HRESULT WINAPI IWineD3DSurfaceImpl_ReleaseDC(IWineD3DSurface *iface, HDC hDC) { HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_texturing, GLenum *format, GLenum *internal, GLenum *type, CONVERT_TYPES *convert, int *target_bpp, BOOL srgb_mode) { BOOL colorkey_active = need_alpha_ck && (This->CKeyFlags & WINEDDSD_CKSRCBLT); const GlPixelFormatDesc *glDesc; + IWineD3DDeviceImpl *device = This->resource.wineD3DDevice; + BOOL p8_render_target = FALSE; getFormatDescEntry(This->resource.format, &GLINFO_LOCATION, &glDesc); /* Default values: From the surface */ @@ -1401,10 +1403,18 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_ /* **************** Paletted Texture **************** */ + + if (device->render_targets && device->render_targets[0]) { + IWineD3DSurfaceImpl* render_target = (IWineD3DSurfaceImpl*)device->render_targets[0]; + if(render_target->resource.usage & WINED3DUSAGE_RENDERTARGET) + p8_render_target = TRUE; + } + /* Use conversion when the paletted texture extension is not available, or when it is available make sure it is used * for texturing as it won't work for calls like glDraw-/glReadPixels and further also use conversion in case of color keying. + * Paletted textures can be emulated using shaders but only do that for 2D purposes e.g. situations in which the main render target uses p8. Some games like GTA Vice City use P8 for texturing which conflicts with this. */ - if( !(GL_SUPPORT(EXT_PALETTED_TEXTURE) || GL_SUPPORT(ARB_FRAGMENT_PROGRAM)) || colorkey_active || (!use_texturing && GL_SUPPORT(EXT_PALETTED_TEXTURE)) ) { + if( !(GL_SUPPORT(EXT_PALETTED_TEXTURE) || (GL_SUPPORT(ARB_FRAGMENT_PROGRAM) && p8_render_target)) || colorkey_active || (!use_texturing && GL_SUPPORT(EXT_PALETTED_TEXTURE)) ) { *format = GL_RGBA; *internal = GL_RGBA; *type = GL_UNSIGNED_BYTE;