VirtualBox

Ignore:
Timestamp:
Aug 24, 2010 4:52:58 PM (14 years ago)
Author:
vboxsync
Message:

wine: shared rc support more impl + fixes

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

Legend:

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

    r31828 r31936  
    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     }
    7768    else
    7869#endif
    7970    {
     71#ifdef VBOXWDDM
     72        if (pool == WINED3DPOOL_DEFAULT && shared_handle)
     73        {
     74            resource->sharerc_handle = *shared_handle;
     75            resource->sharerc_flags = VBOXSHRC_F_SHARED;
     76            if (*shared_handle)
     77                resource->sharerc_flags |= VBOXSHRC_F_SHARED_OPENED;
     78        }
     79#endif
    8080        if (size)
    8181        {
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/surface.c

    r31828 r31936  
    495495{
    496496    IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
     497
     498#if defined(DEBUG_misha) && defined (VBOXWDDM)
     499    if (VBOXSHRC_IS_SHARED(This))
     500    {
     501        Assert(0);
     502    }
     503#endif
    497504
    498505    This->Flags &= ~(SFLAG_ALLOCATED | SFLAG_SRGBALLOCATED);
     
    887894    }
    888895
    889     if (format_desc->Flags & WINED3DFMT_FLAG_COMPRESSED && mem)
    890     {
    891         GL_EXTCALL(glCompressedTexImage2DARB(This->texture_target, This->texture_level,
    892                 internal, width, height, 0, This->resource.size, mem));
    893     }
    894     else
    895     {
    896         glTexImage2D(This->texture_target, This->texture_level,
    897                 internal, width, height, 0, format_desc->glFormat, format_desc->glType, mem);
    898         checkGLcall("glTexImage2D");
     896#ifdef VBOXWDDM
     897    if (!VBOXSHRC_IS_SHARED_OPENED(This))
     898#endif
     899    {
     900        if (format_desc->Flags & WINED3DFMT_FLAG_COMPRESSED && mem)
     901        {
     902            GL_EXTCALL(glCompressedTexImage2DARB(This->texture_target, This->texture_level,
     903                    internal, width, height, 0, This->resource.size, mem));
     904        }
     905        else
     906        {
     907            glTexImage2D(This->texture_target, This->texture_level,
     908                    internal, width, height, 0, format_desc->glFormat, format_desc->glType, mem);
     909            checkGLcall("glTexImage2D");
     910        }
    899911    }
    900912
     
    10011013    IWineD3DBaseTexture *baseTexture = NULL;
    10021014
    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     }
     1015    if (!(This->Flags & SFLAG_INSYSMEM) && (This->Flags & SFLAG_INTEXTURE))
     1016        IWineD3DSurface_LoadLocation(iface, SFLAG_INSYSMEM, NULL /* no partial locking for textures yet */);
     1017
     1018    IWineD3DSurface_ModifyLocation(iface, SFLAG_INSYSMEM, TRUE);
    10191019
    10201020    if (dirty_rect)
     
    39823982}
    39833983
     3984#ifdef VBOXWDDM
     3985static HRESULT WINAPI IWineD3DSurfaceImpl_LoadLocation(IWineD3DSurface *iface, DWORD flag, const RECT *rect);
     3986#endif
     3987
    39843988static HRESULT WINAPI IWineD3DSurfaceImpl_PrivateSetup(IWineD3DSurface *iface) {
    39853989    /** Check against the maximum texture sizes supported by the video card **/
     
    40664070    }
    40674071
    4068 #ifdef VBOXWDDM
    4069     if (!VBOXSHRC_IS_SHARED(This))
    4070 #endif
    4071     {
    4072         This->Flags |= SFLAG_INSYSMEM;
    4073     }
     4072    This->Flags |= SFLAG_INSYSMEM;
    40744073
    40754074    return WINED3D_OK;
     
    42814280        if(((This->Flags & SFLAG_INTEXTURE) && !(flag & SFLAG_INTEXTURE)) ||
    42824281           ((This->Flags & SFLAG_INSRGBTEX) && !(flag & SFLAG_INSRGBTEX))) {
     4282#ifdef VBOXWDDM
     4283            if (VBOXSHRC_IS_SHARED(This))
     4284            {
     4285                IWineD3DSurfaceImpl_LoadLocation(iface, SFLAG_INTEXTURE, NULL);
     4286            }
     4287            else
     4288#endif
    42834289            if (IWineD3DSurface_GetContainer(iface, &IID_IWineD3DBaseTexture, (void **)&texture) == WINED3D_OK) {
    42844290                TRACE("Passing to container\n");
     
    42984304    } else {
    42994305        if((This->Flags & (SFLAG_INTEXTURE | SFLAG_INSRGBTEX)) && (flag & (SFLAG_INTEXTURE | SFLAG_INSRGBTEX))) {
     4306#ifdef VBOXWDDM
     4307            if (VBOXSHRC_IS_SHARED(This))
     4308            {
     4309                IWineD3DSurfaceImpl_LoadLocation(iface, SFLAG_INTEXTURE, NULL);
     4310            }
     4311            else
     4312#endif
    43004313            if (IWineD3DSurface_GetContainer(iface, &IID_IWineD3DBaseTexture, (void **)&texture) == WINED3D_OK) {
    43014314                TRACE("Passing to container\n");
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/texture.c

    r31828 r31936  
    616616    texture->baseTexture.internal_preload = texture_internal_preload;
    617617
     618#ifdef VBOXWDDM
     619    if (VBOXSHRC_IS_SHARED(texture))
     620    {
     621        Assert(shared_handle);
     622        IWineD3DSurface_LoadLocation(texture->surfaces[0], SFLAG_INTEXTURE, NULL);
     623        if (!VBOXSHRC_IS_SHARED_OPENED(texture))
     624        {
     625            Assert(!(*shared_handle));
     626            *shared_handle = VBOXSHRC_GET_SHAREHANDLE(texture);
     627        }
     628        else
     629        {
     630            Assert(*shared_handle);
     631        }
     632#ifdef DEBUG
     633        for (i = 0; i < texture->baseTexture.levels; ++i)
     634        {
     635            Assert((*shared_handle) == ((IWineD3DSurfaceImpl*)texture->surfaces[i])->texture_name);
     636        }
     637#endif
     638    }
     639    else
     640    {
     641        Assert(!shared_handle);
     642    }
     643#endif
     644
    618645    return WINED3D_OK;
    619646}
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/vboxsharedrc.h

    r31884 r31936  
    2626#define VBOXSHRC_IS_SHARED_OPENED(_o) (!!(VBOXSHRC_GET_SHAREFLAFS(_o) & VBOXSHRC_F_SHARED_OPENED))
    2727
     28#ifdef DEBUG_misha
     29/* just for simplicity */
     30#define AssertBreakpoint() do { __asm {int 3} } while (0)
     31#define Assert(_expr) do { \
     32        if (!(_expr)) AssertBreakpoint(); \
     33    } while (0)
     34#else
     35#define AssertBreakpoint() do { } while (0)
     36#define Assert(_expr) do { } while (0)
     37#endif
     38
    2839#endif /* #ifndef ___vboxsharedrc_h___ */
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