mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-24 22:55:41 +00:00
Serialise out viewports
This commit is contained in:
@@ -131,6 +131,7 @@ enum GLChunkType
|
||||
BLEND_EQ_SEPI,
|
||||
DEPTH_FUNC,
|
||||
VIEWPORT,
|
||||
VIEWPORT_ARRAY,
|
||||
USEPROGRAM,
|
||||
BINDVERTEXARRAY,
|
||||
UNIFORM_MATRIX,
|
||||
|
||||
@@ -371,6 +371,46 @@ void WrappedOpenGL::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glViewportArrayv(GLuint index, GLuint count, const GLfloat *v)
|
||||
{
|
||||
SERIALISE_ELEMENT(GLuint, idx, index);
|
||||
SERIALISE_ELEMENT(GLuint, cnt, count);
|
||||
SERIALISE_ELEMENT_ARR(GLfloat, views, v, cnt*4);
|
||||
|
||||
if(m_State <= EXECUTING)
|
||||
{
|
||||
m_Real.glViewportArrayv(idx, cnt, views);
|
||||
}
|
||||
|
||||
delete[] views;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WrappedOpenGL::glViewportArrayv(GLuint index, GLuint count, const GLfloat *v)
|
||||
{
|
||||
m_Real.glViewportArrayv(index, count, v);
|
||||
|
||||
if(m_State == WRITING_CAPFRAME)
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(VIEWPORT_ARRAY);
|
||||
Serialise_glViewportArrayv(index, count, v);
|
||||
|
||||
m_ContextRecord->AddChunk(scope.Get());
|
||||
}
|
||||
}
|
||||
|
||||
void WrappedOpenGL::glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h)
|
||||
{
|
||||
const float v[4] = { x, y, w, h };
|
||||
glViewportArrayv(index, 1, v);
|
||||
}
|
||||
|
||||
void WrappedOpenGL::glViewportIndexedfv(GLuint index, const GLfloat *v)
|
||||
{
|
||||
glViewportArrayv(index, 1, v);
|
||||
}
|
||||
|
||||
void WrappedOpenGL::glPolygonMode(GLenum face, GLenum mode)
|
||||
{
|
||||
m_Real.glPolygonMode(face, mode);
|
||||
|
||||
@@ -88,6 +88,7 @@ const char *GLChunkNames[] =
|
||||
"glBlendEquationSeparatei",
|
||||
"glDepthFunc",
|
||||
"glViewport",
|
||||
"glViewportArrayv",
|
||||
"glUseProgram",
|
||||
"glBindVertexArray",
|
||||
"glUniformMatrix*",
|
||||
@@ -1005,6 +1006,9 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context)
|
||||
case VIEWPORT:
|
||||
Serialise_glViewport(0, 0, 0, 0);
|
||||
break;
|
||||
case VIEWPORT_ARRAY:
|
||||
Serialise_glViewportArrayv(0, 0, 0);
|
||||
break;
|
||||
case USEPROGRAM:
|
||||
Serialise_glUseProgram(0);
|
||||
break;
|
||||
@@ -1406,6 +1410,11 @@ void WrappedOpenGL::glGetIntegeri_v(GLenum pname, GLuint index, GLint *data)
|
||||
m_Real.glGetIntegeri_v(pname, index, data);
|
||||
}
|
||||
|
||||
void WrappedOpenGL::glGetFloati_v(GLenum pname, GLuint index, GLfloat *data)
|
||||
{
|
||||
m_Real.glGetFloati_v(pname, index, data);
|
||||
}
|
||||
|
||||
void WrappedOpenGL::glGetInteger64i_v(GLenum pname, GLuint index, GLint64 *data)
|
||||
{
|
||||
m_Real.glGetInteger64i_v(pname, index, data);
|
||||
|
||||
@@ -281,6 +281,7 @@ class WrappedOpenGL
|
||||
IMPLEMENT_FUNCTION_SERIALISED(void, glGetFloatv(GLenum pname, GLfloat *params));
|
||||
IMPLEMENT_FUNCTION_SERIALISED(void, glGetIntegerv(GLenum pname, GLint *params));
|
||||
IMPLEMENT_FUNCTION_SERIALISED(void, glGetIntegeri_v(GLenum target, GLuint index, GLint *data));
|
||||
IMPLEMENT_FUNCTION_SERIALISED(void, glGetFloati_v(GLenum target, GLuint index, GLfloat *data));
|
||||
IMPLEMENT_FUNCTION_SERIALISED(void, glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data));
|
||||
IMPLEMENT_FUNCTION_SERIALISED(const GLubyte *, glGetStringi(GLenum name, GLuint i));
|
||||
IMPLEMENT_FUNCTION_SERIALISED(const GLubyte *, glGetString(GLenum name));
|
||||
@@ -297,6 +298,9 @@ class WrappedOpenGL
|
||||
IMPLEMENT_FUNCTION_SERIALISED(void, glBindSampler(GLuint unit, GLuint sampler));
|
||||
IMPLEMENT_FUNCTION_SERIALISED(void, glSamplerParameteri(GLuint sampler, GLenum pname, GLint param));
|
||||
IMPLEMENT_FUNCTION_SERIALISED(void, glViewport(GLint x, GLint y, GLsizei width, GLsizei height));
|
||||
IMPLEMENT_FUNCTION_SERIALISED(void, glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h));
|
||||
IMPLEMENT_FUNCTION_SERIALISED(void, glViewportIndexedfv(GLuint index, const GLfloat *v));
|
||||
IMPLEMENT_FUNCTION_SERIALISED(void, glViewportArrayv(GLuint first, GLuint count, const GLfloat *v));
|
||||
IMPLEMENT_FUNCTION_SERIALISED(void, glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels));
|
||||
IMPLEMENT_FUNCTION_SERIALISED(void, glReadBuffer(GLenum mode));
|
||||
IMPLEMENT_FUNCTION_SERIALISED(void, glGenFramebuffers(GLsizei n, GLuint *framebuffers));
|
||||
|
||||
@@ -92,6 +92,7 @@ struct GLHookSet
|
||||
PFNGLGETBUFFERPARAMETERIVPROC glGetBufferParameteriv;
|
||||
PFNGLGETSTRINGIPROC glGetStringi;
|
||||
PFNGLGETINTEGERI_VPROC glGetIntegeri_v;
|
||||
PFNGLGETFLOATI_VPROC glGetFloati_v;
|
||||
PFNGLGETINTEGER64I_VPROC glGetInteger64i_v;
|
||||
PFNGLCHECKFRAMEBUFFERSTATUSPROC glCheckFramebufferStatus;
|
||||
PFNGLBLENDFUNCSEPARATEPROC glBlendFuncSeparate;
|
||||
@@ -142,6 +143,9 @@ struct GLHookSet
|
||||
PFNGLBINDSAMPLERPROC glBindSampler;
|
||||
PFNGLSAMPLERPARAMETERIPROC glSamplerParameteri;
|
||||
PFNGLCLEARBUFFERFVPROC glClearBufferfv;
|
||||
PFNGLVIEWPORTINDEXEDFPROC glViewportIndexedf;
|
||||
PFNGLVIEWPORTINDEXEDFVPROC glViewportIndexedfv;
|
||||
PFNGLVIEWPORTARRAYVPROC glViewportArrayv;
|
||||
PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation;
|
||||
PFNGLGETACTIVEUNIFORMPROC glGetActiveUniform;
|
||||
PFNGLGETUNIFORMFVPROC glGetUniformfv;
|
||||
|
||||
@@ -103,6 +103,7 @@
|
||||
HookExtension(PFNGLGETBUFFERPARAMETERIVPROC, glGetBufferParameteriv); \
|
||||
HookExtension(PFNGLGETSTRINGIPROC, glGetStringi); \
|
||||
HookExtension(PFNGLGETINTEGERI_VPROC, glGetIntegeri_v); \
|
||||
HookExtension(PFNGLGETFLOATI_VPROC, glGetFloati_v); \
|
||||
HookExtension(PFNGLGETINTEGER64I_VPROC, glGetInteger64i_v); \
|
||||
HookExtension(PFNGLCHECKFRAMEBUFFERSTATUSPROC, glCheckFramebufferStatus); \
|
||||
HookExtension(PFNGLBLENDFUNCSEPARATEPROC, glBlendFuncSeparate); \
|
||||
@@ -154,6 +155,9 @@
|
||||
HookExtension(PFNGLBINDSAMPLERPROC, glBindSampler); \
|
||||
HookExtension(PFNGLSAMPLERPARAMETERIPROC, glSamplerParameteri); \
|
||||
HookExtension(PFNGLCLEARBUFFERFVPROC, glClearBufferfv); \
|
||||
HookExtension(PFNGLVIEWPORTINDEXEDFPROC, glViewportIndexedf); \
|
||||
HookExtension(PFNGLVIEWPORTINDEXEDFVPROC, glViewportIndexedfv); \
|
||||
HookExtension(PFNGLVIEWPORTARRAYVPROC, glViewportArrayv); \
|
||||
HookExtension(PFNGLGETUNIFORMLOCATIONPROC, glGetUniformLocation); \
|
||||
HookExtension(PFNGLGETACTIVEUNIFORMPROC, glGetActiveUniform); \
|
||||
HookExtension(PFNGLGETUNIFORMFVPROC, glGetUniformfv); \
|
||||
@@ -287,6 +291,7 @@
|
||||
HookWrapper3(void, glGetBufferParameteriv, GLenum, target, GLenum, pname, GLint *, params); \
|
||||
HookWrapper2(const GLubyte *, glGetStringi, GLenum, name, GLuint, index); \
|
||||
HookWrapper3(void, glGetIntegeri_v, GLenum, target, GLuint, index, GLint *, data); \
|
||||
HookWrapper3(void, glGetFloati_v, GLenum, target, GLuint, index, GLfloat *, data); \
|
||||
HookWrapper3(void, glGetInteger64i_v, GLenum, target, GLuint, index, GLint64 *, data); \
|
||||
HookWrapper1(GLenum, glCheckFramebufferStatus, GLenum, target); \
|
||||
HookWrapper4(void, glBlendFuncSeparate, GLenum, sfactorRGB, GLenum, dfactorRGB, GLenum, sfactorAlpha, GLenum, dfactorAlpha); \
|
||||
@@ -337,6 +342,9 @@
|
||||
HookWrapper2(void, glBindSampler, GLuint, unit, GLuint, sampler); \
|
||||
HookWrapper3(void, glSamplerParameteri, GLuint, sampler, GLenum, pname, GLint, param); \
|
||||
HookWrapper3(void, glClearBufferfv, GLenum, buffer, GLint, drawbuffer, const GLfloat *, value); \
|
||||
HookWrapper5(void, glViewportIndexedf, GLuint, index, GLfloat, x, GLfloat, y, GLfloat, w, GLfloat, h); \
|
||||
HookWrapper2(void, glViewportIndexedfv, GLuint, index, const GLfloat *, v); \
|
||||
HookWrapper3(void, glViewportArrayv, GLuint, first, GLuint, count, const GLfloat *, v); \
|
||||
HookWrapper2(GLint, glGetUniformLocation, GLuint, program, const GLchar *, name); \
|
||||
HookWrapper7(void, glGetActiveUniform, GLuint, program, GLuint, index, GLsizei, bufSize, GLsizei *, length, GLint *, size, GLenum *, type, GLchar *, name); \
|
||||
HookWrapper3(void, glGetUniformfv, GLuint, program, GLint, location, GLfloat *, params); \
|
||||
|
||||
@@ -92,6 +92,9 @@ void GLRenderState::FetchState()
|
||||
}
|
||||
|
||||
m_Real->glGetFloatv(eGL_BLEND_COLOR, &BlendColor[0]);
|
||||
|
||||
for(int i=0; i < ARRAY_COUNT(Viewports); i++)
|
||||
m_Real->glGetFloati_v(eGL_VIEWPORT, i, &Viewports[i].x);
|
||||
}
|
||||
|
||||
void GLRenderState::ApplyState()
|
||||
@@ -134,6 +137,8 @@ void GLRenderState::ApplyState()
|
||||
}
|
||||
|
||||
m_Real->glBlendColor(BlendColor[0], BlendColor[1], BlendColor[2], BlendColor[3]);
|
||||
|
||||
m_Real->glViewportArrayv(0, ARRAY_COUNT(Viewports), &Viewports[0].x);
|
||||
}
|
||||
|
||||
void GLRenderState::Clear()
|
||||
@@ -147,6 +152,7 @@ void GLRenderState::Clear()
|
||||
RDCEraseEl(UniformBinding);
|
||||
RDCEraseEl(Blends);
|
||||
RDCEraseEl(BlendColor);
|
||||
RDCEraseEl(Viewports);
|
||||
}
|
||||
|
||||
void GLRenderState::Serialise(LogState state, GLResourceManager *rm)
|
||||
@@ -203,4 +209,12 @@ void GLRenderState::Serialise(LogState state, GLResourceManager *rm)
|
||||
}
|
||||
|
||||
m_pSerialiser->Serialise<4>("GL_BLEND_COLOR", BlendColor);
|
||||
|
||||
for(int i=0; i < ARRAY_COUNT(Viewports); i++)
|
||||
{
|
||||
m_pSerialiser->Serialise("GL_VIEWPORT.x", Viewports[i].x);
|
||||
m_pSerialiser->Serialise("GL_VIEWPORT.y", Viewports[i].y);
|
||||
m_pSerialiser->Serialise("GL_VIEWPORT.w", Viewports[i].width);
|
||||
m_pSerialiser->Serialise("GL_VIEWPORT.h", Viewports[i].height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,11 @@ struct GLRenderState
|
||||
GLenum DestinationRGB, DestinationAlpha;
|
||||
} Blends[8];
|
||||
float BlendColor[4];
|
||||
|
||||
struct Viewport
|
||||
{
|
||||
float x, y, width, height;
|
||||
} Viewports[16];
|
||||
//
|
||||
|
||||
void Serialise(LogState state, GLResourceManager *rm);
|
||||
|
||||
Reference in New Issue
Block a user