[PATCH] WineD3D: Remove a broken AddDirtyRect all=0A=

Stefan Doesinger stefan at codeweavers.com
Thu Jun 12 20:48:33 CDT 2008

The AddDirtyRect is wrong because it removes the SFLAG_INDRAWABLE flag. =
This causes offscreen rendering to fail=0A=
if the texture is created during a PreLoad call that intends to load the =
drawable contents into the texture,=0A=
since it loads some garbage from system memory instead.=0A=
 dlls/wined3d/surface.c |   11 ++++++++++-=0A=
 1 files changed, 10 insertions(+), 1 deletions(-)=0A=
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c=0A=
index adddaa9..613df9e 100644=0A=
--- a/dlls/wined3d/surface.c=0A=
+++ b/dlls/wined3d/surface.c=0A=
@@ -628,7 +628,16 @@ void WINAPI =
IWineD3DSurfaceImpl_SetGlTextureDesc(IWineD3DSurface *iface, UINT te=0A=
     TRACE("(%p) : setting textureName %u, target %i\n", This, =
textureName, target);=0A=
     if (This->glDescription.textureName =3D=3D 0 && textureName !=3D 0) =
         IWineD3DSurface_ModifyLocation(iface, SFLAG_INTEXTURE, FALSE);=0A=
-        IWineD3DSurface_AddDirtyRect(iface, NULL);=0A=
+        if((This->Flags & SFLAG_LOCATIONS) =3D=3D 0) {=0A=
+            /* In Wine-rc4 and earlier, AddDirtyRect was called in the =
place of this if condition.=0A=
+             * This had the problem that a correctly set INDRAWABLE =
flag was removed if the PreLoad=0A=
+             * during the offscreen rendering readback triggered the =
creation of the GL texture.=0A=
+             * The change intended to keep the INDRAWABLE intact. To =
prevent unintended side effects=0A=
+             * before release, set the INSYSMEM flag like the old =
AddDirtyRect did.=0A=
+             */=0A=
+            ERR("Wine 1.0 safety path hit\n");=0A=
+            This->Flags |=3D SFLAG_INSYSMEM;=0A=
+        }=0A=
     if(target =3D=3D GL_TEXTURE_RECTANGLE_ARB && =
This->glDescription.target !=3D target) {=0A=
         This->Flags &=3D ~SFLAG_NORMCOORD;=0A=
-- =0A=


More information about the wine-patches mailing list