VirtualBox

Ignore:
Timestamp:
Sep 16, 2010 6:11:27 PM (14 years ago)
Author:
vboxsync
Message:

wddm/3d: aero working on win7 (window contents still corrupted)

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

Legend:

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

    r32546 r32577  
    855855    context_validate(context
    856856#ifdef VBOXWDDM/* tmp work-around */
    857             , context->device->swapchains[context->device->NumberOfSwapChains-1]
     857            , (IWineD3DSwapChainImpl*)context->device->swapchains[context->device->NumberOfSwapChains-1]
    858858#endif
    859859            );
     
    12931293    HDC hdc;
    12941294
     1295#if defined(VBOXWDDM) && defined(DEBUG_misha)
     1296    Assert(0);
     1297#endif
     1298
    12951299    TRACE("swapchain %p, target %p, window %p.\n", swapchain, target, swapchain->win_handle);
    12961300
     
    15921596#ifdef VBOXWDDM
    15931597static void context_setup_target(IWineD3DDeviceImpl *device, struct wined3d_context *context, IWineD3DSurface *target);
     1598static void context_apply_state(struct wined3d_context *context, IWineD3DDeviceImpl *device, enum ContextUsage usage);
     1599
     1600BOOL context_acquire_context(struct wined3d_context * context, IWineD3DSurface *target, enum ContextUsage usage, BOOL bReValidate)
     1601{
     1602    IWineD3DDeviceImpl *device = context->device;
     1603    struct wined3d_context *current_context = context_get_current();
     1604    if (bReValidate)
     1605    {
     1606        IWineD3DSwapChain *swapchain = NULL;
     1607        if (target && SUCCEEDED(IWineD3DSurface_GetContainer(target, &IID_IWineD3DSwapChain, (void **)&swapchain))) {
     1608            context_validate(current_context, (IWineD3DSwapChainImpl*)swapchain);
     1609            IWineD3DSwapChain_Release(swapchain);
     1610        }
     1611        else {
     1612                                                                                                    /* tmp work-around */
     1613            context_validate(current_context, (IWineD3DSwapChainImpl*)current_context->device->swapchains[current_context->device->NumberOfSwapChains-1]);
     1614        }
     1615    }
     1616    context_setup_target(device, context, target);
     1617    context_enter(context);
     1618    Assert(context->valid);
     1619    if (!context->valid) return FALSE;
     1620
     1621    if (context != current_context)
     1622    {
     1623        if (!context_set_current(context)) ERR("Failed to activate the new context.\n");
     1624        else device->frag_pipe->enable_extension((IWineD3DDevice *)device, !context->last_was_blit);
     1625
     1626        if (context->vshader_const_dirty)
     1627        {
     1628            memset(context->vshader_const_dirty, 1,
     1629                    sizeof(*context->vshader_const_dirty) * device->d3d_vshader_constantF);
     1630            device->highest_dirty_vs_const = device->d3d_vshader_constantF;
     1631        }
     1632        if (context->pshader_const_dirty)
     1633        {
     1634            memset(context->pshader_const_dirty, 1,
     1635                   sizeof(*context->pshader_const_dirty) * device->d3d_pshader_constantF);
     1636            device->highest_dirty_ps_const = device->d3d_pshader_constantF;
     1637        }
     1638    }
     1639    else if (context->restore_ctx)
     1640    {
     1641        if (!pwglMakeCurrent(context->hdc, context->glCtx))
     1642        {
     1643            DWORD err = GetLastError();
     1644            ERR("Failed to make GL context %p current on device context %p, last error %#x.\n",
     1645                    context->hdc, context->glCtx, err);
     1646        }
     1647    }
     1648
     1649    context_apply_state(context, device, usage);
     1650
     1651    return TRUE;
     1652}
    15941653
    15951654struct wined3d_context *context_find_create(IWineD3DDeviceImpl *device, IWineD3DSwapChainImpl *swapchain, IWineD3DSurfaceImpl *target,
    15961655        const struct wined3d_format_desc *ds_format_desc)
    15971656{
    1598     int i;
     1657    UINT i;
    15991658    DWORD tid = GetCurrentThreadId();
    16001659    struct wined3d_context *context = NULL;
     
    16191678    else
    16201679    {
    1621         context_validate(context, swapchain);
    1622         context_setup_target(device, context, target);
    1623         context_enter(context);
    1624         Assert(context->valid);
     1680        if(!context_acquire_context(context, (IWineD3DSurface*)target, CTXUSAGE_RESOURCELOAD, TRUE))
     1681        {
     1682            ERR("Failed to acquire the context.\n");
     1683            Assert(0);
     1684            Assert(!context->valid);
     1685            context = NULL;
     1686        }
     1687        else
     1688        {
     1689            Assert(context->valid);
     1690        }
    16251691    }
    16261692
     
    19702036    {
    19712037#ifdef VBOXWDDM
    1972         IWineD3DSwapChainImpl *swapchain = NULL;
     2038        IWineD3DSwapChain *swapchain = NULL;
    19732039        if (SUCCEEDED(IWineD3DSurface_GetContainer(target, &IID_IWineD3DSwapChain, (void **)&swapchain))) {
    1974             context_validate(current_context, swapchain);
     2040            context_validate(current_context, (IWineD3DSwapChainImpl*)swapchain);
    19752041            IWineD3DSwapChain_Release(swapchain);
    19762042        }
    19772043        else {
    19782044                                                                                                    /* tmp work-around */
    1979             context_validate(current_context, current_context->device->swapchains[current_context->device->NumberOfSwapChains-1]);
     2045            context_validate(current_context, (IWineD3DSwapChainImpl*)current_context->device->swapchains[current_context->device->NumberOfSwapChains-1]);
    19802046        }
    19812047#else
     
    19902056        context = findThreadContextForSwapChain(swapchain, tid);
    19912057#ifdef VBOXWDDM
    1992         context_validate(context, swapchain);
     2058        context_validate(context, (IWineD3DSwapChainImpl*)swapchain);
    19932059#endif
    19942060        IWineD3DSwapChain_Release(swapchain);
     
    20252091#ifdef VBOXWDDM
    20262092        context_validate(context,
    2027                 This->swapchains[This->NumberOfSwapChains-1] /* tmp work-around */
     2093                (IWineD3DSwapChainImpl*)This->swapchains[This->NumberOfSwapChains-1] /* tmp work-around */
    20282094                                 );
    20292095#endif
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/device.c

    r32545 r32577  
    68636863static HRESULT WINAPI IWineD3DDeviceImpl_Flush(IWineD3DDevice *iface)
    68646864{
    6865     IWineD3DSwapChain *swapChain = NULL;
     6865    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
     6866    struct wined3d_context *context;
    68666867    int i;
    6867     int swapchains = IWineD3DDeviceImpl_GetNumberOfSwapChains(iface);
    6868 
    6869     TRACE("iface %p.\n", iface);
    6870 
    6871     for(i = 0 ; i < swapchains ; i ++) {
    6872 
    6873         IWineD3DDeviceImpl_GetSwapChain(iface, i, &swapChain);
    6874         TRACE("presentinng chain %d, %p\n", i, swapChain);
    6875         IWineD3DSwapChain_Flush(swapChain);
    6876         IWineD3DSwapChain_Release(swapChain);
    6877     }
    6878 
     6868    for (i = 0; i < This->numContexts; ++i)
     6869    {
     6870        context = This->contexts[i];
     6871        if (context_acquire_context(context, NULL, CTXUSAGE_RESOURCELOAD, TRUE))
     6872        {
     6873            Assert(context->valid);
     6874            wglFlush();
     6875            context_release(context);
     6876        }
     6877        else
     6878        {
     6879            WARN("Invalid context, skipping flush.\n");
     6880        }
     6881    }
    68796882    return WINED3D_OK;
    68806883}
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/swapchain.c

    r32545 r32577  
    555555}
    556556
    557 #ifdef VBOXWDDM
    558 static HRESULT WINAPI IWineD3DSwapChainImpl_Flush(IWineD3DSwapChain *iface)
    559 {
    560     IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
    561     struct wined3d_context *context;
    562     RECT src_rect, dst_rect;
    563     BOOL render_to_fbo;
    564     unsigned int sync;
    565     int retval;
    566 
    567     context = context_acquire(This->device, This->backBuffer[0], CTXUSAGE_RESOURCELOAD);
    568 
    569     if (context->valid) wglFlush();
    570     else  WARN("Invalid context, skipping flush.\n");
    571 
    572     context_release(context);
    573 
    574     return WINED3D_OK;
    575 }
    576 #endif
    577 
    578557static const IWineD3DSwapChainVtbl IWineD3DSwapChain_Vtbl =
    579558{
     
    595574    IWineD3DBaseSwapChainImpl_SetGammaRamp,
    596575    IWineD3DBaseSwapChainImpl_GetGammaRamp,
    597 #ifdef VBOXWDDM
    598     IWineD3DSwapChainImpl_Flush,
    599 #endif
    600576};
    601577
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/swapchain_gdi.c

    r32545 r32577  
    254254    return WINED3D_OK;
    255255}
    256 
    257 #ifdef VBOXWDDM
    258 static HRESULT WINAPI IWineGDISwapChainImpl_Flush(IWineD3DSwapChain *iface) {
    259     IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *) iface;
    260 
    261     WARN("GDI Swapchain doesn't implement flush, returning WINED3DERR_INVALIDCALL\n");
    262     return WINED3DERR_INVALIDCALL;
    263 }
    264 #endif
    265256
    266257const IWineD3DSwapChainVtbl IWineGDISwapChain_Vtbl =
     
    283274    IWineD3DBaseSwapChainImpl_SetGammaRamp,
    284275    IWineD3DBaseSwapChainImpl_GetGammaRamp,
    285 #ifdef VBOXWDM
    286     IWineGDISwapChainImpl_Flush,
    287 #endif
    288276};
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_private.h

    r32545 r32577  
    12491249struct wined3d_context *context_find_create(IWineD3DDeviceImpl *device, IWineD3DSwapChainImpl *swapchain, IWineD3DSurfaceImpl *target,
    12501250        const struct wined3d_format_desc *ds_format_desc) DECLSPEC_HIDDEN;
     1251BOOL context_acquire_context(struct wined3d_context * context, IWineD3DSurface *target, enum ContextUsage usage, BOOL bReValidate) DECLSPEC_HIDDEN;
    12511252#endif
    12521253void context_destroy(IWineD3DDeviceImpl *This, struct wined3d_context *context) DECLSPEC_HIDDEN;
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