mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Update GL query functions to new serialisation
This commit is contained in:
@@ -27,15 +27,37 @@
|
||||
#include "common/common.h"
|
||||
#include "strings/string_utils.h"
|
||||
|
||||
bool WrappedOpenGL::Serialise_glFenceSync(GLsync real, GLenum condition, GLbitfield flags)
|
||||
enum GLsyncbitfield
|
||||
{
|
||||
SERIALISE_ELEMENT(GLenum, Condition, condition);
|
||||
SERIALISE_ELEMENT(uint32_t, Flags, flags);
|
||||
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetSyncID(real));
|
||||
};
|
||||
|
||||
if(m_State < WRITING)
|
||||
DECLARE_REFLECTION_ENUM(GLsyncbitfield);
|
||||
|
||||
template <>
|
||||
std::string DoStringise(const GLsyncbitfield &el)
|
||||
{
|
||||
RDCCOMPILE_ASSERT(
|
||||
sizeof(GLsyncbitfield) == sizeof(GLbitfield) && sizeof(GLsyncbitfield) == sizeof(uint32_t),
|
||||
"Fake bitfield enum must be uint32_t sized");
|
||||
|
||||
BEGIN_BITFIELD_STRINGISE(GLsyncbitfield);
|
||||
{
|
||||
real = m_Real.glFenceSync(Condition, Flags);
|
||||
STRINGISE_BITFIELD_BIT(GL_SYNC_FLUSH_COMMANDS_BIT);
|
||||
}
|
||||
END_BITFIELD_STRINGISE();
|
||||
}
|
||||
|
||||
template <typename SerialiserType>
|
||||
bool WrappedOpenGL::Serialise_glFenceSync(SerialiserType &ser, GLsync real, GLenum condition,
|
||||
GLbitfield flags)
|
||||
{
|
||||
SERIALISE_ELEMENT(condition);
|
||||
SERIALISE_ELEMENT_TYPED(GLsyncbitfield, flags);
|
||||
SERIALISE_ELEMENT_LOCAL(sync, GetResourceManager()->GetSyncID(real));
|
||||
|
||||
if(IsReplayingAndReading())
|
||||
{
|
||||
real = m_Real.glFenceSync(condition, flags);
|
||||
|
||||
GLuint name = 0;
|
||||
ResourceId liveid = ResourceId();
|
||||
@@ -44,7 +66,7 @@ bool WrappedOpenGL::Serialise_glFenceSync(GLsync real, GLenum condition, GLbitfi
|
||||
GLResource res = SyncRes(GetCtx(), name);
|
||||
|
||||
ResourceId live = m_ResourceManager->RegisterResource(res);
|
||||
GetResourceManager()->AddLiveResource(id, res);
|
||||
GetResourceManager()->AddLiveResource(sync, res);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -59,13 +81,14 @@ GLsync WrappedOpenGL::glFenceSync(GLenum condition, GLbitfield flags)
|
||||
GetResourceManager()->RegisterSync(GetCtx(), sync, name, id);
|
||||
GLResource res = SyncRes(GetCtx(), name);
|
||||
|
||||
if(m_State == WRITING_CAPFRAME)
|
||||
if(IsActiveCapturing(m_State))
|
||||
{
|
||||
Chunk *chunk = NULL;
|
||||
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(FENCE_SYNC);
|
||||
Serialise_glFenceSync(sync, condition, flags);
|
||||
USE_SCRATCH_SERIALISER();
|
||||
SCOPED_SERIALISE_CHUNK(gl_CurChunk);
|
||||
Serialise_glFenceSync(ser, sync, condition, flags);
|
||||
|
||||
chunk = scope.Get();
|
||||
}
|
||||
@@ -80,19 +103,18 @@ GLsync WrappedOpenGL::glFenceSync(GLenum condition, GLbitfield flags)
|
||||
return sync;
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
|
||||
template <typename SerialiserType>
|
||||
bool WrappedOpenGL::Serialise_glClientWaitSync(SerialiserType &ser, GLsync sync_, GLbitfield flags,
|
||||
GLuint64 timeout)
|
||||
{
|
||||
SERIALISE_ELEMENT(uint32_t, Flags, flags);
|
||||
SERIALISE_ELEMENT(uint64_t, Timeout, timeout);
|
||||
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetSyncID(sync));
|
||||
SERIALISE_ELEMENT_LOCAL(sync, GetResourceManager()->GetSyncID(sync_));
|
||||
SERIALISE_ELEMENT_TYPED(GLsyncbitfield, flags);
|
||||
SERIALISE_ELEMENT(timeout);
|
||||
|
||||
if(m_State < WRITING)
|
||||
if(IsReplayingAndReading() && GetResourceManager()->HasLiveResource(sync))
|
||||
{
|
||||
if(GetResourceManager()->HasLiveResource(id))
|
||||
{
|
||||
GLResource res = GetResourceManager()->GetLiveResource(id);
|
||||
m_Real.glClientWaitSync(GetResourceManager()->GetSync(res.name), Flags, Timeout);
|
||||
}
|
||||
GLResource res = GetResourceManager()->GetLiveResource(sync);
|
||||
m_Real.glClientWaitSync(GetResourceManager()->GetSync(res.name), flags, timeout);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -102,10 +124,11 @@ GLenum WrappedOpenGL::glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 t
|
||||
{
|
||||
GLenum ret = m_Real.glClientWaitSync(sync, flags, timeout);
|
||||
|
||||
if(m_State == WRITING_CAPFRAME)
|
||||
if(IsActiveCapturing(m_State))
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(CLIENTWAIT_SYNC);
|
||||
Serialise_glClientWaitSync(sync, flags, timeout);
|
||||
USE_SCRATCH_SERIALISER();
|
||||
SCOPED_SERIALISE_CHUNK(gl_CurChunk);
|
||||
Serialise_glClientWaitSync(ser, sync, flags, timeout);
|
||||
|
||||
m_ContextRecord->AddChunk(scope.Get());
|
||||
}
|
||||
@@ -113,19 +136,18 @@ GLenum WrappedOpenGL::glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 t
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
|
||||
template <typename SerialiserType>
|
||||
bool WrappedOpenGL::Serialise_glWaitSync(SerialiserType &ser, GLsync sync_, GLbitfield flags,
|
||||
GLuint64 timeout)
|
||||
{
|
||||
SERIALISE_ELEMENT(uint32_t, Flags, flags);
|
||||
SERIALISE_ELEMENT(uint64_t, Timeout, timeout);
|
||||
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetSyncID(sync));
|
||||
SERIALISE_ELEMENT_LOCAL(sync, GetResourceManager()->GetSyncID(sync_));
|
||||
SERIALISE_ELEMENT_TYPED(GLsyncbitfield, flags);
|
||||
SERIALISE_ELEMENT(timeout);
|
||||
|
||||
if(m_State < WRITING)
|
||||
if(IsReplayingAndReading() && GetResourceManager()->HasLiveResource(sync))
|
||||
{
|
||||
if(GetResourceManager()->HasLiveResource(id))
|
||||
{
|
||||
GLResource res = GetResourceManager()->GetLiveResource(id);
|
||||
m_Real.glWaitSync(GetResourceManager()->GetSync(res.name), Flags, Timeout);
|
||||
}
|
||||
GLResource res = GetResourceManager()->GetLiveResource(sync);
|
||||
m_Real.glWaitSync(GetResourceManager()->GetSync(res.name), flags, timeout);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -135,10 +157,11 @@ void WrappedOpenGL::glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
|
||||
{
|
||||
m_Real.glWaitSync(sync, flags, timeout);
|
||||
|
||||
if(m_State == WRITING_CAPFRAME)
|
||||
if(IsActiveCapturing(m_State))
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(WAIT_SYNC);
|
||||
Serialise_glWaitSync(sync, flags, timeout);
|
||||
USE_SCRATCH_SERIALISER();
|
||||
SCOPED_SERIALISE_CHUNK(gl_CurChunk);
|
||||
Serialise_glWaitSync(ser, sync, flags, timeout);
|
||||
|
||||
m_ContextRecord->AddChunk(scope.Get());
|
||||
}
|
||||
@@ -154,11 +177,12 @@ void WrappedOpenGL::glDeleteSync(GLsync sync)
|
||||
GetResourceManager()->UnregisterResource(GetResourceManager()->GetCurrentResource(id));
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glGenQueries(GLsizei n, GLuint *ids)
|
||||
template <typename SerialiserType>
|
||||
bool WrappedOpenGL::Serialise_glGenQueries(SerialiserType &ser, GLsizei n, GLuint *ids)
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(QueryRes(GetCtx(), *ids)));
|
||||
SERIALISE_ELEMENT_LOCAL(query, GetResourceManager()->GetID(QueryRes(GetCtx(), *ids)));
|
||||
|
||||
if(m_State == READING)
|
||||
if(IsReplayingAndReading())
|
||||
{
|
||||
GLuint real = 0;
|
||||
m_Real.glGenQueries(1, &real);
|
||||
@@ -166,7 +190,7 @@ bool WrappedOpenGL::Serialise_glGenQueries(GLsizei n, GLuint *ids)
|
||||
GLResource res = QueryRes(GetCtx(), real);
|
||||
|
||||
ResourceId live = m_ResourceManager->RegisterResource(res);
|
||||
GetResourceManager()->AddLiveResource(id, res);
|
||||
GetResourceManager()->AddLiveResource(query, res);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -181,13 +205,14 @@ void WrappedOpenGL::glGenQueries(GLsizei count, GLuint *ids)
|
||||
GLResource res = QueryRes(GetCtx(), ids[i]);
|
||||
ResourceId id = GetResourceManager()->RegisterResource(res);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
if(IsCaptureMode(m_State))
|
||||
{
|
||||
Chunk *chunk = NULL;
|
||||
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(GEN_QUERIES);
|
||||
Serialise_glGenQueries(1, ids + i);
|
||||
USE_SCRATCH_SERIALISER();
|
||||
SCOPED_SERIALISE_CHUNK(gl_CurChunk);
|
||||
Serialise_glGenQueries(ser, 1, ids + i);
|
||||
|
||||
chunk = scope.Get();
|
||||
}
|
||||
@@ -204,20 +229,22 @@ void WrappedOpenGL::glGenQueries(GLsizei count, GLuint *ids)
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glCreateQueries(GLenum target, GLsizei n, GLuint *ids)
|
||||
template <typename SerialiserType>
|
||||
bool WrappedOpenGL::Serialise_glCreateQueries(SerialiserType &ser, GLenum target, GLsizei n,
|
||||
GLuint *ids)
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(QueryRes(GetCtx(), *ids)));
|
||||
SERIALISE_ELEMENT(GLenum, Target, target);
|
||||
SERIALISE_ELEMENT_LOCAL(query, GetResourceManager()->GetID(SamplerRes(GetCtx(), *ids)));
|
||||
SERIALISE_ELEMENT(target);
|
||||
|
||||
if(m_State == READING)
|
||||
if(IsReplayingAndReading())
|
||||
{
|
||||
GLuint real = 0;
|
||||
m_Real.glCreateQueries(Target, 1, &real);
|
||||
m_Real.glCreateQueries(target, 1, &real);
|
||||
|
||||
GLResource res = QueryRes(GetCtx(), real);
|
||||
|
||||
ResourceId live = m_ResourceManager->RegisterResource(res);
|
||||
GetResourceManager()->AddLiveResource(id, res);
|
||||
GetResourceManager()->AddLiveResource(query, res);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -232,13 +259,14 @@ void WrappedOpenGL::glCreateQueries(GLenum target, GLsizei count, GLuint *ids)
|
||||
GLResource res = QueryRes(GetCtx(), ids[i]);
|
||||
ResourceId id = GetResourceManager()->RegisterResource(res);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
if(IsCaptureMode(m_State))
|
||||
{
|
||||
Chunk *chunk = NULL;
|
||||
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(CREATE_QUERIES);
|
||||
Serialise_glCreateQueries(target, 1, ids + i);
|
||||
USE_SCRATCH_SERIALISER();
|
||||
SCOPED_SERIALISE_CHUNK(gl_CurChunk);
|
||||
Serialise_glCreateQueries(ser, target, 1, ids + i);
|
||||
|
||||
chunk = scope.Get();
|
||||
}
|
||||
@@ -255,18 +283,19 @@ void WrappedOpenGL::glCreateQueries(GLenum target, GLsizei count, GLuint *ids)
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glBeginQuery(GLenum target, GLuint qid)
|
||||
template <typename SerialiserType>
|
||||
bool WrappedOpenGL::Serialise_glBeginQuery(SerialiserType &ser, GLenum target, GLuint qid)
|
||||
{
|
||||
SERIALISE_ELEMENT(GLenum, Target, target);
|
||||
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(QueryRes(GetCtx(), qid)));
|
||||
SERIALISE_ELEMENT(target);
|
||||
SERIALISE_ELEMENT_LOCAL(query, QueryRes(GetCtx(), qid));
|
||||
|
||||
if(m_State < WRITING)
|
||||
if(IsReplayingAndReading())
|
||||
{
|
||||
// Queries in the log interfere with the queries from FetchCounters.
|
||||
if(!m_FetchCounters)
|
||||
{
|
||||
m_Real.glBeginQuery(Target, GetResourceManager()->GetLiveResource(id).name);
|
||||
m_ActiveQueries[QueryIdx(Target)][0] = true;
|
||||
m_Real.glBeginQuery(target, query.name);
|
||||
m_ActiveQueries[QueryIdx(target)][0] = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,26 +309,29 @@ void WrappedOpenGL::glBeginQuery(GLenum target, GLuint id)
|
||||
RDCLOG("Query already active %s", ToStr(target).c_str());
|
||||
m_ActiveQueries[QueryIdx(target)][0] = true;
|
||||
|
||||
if(m_State == WRITING_CAPFRAME)
|
||||
if(IsActiveCapturing(m_State))
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(BEGIN_QUERY);
|
||||
Serialise_glBeginQuery(target, id);
|
||||
USE_SCRATCH_SERIALISER();
|
||||
SCOPED_SERIALISE_CHUNK(gl_CurChunk);
|
||||
Serialise_glBeginQuery(ser, target, id);
|
||||
|
||||
m_ContextRecord->AddChunk(scope.Get());
|
||||
GetResourceManager()->MarkResourceFrameReferenced(QueryRes(GetCtx(), id), eFrameRef_Read);
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glBeginQueryIndexed(GLenum target, GLuint index, GLuint qid)
|
||||
template <typename SerialiserType>
|
||||
bool WrappedOpenGL::Serialise_glBeginQueryIndexed(SerialiserType &ser, GLenum target, GLuint index,
|
||||
GLuint qid)
|
||||
{
|
||||
SERIALISE_ELEMENT(GLenum, Target, target);
|
||||
SERIALISE_ELEMENT(uint32_t, Index, index);
|
||||
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(QueryRes(GetCtx(), qid)));
|
||||
SERIALISE_ELEMENT(target);
|
||||
SERIALISE_ELEMENT(index);
|
||||
SERIALISE_ELEMENT_LOCAL(query, QueryRes(GetCtx(), qid));
|
||||
|
||||
if(m_State < WRITING)
|
||||
if(IsReplayingAndReading())
|
||||
{
|
||||
m_Real.glBeginQueryIndexed(Target, Index, GetResourceManager()->GetLiveResource(id).name);
|
||||
m_ActiveQueries[QueryIdx(Target)][Index] = true;
|
||||
m_Real.glBeginQueryIndexed(target, index, query.name);
|
||||
m_ActiveQueries[QueryIdx(target)][index] = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -310,27 +342,29 @@ void WrappedOpenGL::glBeginQueryIndexed(GLenum target, GLuint index, GLuint id)
|
||||
m_Real.glBeginQueryIndexed(target, index, id);
|
||||
m_ActiveQueries[QueryIdx(target)][index] = true;
|
||||
|
||||
if(m_State == WRITING_CAPFRAME)
|
||||
if(IsActiveCapturing(m_State))
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(BEGIN_QUERY_INDEXED);
|
||||
Serialise_glBeginQueryIndexed(target, index, id);
|
||||
USE_SCRATCH_SERIALISER();
|
||||
SCOPED_SERIALISE_CHUNK(gl_CurChunk);
|
||||
Serialise_glBeginQueryIndexed(ser, target, index, id);
|
||||
|
||||
m_ContextRecord->AddChunk(scope.Get());
|
||||
GetResourceManager()->MarkResourceFrameReferenced(QueryRes(GetCtx(), id), eFrameRef_Read);
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glEndQuery(GLenum target)
|
||||
template <typename SerialiserType>
|
||||
bool WrappedOpenGL::Serialise_glEndQuery(SerialiserType &ser, GLenum target)
|
||||
{
|
||||
SERIALISE_ELEMENT(GLenum, Target, target);
|
||||
SERIALISE_ELEMENT(target);
|
||||
|
||||
if(m_State < WRITING)
|
||||
if(IsReplayingAndReading())
|
||||
{
|
||||
// Queries in the log interfere with the queries from FetchCounters.
|
||||
if(!m_FetchCounters)
|
||||
{
|
||||
m_ActiveQueries[QueryIdx(Target)][0] = false;
|
||||
m_Real.glEndQuery(Target);
|
||||
m_ActiveQueries[QueryIdx(target)][0] = false;
|
||||
m_Real.glEndQuery(target);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,24 +376,26 @@ void WrappedOpenGL::glEndQuery(GLenum target)
|
||||
m_Real.glEndQuery(target);
|
||||
m_ActiveQueries[QueryIdx(target)][0] = false;
|
||||
|
||||
if(m_State == WRITING_CAPFRAME)
|
||||
if(IsActiveCapturing(m_State))
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(END_QUERY);
|
||||
Serialise_glEndQuery(target);
|
||||
USE_SCRATCH_SERIALISER();
|
||||
SCOPED_SERIALISE_CHUNK(gl_CurChunk);
|
||||
Serialise_glEndQuery(ser, target);
|
||||
|
||||
m_ContextRecord->AddChunk(scope.Get());
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glEndQueryIndexed(GLenum target, GLuint index)
|
||||
template <typename SerialiserType>
|
||||
bool WrappedOpenGL::Serialise_glEndQueryIndexed(SerialiserType &ser, GLenum target, GLuint index)
|
||||
{
|
||||
SERIALISE_ELEMENT(GLenum, Target, target);
|
||||
SERIALISE_ELEMENT(uint32_t, Index, index);
|
||||
SERIALISE_ELEMENT(target);
|
||||
SERIALISE_ELEMENT(index);
|
||||
|
||||
if(m_State < WRITING)
|
||||
if(IsReplayingAndReading())
|
||||
{
|
||||
m_Real.glEndQueryIndexed(Target, Index);
|
||||
m_ActiveQueries[QueryIdx(Target)][Index] = false;
|
||||
m_Real.glEndQueryIndexed(target, index);
|
||||
m_ActiveQueries[QueryIdx(target)][index] = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -370,24 +406,26 @@ void WrappedOpenGL::glEndQueryIndexed(GLenum target, GLuint index)
|
||||
m_Real.glEndQueryIndexed(target, index);
|
||||
m_ActiveQueries[QueryIdx(target)][index] = false;
|
||||
|
||||
if(m_State == WRITING_CAPFRAME)
|
||||
if(IsActiveCapturing(m_State))
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(END_QUERY_INDEXED);
|
||||
Serialise_glEndQueryIndexed(target, index);
|
||||
USE_SCRATCH_SERIALISER();
|
||||
SCOPED_SERIALISE_CHUNK(gl_CurChunk);
|
||||
Serialise_glEndQueryIndexed(ser, target, index);
|
||||
|
||||
m_ContextRecord->AddChunk(scope.Get());
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glBeginConditionalRender(GLuint id, GLenum mode)
|
||||
template <typename SerialiserType>
|
||||
bool WrappedOpenGL::Serialise_glBeginConditionalRender(SerialiserType &ser, GLuint id, GLenum mode)
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, qid, GetResourceManager()->GetID(QueryRes(GetCtx(), id)));
|
||||
SERIALISE_ELEMENT(GLenum, Mode, mode);
|
||||
SERIALISE_ELEMENT_LOCAL(query, QueryRes(GetCtx(), id));
|
||||
SERIALISE_ELEMENT(mode);
|
||||
|
||||
if(m_State < WRITING)
|
||||
if(IsReplayingAndReading())
|
||||
{
|
||||
m_ActiveConditional = true;
|
||||
m_Real.glBeginConditionalRender(GetResourceManager()->GetLiveResource(qid).name, Mode);
|
||||
m_Real.glBeginConditionalRender(query.name, mode);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -399,19 +437,21 @@ void WrappedOpenGL::glBeginConditionalRender(GLuint id, GLenum mode)
|
||||
|
||||
m_ActiveConditional = true;
|
||||
|
||||
if(m_State == WRITING_CAPFRAME)
|
||||
if(IsActiveCapturing(m_State))
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(BEGIN_CONDITIONAL);
|
||||
Serialise_glBeginConditionalRender(id, mode);
|
||||
USE_SCRATCH_SERIALISER();
|
||||
SCOPED_SERIALISE_CHUNK(gl_CurChunk);
|
||||
Serialise_glBeginConditionalRender(ser, id, mode);
|
||||
|
||||
m_ContextRecord->AddChunk(scope.Get());
|
||||
GetResourceManager()->MarkResourceFrameReferenced(QueryRes(GetCtx(), id), eFrameRef_Read);
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glEndConditionalRender()
|
||||
template <typename SerialiserType>
|
||||
bool WrappedOpenGL::Serialise_glEndConditionalRender(SerialiserType &ser)
|
||||
{
|
||||
if(m_State < WRITING)
|
||||
if(IsReplayingAndReading())
|
||||
{
|
||||
m_ActiveConditional = false;
|
||||
m_Real.glEndConditionalRender();
|
||||
@@ -425,24 +465,24 @@ void WrappedOpenGL::glEndConditionalRender()
|
||||
m_Real.glEndConditionalRender();
|
||||
m_ActiveConditional = false;
|
||||
|
||||
if(m_State == WRITING_CAPFRAME)
|
||||
if(IsActiveCapturing(m_State))
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(END_CONDITIONAL);
|
||||
Serialise_glEndConditionalRender();
|
||||
USE_SCRATCH_SERIALISER();
|
||||
SCOPED_SERIALISE_CHUNK(gl_CurChunk);
|
||||
Serialise_glEndConditionalRender(ser);
|
||||
|
||||
m_ContextRecord->AddChunk(scope.Get());
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glQueryCounter(GLuint query, GLenum target)
|
||||
template <typename SerialiserType>
|
||||
bool WrappedOpenGL::Serialise_glQueryCounter(SerialiserType &ser, GLuint query_, GLenum target)
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(QueryRes(GetCtx(), query)));
|
||||
SERIALISE_ELEMENT(GLenum, Target, target);
|
||||
SERIALISE_ELEMENT_LOCAL(query, QueryRes(GetCtx(), query_));
|
||||
SERIALISE_ELEMENT(target);
|
||||
|
||||
if(m_State < WRITING)
|
||||
{
|
||||
m_Real.glQueryCounter(GetResourceManager()->GetLiveResource(id).name, Target);
|
||||
}
|
||||
if(IsReplayingAndReading())
|
||||
m_Real.glQueryCounter(query.name, target);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -451,10 +491,11 @@ void WrappedOpenGL::glQueryCounter(GLuint query, GLenum target)
|
||||
{
|
||||
m_Real.glQueryCounter(query, target);
|
||||
|
||||
if(m_State == WRITING_CAPFRAME)
|
||||
if(IsActiveCapturing(m_State))
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(QUERY_COUNTER);
|
||||
Serialise_glQueryCounter(query, target);
|
||||
USE_SCRATCH_SERIALISER();
|
||||
SCOPED_SERIALISE_CHUNK(gl_CurChunk);
|
||||
Serialise_glQueryCounter(ser, query, target);
|
||||
|
||||
m_ContextRecord->AddChunk(scope.Get());
|
||||
GetResourceManager()->MarkResourceFrameReferenced(QueryRes(GetCtx(), query), eFrameRef_Read);
|
||||
@@ -476,3 +517,17 @@ void WrappedOpenGL::glDeleteQueries(GLsizei n, const GLuint *ids)
|
||||
|
||||
m_Real.glDeleteQueries(n, ids);
|
||||
}
|
||||
|
||||
INSTANTIATE_FUNCTION_SERIALISED(void, glFenceSync, GLsync real, GLenum condition, GLbitfield flags);
|
||||
INSTANTIATE_FUNCTION_SERIALISED(void, glClientWaitSync, GLsync sync_, GLbitfield flags,
|
||||
GLuint64 timeout);
|
||||
INSTANTIATE_FUNCTION_SERIALISED(void, glWaitSync, GLsync sync_, GLbitfield flags, GLuint64 timeout);
|
||||
INSTANTIATE_FUNCTION_SERIALISED(void, glGenQueries, GLsizei n, GLuint *ids);
|
||||
INSTANTIATE_FUNCTION_SERIALISED(void, glCreateQueries, GLenum target, GLsizei n, GLuint *ids);
|
||||
INSTANTIATE_FUNCTION_SERIALISED(void, glBeginQuery, GLenum target, GLuint qid);
|
||||
INSTANTIATE_FUNCTION_SERIALISED(void, glBeginQueryIndexed, GLenum target, GLuint index, GLuint qid);
|
||||
INSTANTIATE_FUNCTION_SERIALISED(void, glEndQuery, GLenum target);
|
||||
INSTANTIATE_FUNCTION_SERIALISED(void, glEndQueryIndexed, GLenum target, GLuint index);
|
||||
INSTANTIATE_FUNCTION_SERIALISED(void, glBeginConditionalRender, GLuint id, GLenum mode);
|
||||
INSTANTIATE_FUNCTION_SERIALISED(void, glEndConditionalRender);
|
||||
INSTANTIATE_FUNCTION_SERIALISED(void, glQueryCounter, GLuint query_, GLenum target);
|
||||
|
||||
Reference in New Issue
Block a user