VirtualBox

儲存庫 vbox 的更動 30916


忽略:
時間撮記:
2010-7-19 下午08:32:01 (14 年 以前)
作者:
vboxsync
訊息:

wddm/3d: Aero: fix gdi-backend textures update, avoid extra memcpy for sysmem textures Lock/Unlock

位置:
trunk/src/VBox/Additions/WINNT/Graphics
檔案:
修改 21 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp

    r30885 r30916  
    18891889    HRESULT hr = S_OK;
    18901890
    1891 #ifdef DEBUG_misha
    1892     uint32_t iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations;
    1893     vboxVDbgDumpSurfData((pDevice, ">>>DrawPrimitive:\n", pDevice->pRenderTargetRc, iBackBuf,
    1894             NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n"));
    1895 #endif
     1891//#ifdef DEBUG_misha
     1892//    uint32_t iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations;
     1893//    vboxVDbgDumpSurfData((pDevice, ">>>DrawPrimitive:\n", pDevice->pRenderTargetRc, iBackBuf,
     1894//            NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n"));
     1895//#endif
    18961896
    18971897    if (!pDevice->cStreamSources)
     
    19111911            Assert(hr == S_OK);
    19121912
    1913             vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitiveUP\n"));
     1913//            vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitiveUP\n"));
    19141914        }
    19151915        else
     
    19461946        Assert(hr == S_OK);
    19471947
    1948         vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitive\n"));
     1948//        vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitive\n"));
    19491949#if 0
    19501950        IDirect3DVertexDeclaration9* pDecl;
     
    21562156    }
    21572157
    2158 #ifdef DEBUG_misha
    2159     iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations;
    2160     vboxVDbgDumpSurfData((pDevice, "<<<DrawPrimitive:\n", pDevice->pRenderTargetRc, iBackBuf,
    2161             NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n"));
    2162 #endif
     2158//#ifdef DEBUG_misha
     2159//    iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations;
     2160//    vboxVDbgDumpSurfData((pDevice, "<<<DrawPrimitive:\n", pDevice->pRenderTargetRc, iBackBuf,
     2161//            NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n"));
     2162//#endif
    21632163
    21642164    vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p), hr(0x%x)\n", hDevice, hr));
     
    21722172    Assert(pDevice);
    21732173    Assert(pDevice->pDevice9If);
    2174 #ifdef DEBUG_misha
    2175     uint32_t iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations;
    2176     vboxVDbgDumpSurfData((pDevice, ">>>DrawIndexedPrimitive:\n", pDevice->pRenderTargetRc, iBackBuf,
    2177             NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n"));
    2178 #endif
     2174//#ifdef DEBUG_misha
     2175//    uint32_t iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations;
     2176//    vboxVDbgDumpSurfData((pDevice, ">>>DrawIndexedPrimitive:\n", pDevice->pRenderTargetRc, iBackBuf,
     2177//            NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n"));
     2178//#endif
    21792179
    21802180#ifdef DEBUG
     
    22102210    Assert(hr == S_OK);
    22112211
    2212 #ifdef DEBUG_misha
    2213     iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations;
    2214     vboxVDbgDumpSurfData((pDevice, "<<<DrawIndexedPrimitive:\n", pDevice->pRenderTargetRc, iBackBuf,
    2215             NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n"));
    2216 #endif
     2212//#ifdef DEBUG_misha
     2213//    iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations;
     2214//    vboxVDbgDumpSurfData((pDevice, "<<<DrawIndexedPrimitive:\n", pDevice->pRenderTargetRc, iBackBuf,
     2215//            NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n"));
     2216//#endif
    22172217
    22182218
     
    22742274    hr = pDevice->pDevice9If->DrawPrimitive(pData->PrimitiveType, pData->FirstVertexOffset, pData->PrimitiveCount);
    22752275#else
    2276 #ifdef DEBUG_misha
    2277     uint32_t iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations;
    2278     vboxVDbgDumpSurfData((pDevice, ">>>DrawPrimitive2:\n", pDevice->pRenderTargetRc, iBackBuf,
    2279             NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n"));
    2280 #endif
     2276//#ifdef DEBUG_misha
     2277//    uint32_t iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations;
     2278//    vboxVDbgDumpSurfData((pDevice, ">>>DrawPrimitive2:\n", pDevice->pRenderTargetRc, iBackBuf,
     2279//            NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n"));
     2280//#endif
    22812281
    22822282#ifdef DEBUG
     
    22982298            if (pDevice->aStreamSource[stream]->LockInfo.cLocks)
    22992299            {
    2300                 vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitiveUP\n"));
     2300//                vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitiveUP\n"));
    23012301
    23022302                Assert(pLock->fFlags.MightDrawFromLocked && (pLock->fFlags.Discard || pLock->fFlags.NoOverwrite));
     
    23102310            else
    23112311            {
    2312                 vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitive\n"));
     2312//                vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitive\n"));
    23132313
    23142314                hr = pDevice->pDevice9If->DrawPrimitive(pData->PrimitiveType, pData->FirstVertexOffset/pDevice->StreamSourceInfo[stream].uiStride, pData->PrimitiveCount);
     
    23242324#endif
    23252325
    2326 #ifdef DEBUG_misha
    2327     iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations;
    2328     vboxVDbgDumpSurfData((pDevice, "<<<DrawPrimitive2:\n", pDevice->pRenderTargetRc, iBackBuf,
    2329             NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n"));
    2330 #endif
     2326//#ifdef DEBUG_misha
     2327//    iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations;
     2328//    vboxVDbgDumpSurfData((pDevice, "<<<DrawPrimitive2:\n", pDevice->pRenderTargetRc, iBackBuf,
     2329//            NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n"));
     2330//#endif
    23312331
    23322332    Assert(hr == S_OK);
     
    26792679                    Assert(pLockAlloc->pvMem);
    26802680                    Assert(pRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM);
    2681 
     2681#if 0
    26822682                    if (bNeedResynch)
    26832683                        vboxWddmLockUnlockMemSynch(pLockAlloc, &pLockAlloc->LockInfo.LockedRect, pRect, false /*bool bToLockInfo*/);
     2684#endif
    26842685                }
    26852686            }
     
    29832984                Assert(pD3DIfTex);
    29842985                /* this is a sysmem texture, update  */
     2986#if 0
    29852987                if (pLockAlloc->pvMem && !pLockAlloc->LockInfo.fFlags.ReadOnly)
    29862988                {
     
    29892991                            true /*bool bToLockInfo*/);
    29902992                }
     2993#endif
    29912994                hr = pD3DIfTex->UnlockRect(pData->SubResourceIndex);
    29922995                Assert(hr == S_OK);
     
    34073410                CONST D3DDDI_SURFACEINFO* pSurf = &pResource->pSurfList[0];
    34083411                IDirect3DTexture9 *pD3DIfTex;
     3412#if 0
    34093413                hr = pDevice->pDevice9If->CreateTexture(pSurf->Width,
    34103414                                            pSurf->Height,
     
    34163420                                            NULL /* HANDLE* pSharedHandle */
    34173421                                            );
     3422#else
     3423                hr = pDevice->pAdapter->D3D.pfnVBoxWineExD3DDev9CreateTexture((IDirect3DDevice9Ex *)pDevice->pDevice9If,
     3424                                            pSurf->Width,
     3425                                            pSurf->Height,
     3426                                            pResource->SurfCount,
     3427                                            vboxDDI2D3DUsage(pResource->Flags),
     3428                                            vboxDDI2D3DFormat(pResource->Format),
     3429                                            vboxDDI2D3DPool(pResource->Pool),
     3430                                            &pD3DIfTex,
     3431                                            NULL /* HANDLE* pSharedHandle */,
     3432                                            pResource->Pool == D3DDDIPOOL_SYSTEMMEM ? pRc->aAllocations[0].pvMem : NULL);
     3433#endif
    34183434                Assert(hr == S_OK);
    34193435                if (hr == S_OK)
     
    34223438                    pAllocation->enmD3DIfType = VBOXDISP_D3DIFTYPE_TEXTURE;
    34233439                    pAllocation->pD3DIf = pD3DIfTex;
     3440#if 0
    34243441                    if (pResource->Pool == D3DDDIPOOL_SYSTEMMEM)
    34253442                    {
     
    34443461                        }
    34453462                    }
     3463#endif
    34463464                }
    34473465#ifdef DEBUG
     
    42094227    Assert(pDstRc->cAllocations > pData->DstSubResourceIndex);
    42104228    Assert(pSrcRc->cAllocations > pData->SrcSubResourceIndex);
    4211 //    Assert(pSrcRc->RcDesc.enmPool != D3DDDIPOOL_SYSTEMMEM);
    4212     /* @todo: use UpdateRect in case of Src is a D3DDDIPOOL_SYSTEMMEM */
    4213     Assert(pDstRc->RcDesc.enmPool != D3DDDIPOOL_SYSTEMMEM);
    42144229    Assert(pDstRc != pDevice->pRenderTargetRc || pDevice->iRenderTargetFrontBuf != pData->DstSubResourceIndex);
    42154230    HRESULT hr = S_OK;
     
    42844299            {
    42854300                Assert(pSrcSurfIf);
    4286 
    4287 //#ifdef DEBUG_misha
    4288 //                vboxVDbgDumpSurfData((pDevice, "Blt-pre Src:\n", pSrcRc, pData->SrcSubResourceIndex, &pData->SrcRect, pSrcSurfIf, "\n"));
    4289 //                vboxVDbgDumpSurfData((pDevice, "Blt-pre Dst:\n", pDstRc, pData->DstSubResourceIndex, &pData->DstRect, pDstSurfIf, "\n"));
    4290 //#endif
     4301#ifdef DEBUG_misha
     4302                bool bDo = false;
     4303
     4304                if (g_VDbgTstDumpEnable)
     4305                {
     4306                    if (g_VDbgTstDumpOnSys2VidSameSizeEnable)
     4307                    {
     4308                        if (pDstRc->RcDesc.enmPool != D3DDDIPOOL_SYSTEMMEM
     4309                                && pSrcRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM)
     4310                        {
     4311                            D3DSURFACE_DESC SrcDesc;
     4312                            HRESULT hr = pSrcSurfIf->GetDesc(&SrcDesc);
     4313                            Assert(hr == S_OK);
     4314                            if (hr == S_OK)
     4315                            {
     4316                                D3DSURFACE_DESC DstDesc;
     4317                                hr = pDstSurfIf->GetDesc(&DstDesc);
     4318                                Assert(hr == S_OK);
     4319                                if (hr == S_OK)
     4320                                {
     4321                                    if (SrcDesc.Width == DstDesc.Width
     4322                                            && SrcDesc.Height == DstDesc.Height)
     4323                                    {
     4324                                        bDo = true;
     4325                                    }
     4326                                }
     4327                            }
     4328                        }
     4329                    }
     4330                }
     4331
     4332                if (bDo)
     4333                {
     4334                    vboxVDbgDumpSurfData((pDevice, "Blt-pre Src:\n", pSrcRc, pData->SrcSubResourceIndex, &pData->SrcRect, pSrcSurfIf, "\n"));
     4335                    vboxVDbgDumpSurfData((pDevice, "Blt-pre Dst:\n", pDstRc, pData->DstSubResourceIndex, &pData->DstRect, pDstSurfIf, "\n"));
     4336                }
     4337#endif
    42914338                /* we support only Point & Linear, we ignore [Begin|Continue|End]PresentToDwm */
    42924339                Assert((pData->Flags.Value & (~(0x00000100 | 0x00000200 | 0x00000400 | 0x00000001  | 0x00000002))) == 0);
     
    42984345                Assert(hr == S_OK);
    42994346
    4300 //#ifdef DEBUG_misha
    4301 //                vboxVDbgDumpSurfData((pDevice, "Blt-post Src:\n", pSrcRc, pData->SrcSubResourceIndex, &pData->SrcRect, pSrcSurfIf, "\n"));
    4302 //                vboxVDbgDumpSurfData((pDevice, "Blt-post Dst:\n", pDstRc, pData->DstSubResourceIndex, &pData->DstRect, pDstSurfIf, "\n"));
    4303 //#endif
     4347#ifdef DEBUG_misha
     4348                if (bDo)
     4349                {
     4350                    vboxVDbgDumpSurfData((pDevice, "Blt-post Src:\n", pSrcRc, pData->SrcSubResourceIndex, &pData->SrcRect, pSrcSurfIf, "\n"));
     4351                    vboxVDbgDumpSurfData((pDevice, "Blt-post Dst:\n", pDstRc, pData->DstSubResourceIndex, &pData->DstRect, pDstSurfIf, "\n"));
     4352                }
     4353#endif
    43044354                pSrcSurfIf->Release();
    43054355            }
     
    53695419
    53705420#ifdef VBOXWDDMDISP_DEBUG
     5421
     5422bool g_VDbgTstDumpEnable = false;
     5423bool g_VDbgTstDumpOnSys2VidSameSizeEnable = false;
     5424
    53715425VOID vboxVDbgDoDumpSurfData(const PVBOXWDDMDISP_DEVICE pDevice, const char * pPrefix, const PVBOXWDDMDISP_RESOURCE pRc, uint32_t iAlloc, const RECT *pRect, IDirect3DSurface9 *pSurf, const char* pSuffix)
    53725426{
     
    54115465    {
    54125466        vboxVDbgMpPrint((pDevice, "%s\n", pSuffix));
     5467    }
     5468}
     5469
     5470VOID vboxVDbgDoDumpSurfDataBySurf(const PVBOXWDDMDISP_DEVICE pDevice, IDirect3DSurface9 *pSurf)
     5471{
     5472    D3DSURFACE_DESC Desc;
     5473    HRESULT hr = pSurf->GetDesc(&Desc);
     5474    Assert(hr == S_OK);
     5475    if (hr == S_OK)
     5476    {
     5477        D3DLOCKED_RECT Lr;
     5478        hr = pSurf->LockRect(&Lr, NULL, D3DLOCK_READONLY);
     5479        Assert(hr == S_OK);
     5480        if (hr == S_OK)
     5481        {
     5482            UINT bpp = vboxWddmCalcBitsPerPixel((D3DDDIFORMAT)Desc.Format);
     5483            vboxVDbgMpPrint((pDevice, "<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">surface info</exec>\n",
     5484                    Lr.pBits, Desc.Width, Desc.Height, bpp, Lr.Pitch));
     5485
     5486            Assert(0);
     5487
     5488            hr = pSurf->UnlockRect();
     5489            Assert(hr == S_OK);
     5490        }
    54135491    }
    54145492}
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3DCmn.h

    r30885 r30916  
    3838# define VBOXWDDMDISP_DEBUG
    3939# define VBOXWDDMDISP_DEBUG_FLOW
    40 //# define VBOXWDDMDISP_DEBUG_DUMPSURFDATA
     40# define VBOXWDDMDISP_DEBUG_DUMPSURFDATA
    4141#endif
    4242
     
    5757
    5858#ifdef VBOXWDDMDISP_DEBUG
     59extern bool g_VDbgTstDumpEnable;
     60extern bool g_VDbgTstDumpOnSys2VidSameSizeEnable;
     61
    5962VOID vboxVDbgDoDumpSurfData(const PVBOXWDDMDISP_DEVICE pDevice, const char * pPrefix, const PVBOXWDDMDISP_RESOURCE pRc, uint32_t iAlloc, const RECT *pRect, IDirect3DSurface9 *pSurf, const char* pSuffix);
    6063void vboxVDbgDoMpPrintRect(const PVBOXWDDMDISP_DEVICE pDevice, const char * pPrefix, const RECT *pRect, const char * pSuffix);
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3DIf.cpp

    r30685 r30916  
    3434        Assert(pD3D->pfnDirect3DCreate9Ex);
    3535        if (pD3D->pfnDirect3DCreate9Ex)
    36             return S_OK;
     36        {
     37            pD3D->pfnVBoxWineExD3DDev9CreateTexture = (PFNVBOXWINEEXD3DDEV9_CREATETEXTURE)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DDev9CreateTexture");
     38            Assert(pD3D->pfnVBoxWineExD3DDev9CreateTexture);
     39            if (pD3D->pfnVBoxWineExD3DDev9CreateTexture)
     40            {
     41                return S_OK;
     42            }
     43        }
    3744        else
    3845        {
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3DIf.h

    r30038 r30916  
    2222#include <D3D9.h>
    2323
     24#include "../../Wine/vbox/VBoxWineEx.h"
     25
    2426/* D3D functionality the VBOXDISPD3D provides */
    2527typedef HRESULT WINAPI FNVBOXDISPD3DCREATE9EX(UINT SDKVersion, IDirect3D9Ex **ppD3D);
     
    3032    /* D3D functionality the VBOXDISPD3D provides */
    3133    PFNVBOXDISPD3DCREATE9EX pfnDirect3DCreate9Ex;
     34
     35    PFNVBOXWINEEXD3DDEV9_CREATETEXTURE pfnVBoxWineExD3DDev9CreateTexture;
    3236
    3337    /* module handle */
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/Makefile.kmk

    r30721 r30916  
    186186 VBoxD3D8_DEFS       += WINE_NO_DEBUG_MSGS
    187187endif
     188#ifdef VBOXWDDM
     189# VBoxD3D8_DEFS        += VBOXWDDM IN_VBOXWINEEX
     190#endif
    188191VBoxD3D8_INCS         := $(PATH_SUB_CURRENT)/include
    189192VBoxD3D8_SOURCES      := \
     
    206209    $(PATH_LIB)/libWine$(VBOX_SUFF_LIB) \
    207210    $(PATH_LIB)/wined3d$(VBOX_SUFF_LIB)
    208 
    209211DLLS += VBoxD3D9
    210212
     
    220222ifneq ($(KBUILD_TYPE),debug)
    221223 VBoxD3D9_DEFS       += WINE_NO_DEBUG_MSGS
     224endif
     225ifdef VBOXWDDM
     226 VBoxD3D9_DEFS        += VBOXWDDM IN_VBOXWINEEX
    222227endif
    223228VBoxD3D9_INCS         := $(PATH_SUB_CURRENT)/include
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/d3d9.def

    r20612 r30916  
    1515  Direct3DCreate9@4=Direct3DCreate9
    1616  Direct3DCreate9Ex@8=Direct3DCreate9Ex
     17  VBoxWineExD3DDev9CreateTexture
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/d3d9_private.h

    r28475 r30916  
    4747#include "d3d9.h"
    4848#include "wine/wined3d.h"
     49
     50#ifdef VBOXWDDM
     51#include "../vbox/VBoxWineEx.h"
     52#endif
    4953
    5054/* ===========================================================================
     
    316320HRESULT surface_init(IDirect3DSurface9Impl *surface, IDirect3DDevice9Impl *device,
    317321        UINT width, UINT height, D3DFORMAT format, BOOL lockable, BOOL discard, UINT level,
    318         DWORD usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality) DECLSPEC_HIDDEN;
     322        DWORD usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality
     323#ifdef VBOXWDDM
     324        , HANDLE *shared_handle
     325        , void *pvClientMem
     326#endif
     327        ) DECLSPEC_HIDDEN;
    319328
    320329/* ---------------------- */
     
    428437
    429438HRESULT texture_init(IDirect3DTexture9Impl *texture, IDirect3DDevice9Impl *device,
    430         UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN;
     439        UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool
     440#ifdef VBOXWDDM
     441        , HANDLE *shared_handle
     442        , void *pvClientMem
     443#endif
     444        ) DECLSPEC_HIDDEN;
    431445
    432446/* ----------------------- */
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/device.c

    r28475 r30916  
    713713}
    714714
     715#ifdef VBOXWDDM
     716VBOXWINEEX_DECL(HRESULT) VBoxWineExD3DDev9CreateTexture(IDirect3DDevice9Ex *iface,
     717        UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format,
     718        D3DPOOL pool, IDirect3DTexture9 **texture, HANDLE *shared_handle,
     719        void *pvClientMem) /* <- extension arg to pass in the client memory buffer,
     720                            *    applicable ONLY for SYSMEM textures */
     721{
     722    IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
     723    IDirect3DTexture9Impl *object;
     724    HRESULT hr;
     725
     726    TRACE("iface %p, width %u, height %u, levels %u, usage %#x, format %#x, pool %#x, texture %p, shared_handle %p.\n",
     727            iface, width, height, levels, usage, format, pool, texture, shared_handle);
     728
     729    object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     730    if (!object)
     731    {
     732        ERR("Failed to allocate texture memory.\n");
     733        return D3DERR_OUTOFVIDEOMEMORY;
     734    }
     735
     736    hr = texture_init(object, This, width, height, levels, usage, format, pool
     737#ifdef VBOXWDDM
     738        , shared_handle
     739        , pvClientMem
     740#endif
     741            );
     742    if (FAILED(hr))
     743    {
     744        WARN("Failed to initialize texture, hr %#x.\n", hr);
     745        HeapFree(GetProcessHeap(), 0, object);
     746        return hr;
     747    }
     748
     749    TRACE("Created texture %p.\n", object);
     750    *texture = (IDirect3DTexture9 *)object;
     751
     752    return D3D_OK;
     753}
     754#endif
     755
    715756static HRESULT WINAPI IDirect3DDevice9Impl_CreateTexture(IDirect3DDevice9Ex *iface,
    716757        UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format,
    717758        D3DPOOL pool, IDirect3DTexture9 **texture, HANDLE *shared_handle)
    718759{
     760#ifdef VBOXWDDM
     761    return VBoxWineExD3DDev9CreateTexture(iface, width, height, levels, usage, format,
     762            pool, texture, shared_handle, NULL);
     763#else
    719764    IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
    720765    IDirect3DTexture9Impl *object;
     
    743788
    744789    return D3D_OK;
     790#endif
    745791}
    746792
     
    873919}
    874920
    875 static HRESULT IDirect3DDevice9Impl_CreateSurface(LPDIRECT3DDEVICE9EX iface, UINT Width, UINT Height,
     921#ifdef VBOXWDDM
     922HRESULT VBoxWineExD3DDev9CreateSurface(LPDIRECT3DDEVICE9EX iface, UINT Width, UINT Height,
    876923        D3DFORMAT Format, BOOL Lockable, BOOL Discard, UINT Level, IDirect3DSurface9 **ppSurface,
    877         UINT Usage, D3DPOOL Pool, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality)
     924        UINT Usage, D3DPOOL Pool, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality
     925        , HANDLE *shared_handle
     926        , void *pvClientMem
     927        )
    878928{
    879929    IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
     
    894944
    895945    hr = surface_init(object, This, Width, Height, Format, Lockable, Discard,
    896             Level, Usage, Pool, MultiSample, MultisampleQuality);
     946            Level, Usage, Pool, MultiSample, MultisampleQuality,
     947            shared_handle, pvClientMem);
    897948    if (FAILED(hr))
    898949    {
     
    906957
    907958    return D3D_OK;
     959}
     960#endif
     961static HRESULT IDirect3DDevice9Impl_CreateSurface(LPDIRECT3DDEVICE9EX iface, UINT Width, UINT Height,
     962        D3DFORMAT Format, BOOL Lockable, BOOL Discard, UINT Level, IDirect3DSurface9 **ppSurface,
     963        UINT Usage, D3DPOOL Pool, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality)
     964{
     965#ifdef VBOXWDDM
     966    return VBoxWineExD3DDev9CreateSurface(iface, Width, Height, Format, Lockable, Discard, Level, ppSurface,
     967            Usage, Pool, MultiSample, MultisampleQuality, NULL, NULL);
     968#else
     969    IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
     970    IDirect3DSurface9Impl *object;
     971    HRESULT hr;
     972
     973    TRACE("iface %p, width %u, height %u, format %#x, lockable %#x, discard %#x, level %u, surface %p.\n"
     974            "usage %#x, pool %#x, multisample_type %#x, multisample_quality %u.\n",
     975            iface, Width, Height, Format, Lockable, Discard, Level, ppSurface,
     976            Usage, Pool, MultiSample, MultisampleQuality);
     977
     978    object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DSurface9Impl));
     979    if (!object)
     980    {
     981        FIXME("Failed to allocate surface memory.\n");
     982        return D3DERR_OUTOFVIDEOMEMORY;
     983    }
     984
     985    hr = surface_init(object, This, Width, Height, Format, Lockable, Discard,
     986            Level, Usage, Pool, MultiSample, MultisampleQuality);
     987    if (FAILED(hr))
     988    {
     989        WARN("Failed to initialize surface, hr %#x.\n", hr);
     990        HeapFree(GetProcessHeap(), 0, object);
     991        return hr;
     992    }
     993
     994    TRACE("Created surface %p.\n", object);
     995    *ppSurface = (IDirect3DSurface9 *)object;
     996
     997    return D3D_OK;
     998#endif
    908999}
    9091000
     
    26302721static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
    26312722        IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, DWORD usage,
    2632         WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
     2723        WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface
     2724#ifdef VBOXWDDM
     2725        , HANDLE *shared_handle
     2726        , void *pvClientMem
     2727#endif
     2728        )
    26332729{
    26342730    struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
     
    26442740        lockable = FALSE;
    26452741
     2742#ifdef VBOXWDDM
     2743    hr = VBoxWineExD3DDev9CreateSurface((IDirect3DDevice9Ex *)This, width, height,
     2744            d3dformat_from_wined3dformat(format), lockable, FALSE /* Discard */, level,
     2745            (IDirect3DSurface9 **)&d3d_surface, usage, pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */
     2746            , shared_handle
     2747            , pvClientMem
     2748            );
     2749
     2750#else
    26462751    hr = IDirect3DDevice9Impl_CreateSurface((IDirect3DDevice9Ex *)This, width, height,
    26472752            d3dformat_from_wined3dformat(format), lockable, FALSE /* Discard */, level,
    2648             (IDirect3DSurface9 **)&d3d_surface, usage, pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */);
     2753            (IDirect3DSurface9 **)&d3d_surface, usage, pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */
     2754            );
     2755#endif
    26492756    if (FAILED(hr))
    26502757    {
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/surface.c

    r25949 r30916  
    381381HRESULT surface_init(IDirect3DSurface9Impl *surface, IDirect3DDevice9Impl *device,
    382382        UINT width, UINT height, D3DFORMAT format, BOOL lockable, BOOL discard, UINT level,
    383         DWORD usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality)
     383        DWORD usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality
     384#ifdef VBOXWDDM
     385        , HANDLE *shared_handle
     386        , void *pvClientMem
     387#endif
     388        )
    384389{
    385390    HRESULT hr;
     
    412417
    413418    wined3d_mutex_lock();
     419#ifdef VBOXWDDM
     420    hr = IWineD3DDevice_CreateSurface(device->WineD3DDevice, width, height, wined3dformat_from_d3dformat(format),
     421            lockable, discard, level, &surface->wineD3DSurface, usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool,
     422            multisample_type, multisample_quality, SURFACE_OPENGL, (IUnknown *)surface,
     423            &d3d9_surface_wined3d_parent_ops
     424            , shared_handle
     425            , pvClientMem
     426            );
     427#else
    414428    hr = IWineD3DDevice_CreateSurface(device->WineD3DDevice, width, height, wined3dformat_from_d3dformat(format),
    415429            lockable, discard, level, &surface->wineD3DSurface, usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool,
    416430            multisample_type, multisample_quality, SURFACE_OPENGL, (IUnknown *)surface,
    417431            &d3d9_surface_wined3d_parent_ops);
     432#endif
    418433    wined3d_mutex_unlock();
    419434    if (FAILED(hr))
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/texture.c

    r25949 r30916  
    398398
    399399HRESULT texture_init(IDirect3DTexture9Impl *texture, IDirect3DDevice9Impl *device,
    400         UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool)
     400        UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool
     401#ifdef VBOXWDDM
     402        , HANDLE *shared_handle
     403        , void *pvClientMem
     404#endif
     405        )
    401406{
    402407    HRESULT hr;
     
    406411
    407412    wined3d_mutex_lock();
     413#ifdef VBOXWDDM
     414    hr = IWineD3DDevice_CreateTexture(device->WineD3DDevice, width, height, levels,
     415            usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool,
     416            &texture->wineD3DTexture, (IUnknown *)texture, &d3d9_texture_wined3d_parent_ops
     417            , shared_handle
     418            , pvClientMem);
     419#else
    408420    hr = IWineD3DDevice_CreateTexture(device->WineD3DDevice, width, height, levels,
    409421            usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool,
    410422            &texture->wineD3DTexture, (IUnknown *)texture, &d3d9_texture_wined3d_parent_ops);
     423#endif
     424
    411425    wined3d_mutex_unlock();
    412426    if (FAILED(hr))
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/include/wine/wined3d.h

    r28475 r30916  
    26892689        UINT level,
    26902690        WINED3DCUBEMAP_FACES face,
    2691         IWineD3DSurface **surface);
     2691        IWineD3DSurface **surface
     2692#ifdef VBOXWDDM
     2693        , HANDLE *shared_handle
     2694        , void *pvClientMem
     2695#endif
     2696        );
    26922697
    26932698    HRESULT (STDMETHODCALLTYPE *CreateRenderTarget)(
     
    27422747/*** IWineD3DDeviceParent methods ***/
    27432748#define IWineD3DDeviceParent_WineD3DDeviceCreated(This,device) (This)->lpVtbl->WineD3DDeviceCreated(This,device)
     2749#ifdef VBOXWDDM
     2750#define IWineD3DDeviceParent_CreateSurface(This,superior,width,height,format,usage,pool,level,face,surface,shared_handle,pvClientMem) (This)->lpVtbl->CreateSurface(This,superior,width,height,format,usage,pool,level,face,surface,shared_handle,pvClientMem)
     2751#else
    27442752#define IWineD3DDeviceParent_CreateSurface(This,superior,width,height,format,usage,pool,level,face,surface) (This)->lpVtbl->CreateSurface(This,superior,width,height,format,usage,pool,level,face,surface)
     2753#endif
    27452754#define IWineD3DDeviceParent_CreateRenderTarget(This,superior,width,height,format,multisample_type,multisample_quality,lockable,surface) (This)->lpVtbl->CreateRenderTarget(This,superior,width,height,format,multisample_type,multisample_quality,lockable,surface)
    27462755#define IWineD3DDeviceParent_CreateDepthStencilSurface(This,superior,width,height,format,multisample_type,multisample_quality,discard,surface) (This)->lpVtbl->CreateDepthStencilSurface(This,superior,width,height,format,multisample_type,multisample_quality,discard,surface)
     
    73567365        WINED3DSURFTYPE surface_type,
    73577366        IUnknown *parent,
    7358         const struct wined3d_parent_ops *parent_ops);
     7367        const struct wined3d_parent_ops *parent_ops
     7368#ifdef VBOXWDDM
     7369        , HANDLE *shared_handle
     7370        , void *pvClientMem
     7371#endif
     7372        );
    73597373
    73607374    HRESULT (STDMETHODCALLTYPE *CreateRendertargetView)(
     
    73747388        IWineD3DTexture **texture,
    73757389        IUnknown *parent,
    7376         const struct wined3d_parent_ops *parent_ops);
     7390        const struct wined3d_parent_ops *parent_ops
     7391#ifdef VBOXWDDM
     7392        , HANDLE *shared_handle
     7393        , void *pvClientMem
     7394#endif
     7395        );
    73777396
    73787397    HRESULT (STDMETHODCALLTYPE *CreateVolumeTexture)(
     
    80548073#define IWineD3DDevice_CreateIndexBuffer(This,length,usage,pool,index_buffer,parent,parent_ops) (This)->lpVtbl->CreateIndexBuffer(This,length,usage,pool,index_buffer,parent,parent_ops)
    80558074#define IWineD3DDevice_CreateStateBlock(This,type,stateblock,parent) (This)->lpVtbl->CreateStateBlock(This,type,stateblock,parent)
     8075#ifdef VBOXWDDM
     8076#define IWineD3DDevice_CreateSurface(This,width,height,format,lockable,discard,level,surface,usage,pool,multisample_type,multisample_quality,surface_type,parent,parent_ops,shared_handle,pvClientMem) (This)->lpVtbl->CreateSurface(This,width,height,format,lockable,discard,level,surface,usage,pool,multisample_type,multisample_quality,surface_type,parent,parent_ops,shared_handle,pvClientMem)
     8077#else
    80568078#define IWineD3DDevice_CreateSurface(This,width,height,format,lockable,discard,level,surface,usage,pool,multisample_type,multisample_quality,surface_type,parent,parent_ops) (This)->lpVtbl->CreateSurface(This,width,height,format,lockable,discard,level,surface,usage,pool,multisample_type,multisample_quality,surface_type,parent,parent_ops)
     8079#endif
    80578080#define IWineD3DDevice_CreateRendertargetView(This,resource,parent,rendertarget_view) (This)->lpVtbl->CreateRendertargetView(This,resource,parent,rendertarget_view)
     8081#ifdef VBOXWDDM
     8082#define IWineD3DDevice_CreateTexture(This,width,height,levels,usage,format,pool,texture,parent,parent_ops,shared_handle,pvClientMem) (This)->lpVtbl->CreateTexture(This,width,height,levels,usage,format,pool,texture,parent,parent_ops,shared_handle,pvClientMem)
     8083#else
    80588084#define IWineD3DDevice_CreateTexture(This,width,height,levels,usage,format,pool,texture,parent,parent_ops) (This)->lpVtbl->CreateTexture(This,width,height,levels,usage,format,pool,texture,parent,parent_ops)
     8085#endif
    80598086#define IWineD3DDevice_CreateVolumeTexture(This,width,height,depth,levels,usage,format,pool,texture,parent,parent_ops) (This)->lpVtbl->CreateVolumeTexture(This,width,height,depth,levels,usage,format,pool,texture,parent,parent_ops)
    80608087#define IWineD3DDevice_CreateVolume(This,width,height,depth,usage,format,pool,volume,parent,parent_ops) (This)->lpVtbl->CreateVolume(This,width,height,depth,usage,format,pool,volume,parent,parent_ops)
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/basetexture.c

    r28475 r30916  
    4444
    4545    hr = resource_init((IWineD3DResource *)texture, resource_type, device,
    46             size, usage, format_desc, pool, parent, parent_ops);
     46            size, usage, format_desc, pool, parent, parent_ops
     47#ifdef VBOXWDDM
     48            , NULL, NULL /* <- no need this info here */
     49#endif
     50            );
    4751    if (FAILED(hr))
    4852    {
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/buffer.c

    r28475 r30916  
    14731473
    14741474    hr = resource_init((IWineD3DResource *)buffer, WINED3DRTYPE_BUFFER,
    1475             device, size, usage, format_desc, pool, parent, parent_ops);
     1475            device, size, usage, format_desc, pool, parent, parent_ops
     1476#ifdef VBOXWDDM
     1477            , NULL, NULL /* <- no need this info here so far */
     1478#endif
     1479            );
    14761480    if (FAILED(hr))
    14771481    {
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/cubetexture.c

    r28475 r30916  
    535535            };
    536536
     537#ifdef VBOXWDDM
    537538            hr = IWineD3DDeviceParent_CreateSurface(device->device_parent, parent, tmp_w, tmp_w,
    538                     format, usage, pool, i /* Level */, j, &texture->surfaces[j][i]);
     539                    format, usage, pool, i /* Level */, j, &texture->surfaces[j][i]
     540                    , NULL, NULL /* <- no need this info here */
     541                );
     542#else
     543            hr = IWineD3DDeviceParent_CreateSurface(device->device_parent, parent, tmp_w, tmp_w,
     544                    format, usage, pool, i /* Level */, j, &texture->surfaces[j][i]
     545                );
     546#endif
    539547            if (FAILED(hr))
    540548            {
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/device.c

    r28475 r30916  
    802802        WINED3DFORMAT Format, BOOL Lockable, BOOL Discard, UINT Level, IWineD3DSurface **ppSurface,
    803803        DWORD Usage, WINED3DPOOL Pool, WINED3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality,
    804         WINED3DSURFTYPE Impl, IUnknown *parent, const struct wined3d_parent_ops *parent_ops)
     804        WINED3DSURFTYPE Impl, IUnknown *parent, const struct wined3d_parent_ops *parent_ops
     805#ifdef VBOXWDDM
     806        , HANDLE *shared_handle
     807        , void *pvClientMem
     808#endif
     809        )
    805810{
    806811    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
     
    828833
    829834    hr = surface_init(object, Impl, This->surface_alignment, Width, Height, Level, Lockable,
    830             Discard, MultiSample, MultisampleQuality, This, Usage, Format, Pool, parent, parent_ops);
     835            Discard, MultiSample, MultisampleQuality, This, Usage, Format, Pool, parent, parent_ops
     836#ifdef VBOXWDDM
     837            , shared_handle
     838            , pvClientMem
     839#endif
     840            );
    831841    if (FAILED(hr))
    832842    {
     
    868878static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface,
    869879        UINT Width, UINT Height, UINT Levels, DWORD Usage, WINED3DFORMAT Format, WINED3DPOOL Pool,
    870         IWineD3DTexture **ppTexture, IUnknown *parent, const struct wined3d_parent_ops *parent_ops)
     880        IWineD3DTexture **ppTexture, IUnknown *parent, const struct wined3d_parent_ops *parent_ops
     881#ifdef VBOXWDDM
     882        , HANDLE *shared_handle
     883        , void *pvClientMem
     884#endif
     885        )
    871886{
    872887    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
     
    886901    }
    887902
    888     hr = texture_init(object, Width, Height, Levels, This, Usage, Format, Pool, parent, parent_ops);
     903    hr = texture_init(object, Width, Height, Levels, This, Usage, Format, Pool, parent, parent_ops
     904#ifdef VBOXWDDM
     905            , shared_handle
     906            , pvClientMem
     907#endif
     908            );
    889909    if (FAILED(hr))
    890910    {
     
    14201440    }
    14211441
     1442#ifdef VBOXWDDM
     1443    hr = IWineD3DDevice_CreateSurface((IWineD3DDevice *)This, bm.bmWidth, bm.bmHeight, WINED3DFMT_B5G6R5_UNORM, TRUE,
     1444            FALSE, 0, &This->logo_surface, 0, WINED3DPOOL_DEFAULT, WINED3DMULTISAMPLE_NONE, 0, SURFACE_OPENGL,
     1445            NULL, &wined3d_null_parent_ops, NULL, NULL);
     1446#else
    14221447    hr = IWineD3DDevice_CreateSurface((IWineD3DDevice *)This, bm.bmWidth, bm.bmHeight, WINED3DFMT_B5G6R5_UNORM, TRUE,
    14231448            FALSE, 0, &This->logo_surface, 0, WINED3DPOOL_DEFAULT, WINED3DMULTISAMPLE_NONE, 0, SURFACE_OPENGL,
    14241449            NULL, &wined3d_null_parent_ops);
     1450#endif
    14251451    if(FAILED(hr)) {
    14261452        ERR("Wine logo requested, but failed to create surface\n");
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/resource.c

    r28475 r30916  
    3939HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type,
    4040        IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format_desc *format_desc,
    41         WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops)
     41        WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops
     42#ifdef VBOXWDDM
     43        , HANDLE *shared_handle
     44        , void *pvClientMem
     45#endif
     46        )
    4247{
    4348    struct IWineD3DResourceClass *resource = &((IWineD3DResourceImpl *)iface)->resource;
     
    5560    list_init(&resource->privateData);
    5661
    57     if (size)
    58     {
    59         resource->heapMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + RESOURCE_ALIGNMENT);
    60         if (!resource->heapMemory)
    61         {
    62             ERR("Out of memory!\n");
    63             return WINED3DERR_OUTOFVIDEOMEMORY;
    64         }
     62#ifdef VBOXWDDM
     63    if (pool == WINED3DPOOL_SYSTEMMEM && pvClientMem)
     64    {
     65        resource->allocatedMemory = pvClientMem;
     66        resource->heapMemory = NULL;
    6567    }
    6668    else
    67     {
    68         resource->heapMemory = NULL;
    69     }
    70     resource->allocatedMemory = (BYTE *)(((ULONG_PTR)resource->heapMemory + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1));
     69#endif
     70    {
     71        if (size)
     72        {
     73            resource->heapMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + RESOURCE_ALIGNMENT);
     74            if (!resource->heapMemory)
     75            {
     76                ERR("Out of memory!\n");
     77                return WINED3DERR_OUTOFVIDEOMEMORY;
     78            }
     79        }
     80        else
     81        {
     82            resource->heapMemory = NULL;
     83        }
     84        resource->allocatedMemory = (BYTE *)(((ULONG_PTR)resource->heapMemory + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1));
     85    }
    7186
    7287    /* Check that we have enough video ram left */
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/surface.c

    r28475 r30916  
    356356        UINT width, UINT height, UINT level, BOOL lockable, BOOL discard, WINED3DMULTISAMPLE_TYPE multisample_type,
    357357        UINT multisample_quality, IWineD3DDeviceImpl *device, DWORD usage, WINED3DFORMAT format,
    358         WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops)
     358        WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops
     359#ifdef VBOXWDDM
     360        , HANDLE *shared_handle
     361        , void *pvClientMem
     362#endif
     363        )
    359364{
    360365    const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
     
    393398
    394399    hr = resource_init((IWineD3DResource *)surface, WINED3DRTYPE_SURFACE,
    395             device, resource_size, usage, format_desc, pool, parent, parent_ops);
     400            device, resource_size, usage, format_desc, pool, parent, parent_ops
     401#ifdef VBOXWDDM
     402            , shared_handle
     403            , pvClientMem
     404#endif
     405            );
    396406    if (FAILED(hr))
    397407    {
     
    412422    /* Flags */
    413423    surface->Flags = SFLAG_NORMCOORD; /* Default to normalized coords. */
     424#ifdef VBOXWDDM
     425    if (pool == WINED3DPOOL_SYSTEMMEM && pvClientMem)  surface->Flags |= SFLAG_CLIENTMEM;
     426#endif
    414427    if (discard) surface->Flags |= SFLAG_DISCARD;
    415428    if (lockable || format == WINED3DFMT_D16_LOCKABLE) surface->Flags |= SFLAG_LOCKABLE;
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/surface_base.c

    r28475 r30916  
    849849    }
    850850
     851#ifdef VBOXWDDM
     852    IWineD3DDevice_CreateSurface((IWineD3DDevice *)source->resource.device, source->currentDesc.Width,
     853            source->currentDesc.Height, to_fmt, TRUE /* lockable */, TRUE /* discard  */, 0 /* level */, &ret,
     854            0 /* usage */, WINED3DPOOL_SCRATCH, WINED3DMULTISAMPLE_NONE /* TODO: Multisampled conversion */,
     855            0 /* MultiSampleQuality */, IWineD3DSurface_GetImplType((IWineD3DSurface *) source),
     856            NULL /* parent */, &wined3d_null_parent_ops, NULL, NULL);
     857#else
    851858    IWineD3DDevice_CreateSurface((IWineD3DDevice *)source->resource.device, source->currentDesc.Width,
    852859            source->currentDesc.Height, to_fmt, TRUE /* lockable */, TRUE /* discard  */, 0 /* level */, &ret,
     
    854861            0 /* MultiSampleQuality */, IWineD3DSurface_GetImplType((IWineD3DSurface *) source),
    855862            NULL /* parent */, &wined3d_null_parent_ops);
     863#endif
     864
    856865    if(!ret) {
    857866        ERR("Failed to create a destination surface for conversion\n");
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/texture.c

    r28475 r30916  
    441441HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT levels,
    442442        IWineD3DDeviceImpl *device, DWORD usage, WINED3DFORMAT format, WINED3DPOOL pool,
    443         IUnknown *parent, const struct wined3d_parent_ops *parent_ops)
     443        IUnknown *parent, const struct wined3d_parent_ops *parent_ops
     444#ifdef VBOXWDDM
     445        , HANDLE *shared_handle
     446        , void *pvClientMem
     447#endif
     448        )
    444449{
    445450    const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
     
    577582    for (i = 0; i < texture->baseTexture.levels; ++i)
    578583    {
     584#ifdef VBOXWDDM
     585        /* Use the callback to create the texture surface. */
     586        hr = IWineD3DDeviceParent_CreateSurface(device->device_parent, parent, tmp_w, tmp_h, format_desc->format,
     587                usage, pool, i, WINED3DCUBEMAP_FACE_POSITIVE_X, &texture->surfaces[i]
     588                , shared_handle
     589                , pvClientMem);
     590
     591#else
    579592        /* Use the callback to create the texture surface. */
    580593        hr = IWineD3DDeviceParent_CreateSurface(device->device_parent, parent, tmp_w, tmp_h, format_desc->format,
    581594                usage, pool, i, WINED3DCUBEMAP_FACE_POSITIVE_X, &texture->surfaces[i]);
     595#endif
     596
    582597        if (FAILED(hr))
    583598        {
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/volume.c

    r28475 r30916  
    408408
    409409    hr = resource_init((IWineD3DResource *)volume, WINED3DRTYPE_VOLUME, device,
    410             width * height * depth * format_desc->byte_count, usage, format_desc, pool, parent, parent_ops);
     410            width * height * depth * format_desc->byte_count, usage, format_desc, pool, parent, parent_ops
     411#ifdef VBOXWDDM
     412            , NULL, NULL
     413#endif
     414            );
    411415    if (FAILED(hr))
    412416    {
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_private.h

    r28475 r30916  
    18241824HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type,
    18251825        IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format_desc *format_desc,
    1826         WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
     1826        WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops
     1827#ifdef VBOXWDDM
     1828        , HANDLE *shared_handle
     1829        , void *pvClientMem
     1830#endif
     1831        ) DECLSPEC_HIDDEN;
    18271832WINED3DRESOURCETYPE resource_get_type(IWineD3DResource *iface) DECLSPEC_HIDDEN;
    18281833DWORD resource_set_priority(IWineD3DResource *iface, DWORD new_priority) DECLSPEC_HIDDEN;
     
    19421947HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT levels,
    19431948        IWineD3DDeviceImpl *device, DWORD usage, WINED3DFORMAT format, WINED3DPOOL pool,
    1944         IUnknown *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
     1949        IUnknown *parent, const struct wined3d_parent_ops *parent_ops
     1950#ifdef VBOXWDDM
     1951        , HANDLE *shared_handle
     1952        , void *pvClientMem
     1953#endif
     1954        ) DECLSPEC_HIDDEN;
    19451955
    19461956/*****************************************************************************
     
    21312141        UINT width, UINT height, UINT level, BOOL lockable, BOOL discard, WINED3DMULTISAMPLE_TYPE multisample_type,
    21322142        UINT multisample_quality, IWineD3DDeviceImpl *device, DWORD usage, WINED3DFORMAT format,
    2133         WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
     2143        WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops
     2144#ifdef VBOXWDDM
     2145        , HANDLE *shared_handle
     2146        , void *pvClientMem
     2147#endif
     2148        ) DECLSPEC_HIDDEN;
    21342149
    21352150/* Predeclare the shared Surface functions */
     
    22132228#define SFLAG_SWAPCHAIN     0x01000000 /* The surface is part of a swapchain */
    22142229
     2230#ifdef VBOXWDDM
     2231# define SFLAG_CLIENTMEM     0x10000000 /* SYSMEM surface using client-supplied memory buffer */
     2232
     2233# define SFLAG_DONOTFREE_VBOXWDDM SFLAG_CLIENTMEM
     2234#else
     2235# define SFLAG_DONOTFREE_VBOXWDDM 0
     2236#endif
     2237
    22152238/* In some conditions the surface memory must not be freed:
    22162239 * SFLAG_CONVERTED: Converting the data back would take too long
     
    22272250                             SFLAG_USERPTR    | \
    22282251                             SFLAG_PBO        | \
    2229                              SFLAG_CLIENT)
     2252                             SFLAG_CLIENT     | \
     2253                             SFLAG_DONOTFREE_VBOXWDDM \
     2254                             )
    22302255
    22312256#define SFLAG_LOCATIONS     (SFLAG_INSYSMEM   | \
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette