Stefan Dösinger : wined3d: Add a method for surface location updates.

Alexandre Julliard julliard at winehq.org
Fri Oct 26 08:34:52 CDT 2007


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Tue Sep 25 00:02:14 2007 +0200

wined3d: Add a method for surface location updates.

---

 dlls/wined3d/surface.c           |   48 +++++++++++++++++++++++++++++++++++++-
 dlls/wined3d/surface_gdi.c       |   12 ++++++++-
 include/wine/wined3d_interface.h |    2 +
 3 files changed, 60 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 5fc00a6..b825683 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -3549,6 +3549,51 @@ static void WINAPI IWineD3DSurfaceImpl_ModifyLocation(IWineD3DSurface *iface, DW
     }
 }
 
+static HRESULT WINAPI IWineD3DSurfaceImpl_LoadLocation(IWineD3DSurface *iface, DWORD flag, const RECT *rect) {
+    IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
+    TRACE("(%p)->(%s, %p)\n", iface,
+          flag == SFLAG_INSYSMEM ? "SFLAG_INSYSMEM" : flag == SFLAG_INDRAWABLE ? "SFLAG_INDRAWABLE" : "SFLAG_INTEXTURE",
+          rect);
+    if(rect) {
+        TRACE("Rectangle: (%d,%d)-(%d,%d)\n", rect->left, rect->top, rect->right, rect->bottom);
+    }
+
+    /* TODO: For fbo targets, texture == drawable */
+    if(This->Flags & flag) {
+        TRACE("Location already up to date\n");
+        return WINED3D_OK;
+    }
+
+    if(!(This->Flags & SFLAG_LOCATIONS)) {
+        ERR("Surface does not have any up to date location\n");
+        This->Flags |= SFLAG_LOST;
+        return WINED3DERR_DEVICELOST;
+    }
+
+    if(flag == SFLAG_INSYSMEM) {
+        /* Download the surface to system memory */
+        if(This->Flags & SFLAG_INTEXTURE) {
+            /* Download texture to sysmem */
+        } else {
+            /* Download drawable to sysmem */
+        }
+    } else if(flag == SFLAG_INDRAWABLE) {
+        if(This->Flags & SFLAG_INTEXTURE) {
+            /* Blit texture to drawable */
+        } else {
+            /* Load drawable from sysmem */
+        }
+    } else /* if(flag == SFLAG_INTEXTURE) */ {
+        if(This->Flags & SFLAG_INDRAWABLE) {
+            /* glCopyTexImage the drawable into the texture */
+        } else {
+            /* Load the texture from sysmem */
+        }
+    }
+
+    return WINED3D_OK;
+}
+
 const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl =
 {
     /* IUnknown */
@@ -3601,5 +3646,6 @@ const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl =
     IWineD3DSurfaceImpl_GetData,
     IWineD3DSurfaceImpl_SetFormat,
     IWineD3DSurfaceImpl_PrivateSetup,
-    IWineD3DSurfaceImpl_ModifyLocation
+    IWineD3DSurfaceImpl_ModifyLocation,
+    IWineD3DSurfaceImpl_LoadLocation
 };
diff --git a/dlls/wined3d/surface_gdi.c b/dlls/wined3d/surface_gdi.c
index 19c7ea3..263c603 100644
--- a/dlls/wined3d/surface_gdi.c
+++ b/dlls/wined3d/surface_gdi.c
@@ -796,6 +796,15 @@ static void WINAPI IWineGDISurfaceImpl_ModifyLocation(IWineD3DSurface *iface, DW
     }
 }
 
+static HRESULT WINAPI IWineGDISurfaceImpl_LoadLocation(IWineD3DSurface *iface, DWORD flag, const RECT *rect) {
+    if(flag != SFLAG_INSYSMEM) {
+        ERR("GDI Surface requested to be copied to gl %s\n", flag == SFLAG_INTEXTURE ? "texture" : "drawable");
+    } else {
+        TRACE("Surface requested in surface memory\n");
+    }
+    return WINED3D_OK;
+}
+
 /* FIXME: This vtable should not use any IWineD3DSurface* implementation functions,
  * only IWineD3DBaseSurface and IWineGDISurface ones.
  */
@@ -851,5 +860,6 @@ const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl =
     IWineD3DSurfaceImpl_GetData,
     IWineD3DBaseSurfaceImpl_SetFormat,
     IWineGDISurfaceImpl_PrivateSetup,
-    IWineGDISurfaceImpl_ModifyLocation
+    IWineGDISurfaceImpl_ModifyLocation,
+    IWineGDISurfaceImpl_LoadLocation
 };
diff --git a/include/wine/wined3d_interface.h b/include/wine/wined3d_interface.h
index 9203200..d77a18f 100644
--- a/include/wine/wined3d_interface.h
+++ b/include/wine/wined3d_interface.h
@@ -1142,6 +1142,7 @@ DECLARE_INTERFACE_(IWineD3DSurface,IWineD3DResource)
     STDMETHOD(SetFormat)(THIS_ WINED3DFORMAT format) PURE;
     STDMETHOD(PrivateSetup)(THIS) PURE;
     STDMETHOD_(void,ModifyLocation)(THIS_ DWORD flag, BOOL persistent);
+    STDMETHOD(LoadLocation)(THIS_ DWORD flag, const RECT *rect);
 };
 #undef INTERFACE
 
@@ -1198,6 +1199,7 @@ DECLARE_INTERFACE_(IWineD3DSurface,IWineD3DResource)
 #define IWineD3DSurface_SetFormat(p,a)               (p)->lpVtbl->SetFormat(p,a)
 #define IWineD3DSurface_PrivateSetup(p)              (p)->lpVtbl->PrivateSetup(p)
 #define IWineD3DSurface_ModifyLocation(p,a,b)        (p)->lpVtbl->ModifyLocation(p,a,b)
+#define IWineD3DSurface_LoadLocation(p,a,b)       (p)->lpVtbl->LoadLocation(p,a,b)
 #endif
 
 /*****************************************************************************




More information about the wine-cvs mailing list