Roderick Colenbrander : wined3d: Don' t use texture_rectangle for paletted textures.

Alexandre Julliard julliard at winehq.org
Wed Jan 23 05:25:04 CST 2008


Module: wine
Branch: master
Commit: a1364d11c0a1e919eb66a81df04c57e156c95694
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a1364d11c0a1e919eb66a81df04c57e156c95694

Author: Roderick Colenbrander <thunderbird2k at gmx.net>
Date:   Mon Jan 21 22:29:03 2008 +0100

wined3d: Don't use texture_rectangle for paletted textures.

---

 dlls/wined3d/device.c  |   10 ++++++++--
 dlls/wined3d/surface.c |   10 ++++++++--
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 8d4dfd7..0801ac2 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -894,9 +894,15 @@ static HRESULT  WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, U
     }
 
     /** FIXME: add support for real non-power-two if it's provided by the video card **/
-    /* Precalculated scaling for 'faked' non power of two texture coords */
+    /* Precalculated scaling for 'faked' non power of two texture coords.
+       Second also don't use ARB_TEXTURE_RECTANGLE in case the surface format is P8 and EXT_PALETTED_TEXTURE
+       is used in combination with texture uploads (RTL_READTEX/RTL_TEXTEX). The reason is that EXT_PALETTED_TEXTURE
+       doesn't work in combination with ARB_TEXTURE_RECTANGLE.
+    */
     if(GL_SUPPORT(ARB_TEXTURE_RECTANGLE) &&
-       (Width != pow2Width || Height != pow2Height)) {
+       (Width != pow2Width || Height != pow2Height) &&
+       !((Format == WINED3DFMT_P8) && GL_SUPPORT(EXT_PALETTED_TEXTURE) && (wined3d_settings.rendertargetlock_mode == RTL_READTEX || wined3d_settings.rendertargetlock_mode == RTL_TEXTEX)))
+    {
         object->baseTexture.pow2Matrix[0] =  (float)Width;
         object->baseTexture.pow2Matrix[5] =  (float)Height;
         object->baseTexture.pow2Matrix[10] = 1.0;
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index c6aa7a9..f6aed08 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -3463,8 +3463,14 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_PrivateSetup(IWineD3DSurface *iface) {
         This->glRect.right = 0;
         This->glRect.bottom = 0;
     } else {
-        /* Check this after the oversize check - do not make an oversized surface a texture_rectangle one */
-        if(This->Flags & SFLAG_NONPOW2 && GL_SUPPORT(ARB_TEXTURE_RECTANGLE)) {
+        /* Check this after the oversize check - do not make an oversized surface a texture_rectangle one.
+           Second also don't use ARB_TEXTURE_RECTANGLE in case the surface format is P8 and EXT_PALETTED_TEXTURE
+           is used in combination with texture uploads (RTL_READTEX/RTL_TEXTEX). The reason is that EXT_PALETTED_TEXTURE
+           doesn't work in combination with ARB_TEXTURE_RECTANGLE.
+        */
+        if(This->Flags & SFLAG_NONPOW2 && GL_SUPPORT(ARB_TEXTURE_RECTANGLE) &&
+           !((This->resource.format == WINED3DFMT_P8) && GL_SUPPORT(EXT_PALETTED_TEXTURE) && (wined3d_settings.rendertargetlock_mode == RTL_READTEX || wined3d_settings.rendertargetlock_mode == RTL_TEXTEX)))
+        {
             This->glDescription.target = GL_TEXTURE_RECTANGLE_ARB;
             This->pow2Width  = This->currentDesc.Width;
             This->pow2Height = This->currentDesc.Height;




More information about the wine-cvs mailing list