wined3d: GetRenderTargetData can call BltFast.
This commit is contained in:
parent
8cae0e4d07
commit
f196680c59
|
@ -344,8 +344,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetRenderTargetData(LPDIRECT3DDEVIC
|
|||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
IDirect3DSurface9Impl *renderTarget = (IDirect3DSurface9Impl *)pRenderTarget;
|
||||
IDirect3DSurface9Impl *destSurface = (IDirect3DSurface9Impl *)pDestSurface;
|
||||
TRACE("(%p) Relay\n" , This);
|
||||
return IWineD3DDevice_GetRenderTargetData(This->WineD3DDevice, renderTarget->wineD3DSurface, destSurface->wineD3DSurface);
|
||||
TRACE("(%p)->(%p,%p)\n" , This, renderTarget, destSurface);
|
||||
return IWineD3DSurface_BltFast(destSurface->wineD3DSurface, 0, 0, renderTarget->wineD3DSurface, NULL, DDBLTFAST_NOCOLORKEY);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3DDevice9Impl_GetFrontBufferData(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, IDirect3DSurface9* pDestSurface) {
|
||||
|
|
|
@ -4829,83 +4829,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateTexture (IWineD3DDevice *iface, I
|
|||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DDeviceImpl_GetRenderTargetData(IWineD3DDevice *iface, IWineD3DSurface *pRenderTarget, IWineD3DSurface *pSurface) {
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
/** TODO: remove remove casts to IWineD3DSurfaceImpl *
|
||||
* NOTE It may be best to move the code into surface to occomplish this
|
||||
****************************************/
|
||||
|
||||
WINED3DSURFACE_DESC surfaceDesc;
|
||||
unsigned int surfaceWidth, surfaceHeight;
|
||||
glDescriptor *targetGlDescription = NULL;
|
||||
glDescriptor *surfaceGlDescription = NULL;
|
||||
IWineD3DSwapChainImpl *container = NULL;
|
||||
|
||||
IWineD3DSurface_GetGlDesc(pRenderTarget, &targetGlDescription);
|
||||
IWineD3DSurface_GetGlDesc(pSurface, &surfaceGlDescription);
|
||||
memset(&surfaceDesc, 0, sizeof(surfaceDesc));
|
||||
|
||||
surfaceDesc.Width = &surfaceWidth;
|
||||
surfaceDesc.Height = &surfaceHeight;
|
||||
IWineD3DSurface_GetDesc(pSurface, &surfaceDesc);
|
||||
/* check to see if it's the backbuffer or the frontbuffer being requested (to make sure the data is up to date)*/
|
||||
|
||||
/* Ok, I may need to setup some kind of active swapchain reference on the device */
|
||||
IWineD3DSurface_GetContainer(pRenderTarget, &IID_IWineD3DSwapChain, (void **)&container);
|
||||
ENTER_GL();
|
||||
/* TODO: opengl Context switching for swapchains etc... */
|
||||
if (NULL != container || pRenderTarget == This->render_targets[0] || pRenderTarget == This->depthStencilBuffer) {
|
||||
if (NULL != container && (pRenderTarget == container->backBuffer[0])) {
|
||||
glReadBuffer(GL_BACK);
|
||||
vcheckGLcall("glReadBuffer(GL_BACK)");
|
||||
} else if ((NULL != container && (pRenderTarget == container->frontBuffer)) || (pRenderTarget == This->render_targets[0])) {
|
||||
glReadBuffer(GL_FRONT);
|
||||
vcheckGLcall("glReadBuffer(GL_FRONT)");
|
||||
} else if (pRenderTarget == This->depthStencilBuffer) {
|
||||
FIXME("Reading of depthstencil not yet supported\n");
|
||||
}
|
||||
|
||||
glReadPixels(0,
|
||||
0,
|
||||
surfaceWidth,
|
||||
surfaceHeight,
|
||||
surfaceGlDescription->glFormat,
|
||||
surfaceGlDescription->glType,
|
||||
(void *)IWineD3DSurface_GetData(pSurface));
|
||||
vcheckGLcall("glReadPixels(...)");
|
||||
if(NULL != container ){
|
||||
IWineD3DSwapChain_Release((IWineD3DSwapChain*) container);
|
||||
}
|
||||
} else {
|
||||
IWineD3DBaseTexture *container;
|
||||
GLenum textureDimensions = GL_TEXTURE_2D;
|
||||
|
||||
if (WINED3D_OK == IWineD3DSurface_GetContainer(pSurface, &IID_IWineD3DBaseTexture, (void **)&container)) {
|
||||
textureDimensions = IWineD3DBaseTexture_GetTextureDimensions(container);
|
||||
IWineD3DBaseTexture_Release(container);
|
||||
}
|
||||
/* TODO: 2D -> Cube surface coppies etc.. */
|
||||
if (surfaceGlDescription->target != textureDimensions) {
|
||||
FIXME("(%p) : Texture dimension mismatch\n", This);
|
||||
}
|
||||
glEnable(textureDimensions);
|
||||
vcheckGLcall("glEnable(GL_TEXTURE_...)");
|
||||
/* FIXME: this isn't correct, it need to add a dirty rect if nothing else... */
|
||||
glBindTexture(targetGlDescription->target, targetGlDescription->textureName);
|
||||
vcheckGLcall("glBindTexture");
|
||||
glGetTexImage(surfaceGlDescription->target,
|
||||
surfaceGlDescription->level,
|
||||
surfaceGlDescription->glFormat,
|
||||
surfaceGlDescription->glType,
|
||||
(void *)IWineD3DSurface_GetData(pSurface));
|
||||
glDisable(textureDimensions);
|
||||
vcheckGLcall("glDisable(GL_TEXTURE_...)");
|
||||
|
||||
}
|
||||
LEAVE_GL();
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DDeviceImpl_GetFrontBufferData(IWineD3DDevice *iface,UINT iSwapChain, IWineD3DSurface *pDestSurface) {
|
||||
IWineD3DSwapChain *swapChain;
|
||||
HRESULT hr;
|
||||
|
@ -6205,7 +6128,6 @@ const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
|
|||
IWineD3DDeviceImpl_ColorFill,
|
||||
IWineD3DDeviceImpl_UpdateTexture,
|
||||
IWineD3DDeviceImpl_UpdateSurface,
|
||||
IWineD3DDeviceImpl_GetRenderTargetData,
|
||||
IWineD3DDeviceImpl_GetFrontBufferData,
|
||||
IWineD3DDeviceImpl_SetupFullscreenWindow,
|
||||
IWineD3DDeviceImpl_RestoreWindow,
|
||||
|
|
|
@ -469,7 +469,6 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
|
|||
STDMETHOD(ColorFill)(THIS_ struct IWineD3DSurface* pSurface, CONST WINED3DRECT* pRect, WINED3DCOLOR color) PURE;
|
||||
STDMETHOD(UpdateTexture)(THIS_ struct IWineD3DBaseTexture *pSourceTexture, struct IWineD3DBaseTexture *pDestinationTexture) PURE;
|
||||
STDMETHOD(UpdateSurface)(THIS_ struct IWineD3DSurface* pSourceSurface, CONST RECT* pSourceRect, struct IWineD3DSurface* pDestinationSurface, CONST POINT* pDestPoint) PURE;
|
||||
STDMETHOD(GetRenderTargetData)(THIS_ struct IWineD3DSurface* pRenderTarget, struct IWineD3DSurface* pSurface) PURE;
|
||||
STDMETHOD(GetFrontBufferData)(THIS_ UINT iSwapChain,struct IWineD3DSurface* pSurface) PURE;
|
||||
STDMETHOD_(void, SetupFullscreenWindow)(THIS_ HWND window) PURE;
|
||||
STDMETHOD_(void, RestoreWindow)(THIS_ HWND window) PURE;
|
||||
|
@ -609,7 +608,6 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
|
|||
#define IWineD3DDevice_ColorFill(p,a,b,c) (p)->lpVtbl->ColorFill(p,a,b,c)
|
||||
#define IWineD3DDevice_UpdateTexture(p,a,b) (p)->lpVtbl->UpdateTexture(p,a,b)
|
||||
#define IWineD3DDevice_UpdateSurface(p,a,b,c,d) (p)->lpVtbl->UpdateSurface(p,a,b,c,d)
|
||||
#define IWineD3DDevice_GetRenderTargetData(p,a,b) (p)->lpVtbl->GetRenderTargetData(p,a,b)
|
||||
#define IWineD3DDevice_GetFrontBufferData(p,a,b) (p)->lpVtbl->GetFrontBufferData(p,a,b)
|
||||
#define IWineD3DDevice_SetupFullscreenWindow(p, a) (p)->lpVtbl->SetupFullscreenWindow(p,a);
|
||||
#define IWineD3DDevice_RestoreWindow(p, a) (p)->lpVtbl->RestoreWindow(p,a);
|
||||
|
|
Loading…
Reference in New Issue