VirtualBox

Ignore:
Timestamp:
Dec 6, 2017 11:48:53 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
119468
Message:

Devices/Graphics: VMSVGA: sync the just created shared resource in D3D backend.

File:
1 edited

Legend:

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

    r69922 r69965  
    11891189
    11901190/* Get the shared surface copy or create a new one. */
    1191 static PVMSVGA3DSHAREDSURFACE vmsvga3dSurfaceGetSharedCopy(PVMSVGA3DCONTEXT pContext, PVMSVGA3DSURFACE pSurface)
     1191static PVMSVGA3DSHAREDSURFACE vmsvga3dSurfaceGetSharedCopy(PVMSVGA3DSTATE pState, PVMSVGA3DCONTEXT pContext, PVMSVGA3DSURFACE pSurface)
    11921192{
    11931193    Assert(pSurface->hSharedObject);
     
    12551255
    12561256        if (RT_LIKELY(hr == D3D_OK))
    1257             /* likely */;
     1257        {
     1258            /* Make sure that the created shared copy has the same content as the original. */
     1259            PVMSVGA3DCONTEXT pAssociatedContext;
     1260            int rc = vmsvga3dContextFromCid(pState, pSurface->idAssociatedContext, &pAssociatedContext);
     1261            if (RT_SUCCESS(rc))
     1262            {
     1263                IDirect3DQuery9 *pQuery;
     1264                hr = pAssociatedContext->pDevice->CreateQuery(D3DQUERYTYPE_EVENT, &pQuery);
     1265                if (hr == D3D_OK)
     1266                {
     1267                    hr = pQuery->Issue(D3DISSUE_END);
     1268                    if (hr == D3D_OK)
     1269                    {
     1270                        do
     1271                        {
     1272                            hr = pQuery->GetData(NULL, 0, D3DGETDATA_FLUSH);
     1273                        } while (hr == S_FALSE);
     1274                    }
     1275
     1276                    D3D_RELEASE(pQuery);
     1277                }
     1278            }
     1279            else
     1280                AssertMsgFailed(("idAssociatedContext cid = %d, sid = %d\n", pSurface->idAssociatedContext, pSurface->id));
     1281        }
    12581282        else
    12591283        {
     
    13471371/** Get IDirect3DSurface9 for the given face and mipmap.
    13481372 */
    1349 int vmsvga3dGetD3DSurface(PVMSVGA3DCONTEXT pContext,
     1373int vmsvga3dGetD3DSurface(PVMSVGA3DSTATE pState,
     1374                          PVMSVGA3DCONTEXT pContext,
    13501375                          PVMSVGA3DSURFACE pSurface,
    13511376                          uint32_t face,
     
    13761401                     pSurface->id, pSurface->idAssociatedContext, pContext->id));
    13771402
    1378             PVMSVGA3DSHAREDSURFACE pSharedSurface = vmsvga3dSurfaceGetSharedCopy(pContext, pSurface);
     1403            PVMSVGA3DSHAREDSURFACE pSharedSurface = vmsvga3dSurfaceGetSharedCopy(pState, pContext, pSurface);
    13791404            AssertReturn(pSharedSurface, VERR_INTERNAL_ERROR);
    13801405
     
    14811506
    14821507        IDirect3DSurface9 *pSrc;
    1483         rc = vmsvga3dGetD3DSurface(pContextDst, pSurfaceSrc, src.face, src.mipmap, false, &pSrc);
     1508        rc = vmsvga3dGetD3DSurface(pState, pContextDst, pSurfaceSrc, src.face, src.mipmap, false, &pSrc);
    14841509        AssertRCReturn(rc, rc);
    14851510
    14861511        IDirect3DSurface9 *pDest;
    1487         rc = vmsvga3dGetD3DSurface(pContextDst, pSurfaceDest, dest.face, dest.mipmap, false, &pDest);
     1512        rc = vmsvga3dGetD3DSurface(pState, pContextDst, pSurfaceDest, dest.face, dest.mipmap, false, &pDest);
    14881513        AssertRCReturnStmt(rc, D3D_RELEASE(pSrc), rc);
    14891514
     
    15561581            AssertRCReturn(rc, rc);
    15571582
    1558             rc = vmsvga3dGetD3DSurface(pContext, pSurfaceSrc, src.face, src.mipmap, true, &pD3DSurf);
     1583            rc = vmsvga3dGetD3DSurface(pState, pContext, pSurfaceSrc, src.face, src.mipmap, true, &pD3DSurf);
    15591584            AssertRCReturn(rc, rc);
    15601585        }
     
    15661591            AssertRCReturn(rc, rc);
    15671592
    1568             rc = vmsvga3dGetD3DSurface(pContext, pSurfaceDest, dest.face, dest.mipmap, true, &pD3DSurf);
     1593            rc = vmsvga3dGetD3DSurface(pState, pContext, pSurfaceDest, dest.face, dest.mipmap, true, &pD3DSurf);
    15691594            AssertRCReturn(rc, rc);
    15701595        }
     
    21112136
    21122137    IDirect3DSurface9 *pSrc;
    2113     rc = vmsvga3dGetD3DSurface(pContext, pSrcSurface, uSrcFace, uSrcMipmap, false, &pSrc);
     2138    rc = vmsvga3dGetD3DSurface(pState, pContext, pSrcSurface, uSrcFace, uSrcMipmap, false, &pSrc);
    21142139    AssertRCReturn(rc, rc);
    21152140
    21162141    IDirect3DSurface9 *pDst;
    2117     rc = vmsvga3dGetD3DSurface(pContext, pDstSurface, uDstFace, uDstMipmap, false, &pDst);
     2142    rc = vmsvga3dGetD3DSurface(pState, pContext, pDstSurface, uDstFace, uDstMipmap, false, &pDst);
    21182143    AssertRCReturn(rc, rc);
    21192144
     
    21902215        /* Get the surface involved in the transfer. */
    21912216        IDirect3DSurface9 *pSurf;
    2192         rc = vmsvga3dGetD3DSurface(pContext, pSurface, uHostFace, uHostMipmap, true, &pSurf);
     2217        rc = vmsvga3dGetD3DSurface(pState, pContext, pSurface, uHostFace, uHostMipmap, true, &pSurf);
    21932218        AssertRCReturn(rc, rc);
    21942219
     
    22062231                    /* Source is the texture, destination is the bounce texture. */
    22072232                    IDirect3DSurface9 *pSrc;
    2208                     rc = vmsvga3dGetD3DSurface(pContext, pSurface, uHostFace, uHostMipmap, false, &pSrc);
     2233                    rc = vmsvga3dGetD3DSurface(pState, pContext, pSurface, uHostFace, uHostMipmap, false, &pSrc);
    22092234                    AssertRCReturn(rc, rc);
    22102235
     
    25622587    AssertMsgReturn(hr == D3D_OK, ("GetBackBuffer failed with %x\n", hr), VERR_INTERNAL_ERROR);
    25632588
    2564     rc = vmsvga3dGetD3DSurface(pContext, pSurface, 0, 0, false, &pSurfaceD3D);
     2589    rc = vmsvga3dGetD3DSurface(pState, pContext, pSurface, 0, 0, false, &pSurfaceD3D);
    25652590    AssertRCReturn(rc, rc);
    25662591
     
    43454370            }
    43464371
    4347             rc = vmsvga3dGetD3DSurface(pContext,  pRenderTarget, target.face, target.mipmap, false, &pSurface);
     4372            rc = vmsvga3dGetD3DSurface(pState, pContext,  pRenderTarget, target.face, target.mipmap, false, &pSurface);
    43484373            AssertRCReturn(rc, rc);
    43494374        }
     
    46124637                    LogFunc(("Using texture sid=%x created for another context (%d vs %d)\n", sid, pSurface->idAssociatedContext, cid));
    46134638
    4614                     PVMSVGA3DSHAREDSURFACE pSharedSurface = vmsvga3dSurfaceGetSharedCopy(pContext, pSurface);
     4639                    PVMSVGA3DSHAREDSURFACE pSharedSurface = vmsvga3dSurfaceGetSharedCopy(pState, pContext, pSurface);
    46154640                    AssertReturn(pSharedSurface, VERR_INTERNAL_ERROR);
    46164641
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette