Don't replay markers in GL while timing. Refs #1068

* We also clear GL errors after replaying to ensure we don't get false positives
  when checking for errors beginning the query.
This commit is contained in:
baldurk
2018-08-10 12:21:32 +01:00
parent a128144d50
commit bfe6c75bcc
4 changed files with 27 additions and 6 deletions
+12
View File
@@ -256,8 +256,11 @@ void GLReplay::FillTimers(GLCounterContext &ctx, const DrawcallDescription &draw
m_pDriver->ReplayLog(ctx.eventStart, d.eventId, eReplay_WithoutDraw);
ClearGLErrors();
// Reverse order so that Timer counter is queried the last.
for(int32_t q = uint32_t(GPUCounter::Count) - 1; q >= 0; q--)
{
if(queries->obj[q])
{
m_pDriver->glBeginQuery(glCounters[q], queries->obj[q]);
@@ -267,6 +270,7 @@ void GLReplay::FillTimers(GLCounterContext &ctx, const DrawcallDescription &draw
queries->obj[q] = 0;
}
}
}
m_pDriver->ReplayLog(ctx.eventStart, d.eventId, eReplay_OnlyDraw);
@@ -335,6 +339,8 @@ vector<CounterResult> GLReplay::FetchCountersAMD(const vector<GPUCounter> &count
vector<uint32_t> eventIDs;
m_pDriver->ReplayMarkers(false);
for(uint32_t p = 0; p < passCount; p++)
{
m_pAMDCounters->BeginPass();
@@ -350,6 +356,8 @@ vector<CounterResult> GLReplay::FetchCountersAMD(const vector<GPUCounter> &count
m_pAMDCounters->EndPass();
}
m_pDriver->ReplayMarkers(true);
m_pAMDCounters->EndSesssion(sessionID);
std::vector<CounterResult> ret =
@@ -397,10 +405,14 @@ vector<CounterResult> GLReplay::FetchCounters(const vector<GPUCounter> &allCount
GLCounterContext ctx;
ctx.eventStart = 0;
m_pDriver->ReplayMarkers(false);
m_pDriver->SetFetchCounters(true);
FillTimers(ctx, m_pDriver->GetRootDraw(), counters);
m_pDriver->SetFetchCounters(false);
m_pDriver->ReplayMarkers(true);
double nanosToSecs = 1.0 / 1000000000.0;
GLuint prevbind = 0;
+1 -1
View File
@@ -4838,7 +4838,7 @@ void WrappedOpenGL::ReplayLog(uint32_t startEventID, uint32_t endEventID, Replay
RDCASSERTEQUAL(status, ReplayStatus::Succeeded);
// make sure to end any unbalanced replay events if we stopped in the middle of a frame
for(int i = 0; i < m_ReplayEventCount; i++)
for(int i = 0; m_ReplayMarkers && i < m_ReplayEventCount; i++)
GLMarkerRegion::End();
GLMarkerRegion::Set("!!!!RenderDoc Internal: Done replay");
+3
View File
@@ -224,6 +224,8 @@ private:
vector<APIEvent> m_CurEvents, m_Events;
bool m_AddedDrawcall;
bool m_ReplayMarkers = true;
uint64_t m_CurChunkOffset;
SDChunkMetaData m_ChunkMetadata;
uint32_t m_CurEventID, m_CurDrawcallID;
@@ -536,6 +538,7 @@ public:
bool UsesVRFrameMarkers() { return m_UsesVRMarkers; }
void FirstFrame(void *ctx, void *wndHandle);
void ReplayMarkers(bool replay) { m_ReplayMarkers = replay; }
void StartFrameCapture(void *dev, void *wnd);
bool EndFrameCapture(void *dev, void *wnd);
@@ -175,7 +175,8 @@ bool WrappedOpenGL::Serialise_glDebugMessageInsert(SerialiserType &ser, GLenum s
if(IsReplayingAndReading())
{
GLMarkerRegion::Set(name);
if(m_ReplayMarkers)
GLMarkerRegion::Set(name);
if(IsLoading(m_State))
{
@@ -265,7 +266,8 @@ bool WrappedOpenGL::Serialise_glInsertEventMarkerEXT(SerialiserType &ser, GLsize
if(IsReplayingAndReading())
{
GLMarkerRegion::Set(marker);
if(m_ReplayMarkers)
GLMarkerRegion::Set(marker);
if(IsLoading(m_State))
{
@@ -328,8 +330,11 @@ bool WrappedOpenGL::Serialise_glPushDebugGroup(SerialiserType &ser, GLenum sourc
if(IsReplayingAndReading())
{
GLMarkerRegion::Begin(message, source, id);
m_ReplayEventCount++;
if(m_ReplayMarkers)
{
GLMarkerRegion::Begin(message, source, id);
m_ReplayEventCount++;
}
if(IsLoading(m_State))
{
@@ -365,7 +370,8 @@ bool WrappedOpenGL::Serialise_glPopDebugGroup(SerialiserType &ser)
{
if(IsReplayingAndReading())
{
GLMarkerRegion::End();
if(m_ReplayMarkers)
GLMarkerRegion::End();
m_ReplayEventCount = RDCMAX(0, m_ReplayEventCount - 1);
if(IsLoading(m_State) && !m_CurEvents.empty())