VirtualBox

Changeset 94214 in vbox for trunk


Ignore:
Timestamp:
Mar 14, 2022 6:20:25 AM (3 years ago)
Author:
vboxsync
Message:

Devices/Graphics: debug code cleanup: bugref:9830

File:
1 edited

Legend:

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

    r94205 r94214  
    621621
    622622
     623#ifdef DUMP_BITMAPS
     624static void vmsvga3dDXDrawDumpRenderTargets(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext)
     625{
     626    for (uint32_t i = 0; i < SVGA3D_MAX_SIMULTANEOUS_RENDER_TARGETS; ++i)
     627    {
     628        if (pDXContext->svgaDXContext.renderState.renderTargetViewIds[i] != SVGA3D_INVALID_ID)
     629        {
     630            SVGACOTableDXRTViewEntry *pRTViewEntry = &pDXContext->cot.paRTView[pDXContext->svgaDXContext.renderState.renderTargetViewIds[i]];
     631            Log(("Dump RT[%u] sid = %u rtvid = %u\n", i, pRTViewEntry->sid, pDXContext->svgaDXContext.renderState.renderTargetViewIds[i]));
     632
     633            SVGA3dSurfaceImageId image;
     634            image.sid = pRTViewEntry->sid;
     635            image.face = 0;
     636            image.mipmap = 0;
     637            VMSVGA3D_MAPPED_SURFACE map;
     638            int rc = vmsvga3dSurfaceMap(pThisCC, &image, NULL, VMSVGA3D_SURFACE_MAP_READ, &map);
     639            if (RT_SUCCESS(rc))
     640            {
     641                vmsvga3dMapWriteBmpFile(&map, "rt-");
     642                vmsvga3dSurfaceUnmap(pThisCC, &image, &map, /* fWritten =  */ false);
     643            }
     644            else
     645                Log(("Map failed %Rrc\n", rc));
     646        }
     647    }
     648}
     649#endif
     650
    623651int vmsvga3dDXDraw(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDraw const *pCmd)
    624652{
     
    635663    rc = pSvgaR3State->pFuncsDX->pfnDXDraw(pThisCC, pDXContext, pCmd->vertexCount, pCmd->startVertexLocation);
    636664#ifdef DUMP_BITMAPS
    637     SVGACOTableDXRTViewEntry *pRTViewEntry = &pDXContext->cot.paRTView[pDXContext->svgaDXContext.renderState.renderTargetViewIds[0]];
    638     SVGA3dSurfaceImageId image;
    639     image.sid = pRTViewEntry->sid;
    640     image.face = 0;
    641     image.mipmap = 0;
    642     VMSVGA3D_MAPPED_SURFACE map;
    643     int rc2 = vmsvga3dSurfaceMap(pThisCC, &image, NULL, VMSVGA3D_SURFACE_MAP_READ, &map);
    644     if (RT_SUCCESS(rc2))
    645     {
    646         vmsvga3dMapWriteBmpFile(&map, "rt-");
    647         vmsvga3dSurfaceUnmap(pThisCC, &image, &map, /* fWritten =  */ false);
    648     }
     665    vmsvga3dDXDrawDumpRenderTargets(pThisCC, pDXContext);
    649666#endif
    650667    return rc;
     
    666683    rc = pSvgaR3State->pFuncsDX->pfnDXDrawIndexed(pThisCC, pDXContext, pCmd->indexCount, pCmd->startIndexLocation, pCmd->baseVertexLocation);
    667684#ifdef DUMP_BITMAPS
    668     SVGACOTableDXRTViewEntry *pRTViewEntry = &pDXContext->cot.paRTView[pDXContext->svgaDXContext.renderState.renderTargetViewIds[0]];
    669     SVGA3dSurfaceImageId image;
    670     image.sid = pRTViewEntry->sid;
    671     image.face = 0;
    672     image.mipmap = 0;
    673     VMSVGA3D_MAPPED_SURFACE map;
    674     int rc2 = vmsvga3dSurfaceMap(pThisCC, &image, NULL, VMSVGA3D_SURFACE_MAP_READ, &map);
    675     if (RT_SUCCESS(rc2))
    676     {
    677         vmsvga3dMapWriteBmpFile(&map, "rt-");
    678         vmsvga3dSurfaceUnmap(pThisCC, &image, &map, /* fWritten =  */ false);
    679     }
     685    vmsvga3dDXDrawDumpRenderTargets(pThisCC, pDXContext);
    680686#endif
    681687    return rc;
     
    698704             pCmd->vertexCountPerInstance, pCmd->instanceCount, pCmd->startVertexLocation, pCmd->startInstanceLocation);
    699705#ifdef DUMP_BITMAPS
    700     SVGACOTableDXRTViewEntry *pRTViewEntry = &pDXContext->cot.paRTView[pDXContext->svgaDXContext.renderState.renderTargetViewIds[0]];
    701     SVGA3dSurfaceImageId image;
    702     image.sid = pRTViewEntry->sid;
    703     image.face = 0;
    704     image.mipmap = 0;
    705     VMSVGA3D_MAPPED_SURFACE map;
    706     int rc2 = vmsvga3dSurfaceMap(pThisCC, &image, NULL, VMSVGA3D_SURFACE_MAP_READ, &map);
    707     if (RT_SUCCESS(rc2))
    708     {
    709         vmsvga3dMapWriteBmpFile(&map, "rt-");
    710         vmsvga3dSurfaceUnmap(pThisCC, &image, &map, /* fWritten =  */ false);
    711     }
     706    vmsvga3dDXDrawDumpRenderTargets(pThisCC, pDXContext);
    712707#endif
    713708    return rc;
     
    730725             pCmd->indexCountPerInstance, pCmd->instanceCount, pCmd->startIndexLocation, pCmd->baseVertexLocation, pCmd->startInstanceLocation);
    731726#ifdef DUMP_BITMAPS
    732     SVGACOTableDXRTViewEntry *pRTViewEntry = &pDXContext->cot.paRTView[pDXContext->svgaDXContext.renderState.renderTargetViewIds[0]];
    733     SVGA3dSurfaceImageId image;
    734     image.sid = pRTViewEntry->sid;
    735     image.face = 0;
    736     image.mipmap = 0;
    737     VMSVGA3D_MAPPED_SURFACE map;
    738     int rc2 = vmsvga3dSurfaceMap(pThisCC, &image, NULL, VMSVGA3D_SURFACE_MAP_READ, &map);
    739     if (RT_SUCCESS(rc2))
    740     {
    741         vmsvga3dMapWriteBmpFile(&map, "rt-");
    742         vmsvga3dSurfaceUnmap(pThisCC, &image, &map, /* fWritten =  */ false);
    743     }
     727    vmsvga3dDXDrawDumpRenderTargets(pThisCC, pDXContext);
    744728#endif
    745729    return rc;
     
    761745    rc = pSvgaR3State->pFuncsDX->pfnDXDrawAuto(pThisCC, pDXContext);
    762746#ifdef DUMP_BITMAPS
    763     SVGACOTableDXRTViewEntry *pRTViewEntry = &pDXContext->cot.paRTView[pDXContext->svgaDXContext.renderState.renderTargetViewIds[0]];
    764     SVGA3dSurfaceImageId image;
    765     image.sid = pRTViewEntry->sid;
    766     image.face = 0;
    767     image.mipmap = 0;
    768     VMSVGA3D_MAPPED_SURFACE map;
    769     int rc2 = vmsvga3dSurfaceMap(pThisCC, &image, NULL, VMSVGA3D_SURFACE_MAP_READ, &map);
    770     if (RT_SUCCESS(rc2))
    771     {
    772         vmsvga3dMapWriteBmpFile(&map, "rt-");
    773         vmsvga3dSurfaceUnmap(pThisCC, &image, &map, /* fWritten =  */ false);
    774     }
     747    vmsvga3dDXDrawDumpRenderTargets(pThisCC, pDXContext);
    775748#endif
    776749    return rc;
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