VirtualBox

Changeset 104811 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
May 29, 2024 5:29:10 PM (8 months ago)
Author:
vboxsync
Message:

Devices/Graphics/DevVGA-SVGA3d-dx-dx11.cpp: removed obsolete code which used multiple D3D11 devices. bugref:9830

File:
1 edited

Legend:

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

    r104805 r104811  
    55
    66/*
    7  * Copyright (C) 2020-2023 Oracle and/or its affiliates.
     7 * Copyright (C) 2020-2024 Oracle and/or its affiliates.
    88 *
    99 * This file is part of VirtualBox base platform packages, as
     
    3838#include <iprt/asm-mem.h>
    3939#include <iprt/assert.h>
    40 #include <iprt/avl.h>
    4140#include <iprt/errcore.h>
    4241#include <iprt/mem.h>
     
    6665#endif
    6766
    68 /* One ID3D11Device object is used for all VMSVGA contexts. */
    69 /** @todo This should be the only option because VGPU freely uses surfaces from different VMSVGA contexts
    70  * and synchronization of access to shared surfaces kills performance.
     67/* One ID3D11Device object is used for all VMSVGA guest contexts because the VGPU design makes resources
     68 * independent from rendering contexts. I.e. multiple guest contexts freely access a surface.
     69 *
     70 * The initial implementation of this backend has used separate ID3D11Devices for each VMSVGA context
     71 * and created shared resources to allow one ID3D11Device to access a resource which was rendered to by
     72 * another ID3D11Device. This synchronization of access to shared resources kills performance actually.
    7173 */
    72 #define DX_FORCE_SINGLE_DEVICE
     74
    7375/* A single staging ID3D11Buffer is used for uploading data to other buffers. */
    7476#define DX_COMMON_STAGING_BUFFER
     
    8082# define D3D_RELEASE(a_Ptr) do { if ((a_Ptr)) (a_Ptr)->Release(); (a_Ptr) = NULL; } while (0)
    8183#endif
    82 
    83 /** Fake ID for the backend DX context. The context creates all shared textures. */
    84 #define DX_CID_BACKEND UINT32_C(0xfffffffe)
    8584
    8685#define D3D_RELEASE_ARRAY(a_Count, a_papArray) do { \
     
    217216    } staging;
    218217
    219     /* Screen targets are created as shared surfaces. */
    220     HANDLE              SharedHandle;     /* The shared handle of this structure. */
    221 
    222     /* DX context which last rendered to the texture.
    223      * This is only for render targets and screen targets, which can be shared between contexts.
    224      * The backend context (cid == DX_CID_BACKEND) can also be a drawing context.
    225      */
    226     uint32_t cidDrawing;
    227 
    228     /** AVL tree containing DXSHAREDTEXTURE structures. */
    229     AVLU32TREE SharedTextureTree;
    230 
    231218    /* Render target views, depth stencil views and shader resource views created for this texture or buffer. */
    232219    RTLISTANCHOR listView;                        /* DXVIEW */
    233220
    234221} VMSVGA3DBACKENDSURFACE;
    235 
    236 /* "The only resources that can be shared are 2D non-mipmapped textures." */
    237 typedef struct DXSHAREDTEXTURE
    238 {
    239     AVLU32NODECORE              Core;             /* Key is context id which opened this texture. */
    240     ID3D11Texture2D            *pTexture;         /* The opened shared texture. */
    241     uint32_t sid;                                 /* Surface id. */
    242 } DXSHAREDTEXTURE;
    243222
    244223
     
    388367    PFN_D3D_DISASSEMBLE        pfnD3DDisassemble;
    389368
    390     DXDEVICE                   dxDevice;               /* Device for the VMSVGA3D context independent operation. */
     369    DXDEVICE                   dxDevice;
    391370    UINT                       VendorId;
    392371    UINT                       DeviceId;
     
    395374
    396375    DXBOUNDRESOURCES           resources;              /* What is currently applied to the pipeline. */
    397 
    398     bool                       fSingleDevice;          /* Whether to use one DX device for all guest contexts. */
    399 
    400     /** @todo Here a set of functions which do different job in single and multiple device modes. */
    401376} VMSVGA3DBACKEND;
    402377
     
    11961171    int rc = VINF_SUCCESS;
    11971172
    1198     if (pBackend->fSingleDevice && pBackend->dxDevice.pDevice)
     1173    if (pBackend->dxDevice.pDevice)
    11991174    {
    12001175        pDXDevice->pDevice = pBackend->dxDevice.pDevice;
     
    14821457
    14831458
    1484 DECLINLINE(bool) dxIsSurfaceShareable(PVMSVGA3DSURFACE pSurface)
    1485 {
    1486     /* It is not expected that volume textures will be shared between contexts. */
    1487     if (pSurface->f.surfaceFlags & SVGA3D_SURFACE_VOLUME)
    1488         return false;
    1489 
    1490     return (pSurface->f.surfaceFlags & SVGA3D_SURFACE_SCREENTARGET)
    1491         || (pSurface->f.surfaceFlags & SVGA3D_SURFACE_BIND_RENDER_TARGET);
    1492 }
    1493 
    1494 
     1459/// @todo Rename, parameters
    14951460static DXDEVICE *dxDeviceFromCid(uint32_t cid, PVMSVGA3DSTATE pState)
    14961461{
    1497     if (cid != DX_CID_BACKEND)
    1498     {
    1499         if (pState->pBackend->fSingleDevice)
    1500             return &pState->pBackend->dxDevice;
    1501 
    1502         VMSVGA3DDXCONTEXT *pDXContext;
    1503         int rc = vmsvga3dDXContextFromCid(pState, cid, &pDXContext);
    1504         if (RT_SUCCESS(rc))
    1505             return &pDXContext->pBackendDXContext->dxDevice;
    1506     }
    1507     else
    1508         return &pState->pBackend->dxDevice;
    1509 
    1510     AssertFailed();
    1511     return NULL;
    1512 }
    1513 
    1514 
     1462    RT_NOREF(cid);
     1463    return &pState->pBackend->dxDevice;
     1464}
     1465
     1466
     1467/// @todo Rename, parameters
    15151468static DXDEVICE *dxDeviceFromContext(PVMSVGA3DSTATE p3dState, VMSVGA3DDXCONTEXT *pDXContext)
    15161469{
    1517     DXDEVICE *pDXDevice;
    1518     if (pDXContext && !p3dState->pBackend->fSingleDevice)
    1519         pDXDevice = &pDXContext->pBackendDXContext->dxDevice;
    1520     else
    1521         pDXDevice = &p3dState->pBackend->dxDevice;
    1522 
     1470    RT_NOREF(pDXContext);
     1471    DXDEVICE *pDXDevice = &p3dState->pBackend->dxDevice;
    15231472#ifdef DEBUG
    15241473    HRESULT hr = pDXDevice->pDevice->GetDeviceRemovedReason();
     
    15531502
    15541503
    1555 static int dxContextWait(uint32_t cidDrawing, PVMSVGA3DSTATE pState)
    1556 {
    1557     if (pState->pBackend->fSingleDevice)
    1558       return VINF_SUCCESS;
    1559 
    1560     /* Flush cidDrawing context and issue a query. */
    1561     DXDEVICE *pDXDevice = dxDeviceFromCid(cidDrawing, pState);
    1562     if (pDXDevice)
    1563         return dxDeviceFlush(pDXDevice);
    1564     /* cidDrawing does not exist anymore. */
    1565     return VINF_SUCCESS;
    1566 }
    1567 
    1568 
    1569 static int dxSurfaceWait(PVMSVGA3DSTATE pState, PVMSVGA3DSURFACE pSurface, uint32_t cidRequesting)
    1570 {
    1571     if (pState->pBackend->fSingleDevice)
    1572         return VINF_SUCCESS;
    1573 
    1574     VMSVGA3DBACKENDSURFACE *pBackendSurface = pSurface->pBackendSurface;
    1575     if (!pBackendSurface)
    1576         AssertFailedReturn(VERR_INVALID_STATE);
    1577 
    1578     int rc = VINF_SUCCESS;
    1579     if (pBackendSurface->cidDrawing != SVGA_ID_INVALID)
    1580     {
    1581         if (pBackendSurface->cidDrawing != cidRequesting)
    1582         {
    1583             LogFunc(("sid = %u, assoc cid = %u, drawing cid = %u, req cid = %u\n",
    1584                      pSurface->id, pSurface->idAssociatedContext, pBackendSurface->cidDrawing, cidRequesting));
    1585             Assert(dxIsSurfaceShareable(pSurface));
    1586             rc = dxContextWait(pBackendSurface->cidDrawing, pState);
    1587             pBackendSurface->cidDrawing = SVGA_ID_INVALID;
    1588         }
    1589     }
    1590     return rc;
    1591 }
    1592 
    1593 
     1504/// @todo Parameters
    15941505static ID3D11Resource *dxResource(PVMSVGA3DSTATE pState, PVMSVGA3DSURFACE pSurface, VMSVGA3DDXCONTEXT *pDXContext)
    15951506{
     1507    RT_NOREF(pState, pDXContext);
    15961508    VMSVGA3DBACKENDSURFACE *pBackendSurface = pSurface->pBackendSurface;
    15971509    if (!pBackendSurface)
    15981510        AssertFailedReturn(NULL);
    15991511
    1600     ID3D11Resource *pResource;
    1601 
    1602     uint32_t const cidRequesting = pDXContext ? pDXContext->cid : DX_CID_BACKEND;
    1603     if (cidRequesting == pSurface->idAssociatedContext || pState->pBackend->fSingleDevice)
    1604         pResource = pBackendSurface->u.pResource;
    1605     else
    1606     {
    1607         /*
    1608          * Context, which as not created the surface, is requesting.
    1609          */
    1610         AssertReturn(pDXContext, NULL);
    1611 
    1612         Assert(dxIsSurfaceShareable(pSurface));
    1613         Assert(pSurface->idAssociatedContext == DX_CID_BACKEND);
    1614 
    1615         DXSHAREDTEXTURE *pSharedTexture = (DXSHAREDTEXTURE *)RTAvlU32Get(&pBackendSurface->SharedTextureTree, pDXContext->cid);
    1616         if (!pSharedTexture)
    1617         {
    1618             DXDEVICE *pDevice = dxDeviceFromContext(pState, pDXContext);
    1619             AssertReturn(pDevice->pDevice, NULL);
    1620 
    1621             AssertReturn(pBackendSurface->SharedHandle, NULL);
    1622 
    1623             /* This context has not yet opened the texture. */
    1624             pSharedTexture = (DXSHAREDTEXTURE *)RTMemAllocZ(sizeof(DXSHAREDTEXTURE));
    1625             AssertReturn(pSharedTexture, NULL);
    1626 
    1627             pSharedTexture->Core.Key = pDXContext->cid;
    1628             bool const fSuccess = RTAvlU32Insert(&pBackendSurface->SharedTextureTree, &pSharedTexture->Core);
    1629             AssertReturn(fSuccess, NULL);
    1630 
    1631             HRESULT hr = pDevice->pDevice->OpenSharedResource(pBackendSurface->SharedHandle, __uuidof(ID3D11Texture2D), (void**)&pSharedTexture->pTexture);
    1632             Assert(SUCCEEDED(hr));
    1633             if (SUCCEEDED(hr))
    1634                 pSharedTexture->sid = pSurface->id;
    1635             else
    1636             {
    1637                 RTAvlU32Remove(&pBackendSurface->SharedTextureTree, pDXContext->cid);
    1638                 RTMemFree(pSharedTexture);
    1639                 return NULL;
    1640             }
    1641         }
    1642 
    1643         pResource = pSharedTexture->pTexture;
    1644     }
    1645 
    1646     /* Wait for drawing to finish. */
    1647     dxSurfaceWait(pState, pSurface, cidRequesting);
    1648 
    1649     return pResource;
     1512    return pBackendSurface->u.pResource;
    16501513}
    16511514
     
    16571520    SVGACOTableDXRTViewEntry const *pRTViewEntry = &pDXContext->cot.paRTView[renderTargetViewId];
    16581521    return pRTViewEntry->sid;
    1659 }
    1660 
    1661 
    1662 static int dxTrackRenderTargets(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext)
    1663 {
    1664     PVMSVGA3DSTATE pState = pThisCC->svga.p3dState;
    1665     AssertReturn(pState, VERR_INVALID_STATE);
    1666 
    1667     for (unsigned long i = 0; i < RT_ELEMENTS(pDXContext->svgaDXContext.renderState.renderTargetViewIds); ++i)
    1668     {
    1669         uint32_t const renderTargetViewId = pDXContext->svgaDXContext.renderState.renderTargetViewIds[i];
    1670         if (renderTargetViewId == SVGA_ID_INVALID)
    1671             continue;
    1672 
    1673         uint32_t const sid = dxGetRenderTargetViewSid(pDXContext, renderTargetViewId);
    1674         LogFunc(("[%u] sid = %u, drawing cid = %u\n", i, sid, pDXContext->cid));
    1675 
    1676         PVMSVGA3DSURFACE pSurface;
    1677         int rc = vmsvga3dSurfaceFromSid(pState, sid, &pSurface);
    1678         if (RT_SUCCESS(rc))
    1679         {
    1680             AssertContinue(pSurface->pBackendSurface);
    1681             pSurface->pBackendSurface->cidDrawing = pDXContext->cid;
    1682         }
    1683     }
    1684     return VINF_SUCCESS;
    16851522}
    16861523
     
    24872324    PVMSVGA3DBACKENDSURFACE pBackendSurface = (PVMSVGA3DBACKENDSURFACE)RTMemAllocZ(sizeof(VMSVGA3DBACKENDSURFACE));
    24882325    AssertPtrReturn(pBackendSurface, VERR_NO_MEMORY);
    2489     pBackendSurface->cidDrawing = SVGA_ID_INVALID;
    24902326    RTListInit(&pBackendSurface->listView);
    24912327    *ppBackendSurface = pBackendSurface;
    24922328    return VINF_SUCCESS;
    2493 }
    2494 
    2495 
    2496 static HRESULT dxInitSharedHandle(PVMSVGA3DBACKEND pBackend, PVMSVGA3DBACKENDSURFACE pBackendSurface)
    2497 {
    2498     if (pBackend->fSingleDevice)
    2499         return S_OK;
    2500 
    2501     /* Get the shared handle. */
    2502     IDXGIResource *pDxgiResource = NULL;
    2503     HRESULT hr = pBackendSurface->u.pResource->QueryInterface(__uuidof(IDXGIResource), (void**)&pDxgiResource);
    2504     Assert(SUCCEEDED(hr));
    2505     if (SUCCEEDED(hr))
    2506     {
    2507         hr = pDxgiResource->GetSharedHandle(&pBackendSurface->SharedHandle);
    2508         Assert(SUCCEEDED(hr));
    2509         D3D_RELEASE(pDxgiResource);
    2510     }
    2511 
    2512     return hr;
    25132329}
    25142330
     
    25372353
    25382354
     2355/// @todo Parameters
    25392356static DXDEVICE *dxSurfaceDevice(PVMSVGA3DSTATE p3dState, PVMSVGA3DSURFACE pSurface, PVMSVGA3DDXCONTEXT pDXContext, UINT *pMiscFlags)
    25402357{
    2541     if (p3dState->pBackend->fSingleDevice)
    2542     {
    2543         *pMiscFlags = 0;
    2544         return &p3dState->pBackend->dxDevice;
    2545     }
    2546 
    2547     if (!pDXContext || dxIsSurfaceShareable(pSurface))
    2548     {
    2549         *pMiscFlags = D3D11_RESOURCE_MISC_SHARED;
    2550         return &p3dState->pBackend->dxDevice;
    2551     }
    2552 
     2358    RT_NOREF(pSurface, pDXContext);
    25532359    *pMiscFlags = 0;
    2554     return &pDXContext->pBackendDXContext->dxDevice;
     2360    return &p3dState->pBackend->dxDevice;
    25552361}
    25562362
     
    28062612
    28072613        if (SUCCEEDED(hr))
    2808             hr = dxInitSharedHandle(pBackend, pBackendSurface);
    2809 
    2810         if (SUCCEEDED(hr))
    28112614        {
    28122615            pBackendSurface->enmResType = VMSVGA3D_RESTYPE_TEXTURE_CUBE;
     
    28612664            Assert(SUCCEEDED(hr));
    28622665        }
    2863 
    2864         if (SUCCEEDED(hr))
    2865             hr = dxInitSharedHandle(pBackend, pBackendSurface);
    28662666
    28672667        if (SUCCEEDED(hr))
     
    29212721                Assert(SUCCEEDED(hr));
    29222722            }
    2923 
    2924             if (SUCCEEDED(hr))
    2925                 hr = dxInitSharedHandle(pBackend, pBackendSurface);
    29262723
    29272724            if (SUCCEEDED(hr))
     
    29862783
    29872784            if (SUCCEEDED(hr))
    2988                 hr = dxInitSharedHandle(pBackend, pBackendSurface);
    2989 
    2990             if (SUCCEEDED(hr))
    29912785            {
    29922786                pBackendSurface->enmResType = VMSVGA3D_RESTYPE_TEXTURE_2D;
     
    30172811        pBackendSurface->enmDxgiFormat = dxgiFormat;
    30182812        pSurface->pBackendSurface = pBackendSurface;
    3019         if (p3dState->pBackend->fSingleDevice || RT_BOOL(MiscFlags & D3D11_RESOURCE_MISC_SHARED))
    3020             pSurface->idAssociatedContext = DX_CID_BACKEND;
    3021         else
    3022             pSurface->idAssociatedContext = pDXContext->cid;
    30232813        return VINF_SUCCESS;
    30242814    }
     
    31102900        pBackendSurface->enmDxgiFormat = DXGI_FORMAT_UNKNOWN;
    31112901        pSurface->pBackendSurface = pBackendSurface;
    3112         pSurface->idAssociatedContext = pDXContext->cid;
    31132902        return VINF_SUCCESS;
    31142903    }
     
    31832972        pBackendSurface->enmDxgiFormat = DXGI_FORMAT_UNKNOWN;
    31842973        pSurface->pBackendSurface = pBackendSurface;
    3185         pSurface->idAssociatedContext = pDXContext->cid;
    31862974        return VINF_SUCCESS;
    31872975    }
     
    32553043        pBackendSurface->enmDxgiFormat = DXGI_FORMAT_UNKNOWN;
    32563044        pSurface->pBackendSurface = pBackendSurface;
    3257         pSurface->idAssociatedContext = pDXContext->cid;
    32583045        return VINF_SUCCESS;
    32593046    }
     
    33953182         */
    33963183        pSurface->pBackendSurface = pBackendSurface;
    3397         pSurface->idAssociatedContext = pDXContext->cid;
    33983184        return VINF_SUCCESS;
    33993185    }
     
    35113297        Log6Func(("Load D3DDisassemble: %Rrc\n", rc2));
    35123298    }
    3513 
    3514 #if !defined(RT_OS_WINDOWS) || defined(DX_FORCE_SINGLE_DEVICE)
    3515     pBackend->fSingleDevice = true;
    3516 #endif
    3517 
    3518     LogRelMax(1, ("VMSVGA: Single DX device mode: %s\n", pBackend->fSingleDevice ? "enabled" : "disabled"));
    35193299
    35203300    vmsvga3dDXInitContextMobData(&pBackend->svgaDXContext);
     
    38723652        || pBackendSurface->enmResType == VMSVGA3D_RESTYPE_TEXTURE_3D)
    38733653    {
    3874         dxSurfaceWait(pState, pSurface, pSurface->idAssociatedContext);
    3875 
    38763654        ID3D11Resource *pMappedResource;
    38773655        if (enmMapType == VMSVGA3D_SURFACE_MAP_READ)
     
    40903868            pDevice->pImmediateContext->CopySubresourceRegion(pDstResource, DstSubresource, DstX, DstY, DstZ,
    40913869                                                              pSrcResource, SrcSubresource, pSrcBox);
    4092 
    4093             pBackendSurface->cidDrawing = pSurface->idAssociatedContext;
    40943870        }
    40953871    }
     
    41643940            pDevice->pImmediateContext->CopySubresourceRegion(pDstResource, DstSubresource, DstX, DstY, DstZ,
    41653941                                                              pSrcResource, SrcSubresource, &SrcBox);
    4166 
    4167             pBackendSurface->cidDrawing = pSurface->idAssociatedContext;
    41683942        }
    41693943#endif
     
    42634037    vmsvgaR3Clip3dRect(&boundRect, &clipRect);
    42644038    ASSERT_GUEST_RETURN(clipRect.w && clipRect.h, VERR_INVALID_PARAMETER);
    4265 
    4266     /* Wait for the surface to finish drawing. */
    4267     dxSurfaceWait(pState, pSurface, DX_CID_BACKEND);
    42684039
    42694040    /* Copy the screen texture to the shared surface. */
     
    48804651    AssertRCReturn(rc, rc);
    48814652
    4882     LogFunc(("src%s cid %d -> dst%s cid %d\n",
    4883              pSrcSurface->pBackendSurface ? "" : " sysmem",
    4884              pSrcSurface ? pSrcSurface->idAssociatedContext : SVGA_ID_INVALID,
    4885              pDstSurface->pBackendSurface ? "" : " sysmem",
    4886              pDstSurface ? pDstSurface->idAssociatedContext : SVGA_ID_INVALID));
     4653    LogFunc(("src%s sid = %u -> dst%s sid = %u\n",
     4654             pSrcSurface->pBackendSurface ? "" : " sysmem", pSrcSurface->id,
     4655             pDstSurface->pBackendSurface ? "" : " sysmem", pDstSurface->id));
    48874656
    48884657    //DXDEVICE *pDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     
    48934662        if (pDstSurface->pBackendSurface == NULL)
    48944663        {
    4895             /* Create the target if it can be used as a device context shared resource (render or screen target). */
    4896             if (pBackend->fSingleDevice || dxIsSurfaceShareable(pDstSurface))
    4897             {
    4898                 rc = vmsvga3dBackSurfaceCreateTexture(pThisCC, NULL, pDstSurface);
    4899                 AssertRCReturn(rc, rc);
    4900             }
     4664            rc = vmsvga3dBackSurfaceCreateTexture(pThisCC, NULL, pDstSurface);
     4665            AssertRCReturn(rc, rc);
    49014666        }
    49024667
     
    49044669        {
    49054670            /* Surface -> Surface. */
    4906             /* Expect both of them to be shared surfaces created by the backend context. */
    4907             Assert(pSrcSurface->idAssociatedContext == DX_CID_BACKEND && pDstSurface->idAssociatedContext == DX_CID_BACKEND);
    4908 
    4909             /* Wait for the source surface to finish drawing. */
    4910             dxSurfaceWait(pState, pSrcSurface, DX_CID_BACKEND);
    4911 
    49124671            DXDEVICE *pDXDevice = &pBackend->dxDevice;
    49134672
     
    49474706            pDXDevice->pImmediateContext->CopySubresourceRegion(pDstResource, DstSubresource, DstX, DstY, DstZ,
    49484707                                                                pSrcResource, SrcSubresource, &SrcBox);
    4949 
    4950             pDstSurface->pBackendSurface->cidDrawing = DX_CID_BACKEND;
    49514708        }
    49524709        else
     
    54005157
    54015158    RTMemFree(pBackendSurface);
    5402 
    5403     /* No context has created the surface, because the surface does not exist anymore. */
    5404     pSurface->idAssociatedContext = SVGA_ID_INVALID;
    54055159}
    54065160
     
    57605514        RTMemFreeZ(pBackendDXContext->paVideoProcessorOutputView, sizeof(pBackendDXContext->paVideoProcessorOutputView[0]) * pBackendDXContext->cVideoProcessorOutputView);
    57615515
    5762         /* Destroy backend surfaces which belong to this context. */
    5763         /** @todo The context should have a list of surfaces (and also shared resources). */
    5764         /** @todo This should not be needed in fSingleDevice mode. */
    5765         for (uint32_t sid = 0; sid < pThisCC->svga.p3dState->cSurfaces; ++sid)
    5766         {
    5767             PVMSVGA3DSURFACE const pSurface = pThisCC->svga.p3dState->papSurfaces[sid];
    5768             if (   pSurface
    5769                 && pSurface->id == sid)
    5770             {
    5771                 if (pSurface->idAssociatedContext == pDXContext->cid)
    5772                 {
    5773                     if (pSurface->pBackendSurface)
    5774                         vmsvga3dBackSurfaceDestroy(pThisCC, true, pSurface);
    5775                 }
    5776                 else if (pSurface->idAssociatedContext == DX_CID_BACKEND)
    5777                 {
    5778                     /* May have shared resources in this context. */
    5779                     if (pSurface->pBackendSurface)
    5780                     {
    5781                         DXSHAREDTEXTURE *pSharedTexture = (DXSHAREDTEXTURE *)RTAvlU32Get(&pSurface->pBackendSurface->SharedTextureTree, pDXContext->cid);
    5782                         if (pSharedTexture)
    5783                         {
    5784                             Assert(pSharedTexture->sid == sid);
    5785                             RTAvlU32Remove(&pSurface->pBackendSurface->SharedTextureTree, pDXContext->cid);
    5786                             D3D_RELEASE(pSharedTexture->pTexture);
    5787                             RTMemFreeZ(pSharedTexture, sizeof(*pSharedTexture));
    5788                         }
    5789                     }
    5790                 }
    5791             }
    5792         }
    5793 
    57945516        dxDeviceDestroy(pBackend, &pBackendDXContext->dxDevice);
    57955517
     
    58115533static DECLCALLBACK(int) vmsvga3dBackDXSwitchContext(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext)
    58125534{
    5813     PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend;
    5814     if (!pBackend->fSingleDevice)
    5815         return VINF_NOT_IMPLEMENTED; /* Not required. */
    5816 
    58175535    /* The new context state will be applied by the generic DX code. */
    5818     RT_NOREF(pDXContext);
     5536    RT_NOREF(pThisCC, pDXContext);
    58195537    return VINF_SUCCESS;
    58205538}
     
    73787096    }
    73797097
    7380     /* Note which surfaces are being drawn. */
    7381     dxTrackRenderTargets(pThisCC, pDXContext);
    7382 
    73837098#ifdef DX_FLUSH_AFTER_DRAW
    73847099    dxDeviceFlush(pDevice);
     
    76377352    }
    76387353
    7639     /* Note which surfaces are being drawn. */
    7640     dxTrackRenderTargets(pThisCC, pDXContext);
    7641 
    76427354#ifdef DX_FLUSH_AFTER_DRAW
    76437355    dxDeviceFlush(pDevice);
     
    76687380    pDevice->pImmediateContext->DrawInstanced(vertexCountPerInstance, instanceCount, startVertexLocation, startInstanceLocation);
    76697381
    7670     /* Note which surfaces are being drawn. */
    7671     dxTrackRenderTargets(pThisCC, pDXContext);
    7672 
    76737382#ifdef DX_FLUSH_AFTER_DRAW
    76747383    dxDeviceFlush(pDevice);
     
    76997408    pDevice->pImmediateContext->DrawIndexedInstanced(indexCountPerInstance, instanceCount, startIndexLocation, baseVertexLocation, startInstanceLocation);
    77007409
    7701     /* Note which surfaces are being drawn. */
    7702     dxTrackRenderTargets(pThisCC, pDXContext);
    7703 
    77047410#ifdef DX_FLUSH_AFTER_DRAW
    77057411    dxDeviceFlush(pDevice);
     
    77237429
    77247430    pDevice->pImmediateContext->DrawAuto();
    7725 
    7726     /* Note which surfaces are being drawn. */
    7727     dxTrackRenderTargets(pThisCC, pDXContext);
    77287431
    77297432#ifdef DX_FLUSH_AFTER_DRAW
     
    84108113    }
    84118114
    8412     LogFunc(("cid %d: src cid %d%s -> dst cid %d%s\n",
    8413              pDXContext->cid, pSrcSurface->idAssociatedContext,
    8414              (pSrcSurface->f.surfaceFlags & SVGA3D_SURFACE_SCREENTARGET) ? " st" : "",
    8415              pDstSurface->idAssociatedContext,
    8416              (pDstSurface->f.surfaceFlags & SVGA3D_SURFACE_SCREENTARGET) ? " st" : ""));
     8115    LogFunc(("src%s sid = %u -> dst%s sid = %u\n",
     8116             (pSrcSurface->f.surfaceFlags & SVGA3D_SURFACE_SCREENTARGET) ? " st" : "", pSrcSurface->id,
     8117             (pDstSurface->f.surfaceFlags & SVGA3D_SURFACE_SCREENTARGET) ? " st" : "", pDstSurface->id));
    84178118
    84188119    /* Clip the box. */
     
    84768177#endif
    84778178
    8478     pDstSurface->pBackendSurface->cidDrawing = pDXContext->cid;
    84798179    return VINF_SUCCESS;
    84808180}
     
    85178217    }
    85188218
    8519     LogFunc(("cid %d: src cid %d%s -> dst cid %d%s\n",
    8520              pDXContext->cid, pSrcSurface->idAssociatedContext,
    8521              (pSrcSurface->f.surfaceFlags & SVGA3D_SURFACE_SCREENTARGET) ? " st" : "",
    8522              pDstSurface->idAssociatedContext,
    8523              (pDstSurface->f.surfaceFlags & SVGA3D_SURFACE_SCREENTARGET) ? " st" : ""));
     8219    LogFunc(("src%s sid = %u -> dst%s sid = %u\n",
     8220             (pSrcSurface->f.surfaceFlags & SVGA3D_SURFACE_SCREENTARGET) ? " st" : "", pSrcSurface->id,
     8221             (pDstSurface->f.surfaceFlags & SVGA3D_SURFACE_SCREENTARGET) ? " st" : "", pDstSurface->id));
    85248222
    85258223    ID3D11Resource *pDstResource = dxResource(pThisCC->svga.p3dState, pDstSurface, pDXContext);
     
    85288226    pDevice->pImmediateContext->CopyResource(pDstResource, pSrcResource);
    85298227
    8530     pDstSurface->pBackendSurface->cidDrawing = pDXContext->cid;
    85318228    return VINF_SUCCESS;
    85328229}
     
    88298526#endif
    88308527
    8831     LogFunc(("cid %d: src cid %d%s -> dst cid %d%s\n",
    8832              pDXContext->cid, pSrcSurface->idAssociatedContext,
    8833              (pSrcSurface->f.surfaceFlags & SVGA3D_SURFACE_SCREENTARGET) ? " st" : "",
    8834              pDstSurface->idAssociatedContext,
    8835              (pDstSurface->f.surfaceFlags & SVGA3D_SURFACE_SCREENTARGET) ? " st" : ""));
     8528    LogFunc(("src%s sid = %u -> dst%s sid = %u\n",
     8529             (pSrcSurface->f.surfaceFlags & SVGA3D_SURFACE_SCREENTARGET) ? " st" : "", pSrcSurface->id,
     8530             (pDstSurface->f.surfaceFlags & SVGA3D_SURFACE_SCREENTARGET) ? " st" : "", pDstSurface->id));
    88368531
    88378532    /* Clip the box. */
     
    88958590    D3D_RELEASE(pDstRenderTargetView);
    88968591
    8897     pDstSurface->pBackendSurface->cidDrawing = pDXContext->cid;
    88988592    return VINF_SUCCESS;
    88998593}
     
    98499543    vmsvgaR3ClipCopyBox(&pMipLevel->mipmapSize, &pMipLevel->mipmapSize, &clipBox);
    98509544
    9851     LogFunc(("surface%s cid %d\n",
    9852              pSurface->pBackendSurface ? "" : " sysmem",
    9853              pSurface ? pSurface->idAssociatedContext : SVGA_ID_INVALID));
     9545    LogFunc(("surface%s sid = %u\n",
     9546             pSurface->pBackendSurface ? "" : " sysmem", pSurface->id));
    98549547
    98559548    if (pSurface->pBackendSurface)
     
    99409633    pDXDevice->pImmediateContext->ResolveSubresource(pDstResource, dstSubResource, pSrcResource, srcSubResource, dxgiFormat);
    99419634
    9942     pDstSurface->pBackendSurface->cidDrawing = pDXContext->cid;
    99439635    return VINF_SUCCESS;
    99449636}
     
    101039795    pDevice->pImmediateContext->DrawIndexedInstancedIndirect(pBufferForArgs, byteOffsetForArgs);
    101049796
    10105     /* Note which surfaces are being drawn. */
    10106     dxTrackRenderTargets(pThisCC, pDXContext);
    10107 
    101089797#ifdef DX_FLUSH_AFTER_DRAW
    101099798    dxDeviceFlush(pDevice);
     
    101429831
    101439832    pDevice->pImmediateContext->DrawInstancedIndirect(pBufferForArgs, byteOffsetForArgs);
    10144 
    10145     /* Note which surfaces are being drawn. */
    10146     dxTrackRenderTargets(pThisCC, pDXContext);
    101479833
    101489834#ifdef DX_FLUSH_AFTER_DRAW
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