1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0023081: This is desirable to retrieve GPU memory information from graphic driver

Added Graphic3d_GraphicDriver::MemoryInfo() function.
Added vfps command to estimate average frame rate of 3D Viewer
Simplified vdrawsphere command
Removed turnVbo and performance measurements from vdrawsphere.
Added vvbo command to control VBO usage flag.
Added vmemgpu command to display GPU memory info from graphic driver
This commit is contained in:
kgv
2012-04-12 12:49:54 +04:00
parent 0316739bfe
commit f04309524a
11 changed files with 614 additions and 21 deletions

View File

@@ -2772,6 +2772,51 @@ static int VVbo (Draw_Interpretor& theDI,
return 0;
}
//==============================================================================
//function : VMemGpu
//purpose :
//==============================================================================
static int VMemGpu (Draw_Interpretor& theDI,
Standard_Integer theArgNb,
const char** theArgVec)
{
// get the context
Handle(AIS_InteractiveContext) aContextAIS = ViewerTest::GetAISContext();
if (aContextAIS.IsNull())
{
std::cerr << "No active view. Please call vinit.\n";
return 1;
}
Handle(Graphic3d_GraphicDriver) aDriver =
Handle(Graphic3d_GraphicDriver)::DownCast (aContextAIS->CurrentViewer()->Device()->GraphicDriver());
if (aDriver.IsNull())
{
std::cerr << "Graphic driver not available.\n";
return 1;
}
Standard_Size aFreeBytes = 0;
TCollection_AsciiString anInfo;
if (!aDriver->MemoryInfo (aFreeBytes, anInfo))
{
std::cerr << "Information not available.\n";
return 1;
}
if (theArgNb > 1 && *theArgVec[1] == 'f')
{
theDI << Standard_Real (aFreeBytes);
}
else
{
theDI << anInfo;
}
return 0;
}
//=======================================================================
//function : ViewerCommands
//purpose :
@@ -2879,4 +2924,8 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
theCommands.Add ("vvbo",
"vvbo {0|1} : turn VBO usage On/Off; affects only newly displayed objects",
__FILE__, VVbo, group);
theCommands.Add ("vmemgpu",
"vmemgpu [f]: print system-dependent GPU memory information if available;"
" with f option returns free memory in bytes",
__FILE__, VMemGpu, group);
}