VirtualBox

Changeset 31828 in vbox for trunk


Ignore:
Timestamp:
Aug 20, 2010 5:12:14 PM (14 years ago)
Author:
vboxsync
Message:

wine: basics for shared resource handling

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/basetexture.c

    r30916 r31828  
    3939HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT levels, 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    HRESULT hr;
     
    4651            size, usage, format_desc, pool, parent, parent_ops
    4752#ifdef VBOXWDDM
    48             , NULL, NULL /* <- no need this info here */
     53            , shared_handle, pvClientMem
    4954#endif
    5055            );
     
    262267    if (gl_tex->name == 0) {
    263268        *set_surface_desc = TRUE;
    264         glGenTextures(1, &gl_tex->name);
     269#ifdef VBOXWDDM
     270        if (VBOXSHRC_IS_SHARED_OPENED(This))
     271        {
     272            gl_tex->name = VBOXSHRC_GET_SHAREHANDLE(This);
     273        }
     274        else
     275#endif
     276        {
     277            glGenTextures(1, &gl_tex->name);
     278#ifdef VBOXWDDM
     279            if (VBOXSHRC_IS_SHARED(This))
     280            {
     281                VBOXSHRC_SET_SHAREHANDLE(This, gl_tex->name);
     282            }
     283#endif
     284        }
    265285        checkGLcall("glGenTextures");
    266286        TRACE("Generated texture %d\n", gl_tex->name);
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/context.c

    r30719 r31828  
    15081508        GL_EXTCALL(glProvokingVertexEXT(GL_FIRST_VERTEX_CONVENTION_EXT));
    15091509    }
     1510
     1511#ifdef VBOXWDDM
     1512    GL_EXTCALL(glChromiumParameteriCR(GL_SHARE_CONTEXT_RESOURCES_CR, GL_TRUE));
     1513#endif
    15101514
    15111515    LEAVE_GL();
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/cubetexture.c

    r30916 r31828  
    489489
    490490    hr = basetexture_init((IWineD3DBaseTextureImpl *)texture, levels, WINED3DRTYPE_CUBETEXTURE,
    491             device, 0, usage, format_desc, pool, parent, parent_ops);
     491            device, 0, usage, format_desc, pool, parent, parent_ops
     492#ifdef VBOXWDDM
     493        , NULL
     494        , NULL
     495#endif
     496            );
    492497    if (FAILED(hr))
    493498    {
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/directx.c

    r29452 r31828  
    21822182    gl_info->supported[WINED3D_GL_EXT_NONE] = TRUE;
    21832183
     2184#ifdef VBOXWDDM
     2185    gl_info->supported[VBOX_SHARED_CONTEXTS] = TRUE;
     2186#endif
     2187
    21842188    while (*GL_Extensions)
    21852189    {
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/resource.c

    r30916 r31828  
    6666        resource->heapMemory = NULL;
    6767    }
     68    else if (pool == WINED3DPOOL_DEFAULT && shared_handle)
     69    {
     70        resource->allocatedMemory = NULL;
     71        resource->heapMemory = NULL;
     72        resource->sharerc_handle = shared_handle;
     73        resource->sharerc_flags = VBOXSHRC_F_SHARED;
     74        if (*shared_handle)
     75            resource->sharerc_flags |= VBOXSHRC_F_SHARED_OPENED;
     76    }
    6877    else
    6978#endif
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/surface.c

    r30916 r31828  
    482482        return hr;
    483483    }
     484#ifdef VBOXWDDM
     485    if (shared_handle && !*shared_handle)
     486    {
     487        *shared_handle = VBOXSHRC_GET_SHAREHANDLE(surface);
     488    }
     489#endif
    484490
    485491    return hr;
     
    521527    }
    522528
     529#ifdef VBOXWDDM
     530    if (VBOXSHRC_IS_SHARED(This))
     531    {
     532        VBOXSHRC_SET_SHAREHANDLE(This, new_name);
     533    }
     534#endif
    523535    *name = new_name;
    524536    surface_force_reload(iface);
     
    979991}
    980992
     993#ifdef VBOXWDDM
     994static HRESULT WINAPI IWineD3DSurfaceImpl_LoadLocation(IWineD3DSurface *iface, DWORD flag, const RECT *rect);
     995#endif
     996
    981997/* Slightly inefficient way to handle multiple dirty rects but it works :) */
    982998void surface_add_dirty_rect(IWineD3DSurface *iface, const RECT *dirty_rect)
     
    9851001    IWineD3DBaseTexture *baseTexture = NULL;
    9861002
    987     if (!(This->Flags & SFLAG_INSYSMEM) && (This->Flags & SFLAG_INTEXTURE))
    988         IWineD3DSurface_LoadLocation(iface, SFLAG_INSYSMEM, NULL /* no partial locking for textures yet */);
    989 
    990     IWineD3DSurface_ModifyLocation(iface, SFLAG_INSYSMEM, TRUE);
     1003#ifdef VBOXWDDM
     1004    if (VBOXSHRC_IS_SHARED(This))
     1005    {
     1006        if (!VBOXSHRC_IS_SHARED_OPENED(This))
     1007            IWineD3DSurfaceImpl_LoadLocation(iface, SFLAG_INTEXTURE, NULL);
     1008        else
     1009            This->Flags |= SFLAG_INTEXTURE;
     1010    }
     1011    else
     1012#endif
     1013    {
     1014        if (!(This->Flags & SFLAG_INSYSMEM) && (This->Flags & SFLAG_INTEXTURE))
     1015            IWineD3DSurface_LoadLocation(iface, SFLAG_INSYSMEM, NULL /* no partial locking for textures yet */);
     1016
     1017        IWineD3DSurface_ModifyLocation(iface, SFLAG_INSYSMEM, TRUE);
     1018    }
     1019
    9911020    if (dirty_rect)
    9921021    {
     
    26012630        {
    26022631            if (!*name) {
    2603                 glGenTextures(1, name);
     2632#ifdef VBOXWDDM
     2633                if (VBOXSHRC_IS_SHARED_OPENED(This))
     2634                {
     2635                    *name = VBOXSHRC_GET_SHAREHANDLE(This);
     2636                }
     2637                else
     2638#endif
     2639                {
     2640                    glGenTextures(1, name);
     2641#ifdef VBOXWDDM
     2642                    if (VBOXSHRC_IS_SHARED(This))
     2643                    {
     2644                        VBOXSHRC_SET_SHAREHANDLE(This, *name);
     2645                    }
     2646#endif
     2647                }
    26042648                checkGLcall("glGenTextures");
    26052649                TRACE("Surface %p given name %d\n", This, *name);
     
    40224066    }
    40234067
    4024     This->Flags |= SFLAG_INSYSMEM;
     4068#ifdef VBOXWDDM
     4069    if (!VBOXSHRC_IS_SHARED(This))
     4070#endif
     4071    {
     4072        This->Flags |= SFLAG_INSYSMEM;
     4073    }
    40254074
    40264075    return WINED3D_OK;
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/texture.c

    r30916 r31828  
    513513
    514514    hr = basetexture_init((IWineD3DBaseTextureImpl *)texture, levels, WINED3DRTYPE_TEXTURE,
    515             device, 0, usage, format_desc, pool, parent, parent_ops);
     515            device, 0, usage, format_desc, pool, parent, parent_ops
     516#ifdef VBOXWDDM
     517            , shared_handle, pvClientMem
     518#endif
     519        );
    516520    if (FAILED(hr))
    517521    {
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/volumetexture.c

    r28475 r31828  
    410410
    411411    hr = basetexture_init((IWineD3DBaseTextureImpl *)texture, levels, WINED3DRTYPE_VOLUMETEXTURE,
    412             device, 0, usage, format_desc, pool, parent, parent_ops);
     412            device, 0, usage, format_desc, pool, parent, parent_ops
     413#ifdef VBOXWDDM
     414        , NULL, NULL
     415#endif
     416            );
    413417    if (FAILED(hr))
    414418    {
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_gl.h

    r28475 r31828  
    18421842    WGL_ARB_PIXEL_FORMAT,
    18431843    WGL_WINE_PIXEL_FORMAT_PASSTHROUGH,
     1844
     1845#ifdef VBOXWDDM
     1846    VBOX_SHARED_CONTEXTS,
     1847#endif
    18441848    /* Internally used */
    18451849    WINE_NORMALIZED_TEXRECT,
     
    37683772typedef BOOL (WINAPI *WINED3D_PFNWGLSETPIXELFORMATWINE)(HDC hdc, int iPixelFormat,
    37693773        const PIXELFORMATDESCRIPTOR *ppfd);
     3774
     3775#ifdef VBOXWDDM
     3776#define GL_SHARE_CONTEXT_RESOURCES_CR 0x8B27
     3777typedef void (WINE_GLAPI *PGLFNCHROMIUMPARAMETERUCR)(GLenum param, GLint value);
     3778
     3779# define VBOXWDDM_GL_EXT_FUNCS_GEN \
     3780        USE_GL_FUNC(PGLFNCHROMIUMPARAMETERUCR, \
     3781                glChromiumParameteriCR,                VBOX_SHARED_CONTEXTS,            NULL) \
     3782
     3783#else
     3784# define VBOXWDDM_GL_EXT_FUNCS_GEN
     3785#endif
    37703786
    37713787#define GL_EXT_FUNCS_GEN \
     
    44944510            glXGetVideoSyncSGI,                         SGI_VIDEO_SYNC,                 NULL) \
    44954511    USE_GL_FUNC(PGLXFNWAITVIDEOSYNCSGIPROC, \
    4496             glXWaitVideoSyncSGI,                        SGI_VIDEO_SYNC,                 NULL)
     4512            glXWaitVideoSyncSGI,                        SGI_VIDEO_SYNC,                 NULL) \
     4513    VBOXWDDM_GL_EXT_FUNCS_GEN
    44974514
    44984515#define WGL_EXT_FUNCS_GEN \
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_private.h

    r30916 r31828  
    5353#include "wine/list.h"
    5454#include "wine/rbtree.h"
     55
     56#ifdef VBOXWDDM
     57# include "vboxsharedrc.h"
     58#endif
    5559
    5660/* Driver quirks */
     
    18041808    BYTE                   *allocatedMemory; /* Pointer to the real data location */
    18051809    BYTE                   *heapMemory; /* Pointer to the HeapAlloced block of memory */
     1810#ifdef VBOXWDDM
     1811    DWORD                   sharerc_flags; /* shared resource flags */
     1812    DWORD                   sharerc_handle;
     1813#endif
    18061814    struct list             privateData;
    18071815    struct list             resource_list_entry;
     
    19211929HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT levels, WINED3DRESOURCETYPE resource_type,
    19221930        IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format_desc *format_desc,
    1923         WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
     1931        WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops
     1932#ifdef VBOXWDDM
     1933        , HANDLE *shared_handle
     1934        , void *pvClientMem
     1935#endif
     1936        ) DECLSPEC_HIDDEN;
    19241937HRESULT basetexture_set_autogen_filter_type(IWineD3DBaseTexture *iface,
    19251938        WINED3DTEXTUREFILTERTYPE filter_type) DECLSPEC_HIDDEN;
     
    22302243#ifdef VBOXWDDM
    22312244# define SFLAG_CLIENTMEM     0x10000000 /* SYSMEM surface using client-supplied memory buffer */
    2232 
    22332245# define SFLAG_DONOTFREE_VBOXWDDM SFLAG_CLIENTMEM
    22342246#else
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