Stefan Dösinger : wined3d: Set the texture wrap default with the NP2 emulation properly.

Alexandre Julliard julliard at winehq.org
Thu Aug 21 10:02:51 CDT 2008


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Tue Aug 12 17:18:25 2008 -0500

wined3d: Set the texture wrap default with the NP2 emulation properly.

---

 dlls/wined3d/texture.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 5dc9821..35dfcae 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -227,6 +227,20 @@ static HRESULT WINAPI IWineD3DTextureImpl_BindTexture(IWineD3DTexture *iface) {
         for (i = 0; i < This->baseTexture.levels; ++i) {
             IWineD3DSurface_SetGlTextureDesc(This->surfaces[i], This->baseTexture.textureName, IWineD3DTexture_GetTextureDimensions(iface));
         }
+        /* Conditinal non power of two textures use a different clamping default. If we're using the GL_WINE_normalized_texrect
+         * partial driver emulation, we're dealing with a GL_TEXTURE_2D texture which has the address mode set to repeat - something
+         * that prevents us from hitting the accelerated codepath. Thus manually set the GL state
+         */
+        if(IWineD3DBaseTexture_IsCondNP2(iface)) {
+            ENTER_GL();
+            glTexParameteri(IWineD3DTexture_GetTextureDimensions(iface), GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+            checkGLcall("glTexParameteri(dimension, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)");
+            glTexParameteri(IWineD3DTexture_GetTextureDimensions(iface), GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+            checkGLcall("glTexParameteri(dimension, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)");
+            LEAVE_GL();
+            This->baseTexture.states[WINED3DTEXSTA_ADDRESSU]      = WINED3DTADDRESS_CLAMP;
+            This->baseTexture.states[WINED3DTEXSTA_ADDRESSV]      = WINED3DTADDRESS_CLAMP;
+        }
     }
 
     return hr;




More information about the wine-cvs mailing list