[2/10] WineD3D: GetRenderTargetData can call BltFast

Stefan Dösinger stefan at codeweavers.com
Tue Feb 13 13:14:41 CST 2007


Removes the call from wined3d because it provides a subset of the 
functionalitty of Blt and BltFast. It is implemented in d3d9 by calling 
BltFast

-------------- next part --------------
From 2208efa57bde0d5c5ce5d232fb190afe21af0931 Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan at codeweavers.com>
Date: Sat, 27 Jan 2007 13:18:52 +0100
Subject: [PATCH] WineD3D: GetRenderTargetData can call BltFast

---
 dlls/d3d9/device.c               |    4 +-
 dlls/wined3d/device.c            |   78 --------------------------------------
 include/wine/wined3d_interface.h |    2 -
 3 files changed, 2 insertions(+), 82 deletions(-)

diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 4c27853..4eff550 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -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) {
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index f84f514..d3b8315 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -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,
diff --git a/include/wine/wined3d_interface.h b/include/wine/wined3d_interface.h
index 305616b..b6bf26e 100644
--- a/include/wine/wined3d_interface.h
+++ b/include/wine/wined3d_interface.h
@@ -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);
-- 
1.4.4.3



More information about the wine-patches mailing list