Beispiel #1
0
//--------------------------------------------------------------------------
/// End the frame.
//--------------------------------------------------------------------------
void ModernAPILayerManager::EndFrame()
{
    // Check if we need to collect a trace for this currently-rendering frame.
    MultithreadedTraceAnalyzerLayer* pTraceAnalyzer = GetTraceAnalyzerLayer();

    bool bDisableObjectDataBase = false;

    if (mCmdFrameCaptureWithSave.IsActive())
    {
        // Extract the capture mode argument from the
        m_captureType = (CaptureType)mCmdFrameCaptureWithSave.GetCaptureType();
        m_captureCount = mCmdFrameCaptureWithSave.GetCaptureCount();

        // Exclude Frame Capture
        if (m_captureType > 0 && m_captureType < 4)
        {
            // Now need to make sure that the MultithreadedTraceAnalyzerLayer is on the stack.
            if (pTraceAnalyzer != nullptr)
            {
                pTraceAnalyzer->DisableLinkedTraceCollection();
            }

            // stop objectInspector from writing to disk
            bDisableObjectDataBase = true;
        }
    }

    LayerManager::EndFrame();

    // If the TraceAnalyzer layer is active, and a trace was triggered by keypress, disable the tracing layer.
    if (pTraceAnalyzer != nullptr)
    {
        // Check if the previous frame had been traced. If so, we'll need to clean up the TraceAnalyzer from the stack.
        bool bTracedLastFrame = (pTraceAnalyzer->GetLastTracedFrameIndex() == static_cast<int>(GetCurrentFrameIndex()));

        if (bTracedLastFrame && mbTraceTriggeredFromKeypress)
        {
            Log(logMESSAGE, "Keypress capture ending.\n");

            // Enable trace collection for the next rendered frame.
            pTraceAnalyzer->DisableLinkedTraceCollection();

            if (pTraceAnalyzer->IsEnabled())
            {
                // Remove the TraceAnalyzerLayer that we pushed earlier.
                PopEnabledLayer();
            }

#if ENABLE_CLIENT_LOCKOUT_ON_KEYPRESS
            // Tell the GPUPerfServer to accept all incoming commands
            SG_SET_BOOL(ForceRenderStallState, false);
#endif // ENABLE_CLIENT_LOCKOUT_ON_KEYPRESS

            // Disable the keypress flag- we've finished tracing the frame.
            mbTraceTriggeredFromKeypress = false;
        }
    }

    // need to disable ObjectDataBase after because mCmdFrameCaptureWithSave is cleared before object EndFrame
    if (bDisableObjectDataBase)
    {
        // stop objectInspector from writing to disk
        ObjectDatabaseProcessor* objectDatabase = GetObjectDatabaseProcessor();
        objectDatabase->DisableObjectDatabaseCollection();
    }
}
static bool Cmd_GetCurrentFrameIndex_Execute(COMMAND_ARGS)
{
	*result = GetCurrentFrameIndex();
	return true;
}