A few more assorted functions wrapped.

* Also rearranged and organised the ProcessChunk() switch to match the
  enum in gl_common.h for easier reference
This commit is contained in:
Baldur Karlsson
2014-06-18 17:23:07 +01:00
parent eeadec99f6
commit acb36a5308
10 changed files with 542 additions and 89 deletions
+6 -2
View File
@@ -99,6 +99,7 @@ enum GLChunkType
TEXPARAMETERI,
TEXPARAMETERIV,
GENERATE_MIPMAP,
TEXTURE_VIEW,
CREATE_SHADER,
CREATE_PROGRAM,
@@ -109,6 +110,8 @@ enum GLChunkType
DETACHSHADER,
USEPROGRAM,
PROGRAMPARAMETER,
BINDATTRIB_LOCATION,
UNIFORM_BLOCKBIND,
PROGRAMUNIFORM_VECTOR,
LINKPROGRAM,
@@ -183,6 +186,8 @@ enum GLChunkType
GEN_FRAMEBUFFERS,
FRAMEBUFFER_TEX,
FRAMEBUFFER_TEX2D,
FRAMEBUFFER_TEXLAYER,
READ_BUFFER,
BIND_FRAMEBUFFER,
DRAW_BUFFER,
@@ -207,10 +212,9 @@ enum GLChunkType
GEN_VERTEXARRAY,
BIND_VERTEXARRAY,
VERTEXATTRIBPOINTER,
VERTEXATTRIBIPOINTER,
ENABLEVERTEXATTRIBARRAY,
DISABLEVERTEXATTRIBARRAY,
DELETE_VERTEXARRAY,
DELETE_BUFFER,
OBJECT_LABEL,
BEGIN_EVENT,
+129 -84
View File
@@ -37,6 +37,7 @@
const char *GLChunkNames[] =
{
"WrappedOpenGL::Initialisation",
"glGenTextures",
"glBindTexture",
"glActiveTexture",
@@ -55,6 +56,7 @@ const char *GLChunkNames[] =
"glTexParameteri",
"glTexParameteriv",
"glGenerateMipmap",
"glTextureView",
"glCreateShader",
"glCreateProgram",
@@ -65,6 +67,8 @@ const char *GLChunkNames[] =
"glDetachShader",
"glUseProgram",
"glProgramParameter",
"glBindAttribLocation",
"glUniformBlockBinding",
"glProgramUniformVector*",
"glLinkProgram",
@@ -136,8 +140,11 @@ const char *GLChunkNames[] =
"glDrawElementsBaseVertex",
"glDrawElementsInstancedBaseVertex",
"glDrawElementsInstancedBaseVertexBaseInstance",
"glGenFramebuffers",
"glFramebufferTexture",
"glFramebufferTexture2D",
"glFramebufferTextureLayer",
"glReadBuffer",
"glBindFramebuffer",
"glDrawBuffer",
@@ -162,10 +169,9 @@ const char *GLChunkNames[] =
"glGenVertexArrays",
"glBindVertexArray",
"glVertexAttribPointer",
"glVertexAttribIPointer",
"glEnableVertexAttribArray",
"glDisableVertexAttribArray",
"glDeleteVertexArray",
"glDeleteBuffer",
"glObjectLabel",
"glPushDebugGroup",
@@ -961,6 +967,9 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context)
case GENERATE_MIPMAP:
Serialise_glGenerateMipmap(eGL_UNKNOWN_ENUM);
break;
case TEXTURE_VIEW:
Serialise_glTextureView(0, eGL_UNKNOWN_ENUM, 0, eGL_UNKNOWN_ENUM, 0, 0, 0, 0);
break;
case CREATE_SHADER:
Serialise_glCreateShader(0, eGL_UNKNOWN_ENUM);
@@ -989,6 +998,12 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context)
case PROGRAMPARAMETER:
Serialise_glProgramParameteri(0, eGL_UNKNOWN_ENUM, 0);
break;
case BINDATTRIB_LOCATION:
Serialise_glBindAttribLocation(0, 0, NULL);
break;
case UNIFORM_BLOCKBIND:
Serialise_glUniformBlockBinding(0, 0, 0);
break;
case PROGRAMUNIFORM_VECTOR:
Serialise_glProgramUniformVector(0, eGL_UNKNOWN_ENUM, 0, 0, UNIFORM_UNKNOWN);
break;
@@ -1005,54 +1020,27 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context)
case BIND_PROGRAMPIPE:
Serialise_glBindProgramPipeline(0);
break;
case FENCE_SYNC:
Serialise_glFenceSync(NULL, eGL_UNKNOWN_ENUM, 0);
break;
case CLIENTWAIT_SYNC:
Serialise_glClientWaitSync(NULL, 0, 0);
break;
case WAIT_SYNC:
Serialise_glWaitSync(NULL, 0, 0);
break;
case GEN_QUERIES:
Serialise_glGenQueries(0, NULL);
break;
case BEGIN_QUERY:
Serialise_glBeginQuery(eGL_UNKNOWN_ENUM, 0);
break;
case END_QUERY:
Serialise_glEndQuery(eGL_UNKNOWN_ENUM);
break;
case GEN_FRAMEBUFFERS:
Serialise_glGenFramebuffers(0, NULL);
break;
case BIND_FRAMEBUFFER:
Serialise_glBindFramebuffer(eGL_UNKNOWN_ENUM, 0);
break;
case READ_BUFFER:
Serialise_glReadBuffer(eGL_UNKNOWN_ENUM);
break;
case FRAMEBUFFER_TEX:
Serialise_glFramebufferTexture(eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM, 0, 0);
break;
case DRAW_BUFFER:
Serialise_glDrawBuffer(eGL_UNKNOWN_ENUM);
break;
case DRAW_BUFFERS:
Serialise_glDrawBuffers(0, NULL);
break;
case BLIT_FRAMEBUFFER:
Serialise_glBlitFramebuffer(0, 0, 0, 0, 0, 0, 0, 0, 0, eGL_UNKNOWN_ENUM);
break;
case GEN_SAMPLERS:
Serialise_glGenSamplers(0, NULL);
break;
case BIND_SAMPLER:
Serialise_glBindSampler(0, 0);
break;
case SAMPLER_PARAMETERI:
Serialise_glSamplerParameteri(0, eGL_UNKNOWN_ENUM, 0);
break;
case SAMPLER_PARAMETERF:
Serialise_glSamplerParameterf(0, eGL_UNKNOWN_ENUM, 0);
break;
case SAMPLER_PARAMETERIV:
Serialise_glSamplerParameteriv(0, eGL_UNKNOWN_ENUM, NULL);
break;
case SAMPLER_PARAMETERFV:
Serialise_glSamplerParameterfv(0, eGL_UNKNOWN_ENUM, NULL);
break;
case SAMPLER_PARAMETERIIV:
Serialise_glSamplerParameterIiv(0, eGL_UNKNOWN_ENUM, NULL);
break;
case SAMPLER_PARAMETERIUIV:
Serialise_glSamplerParameterIuiv(0, eGL_UNKNOWN_ENUM, NULL);
break;
case CLEAR_COLOR:
Serialise_glClearColor(0, 0, 0, 0);
break;
@@ -1062,15 +1050,6 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context)
case CLEAR:
Serialise_glClear(0);
break;
case CULL_FACE:
Serialise_glCullFace(eGL_UNKNOWN_ENUM);
break;
case POLYGON_MODE:
glPolygonMode(eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM);
break;
case POLYGON_OFFSET:
glPolygonOffset(0, 0);
break;
case CLEARBUFFERF:
Serialise_glClearBufferfv(eGL_UNKNOWN_ENUM, 0, NULL);
break;
@@ -1083,8 +1062,14 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context)
case CLEARBUFFERFI:
Serialise_glClearBufferfi(eGL_UNKNOWN_ENUM, 0, 0, 0);
break;
case DISABLE:
Serialise_glDisable(eGL_UNKNOWN_ENUM);
case POLYGON_MODE:
glPolygonMode(eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM);
break;
case POLYGON_OFFSET:
glPolygonOffset(0, 0);
break;
case CULL_FACE:
Serialise_glCullFace(eGL_UNKNOWN_ENUM);
break;
case HINT:
Serialise_glHint(eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM);
@@ -1092,61 +1077,67 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context)
case ENABLE:
Serialise_glEnable(eGL_UNKNOWN_ENUM);
break;
case DISABLEI:
Serialise_glDisablei(eGL_UNKNOWN_ENUM, 0);
case DISABLE:
Serialise_glDisable(eGL_UNKNOWN_ENUM);
break;
case ENABLEI:
Serialise_glEnablei(eGL_UNKNOWN_ENUM, 0);
break;
case DISABLEI:
Serialise_glDisablei(eGL_UNKNOWN_ENUM, 0);
break;
case FRONT_FACE:
Serialise_glFrontFace(eGL_UNKNOWN_ENUM);
break;
case BLEND_FUNC:
glBlendFunc(eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM);
Serialise_glBlendFunc(eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM);
break;
case BLEND_FUNCI:
Serialise_glBlendFunci(0, eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM);
break;
case BLEND_COLOR:
glBlendColor(0, 0, 0, 0);
Serialise_glBlendColor(0, 0, 0, 0);
break;
case BLEND_FUNC_SEP:
glBlendFuncSeparate(eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM);
Serialise_glBlendFuncSeparate(eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM);
break;
case BLEND_FUNC_SEPI:
glBlendFuncSeparatei(0, eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM);
Serialise_glBlendFuncSeparatei(0, eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM);
break;
case BLEND_EQ_SEP:
glBlendEquationSeparate(eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM);
Serialise_glBlendEquationSeparate(eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM);
break;
case BLEND_EQ_SEPI:
glBlendEquationSeparatei(0, eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM);
Serialise_glBlendEquationSeparatei(0, eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM);
break;
case STENCIL_OP:
glStencilOp(eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM);
Serialise_glStencilOp(eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM);
break;
case STENCIL_OP_SEP:
glStencilOpSeparate(eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM);
Serialise_glStencilOpSeparate(eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM);
break;
case STENCIL_FUNC:
glStencilFunc(eGL_UNKNOWN_ENUM, 0, 0);
Serialise_glStencilFunc(eGL_UNKNOWN_ENUM, 0, 0);
break;
case STENCIL_FUNC_SEP:
glStencilFuncSeparate(eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM, 0, 0);
Serialise_glStencilFuncSeparate(eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM, 0, 0);
break;
case STENCIL_MASK:
glStencilMask(0);
Serialise_glStencilMask(0);
break;
case STENCIL_MASK_SEP:
glStencilMaskSeparate(eGL_UNKNOWN_ENUM, 0);
Serialise_glStencilMaskSeparate(eGL_UNKNOWN_ENUM, 0);
break;
case COLOR_MASK:
glColorMask(0, 0, 0, 0);
Serialise_glColorMask(0, 0, 0, 0);
break;
case COLOR_MASKI:
glColorMaski(0, 0, 0, 0, 0);
Serialise_glColorMaski(0, 0, 0, 0, 0);
break;
case SAMPLE_MASK:
glSampleMaski(0, 0);
Serialise_glSampleMaski(0, 0);
break;
case DEPTH_FUNC:
Serialise_glDepthFunc(eGL_UNKNOWN_ENUM);
@@ -1202,8 +1193,8 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context)
case DRAWELEMENTS:
Serialise_glDrawElements(eGL_UNKNOWN_ENUM, 0, eGL_UNKNOWN_ENUM, NULL);
break;
case DRAWELEMENTS_BASEVERTEX:
Serialise_glDrawElementsBaseVertex(eGL_UNKNOWN_ENUM, 0, eGL_UNKNOWN_ENUM, NULL, 0);
case DRAWRANGEELEMENTS:
Serialise_glDrawRangeElements(eGL_UNKNOWN_ENUM, 0, 0, 0, eGL_UNKNOWN_ENUM, NULL);
break;
case DRAWELEMENTS_INSTANCED:
Serialise_glDrawElementsInstanced(eGL_UNKNOWN_ENUM, 0, eGL_UNKNOWN_ENUM, NULL, 0);
@@ -1211,6 +1202,9 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context)
case DRAWELEMENTS_INSTANCEDBASEINSTANCE:
Serialise_glDrawElementsInstancedBaseInstance(eGL_UNKNOWN_ENUM, 0, eGL_UNKNOWN_ENUM, NULL, 0, 0);
break;
case DRAWELEMENTS_BASEVERTEX:
Serialise_glDrawElementsBaseVertex(eGL_UNKNOWN_ENUM, 0, eGL_UNKNOWN_ENUM, NULL, 0);
break;
case DRAWELEMENTS_INSTANCEDBASEVERTEX:
Serialise_glDrawElementsInstancedBaseVertex(eGL_UNKNOWN_ENUM, 0, eGL_UNKNOWN_ENUM, NULL, 0, 0);
break;
@@ -1218,6 +1212,59 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context)
Serialise_glDrawElementsInstancedBaseVertexBaseInstance(eGL_UNKNOWN_ENUM, 0, eGL_UNKNOWN_ENUM, NULL, 0, 0, 0);
break;
case GEN_FRAMEBUFFERS:
Serialise_glGenFramebuffers(0, NULL);
break;
case FRAMEBUFFER_TEX:
Serialise_glFramebufferTexture(eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM, 0, 0);
break;
case FRAMEBUFFER_TEX2D:
Serialise_glFramebufferTexture2D(eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM, 0, 0);
break;
case FRAMEBUFFER_TEXLAYER:
Serialise_glFramebufferTextureLayer(eGL_UNKNOWN_ENUM, eGL_UNKNOWN_ENUM, 0, 0, 0);
break;
case READ_BUFFER:
Serialise_glReadBuffer(eGL_UNKNOWN_ENUM);
break;
case BIND_FRAMEBUFFER:
Serialise_glBindFramebuffer(eGL_UNKNOWN_ENUM, 0);
break;
case DRAW_BUFFER:
Serialise_glDrawBuffer(eGL_UNKNOWN_ENUM);
break;
case DRAW_BUFFERS:
Serialise_glDrawBuffers(0, NULL);
break;
case BLIT_FRAMEBUFFER:
Serialise_glBlitFramebuffer(0, 0, 0, 0, 0, 0, 0, 0, 0, eGL_UNKNOWN_ENUM);
break;
case GEN_SAMPLERS:
Serialise_glGenSamplers(0, NULL);
break;
case SAMPLER_PARAMETERI:
Serialise_glSamplerParameteri(0, eGL_UNKNOWN_ENUM, 0);
break;
case SAMPLER_PARAMETERF:
Serialise_glSamplerParameterf(0, eGL_UNKNOWN_ENUM, 0);
break;
case SAMPLER_PARAMETERIV:
Serialise_glSamplerParameteriv(0, eGL_UNKNOWN_ENUM, NULL);
break;
case SAMPLER_PARAMETERFV:
Serialise_glSamplerParameterfv(0, eGL_UNKNOWN_ENUM, NULL);
break;
case SAMPLER_PARAMETERIIV:
Serialise_glSamplerParameterIiv(0, eGL_UNKNOWN_ENUM, NULL);
break;
case SAMPLER_PARAMETERIUIV:
Serialise_glSamplerParameterIuiv(0, eGL_UNKNOWN_ENUM, NULL);
break;
case BIND_SAMPLER:
Serialise_glBindSampler(0, 0);
break;
case GEN_BUFFER:
Serialise_glGenBuffers(0, NULL);
break;
@@ -1245,6 +1292,9 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context)
case VERTEXATTRIBPOINTER:
Serialise_glVertexAttribPointer(0, 0, eGL_UNKNOWN_ENUM, 0, 0, NULL);
break;
case VERTEXATTRIBIPOINTER:
Serialise_glVertexAttribIPointer(0, 0, eGL_UNKNOWN_ENUM, 0, NULL);
break;
case ENABLEVERTEXATTRIBARRAY:
Serialise_glEnableVertexAttribArray(0);
break;
@@ -1252,11 +1302,6 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context)
Serialise_glDisableVertexAttribArray(0);
break;
case DELETE_VERTEXARRAY:
case DELETE_BUFFER:
RDCFATAL("Not impl");
break;
case OBJECT_LABEL:
Serialise_glObjectLabel(eGL_UNKNOWN_ENUM, 0, 0, NULL);
break;
+8
View File
@@ -316,6 +316,7 @@ class WrappedOpenGL
IMPLEMENT_FUNCTION_SERIALISED(void, glTexParameteriv(GLenum target, GLenum pname, const GLint *params));
IMPLEMENT_FUNCTION_SERIALISED(void, glGenSamplers(GLsizei count, GLuint *samplers));
IMPLEMENT_FUNCTION_SERIALISED(void, glBindSampler(GLuint unit, GLuint sampler));
IMPLEMENT_FUNCTION_SERIALISED(void, glDeleteSamplers(GLsizei n, const GLuint *ids));
IMPLEMENT_FUNCTION_SERIALISED(void, glSamplerParameteri(GLuint sampler, GLenum pname, GLint param));
IMPLEMENT_FUNCTION_SERIALISED(void, glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param));
IMPLEMENT_FUNCTION_SERIALISED(void, glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params));
@@ -337,6 +338,8 @@ class WrappedOpenGL
IMPLEMENT_FUNCTION_SERIALISED(void, glDrawBuffers(GLsizei n, const GLenum *bufs));
IMPLEMENT_FUNCTION_SERIALISED(void, glBindFramebuffer(GLenum target, GLuint framebuffer));
IMPLEMENT_FUNCTION_SERIALISED(void, glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level));
IMPLEMENT_FUNCTION_SERIALISED(void, glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level));
IMPLEMENT_FUNCTION_SERIALISED(void, glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer));
IMPLEMENT_FUNCTION_SERIALISED(void, glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers));
IMPLEMENT_FUNCTION_SERIALISED(void, glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params));
@@ -374,6 +377,7 @@ class WrappedOpenGL
IMPLEMENT_FUNCTION_SERIALISED(void, glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data));
IMPLEMENT_FUNCTION_SERIALISED(void, glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data));
IMPLEMENT_FUNCTION_SERIALISED(void, glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data));
IMPLEMENT_FUNCTION_SERIALISED(void, glTextureView(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers));
IMPLEMENT_FUNCTION_SERIALISED(void, glGenerateMipmap(GLenum target));
IMPLEMENT_FUNCTION_SERIALISED(void, glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter));
@@ -407,6 +411,8 @@ class WrappedOpenGL
IMPLEMENT_FUNCTION_SERIALISED(void, glDeleteProgram(GLuint program));
IMPLEMENT_FUNCTION_SERIALISED(void, glLinkProgram(GLuint program));
IMPLEMENT_FUNCTION_SERIALISED(void, glProgramParameteri(GLuint program, GLenum pname, GLint value));
IMPLEMENT_FUNCTION_SERIALISED(void, glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding));
IMPLEMENT_FUNCTION_SERIALISED(void, glBindAttribLocation(GLuint program, GLuint index, const GLchar *name));
IMPLEMENT_FUNCTION_SERIALISED(void, glUseProgram(GLuint program));
IMPLEMENT_FUNCTION_SERIALISED(void, glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program));
IMPLEMENT_FUNCTION_SERIALISED(void, glValidateProgram(GLuint program));
@@ -426,6 +432,7 @@ class WrappedOpenGL
IMPLEMENT_FUNCTION_SERIALISED(void, glBufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage));
IMPLEMENT_FUNCTION_SERIALISED(void, glBindBufferBase(GLenum target, GLuint index, GLuint buffer));
IMPLEMENT_FUNCTION_SERIALISED(void, glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size));
IMPLEMENT_FUNCTION_SERIALISED(void *, glMapBuffer(GLenum target, GLenum access));
IMPLEMENT_FUNCTION_SERIALISED(void *, glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access));
IMPLEMENT_FUNCTION_SERIALISED(GLboolean, glUnmapBuffer(GLenum target));
@@ -434,6 +441,7 @@ class WrappedOpenGL
IMPLEMENT_FUNCTION_SERIALISED(void, glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value));
IMPLEMENT_FUNCTION_SERIALISED(void, glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil));
IMPLEMENT_FUNCTION_SERIALISED(void, glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer));
IMPLEMENT_FUNCTION_SERIALISED(void, glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer));
IMPLEMENT_FUNCTION_SERIALISED(void, glEnableVertexAttribArray(GLuint index));
IMPLEMENT_FUNCTION_SERIALISED(void, glDisableVertexAttribArray(GLuint index));
IMPLEMENT_FUNCTION_SERIALISED(void, glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params));
+8
View File
@@ -96,6 +96,7 @@ struct GLHookSet
PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glCompressedTexSubImage1D;
PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glCompressedTexSubImage2D;
PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glCompressedTexSubImage3D;
PFNGLTEXTUREVIEWPROC glTextureView;
PFNGLGENERATEMIPMAPPROC glGenerateMipmap;
PFNGLGETINTERNALFORMATIVPROC glGetInternalformativ;
PFNGLGETINTERNALFORMATI64VPROC glGetInternalformati64v;
@@ -173,6 +174,8 @@ struct GLHookSet
PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers;
PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer;
PFNGLFRAMEBUFFERTEXTUREPROC glFramebufferTexture;
PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D;
PFNGLFRAMEBUFFERTEXTURELAYERPROC glFramebufferTextureLayer;
PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers;
PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glGetFramebufferAttachmentParameteriv;
PFNGLFENCESYNCPROC glFenceSync;
@@ -188,6 +191,7 @@ struct GLHookSet
PFNGLBUFFERDATAPROC glBufferData;
PFNGLBINDBUFFERBASEPROC glBindBufferBase;
PFNGLBINDBUFFERRANGEPROC glBindBufferRange;
PFNGLMAPBUFFERPROC glMapBuffer;
PFNGLMAPBUFFERRANGEPROC glMapBufferRange;
PFNGLUNMAPBUFFERPROC glUnmapBuffer;
PFNGLDELETEBUFFERSPROC glDeleteBuffers;
@@ -196,6 +200,8 @@ struct GLHookSet
PFNGLBINDVERTEXARRAYPROC glBindVertexArray;
PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays;
PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer;
PFNGLVERTEXATTRIBIPOINTERPROC glVertexAttribIPointer;
PFNGLBINDATTRIBLOCATIONPROC glBindAttribLocation;
PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray;
PFNGLDISABLEVERTEXATTRIBARRAYPROC glDisableVertexAttribArray;
PFNGLGETVERTEXATTRIBIVPROC glGetVertexAttribiv;
@@ -203,6 +209,7 @@ struct GLHookSet
PFNGLGETCOMPRESSEDTEXIMAGEPROC glGetCompressedTexImage;
PFNGLGENSAMPLERSPROC glGenSamplers;
PFNGLBINDSAMPLERPROC glBindSampler;
PFNGLDELETESAMPLERSPROC glDeleteSamplers;
PFNGLSAMPLERPARAMETERIPROC glSamplerParameteri;
PFNGLSAMPLERPARAMETERFPROC glSamplerParameterf;
PFNGLSAMPLERPARAMETERIVPROC glSamplerParameteriv;
@@ -230,6 +237,7 @@ struct GLHookSet
PFNGLGETACTIVEATTRIBPROC glGetActiveAttrib;
PFNGLGETUNIFORMFVPROC glGetUniformfv;
PFNGLGETUNIFORMIVPROC glGetUniformiv;
PFNGLUNIFORMBLOCKBINDINGPROC glUniformBlockBinding;
PFNGLUNIFORMMATRIX4FVPROC glUniformMatrix4fv;
PFNGLUNIFORM1FPROC glUniform1f;
PFNGLUNIFORM1IPROC glUniform1i;
+16
View File
@@ -109,6 +109,7 @@
HookExtension(PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC, glCompressedTexSubImage1D); \
HookExtension(PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC, glCompressedTexSubImage2D); \
HookExtension(PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC, glCompressedTexSubImage3D); \
HookExtension(PFNGLTEXTUREVIEWPROC, glTextureView); \
HookExtension(PFNGLGENERATEMIPMAPPROC, glGenerateMipmap); \
HookExtension(PFNGLGETINTERNALFORMATIVPROC, glGetInternalformativ); \
HookExtension(PFNGLGETINTERNALFORMATI64VPROC, glGetInternalformati64v); \
@@ -187,6 +188,8 @@
HookExtension(PFNGLGENFRAMEBUFFERSPROC, glGenFramebuffers); \
HookExtension(PFNGLBINDFRAMEBUFFERPROC, glBindFramebuffer); \
HookExtension(PFNGLFRAMEBUFFERTEXTUREPROC, glFramebufferTexture); \
HookExtension(PFNGLFRAMEBUFFERTEXTURE2DPROC, glFramebufferTexture2D); \
HookExtension(PFNGLFRAMEBUFFERTEXTURELAYERPROC, glFramebufferTextureLayer); \
HookExtension(PFNGLDELETEFRAMEBUFFERSPROC, glDeleteFramebuffers); \
HookExtension(PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC, glGetFramebufferAttachmentParameteriv); \
HookExtension(PFNGLFENCESYNCPROC, glFenceSync); \
@@ -202,6 +205,7 @@
HookExtension(PFNGLBUFFERDATAPROC, glBufferData); \
HookExtension(PFNGLBINDBUFFERBASEPROC, glBindBufferBase); \
HookExtension(PFNGLBINDBUFFERRANGEPROC, glBindBufferRange); \
HookExtension(PFNGLMAPBUFFERPROC, glMapBuffer); \
HookExtension(PFNGLMAPBUFFERRANGEPROC, glMapBufferRange); \
HookExtension(PFNGLUNMAPBUFFERPROC, glUnmapBuffer); \
HookExtension(PFNGLDELETEBUFFERSPROC, glDeleteBuffers); \
@@ -210,6 +214,8 @@
HookExtension(PFNGLBINDVERTEXARRAYPROC, glBindVertexArray); \
HookExtension(PFNGLDELETEVERTEXARRAYSPROC, glDeleteVertexArrays); \
HookExtension(PFNGLVERTEXATTRIBPOINTERPROC, glVertexAttribPointer); \
HookExtension(PFNGLVERTEXATTRIBIPOINTERPROC, glVertexAttribIPointer); \
HookExtension(PFNGLBINDATTRIBLOCATIONPROC, glBindAttribLocation); \
HookExtension(PFNGLENABLEVERTEXATTRIBARRAYPROC, glEnableVertexAttribArray); \
HookExtension(PFNGLDISABLEVERTEXATTRIBARRAYPROC, glDisableVertexAttribArray); \
HookExtension(PFNGLGETVERTEXATTRIBIVPROC, glGetVertexAttribiv); \
@@ -217,6 +223,7 @@
HookExtension(PFNGLGETCOMPRESSEDTEXIMAGEPROC, glGetCompressedTexImage); \
HookExtension(PFNGLGENSAMPLERSPROC, glGenSamplers); \
HookExtension(PFNGLBINDSAMPLERPROC, glBindSampler); \
HookExtension(PFNGLDELETESAMPLERSPROC, glDeleteSamplers); \
HookExtension(PFNGLSAMPLERPARAMETERIPROC, glSamplerParameteri); \
HookExtension(PFNGLSAMPLERPARAMETERFPROC, glSamplerParameterf); \
HookExtension(PFNGLSAMPLERPARAMETERIVPROC, glSamplerParameteriv); \
@@ -244,6 +251,7 @@
HookExtension(PFNGLGETACTIVEATTRIBPROC, glGetActiveAttrib); \
HookExtension(PFNGLGETUNIFORMFVPROC, glGetUniformfv); \
HookExtension(PFNGLGETUNIFORMIVPROC, glGetUniformiv); \
HookExtension(PFNGLUNIFORMBLOCKBINDINGPROC, glUniformBlockBinding); \
HookExtension(PFNGLUNIFORMMATRIX4FVPROC, glUniformMatrix4fv); \
HookExtension(PFNGLUNIFORM1FPROC, glUniform1f); \
HookExtension(PFNGLUNIFORM1IPROC, glUniform1i); \
@@ -398,6 +406,7 @@
HookWrapper7(void, glCompressedTexSubImage1D, GLenum, target, GLint, level, GLint, xoffset, GLsizei, width, GLenum, format, GLsizei, imageSize, const void *, data); \
HookWrapper9(void, glCompressedTexSubImage2D, GLenum, target, GLint, level, GLint, xoffset, GLint, yoffset, GLsizei, width, GLsizei, height, GLenum, format, GLsizei, imageSize, const void *, data); \
HookWrapper11(void, glCompressedTexSubImage3D, GLenum, target, GLint, level, GLint, xoffset, GLint, yoffset, GLint, zoffset, GLsizei, width, GLsizei, height, GLsizei, depth, GLenum, format, GLsizei, imageSize, const void *, data); \
HookWrapper8(void, glTextureView, GLuint, texture, GLenum, target, GLuint, origtexture, GLenum, internalformat, GLuint, minlevel, GLuint, numlevels, GLuint, minlayer, GLuint, numlayers); \
HookWrapper1(void, glGenerateMipmap, GLenum, target); \
HookWrapper5(void, glGetInternalformativ, GLenum, target, GLenum, internalformat, GLenum, pname, GLsizei, bufSize, GLint *, params); \
HookWrapper5(void, glGetInternalformati64v, GLenum, target, GLenum, internalformat, GLenum, pname, GLsizei, bufSize, GLint64 *, params); \
@@ -475,6 +484,8 @@
HookWrapper2(void, glGenFramebuffers, GLsizei, n, GLuint *, framebuffers); \
HookWrapper2(void, glBindFramebuffer, GLenum, target, GLuint, framebuffer); \
HookWrapper4(void, glFramebufferTexture, GLenum, target, GLenum, attachment, GLuint, texture, GLint, level); \
HookWrapper5(void, glFramebufferTexture2D, GLenum, target, GLenum, attachment, GLenum, textarget, GLuint, texture, GLint, level); \
HookWrapper5(void, glFramebufferTextureLayer, GLenum, target, GLenum, attachment, GLuint, texture, GLint, level, GLint, layer); \
HookWrapper2(void, glDeleteFramebuffers, GLsizei, n, const GLuint *, framebuffers); \
HookWrapper4(void, glGetFramebufferAttachmentParameteriv, GLenum, target, GLenum, attachment, GLenum, pname, GLint *, params); \
HookWrapper2(GLsync, glFenceSync, GLenum, condition, GLbitfield, flags); \
@@ -490,6 +501,7 @@
HookWrapper4(void, glBufferData, GLenum, target, GLsizeiptr, size, const void *, data, GLenum, usage); \
HookWrapper3(void, glBindBufferBase, GLenum, target, GLuint, index, GLuint, buffer); \
HookWrapper5(void, glBindBufferRange, GLenum, target, GLuint, index, GLuint, buffer, GLintptr, offset, GLsizeiptr, size); \
HookWrapper2(void *, glMapBuffer, GLenum, target, GLenum, access); \
HookWrapper4(void *, glMapBufferRange, GLenum, target, GLintptr, offset, GLsizeiptr, length, GLbitfield, access); \
HookWrapper1(GLboolean, glUnmapBuffer, GLenum, target); \
HookWrapper2(void, glDeleteBuffers, GLsizei, n, const GLuint *, buffers); \
@@ -498,6 +510,8 @@
HookWrapper1(void, glBindVertexArray, GLuint, array); \
HookWrapper2(void, glDeleteVertexArrays, GLsizei, n, const GLuint *, arrays); \
HookWrapper6(void, glVertexAttribPointer, GLuint, index, GLint, size, GLenum, type, GLboolean, normalized, GLsizei, stride, const void *, pointer); \
HookWrapper5(void, glVertexAttribIPointer, GLuint, index, GLint, size, GLenum, type, GLsizei, stride, const void *, pointer); \
HookWrapper3(void, glBindAttribLocation, GLuint, program, GLuint, index, const GLchar *, name); \
HookWrapper1(void, glEnableVertexAttribArray, GLuint, index); \
HookWrapper1(void, glDisableVertexAttribArray, GLuint, index); \
HookWrapper3(void, glGetVertexAttribiv, GLuint, index, GLenum, pname, GLint *, params); \
@@ -505,6 +519,7 @@
HookWrapper3(void, glGetCompressedTexImage, GLenum, target, GLint, level, void *, img); \
HookWrapper2(void, glGenSamplers, GLsizei, count, GLuint *, samplers); \
HookWrapper2(void, glBindSampler, GLuint, unit, GLuint, sampler); \
HookWrapper2(void, glDeleteSamplers, GLsizei, count, const GLuint *, samplers); \
HookWrapper3(void, glSamplerParameteri, GLuint, sampler, GLenum, pname, GLint, param); \
HookWrapper3(void, glSamplerParameterf, GLuint, sampler, GLenum, pname, GLfloat, param); \
HookWrapper3(void, glSamplerParameteriv, GLuint, sampler, GLenum, pname, const GLint *, param); \
@@ -532,6 +547,7 @@
HookWrapper7(void, glGetActiveAttrib, GLuint, program, GLuint, index, GLsizei, bufSize, GLsizei *, length, GLint *, size, GLenum *, type, GLchar *, name); \
HookWrapper3(void, glGetUniformfv, GLuint, program, GLint, location, GLfloat *, params); \
HookWrapper3(void, glGetUniformiv, GLuint, program, GLint, location, GLint *, params); \
HookWrapper3(void, glUniformBlockBinding, GLuint, program, GLuint, uniformBlockIndex, GLuint, uniformBlockBinding); \
HookWrapper4(void, glUniformMatrix4fv, GLint, location, GLsizei, count, GLboolean, transpose, const GLfloat *, value); \
HookWrapper2(void, glUniform1f, GLint, location, GLfloat, v0); \
HookWrapper2(void, glUniform1i, GLint, location, GLint, v0); \
@@ -294,10 +294,56 @@ void WrappedOpenGL::glBindBufferRange(GLenum target, GLuint index, GLuint buffer
m_Real.glBindBufferRange(target, index, buffer, offset, size);
}
void *WrappedOpenGL::glMapBuffer(GLenum target, GLenum access)
{
if(m_State >= WRITING)
{
GLint length;
m_Real.glGetBufferParameteriv(target, eGL_BUFFER_SIZE, &length);
// TODO align return pointer to GL_MIN_MAP_BUFFER_ALIGNMENT (min 64)
m_BufferRecord[BufferIdx(target)]->Map.offset = 0;
m_BufferRecord[BufferIdx(target)]->Map.length = length;
if(access == eGL_READ_ONLY) m_BufferRecord[BufferIdx(target)]->Map.access = GL_MAP_READ_BIT;
else if(access == eGL_WRITE_ONLY) m_BufferRecord[BufferIdx(target)]->Map.access = GL_MAP_WRITE_BIT;
else if(access == eGL_READ_WRITE) m_BufferRecord[BufferIdx(target)]->Map.access = GL_MAP_READ_BIT|GL_MAP_WRITE_BIT;
if(access == eGL_READ_ONLY)
{
m_BufferRecord[BufferIdx(target)]->Map.status = GLResourceRecord::Mapped_Read_Real;
return m_Real.glMapBuffer(target, access);
}
byte *ptr = m_BufferRecord[BufferIdx(target)]->GetDataPtr();
if(ptr == NULL)
{
ptr = new byte[length];
RDCWARN("Mapping buffer that hasn't been allocated");
m_BufferRecord[BufferIdx(target)]->Map.status = GLResourceRecord::Mapped_Write_Alloc;
}
else
{
m_BufferRecord[BufferIdx(target)]->Map.status = GLResourceRecord::Mapped_Write;
}
m_Real.glGetBufferSubData(target, 0, length, ptr);
return ptr;
}
return m_Real.glMapBuffer(target, access);
}
void *WrappedOpenGL::glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
{
if(m_State >= WRITING)
{
// TODO align return pointer to GL_MIN_MAP_BUFFER_ALIGNMENT (min 64)
if((access & (GL_MAP_INVALIDATE_BUFFER_BIT|GL_MAP_INVALIDATE_RANGE_BIT|GL_MAP_READ_BIT)) == 0)
RDCUNIMPLEMENTED("haven't implemented non-invalidating glMap WRITE");
@@ -393,7 +439,10 @@ bool WrappedOpenGL::Serialise_glUnmapBuffer(GLenum target)
SERIALISE_ELEMENT(uint64_t, bufOffs, bufBindStart);
SERIALISE_ELEMENT_BUF(byte *, data, record->Map.ptr, (size_t)len);
if(m_State >= WRITING && record && record->GetDataPtr() == NULL)
record->SetDataOffset(m_pSerialiser->GetOffset() - (uint64_t)len);
if(m_State < WRITING ||
(m_State >= WRITING &&
(record->Map.status == GLResourceRecord::Mapped_Write || record->Map.status == GLResourceRecord::Mapped_Write_Alloc)
@@ -475,17 +524,29 @@ GLboolean WrappedOpenGL::glUnmapBuffer(GLenum target)
Serialise_glUnmapBuffer(target);
if(m_State == WRITING_CAPFRAME)
{
m_ContextRecord->AddChunk(scope.Get());
}
else
{
Chunk *chunk = scope.Get();
m_BufferRecord[BufferIdx(target)]->AddChunk(chunk);
m_BufferRecord[BufferIdx(target)]->SetDataPtr(chunk->GetData());
}
delete[] m_BufferRecord[BufferIdx(target)]->Map.ptr;
break;
}
case GLResourceRecord::Mapped_Write_Real:
RDCWARN("Throwing away map contents as we don't have datastore allocated");
RDCWARN("Could init chunk here using known data (although maybe it's only partial)");
{
// Throwing away map contents as we don't have datastore allocated
// Could init chunk here using known data (although maybe it's only partial).
ret = m_Real.glUnmapBuffer(target);
GetResourceManager()->MarkDirtyResource(m_BufferRecord[BufferIdx(target)]->GetResourceID());
break;
}
}
m_BufferRecord[BufferIdx(target)]->Map.status = GLResourceRecord::Unmapped;
@@ -540,6 +601,49 @@ void WrappedOpenGL::glVertexAttribPointer(GLuint index, GLint size, GLenum type,
}
}
bool WrappedOpenGL::Serialise_glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer)
{
SERIALISE_ELEMENT(uint32_t, Index, index);
SERIALISE_ELEMENT(int32_t, Size, size);
SERIALISE_ELEMENT(GLenum, Type, type);
SERIALISE_ELEMENT(uint32_t, Stride, stride);
SERIALISE_ELEMENT(uint64_t, Offset, (uint64_t)pointer);
SERIALISE_ELEMENT(ResourceId, id, m_VertexArrayRecord ? m_VertexArrayRecord->GetResourceID() : ResourceId());
if(m_State < WRITING)
{
if(id != ResourceId())
{
GLResource res = GetResourceManager()->GetLiveResource(id);
m_Real.glBindVertexArray(res.name);
}
else
{
m_Real.glBindVertexArray(0);
}
m_Real.glVertexAttribIPointer(Index, Size, Type, Stride, (const void *)Offset);
}
return true;
}
void WrappedOpenGL::glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer)
{
m_Real.glVertexAttribIPointer(index, size, type, stride, pointer);
GLResourceRecord *r = m_VertexArrayRecord ? m_VertexArrayRecord : m_DeviceRecord;
if(m_State >= WRITING)
{
RDCASSERT(r);
SCOPED_SERIALISE_CONTEXT(VERTEXATTRIBIPOINTER);
Serialise_glVertexAttribIPointer(index, size, type, stride, pointer);
r->AddChunk(scope.Get());
}
}
bool WrappedOpenGL::Serialise_glEnableVertexAttribArray(GLuint index)
{
SERIALISE_ELEMENT(uint32_t, Index, index);
@@ -154,6 +154,164 @@ void WrappedOpenGL::glFramebufferTexture(GLenum target, GLenum attachment, GLuin
}
}
bool WrappedOpenGL::Serialise_glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
{
SERIALISE_ELEMENT(GLenum, Target, target);
SERIALISE_ELEMENT(GLenum, Attach, attachment);
SERIALISE_ELEMENT(GLenum, TexTarget, textarget);
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(TextureRes(texture)));
SERIALISE_ELEMENT(int32_t, Level, level);
ResourceId curFrameBuffer;
if(m_State == WRITING_IDLE)
{
if(target == eGL_DRAW_FRAMEBUFFER || target == eGL_FRAMEBUFFER)
{
if(m_DrawFramebufferRecord)
curFrameBuffer = m_DrawFramebufferRecord->GetResourceID();
}
else
{
if(m_ReadFramebufferRecord)
curFrameBuffer = m_ReadFramebufferRecord->GetResourceID();
}
}
SERIALISE_ELEMENT(ResourceId, fbid, curFrameBuffer);
if(m_State < WRITING)
{
if(m_State == READING)
{
if(fbid != ResourceId())
{
GLResource res = GetResourceManager()->GetLiveResource(fbid);
m_Real.glBindFramebuffer(Target, res.name);
}
else
{
m_Real.glBindFramebuffer(Target, 0);
}
}
GLResource res = GetResourceManager()->GetLiveResource(id);
glFramebufferTexture2D(Target, Attach, TexTarget, res.name, Level);
}
return true;
}
void WrappedOpenGL::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
{
m_Real.glFramebufferTexture2D(target, attachment, textarget, texture, level);
if(m_State >= WRITING)
{
SCOPED_SERIALISE_CONTEXT(FRAMEBUFFER_TEX2D);
Serialise_glFramebufferTexture2D(target, attachment, textarget, texture, level);
if(m_State == WRITING_IDLE)
{
if(target == eGL_DRAW_FRAMEBUFFER || target == eGL_FRAMEBUFFER)
{
if(m_DrawFramebufferRecord)
m_DrawFramebufferRecord->AddChunk(scope.Get());
else
m_DeviceRecord->AddChunk(scope.Get());
}
else
{
if(m_ReadFramebufferRecord)
m_ReadFramebufferRecord->AddChunk(scope.Get());
else
m_DeviceRecord->AddChunk(scope.Get());
}
}
else
m_ContextRecord->AddChunk(scope.Get());
}
}
bool WrappedOpenGL::Serialise_glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
{
SERIALISE_ELEMENT(GLenum, Target, target);
SERIALISE_ELEMENT(GLenum, Attach, attachment);
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(TextureRes(texture)));
SERIALISE_ELEMENT(int32_t, Level, level);
SERIALISE_ELEMENT(int32_t, Layer, layer);
ResourceId curFrameBuffer;
if(m_State == WRITING_IDLE)
{
if(target == eGL_DRAW_FRAMEBUFFER || target == eGL_FRAMEBUFFER)
{
if(m_DrawFramebufferRecord)
curFrameBuffer = m_DrawFramebufferRecord->GetResourceID();
}
else
{
if(m_ReadFramebufferRecord)
curFrameBuffer = m_ReadFramebufferRecord->GetResourceID();
}
}
SERIALISE_ELEMENT(ResourceId, fbid, curFrameBuffer);
if(m_State < WRITING)
{
if(m_State == READING)
{
if(fbid != ResourceId())
{
GLResource res = GetResourceManager()->GetLiveResource(fbid);
m_Real.glBindFramebuffer(Target, res.name);
}
else
{
m_Real.glBindFramebuffer(Target, 0);
}
}
GLResource res = GetResourceManager()->GetLiveResource(id);
glFramebufferTextureLayer(Target, Attach, res.name, Level, Layer);
}
return true;
}
void WrappedOpenGL::glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
{
m_Real.glFramebufferTextureLayer(target, attachment, texture, level, layer);
if(m_State >= WRITING)
{
SCOPED_SERIALISE_CONTEXT(FRAMEBUFFER_TEXLAYER);
Serialise_glFramebufferTextureLayer(target, attachment, texture, level, layer);
if(m_State == WRITING_IDLE)
{
if(target == eGL_DRAW_FRAMEBUFFER || target == eGL_FRAMEBUFFER)
{
if(m_DrawFramebufferRecord)
m_DrawFramebufferRecord->AddChunk(scope.Get());
else
m_DeviceRecord->AddChunk(scope.Get());
}
else
{
if(m_ReadFramebufferRecord)
m_ReadFramebufferRecord->AddChunk(scope.Get());
else
m_DeviceRecord->AddChunk(scope.Get());
}
}
else
m_ContextRecord->AddChunk(scope.Get());
}
}
bool WrappedOpenGL::Serialise_glReadBuffer(GLenum mode)
{
SERIALISE_ELEMENT(GLenum, m, mode);
@@ -300,3 +300,11 @@ void WrappedOpenGL::glSamplerParameterIuiv(GLuint sampler, GLenum pname, const G
m_ContextRecord->AddChunk(scope.Get());
}
}
void WrappedOpenGL::glDeleteSamplers(GLsizei n, const GLuint *ids)
{
m_Real.glDeleteSamplers(n, ids);
for(GLsizei i=0; i < n; i++)
GetResourceManager()->UnregisterResource(SamplerRes(ids[i]));
}
@@ -402,6 +402,70 @@ void WrappedOpenGL::glLinkProgram(GLuint program)
}
}
bool WrappedOpenGL::Serialise_glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
{
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(ProgramRes(program)));
SERIALISE_ELEMENT(uint32_t, index, uniformBlockIndex);
SERIALISE_ELEMENT(uint32_t, binding, uniformBlockBinding);
if(m_State == READING)
{
m_Real.glUniformBlockBinding(GetResourceManager()->GetLiveResource(id).name, index, binding);
}
return true;
}
void WrappedOpenGL::glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
{
m_Real.glUniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
if(m_State >= WRITING)
{
GLResourceRecord *record = GetResourceManager()->GetResourceRecord(ProgramRes(program));
RDCASSERT(record);
{
SCOPED_SERIALISE_CONTEXT(UNIFORM_BLOCKBIND);
Serialise_glUniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
record->AddChunk(scope.Get());
}
}
}
bool WrappedOpenGL::Serialise_glBindAttribLocation(GLuint program, GLuint index, const GLchar *name_)
{
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(ProgramRes(program)));
SERIALISE_ELEMENT(uint32_t, idx, index);
string name = name_ ? name_ : "";
m_pSerialiser->Serialise("Name", name);
if(m_State == READING)
{
m_Real.glBindAttribLocation(GetResourceManager()->GetLiveResource(id).name, idx, name.c_str());
}
return true;
}
void WrappedOpenGL::glBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
{
m_Real.glBindAttribLocation(program, index, name);
if(m_State >= WRITING)
{
GLResourceRecord *record = GetResourceManager()->GetResourceRecord(ProgramRes(program));
RDCASSERT(record);
{
SCOPED_SERIALISE_CONTEXT(BINDATTRIB_LOCATION);
Serialise_glBindAttribLocation(program, index, name);
record->AddChunk(scope.Get());
}
}
}
bool WrappedOpenGL::Serialise_glProgramParameteri(GLuint program, GLenum pname, GLint value)
{
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(ProgramRes(program)));
@@ -169,7 +169,45 @@ void WrappedOpenGL::glBindTexture(GLenum target, GLuint texture)
}
}
bool WrappedOpenGL::Serialise_glTextureView(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers)
{
SERIALISE_ELEMENT(GLenum, Target, target);
SERIALISE_ELEMENT(GLenum, InternalFormat, internalformat);
SERIALISE_ELEMENT(uint32_t, MinLevel, minlevel);
SERIALISE_ELEMENT(uint32_t, NumLevels, numlevels);
SERIALISE_ELEMENT(uint32_t, MinLayer, minlayer);
SERIALISE_ELEMENT(uint32_t, NumLayers, numlayers);
SERIALISE_ELEMENT(ResourceId, texid, GetResourceManager()->GetID(TextureRes(texture)));
SERIALISE_ELEMENT(ResourceId, origid, GetResourceManager()->GetID(TextureRes(origtexture)));
if(m_State == READING)
{
GLResource tex = GetResourceManager()->GetLiveResource(texid);
GLResource origtex = GetResourceManager()->GetLiveResource(origid);
m_Real.glTextureView(tex.name, Target, origtex.name, InternalFormat, MinLevel, NumLevels, MinLayer, NumLayers);
}
return true;
}
void WrappedOpenGL::glTextureView(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers)
{
m_Real.glTextureView(texture, target, origtexture, internalformat, minlevel, numlevels, minlayer, numlayers);
if(m_State >= WRITING)
{
ResourceRecord *record = GetResourceManager()->GetResourceRecord(TextureRes(texture));
ResourceRecord *origrecord = GetResourceManager()->GetResourceRecord(TextureRes(origtexture));
RDCASSERT(record && origrecord);
SCOPED_SERIALISE_CONTEXT(TEXTURE_VIEW);
Serialise_glTextureView(texture, target, origtexture, internalformat, minlevel, numlevels, minlayer, numlayers);
record->AddChunk(scope.Get());
record->AddParent(origrecord);
}
}
bool WrappedOpenGL::Serialise_glGenerateMipmap(GLenum target)
{
SERIALISE_ELEMENT(GLenum, Target, target);