//====================================================================== // // // function // // //====================================================================== //===================================== // // main // //===================================== int main( int nArgc, char *pstrArgv[] ) { int i; const STCMD* cmd; //===================================== // // check param // //===================================== _sysCmdInit( ); if( 2 > nArgc ) return Usage( "parameter is nedded" ); // shift arg nArgc--; pstrArgv++; for ( i=0 ; i<GetCmdListSize( ) ; i++ ) { if ( !IsEnableCmd( i ) ) continue; cmd = GetCmdList( i ); if ( CMD_HIT( pstrArgv[0], cmd->pstrName ) && pstrArgv[1] && (CMD_HIT( pstrArgv[1], "--help" ) || CMD_HIT( pstrArgv[1], "-h" ))) return DetailUsage( cmd->pstrName ); if ( cmd->fnIsHit( nArgc , pstrArgv ) ) goto cmdstart; } return Usage( "parameter error" ); cmdstart: if( !cmd->fnCmd( nArgc , pstrArgv ) ) Error( "Cmd return error" ); return 0; }
bool DX12GPASample::CopyResult(size_t sampleDataSize, void* pResultBuffer) const { bool isDataReady = false; bool isAnyHardwareCounterEnabled = GetPass()->GetEnabledCounterCount() > 0; if (nullptr != pResultBuffer) { if (isAnyHardwareCounterEnabled) { DX12GPACommandList* pDX12GpaCmdList = reinterpret_cast<DX12GPACommandList*>(GetCmdList()); IAmdExtGpaSession* pResultSession = nullptr; if (IsCopied()) { pResultSession = pDX12GpaCmdList->GetBundleResultAmdExtSession(GetClientSampleId()); } else { pResultSession = pDX12GpaCmdList->GetAmdExtSession(); } if (nullptr == pResultSession) { GPA_LogError("Invalid profiling session encountered while copying results."); } else { if (pResultSession->IsReady()) { size_t sampleDataSizeInDriver = 0u; HRESULT driverResult = pResultSession->GetResults(GetDriverSampleId(), &sampleDataSizeInDriver, nullptr); assert(SUCCEEDED(driverResult)); assert(sampleDataSize == sampleDataSizeInDriver); if (SUCCEEDED(driverResult) && sampleDataSize == sampleDataSizeInDriver) { driverResult = pResultSession->GetResults(GetDriverSampleId(), &sampleDataSizeInDriver, pResultBuffer); assert(SUCCEEDED(driverResult)); if (SUCCEEDED(driverResult)) { isDataReady = true; } else { GPA_LogError("Error occurred while getting sample results from driver."); } } else { GPA_LogError("Error occurred while getting sample result size from driver."); } } } } else { // there is no hardware counter enabled in the driver, put zeros in all result location memcpy(pResultBuffer, 0, sampleDataSize); isDataReady = true; } } return isDataReady; }