VirtualBox

Ignore:
Timestamp:
Jul 19, 2010 8:32:01 PM (14 years ago)
Author:
vboxsync
Message:

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

Location:
trunk/src/VBox/Additions/WINNT/Graphics/Wine
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • 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   | \
Note: See TracChangeset for help on using the changeset viewer.

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