Commit 12374491 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Add a method for surface location updates.

parent dcff7dc2
......@@ -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
};
......@@ -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
};
......@@ -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
/*****************************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment