VirtualBox

Ignore:
Timestamp:
Sep 16, 2010 10:00:43 AM (14 years ago)
Author:
vboxsync
Message:

wddm/3d: wine multi-swapchain fixes, umd driver fixes

File:
1 edited

Legend:

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

    r32461 r32545  
    62966296}
    62976297
    6298 static void delete_opengl_contexts(IWineD3DDevice *iface, IWineD3DSwapChainImpl *swapchain)
     6298static void delete_opengl_contexts(IWineD3DDevice *iface
     6299#ifndef VBOXWDDM
     6300        , IWineD3DSwapChainImpl *swapchain
     6301#endif
     6302        )
    62996303{
    63006304    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
     
    63356339        context_destroy(This, This->contexts[0]);
    63366340    }
     6341#ifndef VBOXWDDM
    63376342    HeapFree(GetProcessHeap(), 0, swapchain->context);
    63386343    swapchain->context = NULL;
    63396344    swapchain->num_contexts = 0;
     6345#endif
    63406346}
    63416347
     
    63476353    IWineD3DSurfaceImpl *target;
    63486354
     6355#ifndef VBOXWDDM
    63496356    /* Recreate the primary swapchain's context */
    63506357    swapchain->context = HeapAlloc(GetProcessHeap(), 0, sizeof(*swapchain->context));
     
    63546361        return E_OUTOFMEMORY;
    63556362    }
     6363#endif
    63566364
    63576365    target = (IWineD3DSurfaceImpl *)(swapchain->backBuffer ? swapchain->backBuffer[0] : swapchain->frontBuffer);
     
    63596367    {
    63606368        WARN("Failed to create context.\n");
     6369#ifndef VBOXWDDM
    63616370        HeapFree(GetProcessHeap(), 0, swapchain->context);
     6371#endif
    63626372        return E_FAIL;
    63636373    }
    63646374
     6375#ifndef VBOXWDDM
    63656376    swapchain->context[0] = context;
    63666377    swapchain->num_contexts = 1;
     6378#endif
    63676379    create_dummy_textures(This);
    63686380    context_release(context);
     
    63996411    context_release(context);
    64006412    context_destroy(This, context);
     6413#ifndef VBOXWDDM
    64016414    HeapFree(GetProcessHeap(), 0, swapchain->context);
    64026415    swapchain->num_contexts = 0;
     6416#endif
    64036417    return hr;
    64046418}
     
    64116425    WINED3DDISPLAYMODE mode;
    64126426    TRACE("(%p)\n", This);
     6427
     6428#ifdef VBOXWDDM
     6429    /* todo: implement multi-swapchain handlling!!! */
     6430    Assert(0);
     6431#endif
    64136432
    64146433    hr = IWineD3DDevice_GetSwapChain(iface, 0, (IWineD3DSwapChain **) &swapchain);
     
    64996518    IWineD3DStateBlock_Release((IWineD3DStateBlock *)This->stateBlock);
    65006519
    6501     delete_opengl_contexts(iface, swapchain);
     6520    delete_opengl_contexts(iface
     6521#ifndef VBOXWDDM
     6522            , swapchain
     6523#endif
     6524            );
    65026525
    65036526    if(pPresentationParameters->Windowed) {
     
    68656888        return E_OUTOFMEMORY;
    68666889    }
    6867     IUnknown_AddRef(swapchain);
    68686890    This->swapchains = (IWineD3DSwapChain *)pvNewBuf;
    68696891    This->swapchains[This->NumberOfSwapChains] = swapchain;
    68706892    ++This->NumberOfSwapChains;
     6893    return WINED3D_OK;
     6894}
     6895
     6896static HRESULT WINAPI IWineD3DDeviceImpl_RemoveSwapChain(IWineD3DDevice *iface, IWineD3DSwapChain *swapchain)
     6897{
     6898    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
     6899    int i;
     6900    for (i = 0; i < This->NumberOfSwapChains; ++i)
     6901    {
     6902        if (This->swapchains[i] == swapchain)
     6903        {
     6904            break;
     6905        }
     6906    }
     6907
     6908    if (i == This->NumberOfSwapChains)
     6909    {
     6910        WARN("swapchain 0x%p is not part of device 0x%p\n", swapchain, iface);
     6911        return E_INVALIDARG;
     6912    }
     6913
     6914    --This->NumberOfSwapChains;
     6915    if (This->NumberOfSwapChains)
     6916    {
     6917        IWineD3DSwapChain **pvNewBuf = (IWineD3DSwapChain **)HeapAlloc(GetProcessHeap(), 0, (This->NumberOfSwapChains) * sizeof(IWineD3DSwapChain *));
     6918        if(!pvNewBuf) {
     6919            ERR("Out of memory!\n");
     6920            return E_OUTOFMEMORY;
     6921        }
     6922        if (i) {
     6923            memcpy (pvNewBuf, This->swapchains, i*sizeof(IWineD3DSwapChain *));
     6924        }
     6925        if (i < This->NumberOfSwapChains) {
     6926            memcpy (pvNewBuf + i, This->swapchains +i+1, (This->NumberOfSwapChains - i)*sizeof(IWineD3DSwapChain *));
     6927        }
     6928
     6929        This->swapchains = (IWineD3DSwapChain *)pvNewBuf;
     6930    }
     6931    else
     6932    {
     6933        while (This->numContexts)
     6934        {
     6935            context_destroy(This, This->contexts[0]);
     6936        }
     6937    }
    68716938    return WINED3D_OK;
    68726939}
     
    70297096    IWineD3DDeviceImpl_Flush,
    70307097    IWineD3DDeviceImpl_AddSwapChain,
     7098    IWineD3DDeviceImpl_RemoveSwapChain,
    70317099#endif
    70327100};
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