wined3d: Do not call PreLoad in surface_download_data.

This commit is contained in:
Stefan Dösinger 2007-11-15 14:38:34 +01:00 committed by Alexandre Julliard
parent c835703ff7
commit f13bb40671
5 changed files with 35 additions and 1 deletions

View File

@ -57,7 +57,7 @@ static void surface_download_data(IWineD3DSurfaceImpl *This) {
checkGLcall("glActiveTextureARB"); checkGLcall("glActiveTextureARB");
} }
IWineD3DDeviceImpl_MarkStateDirty(This->resource.wineD3DDevice, STATE_SAMPLER(0)); IWineD3DDeviceImpl_MarkStateDirty(This->resource.wineD3DDevice, STATE_SAMPLER(0));
IWineD3DSurface_PreLoad((IWineD3DSurface *) This); IWineD3DSurface_BindTexture((IWineD3DSurface *) This);
if (This->resource.format == WINED3DFMT_DXT1 || if (This->resource.format == WINED3DFMT_DXT1 ||
This->resource.format == WINED3DFMT_DXT2 || This->resource.format == WINED3DFMT_DXT3 || This->resource.format == WINED3DFMT_DXT2 || This->resource.format == WINED3DFMT_DXT3 ||
@ -2186,6 +2186,30 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, BO
return WINED3D_OK; return WINED3D_OK;
} }
static void WINAPI IWineD3DSurfaceImpl_BindTexture(IWineD3DSurface *iface) {
/* TODO: check for locks */
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
IWineD3DBaseTexture *baseTexture = NULL;
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
TRACE("(%p)Checking to see if the container is a base texture\n", This);
if (IWineD3DSurface_GetContainer(iface, &IID_IWineD3DBaseTexture, (void **)&baseTexture) == WINED3D_OK) {
TRACE("Passing to container\n");
IWineD3DBaseTexture_BindTexture(baseTexture);
IWineD3DBaseTexture_Release(baseTexture);
} else {
TRACE("(%p) : Binding surface\n", This);
if(!device->isInDraw) {
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
}
ENTER_GL();
glBindTexture(This->glDescription.target, This->glDescription.textureName);
LEAVE_GL();
}
return;
}
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
HRESULT WINAPI IWineD3DSurfaceImpl_SaveSnapshot(IWineD3DSurface *iface, const char* filename) { HRESULT WINAPI IWineD3DSurfaceImpl_SaveSnapshot(IWineD3DSurface *iface, const char* filename) {
@ -3845,6 +3869,7 @@ const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl =
/* Internal use: */ /* Internal use: */
IWineD3DSurfaceImpl_AddDirtyRect, IWineD3DSurfaceImpl_AddDirtyRect,
IWineD3DSurfaceImpl_LoadTexture, IWineD3DSurfaceImpl_LoadTexture,
IWineD3DSurfaceImpl_BindTexture,
IWineD3DSurfaceImpl_SaveSnapshot, IWineD3DSurfaceImpl_SaveSnapshot,
IWineD3DBaseSurfaceImpl_SetContainer, IWineD3DBaseSurfaceImpl_SetContainer,
IWineD3DSurfaceImpl_SetGlTextureDesc, IWineD3DSurfaceImpl_SetGlTextureDesc,

View File

@ -1628,3 +1628,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED3DL
return WINED3D_OK; return WINED3D_OK;
} }
void WINAPI IWineD3DBaseSurfaceImpl_BindTexture(IWineD3DSurface *iface) {
ERR("Should not be called on base texture\n");
return;
}

View File

@ -805,6 +805,7 @@ const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl =
/* Internal use: */ /* Internal use: */
IWineGDISurfaceImpl_AddDirtyRect, IWineGDISurfaceImpl_AddDirtyRect,
IWineGDISurfaceImpl_LoadTexture, IWineGDISurfaceImpl_LoadTexture,
IWineD3DBaseSurfaceImpl_BindTexture,
IWineGDISurfaceImpl_SaveSnapshot, IWineGDISurfaceImpl_SaveSnapshot,
IWineD3DBaseSurfaceImpl_SetContainer, IWineD3DBaseSurfaceImpl_SetContainer,
IWineGDISurfaceImpl_SetGlTextureDesc, IWineGDISurfaceImpl_SetGlTextureDesc,

View File

@ -1159,6 +1159,7 @@ HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface);
HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, RECT *DestRect, IWineD3DSurface *SrcSurface, RECT *SrcRect, DWORD Flags, WINEDDBLTFX *DDBltFx, WINED3DTEXTUREFILTERTYPE Filter); HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, RECT *DestRect, IWineD3DSurface *SrcSurface, RECT *SrcRect, DWORD Flags, WINEDDBLTFX *DDBltFx, WINED3DTEXTUREFILTERTYPE Filter);
HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dstx, DWORD dsty, IWineD3DSurface *Source, RECT *rsrc, DWORD trans); HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dstx, DWORD dsty, IWineD3DSurface *Source, RECT *rsrc, DWORD trans);
HRESULT WINAPI IWineD3DBaseSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags); HRESULT WINAPI IWineD3DBaseSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags);
void WINAPI IWineD3DBaseSurfaceImpl_BindTexture(IWineD3DSurface *iface);
const void *WINAPI IWineD3DSurfaceImpl_GetData(IWineD3DSurface *iface); const void *WINAPI IWineD3DSurfaceImpl_GetData(IWineD3DSurface *iface);

View File

@ -1134,6 +1134,7 @@ DECLARE_INTERFACE_(IWineD3DSurface,IWineD3DResource)
/* Internally used methods */ /* Internally used methods */
STDMETHOD(AddDirtyRect)(THIS_ CONST RECT* pRect) PURE; STDMETHOD(AddDirtyRect)(THIS_ CONST RECT* pRect) PURE;
STDMETHOD(LoadTexture)(THIS, BOOL srgb_mode) PURE; STDMETHOD(LoadTexture)(THIS, BOOL srgb_mode) PURE;
STDMETHOD_(void, BindTexture)(THIS) PURE;
STDMETHOD(SaveSnapshot)(THIS_ const char *filename) PURE; STDMETHOD(SaveSnapshot)(THIS_ const char *filename) PURE;
STDMETHOD(SetContainer)(THIS_ IWineD3DBase *container) PURE; STDMETHOD(SetContainer)(THIS_ IWineD3DBase *container) PURE;
STDMETHOD_(void,SetGlTextureDesc)(THIS_ UINT textureName, int target) PURE; STDMETHOD_(void,SetGlTextureDesc)(THIS_ UINT textureName, int target) PURE;
@ -1191,6 +1192,7 @@ DECLARE_INTERFACE_(IWineD3DSurface,IWineD3DResource)
/*** IWineD3DSurface (Internal, no d3d mapping) methods ***/ /*** IWineD3DSurface (Internal, no d3d mapping) methods ***/
#define IWineD3DSurface_AddDirtyRect(p,a) (p)->lpVtbl->AddDirtyRect(p,a) #define IWineD3DSurface_AddDirtyRect(p,a) (p)->lpVtbl->AddDirtyRect(p,a)
#define IWineD3DSurface_LoadTexture(p,a) (p)->lpVtbl->LoadTexture(p,a) #define IWineD3DSurface_LoadTexture(p,a) (p)->lpVtbl->LoadTexture(p,a)
#define IWineD3DSurface_BindTexture(p) (p)->lpVtbl->BindTexture(p)
#define IWineD3DSurface_SaveSnapshot(p,a) (p)->lpVtbl->SaveSnapshot(p,a) #define IWineD3DSurface_SaveSnapshot(p,a) (p)->lpVtbl->SaveSnapshot(p,a)
#define IWineD3DSurface_SetContainer(p,a) (p)->lpVtbl->SetContainer(p,a) #define IWineD3DSurface_SetContainer(p,a) (p)->lpVtbl->SetContainer(p,a)
#define IWineD3DSurface_SetGlTextureDesc(p,a,b) (p)->lpVtbl->SetGlTextureDesc(p,a,b) #define IWineD3DSurface_SetGlTextureDesc(p,a,b) (p)->lpVtbl->SetGlTextureDesc(p,a,b)