Implement some missing query/conditional render functions

This commit is contained in:
baldurk
2014-11-25 22:40:38 +00:00
parent 3f33541132
commit c79fb99434
6 changed files with 138 additions and 0 deletions
+4
View File
@@ -166,7 +166,11 @@ enum GLChunkType
GEN_QUERIES,
BEGIN_QUERY,
BEGIN_QUERY_INDEXED,
END_QUERY,
END_QUERY_INDEXED,
BEGIN_CONDITIONAL,
END_CONDITIONAL,
QUERY_COUNTER,
CLEAR_COLOR,
+16
View File
@@ -111,7 +111,11 @@ const char *GLChunkNames[] =
"glGenQueries",
"glBeginQuery",
"glBeginQueryIndexed",
"glEndQuery",
"glEndQueryIndexed",
"glBeginConditional",
"glEndConditional",
"glQueryCounter",
"glClearColor",
@@ -1772,9 +1776,21 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context)
case BEGIN_QUERY:
Serialise_glBeginQuery(eGL_NONE, 0);
break;
case BEGIN_QUERY_INDEXED:
Serialise_glBeginQueryIndexed(eGL_NONE, 0, 0);
break;
case END_QUERY:
Serialise_glEndQuery(eGL_NONE);
break;
case END_QUERY_INDEXED:
Serialise_glEndQueryIndexed(eGL_NONE, 0);
break;
case BEGIN_CONDITIONAL:
Serialise_glBeginConditionalRender(0, eGL_NONE);
break;
case END_CONDITIONAL:
Serialise_glEndConditionalRender();
break;
case QUERY_COUNTER:
Serialise_glQueryCounter(0, eGL_NONE);
break;
+4
View File
@@ -468,7 +468,11 @@ class WrappedOpenGL
IMPLEMENT_FUNCTION_SERIALISED(void, glDeleteSync(GLsync sync));
IMPLEMENT_FUNCTION_SERIALISED(void, glGenQueries(GLsizei n, GLuint *ids));
IMPLEMENT_FUNCTION_SERIALISED(void, glBeginQuery(GLenum target, GLuint id));
IMPLEMENT_FUNCTION_SERIALISED(void, glBeginQueryIndexed(GLenum target, GLuint index, GLuint id));
IMPLEMENT_FUNCTION_SERIALISED(void, glEndQuery(GLenum target));
IMPLEMENT_FUNCTION_SERIALISED(void, glEndQueryIndexed(GLenum target, GLuint index));
IMPLEMENT_FUNCTION_SERIALISED(void, glBeginConditionalRender(GLuint id, GLenum mode));
IMPLEMENT_FUNCTION_SERIALISED(void, glEndConditionalRender());
IMPLEMENT_FUNCTION_SERIALISED(void, glQueryCounter(GLuint id, GLenum target));
IMPLEMENT_FUNCTION_SERIALISED(void, glDeleteQueries(GLsizei n, const GLuint *ids));
+4
View File
@@ -323,7 +323,11 @@ struct GLHookSet
PFNGLDELETESYNCPROC glDeleteSync;
PFNGLGENQUERIESPROC glGenQueries;
PFNGLBEGINQUERYPROC glBeginQuery;
PFNGLBEGINQUERYINDEXEDPROC glBeginQueryIndexed;
PFNGLENDQUERYPROC glEndQuery;
PFNGLENDQUERYINDEXEDPROC glEndQueryIndexed;
PFNGLBEGINCONDITIONALRENDERPROC glBeginConditionalRender;
PFNGLENDCONDITIONALRENDERPROC glEndConditionalRender;
PFNGLQUERYCOUNTERPROC glQueryCounter;
PFNGLDELETEQUERIESPROC glDeleteQueries;
PFNGLBUFFERDATAPROC glBufferData; // aliases glBufferDataARB
+8
View File
@@ -349,7 +349,11 @@
HookExtension(PFNGLDELETESYNCPROC, glDeleteSync); \
HookExtension(PFNGLGENQUERIESPROC, glGenQueries); \
HookExtension(PFNGLBEGINQUERYPROC, glBeginQuery); \
HookExtension(PFNGLBEGINQUERYINDEXEDPROC, glBeginQueryIndexed); \
HookExtension(PFNGLENDQUERYPROC, glEndQuery); \
HookExtension(PFNGLENDQUERYINDEXEDPROC, glEndQueryIndexed); \
HookExtension(PFNGLBEGINCONDITIONALRENDERPROC, glBeginConditionalRender); \
HookExtension(PFNGLENDCONDITIONALRENDERPROC, glEndConditionalRender); \
HookExtension(PFNGLQUERYCOUNTERPROC, glQueryCounter); \
HookExtension(PFNGLDELETEQUERIESPROC, glDeleteQueries); \
HookExtension(PFNGLBUFFERDATAPROC, glBufferData); \
@@ -1035,7 +1039,11 @@
HookWrapper1(void, glDeleteSync, GLsync, sync); \
HookWrapper2(void, glGenQueries, GLsizei, n, GLuint *, ids); \
HookWrapper2(void, glBeginQuery, GLenum, target, GLuint, id); \
HookWrapper3(void, glBeginQueryIndexed, GLenum, target, GLuint, index, GLuint, id); \
HookWrapper1(void, glEndQuery, GLenum, target); \
HookWrapper2(void, glEndQueryIndexed, GLenum, target, GLuint, index); \
HookWrapper2(void, glBeginConditionalRender, GLuint, id, GLenum, mode); \
HookWrapper0(void, glEndConditionalRender); \
HookWrapper2(void, glQueryCounter, GLuint, id, GLenum, target); \
HookWrapper2(void, glDeleteQueries, GLsizei, n, const GLuint *, ids); \
HookWrapper4(void, glBufferData, GLenum, target, GLsizeiptr, size, const void *, data, GLenum, usage); \
@@ -229,6 +229,33 @@ void WrappedOpenGL::glBeginQuery(GLenum target, GLuint id)
}
}
bool WrappedOpenGL::Serialise_glBeginQueryIndexed(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)));
if(m_State < WRITING)
{
m_Real.glBeginQueryIndexed(Target, Index, GetResourceManager()->GetLiveResource(id).name);
}
return true;
}
void WrappedOpenGL::glBeginQueryIndexed(GLenum target, GLuint index, GLuint id)
{
m_Real.glBeginQueryIndexed(target, index, id);
if(m_State == WRITING_CAPFRAME)
{
SCOPED_SERIALISE_CONTEXT(BEGIN_QUERY_INDEXED);
Serialise_glBeginQueryIndexed(target, index, id);
m_ContextRecord->AddChunk(scope.Get());
}
}
bool WrappedOpenGL::Serialise_glEndQuery(GLenum target)
{
SERIALISE_ELEMENT(GLenum, Target, target);
@@ -254,6 +281,81 @@ void WrappedOpenGL::glEndQuery(GLenum target)
}
}
bool WrappedOpenGL::Serialise_glEndQueryIndexed(GLenum target, GLuint index)
{
SERIALISE_ELEMENT(GLenum, Target, target);
SERIALISE_ELEMENT(uint32_t, Index, index);
if(m_State < WRITING)
{
m_Real.glEndQueryIndexed(Target, Index);
}
return true;
}
void WrappedOpenGL::glEndQueryIndexed(GLenum target, GLuint index)
{
m_Real.glEndQueryIndexed(target, index);
if(m_State == WRITING_CAPFRAME)
{
SCOPED_SERIALISE_CONTEXT(END_QUERY_INDEXED);
Serialise_glEndQueryIndexed(target, index);
m_ContextRecord->AddChunk(scope.Get());
}
}
bool WrappedOpenGL::Serialise_glBeginConditionalRender(GLuint id, GLenum mode)
{
SERIALISE_ELEMENT(ResourceId, qid, GetResourceManager()->GetID(QueryRes(GetCtx(), id)));
SERIALISE_ELEMENT(GLenum, Mode, mode);
if(m_State < WRITING)
{
m_Real.glBeginConditionalRender(GetResourceManager()->GetLiveResource(qid).name, Mode);
}
return true;
}
void WrappedOpenGL::glBeginConditionalRender(GLuint id, GLenum mode)
{
m_Real.glBeginConditionalRender(id, mode);
if(m_State == WRITING_CAPFRAME)
{
SCOPED_SERIALISE_CONTEXT(BEGIN_CONDITIONAL);
Serialise_glBeginConditionalRender(id, mode);
m_ContextRecord->AddChunk(scope.Get());
}
}
bool WrappedOpenGL::Serialise_glEndConditionalRender()
{
if(m_State < WRITING)
{
m_Real.glEndConditionalRender();
}
return true;
}
void WrappedOpenGL::glEndConditionalRender()
{
m_Real.glEndConditionalRender();
if(m_State == WRITING_CAPFRAME)
{
SCOPED_SERIALISE_CONTEXT(END_CONDITIONAL);
Serialise_glEndConditionalRender();
m_ContextRecord->AddChunk(scope.Get());
}
}
bool WrappedOpenGL::Serialise_glQueryCounter(GLuint query, GLenum target)
{
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(QueryRes(GetCtx(), query)));