VirtualBox

Changeset 95014 in vbox


Ignore:
Timestamp:
May 15, 2022 9:52:59 AM (3 years ago)
Author:
vboxsync
Message:

Devices/Graphics: 11.1 interfaces: bugref:9830

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win-dx.cpp

    r95012 r95014  
    7272typedef struct DXDEVICE
    7373{
    74     ID3D11Device               *pDevice;               /* Device. */
    75     ID3D11DeviceContext        *pImmediateContext;     /* Corresponding context. */
     74    ID3D11Device1              *pDevice;               /* Device. */
     75    ID3D11DeviceContext1       *pImmediateContext;     /* Corresponding context. */
    7676    IDXGIFactory               *pDxgiFactory;          /* DXGI Factory. */
    7777    D3D_FEATURE_LEVEL           FeatureLevel;
     
    821821
    822822
    823 static int dxDeviceCreate(PVMSVGA3DBACKEND pBackend, DXDEVICE *pDevice)
     823static int dxDeviceCreate(PVMSVGA3DBACKEND pBackend, DXDEVICE *pDXDevice)
    824824{
    825825    int rc = VINF_SUCCESS;
     
    827827    if (pBackend->fSingleDevice && pBackend->dxDevice.pDevice)
    828828    {
    829         pDevice->pDevice = pBackend->dxDevice.pDevice;
    830         pDevice->pDevice->AddRef();
    831 
    832         pDevice->pImmediateContext = pBackend->dxDevice.pImmediateContext;
    833         pDevice->pImmediateContext->AddRef();
    834 
    835         pDevice->pDxgiFactory = pBackend->dxDevice.pDxgiFactory;
    836         pDevice->pDxgiFactory->AddRef();
    837 
    838         pDevice->FeatureLevel = pBackend->dxDevice.FeatureLevel;
    839 
    840         pDevice->pStagingBuffer = 0;
    841         pDevice->cbStagingBuffer = 0;
     829        pDXDevice->pDevice = pBackend->dxDevice.pDevice;
     830        pDXDevice->pDevice->AddRef();
     831
     832        pDXDevice->pImmediateContext = pBackend->dxDevice.pImmediateContext;
     833        pDXDevice->pImmediateContext->AddRef();
     834
     835        pDXDevice->pDxgiFactory = pBackend->dxDevice.pDxgiFactory;
     836        pDXDevice->pDxgiFactory->AddRef();
     837
     838        pDXDevice->FeatureLevel = pBackend->dxDevice.FeatureLevel;
     839
     840        pDXDevice->pStagingBuffer = 0;
     841        pDXDevice->cbStagingBuffer = 0;
    842842
    843843        return rc;
     
    855855#endif
    856856
     857    ID3D11Device *pDevice = 0;
     858    ID3D11DeviceContext *pImmediateContext = 0;
    857859    HRESULT hr = pBackend->pfnD3D11CreateDevice(pAdapter,
    858860                                                D3D_DRIVER_TYPE_HARDWARE,
     
    862864                                                RT_ELEMENTS(s_aFeatureLevels),
    863865                                                D3D11_SDK_VERSION,
    864                                                 &pDevice->pDevice,
    865                                                 &pDevice->FeatureLevel,
    866                                                 &pDevice->pImmediateContext);
     866                                                &pDevice,
     867                                                &pDXDevice->FeatureLevel,
     868                                                &pImmediateContext);
    867869    if (SUCCEEDED(hr))
    868870    {
    869         LogRel(("VMSVGA: Feature level %#x\n", pDevice->FeatureLevel));
     871        LogRel(("VMSVGA: Feature level %#x\n", pDXDevice->FeatureLevel));
     872
     873        hr = pDevice->QueryInterface(__uuidof(ID3D11Device1), (void**)&pDXDevice->pDevice);
     874        AssertReturnStmt(SUCCEEDED(hr),
     875                         D3D_RELEASE(pImmediateContext); D3D_RELEASE(pDevice),
     876                         VERR_NOT_SUPPORTED);
     877
     878        hr = pImmediateContext->QueryInterface(__uuidof(ID3D11DeviceContext1), (void**)&pDXDevice->pImmediateContext);
     879        AssertReturnStmt(SUCCEEDED(hr),
     880                         D3D_RELEASE(pImmediateContext); D3D_RELEASE(pDXDevice->pDevice); D3D_RELEASE(pDevice),
     881                         VERR_NOT_SUPPORTED);
    870882
    871883#ifdef DEBUG
     
    873885        HRESULT hr2;
    874886        ID3D11Debug *pDebug = 0;
    875         hr2 = pDevice->pDevice->QueryInterface(__uuidof(ID3D11Debug), (void**)&pDebug);
     887        hr2 = pDXDevice->pDevice->QueryInterface(__uuidof(ID3D11Debug), (void**)&pDebug);
    876888        if (SUCCEEDED(hr2))
    877889        {
     
    909921
    910922        IDXGIDevice *pDxgiDevice = 0;
    911         hr = pDevice->pDevice->QueryInterface(__uuidof(IDXGIDevice), (void**)&pDxgiDevice);
     923        hr = pDXDevice->pDevice->QueryInterface(__uuidof(IDXGIDevice), (void**)&pDxgiDevice);
    912924        if (SUCCEEDED(hr))
    913925        {
     
    916928            if (SUCCEEDED(hr))
    917929            {
    918                 hr = pDxgiAdapter->GetParent(__uuidof(IDXGIFactory), (void**)&pDevice->pDxgiFactory);
     930                hr = pDxgiAdapter->GetParent(__uuidof(IDXGIFactory), (void**)&pDXDevice->pDxgiFactory);
    919931                D3D_RELEASE(pDxgiAdapter);
    920932            }
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