mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-28 12:51:03 +00:00
Add hooks for vertex attrib format/binding functions
This commit is contained in:
@@ -222,6 +222,9 @@ enum GLChunkType
|
||||
VERTEXATTRIBIPOINTER,
|
||||
ENABLEVERTEXATTRIBARRAY,
|
||||
DISABLEVERTEXATTRIBARRAY,
|
||||
VERTEXATTRIBFORMAT,
|
||||
VERTEXATTRIBIFORMAT,
|
||||
VERTEXATTRIBBINDING,
|
||||
|
||||
OBJECT_LABEL,
|
||||
BEGIN_EVENT,
|
||||
|
||||
@@ -179,6 +179,10 @@ const char *GLChunkNames[] =
|
||||
"glVertexAttribIPointer",
|
||||
"glEnableVertexAttribArray",
|
||||
"glDisableVertexAttribArray",
|
||||
"glVertexAttribFormat",
|
||||
"glVertexAttribIFormat",
|
||||
"glVertexAttribBinding",
|
||||
|
||||
|
||||
"glObjectLabel",
|
||||
"glPushDebugGroup",
|
||||
@@ -1339,6 +1343,15 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context)
|
||||
case DISABLEVERTEXATTRIBARRAY:
|
||||
Serialise_glDisableVertexAttribArray(0);
|
||||
break;
|
||||
case VERTEXATTRIBFORMAT:
|
||||
Serialise_glVertexAttribFormat(0, 0, eGL_UNKNOWN_ENUM, 0, 0);
|
||||
break;
|
||||
case VERTEXATTRIBIFORMAT:
|
||||
Serialise_glVertexAttribIFormat(0, 0, eGL_UNKNOWN_ENUM, 0);
|
||||
break;
|
||||
case VERTEXATTRIBBINDING:
|
||||
Serialise_glVertexAttribBinding(0, 0);
|
||||
break;
|
||||
|
||||
case OBJECT_LABEL:
|
||||
Serialise_glObjectLabel(eGL_UNKNOWN_ENUM, 0, 0, NULL);
|
||||
|
||||
@@ -486,6 +486,9 @@ class WrappedOpenGL
|
||||
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, glVertexAttribBinding(GLuint attribindex, GLuint bindingindex));
|
||||
IMPLEMENT_FUNCTION_SERIALISED(void, glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset));
|
||||
IMPLEMENT_FUNCTION_SERIALISED(void, glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset));
|
||||
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));
|
||||
|
||||
@@ -207,6 +207,9 @@ struct GLHookSet
|
||||
PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays;
|
||||
PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer;
|
||||
PFNGLVERTEXATTRIBIPOINTERPROC glVertexAttribIPointer;
|
||||
PFNGLVERTEXATTRIBBINDINGPROC glVertexAttribBinding;
|
||||
PFNGLVERTEXATTRIBFORMATPROC glVertexAttribFormat;
|
||||
PFNGLVERTEXATTRIBIFORMATPROC glVertexAttribIFormat;
|
||||
PFNGLBINDATTRIBLOCATIONPROC glBindAttribLocation;
|
||||
PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray;
|
||||
PFNGLDISABLEVERTEXATTRIBARRAYPROC glDisableVertexAttribArray;
|
||||
|
||||
@@ -221,6 +221,9 @@
|
||||
HookExtension(PFNGLDELETEVERTEXARRAYSPROC, glDeleteVertexArrays); \
|
||||
HookExtension(PFNGLVERTEXATTRIBPOINTERPROC, glVertexAttribPointer); \
|
||||
HookExtension(PFNGLVERTEXATTRIBIPOINTERPROC, glVertexAttribIPointer); \
|
||||
HookExtension(PFNGLVERTEXATTRIBBINDINGPROC, glVertexAttribBinding); \
|
||||
HookExtension(PFNGLVERTEXATTRIBFORMATPROC, glVertexAttribFormat); \
|
||||
HookExtension(PFNGLVERTEXATTRIBIFORMATPROC, glVertexAttribIFormat); \
|
||||
HookExtension(PFNGLBINDATTRIBLOCATIONPROC, glBindAttribLocation); \
|
||||
HookExtension(PFNGLENABLEVERTEXATTRIBARRAYPROC, glEnableVertexAttribArray); \
|
||||
HookExtension(PFNGLDISABLEVERTEXATTRIBARRAYPROC, glDisableVertexAttribArray); \
|
||||
@@ -567,6 +570,9 @@
|
||||
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); \
|
||||
HookWrapper2(void, glVertexAttribBinding, GLuint, attribindex, GLuint, bindingindex); \
|
||||
HookWrapper5(void, glVertexAttribFormat, GLuint, attribindex, GLint, size, GLenum, type, GLboolean, normalized, GLuint, relativeoffset); \
|
||||
HookWrapper4(void, glVertexAttribIFormat, GLuint, attribindex, GLint, size, GLenum, type, GLuint, relativeoffset); \
|
||||
HookWrapper3(void, glBindAttribLocation, GLuint, program, GLuint, index, const GLchar *, name); \
|
||||
HookWrapper1(void, glEnableVertexAttribArray, GLuint, index); \
|
||||
HookWrapper1(void, glDisableVertexAttribArray, GLuint, index); \
|
||||
|
||||
@@ -109,6 +109,7 @@ struct GLResourceRecord : public ResourceRecord
|
||||
{
|
||||
RDCEraseEl(ShadowPtr);
|
||||
RDCEraseEl(ptrchunks);
|
||||
RDCEraseEl(bndchunks);
|
||||
RDCEraseEl(enabledchunks);
|
||||
}
|
||||
|
||||
@@ -165,6 +166,7 @@ struct GLResourceRecord : public ResourceRecord
|
||||
}
|
||||
|
||||
Chunk *ptrchunks[12];
|
||||
Chunk *bndchunks[12];
|
||||
Chunk *enabledchunks[12];
|
||||
|
||||
private:
|
||||
|
||||
@@ -1186,6 +1186,160 @@ void WrappedOpenGL::glVertexAttribIPointer(GLuint index, GLint size, GLenum type
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glVertexAttribBinding(GLuint attribindex, GLuint bindingindex)
|
||||
{
|
||||
SERIALISE_ELEMENT(uint32_t, aidx, attribindex);
|
||||
SERIALISE_ELEMENT(uint32_t, bidx, bindingindex);
|
||||
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.glVertexAttribBinding(aidx, bidx);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void WrappedOpenGL::glVertexAttribBinding(GLuint attribindex, GLuint bindingindex)
|
||||
{
|
||||
m_Real.glVertexAttribBinding(attribindex, bindingindex);
|
||||
|
||||
GLResourceRecord *r = m_VertexArrayRecord ? m_VertexArrayRecord : m_DeviceRecord;
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
RDCASSERT(r);
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(VERTEXATTRIBBINDING);
|
||||
Serialise_glVertexAttribBinding(attribindex, bindingindex);
|
||||
|
||||
if(m_State == WRITING_CAPFRAME)
|
||||
{
|
||||
m_ContextRecord->AddChunk(scope.Get());
|
||||
}
|
||||
else
|
||||
{
|
||||
r->RemoveChunk(r->bndchunks[attribindex]);
|
||||
delete r->bndchunks[attribindex];
|
||||
Chunk *newchunk = r->bndchunks[attribindex] = scope.Get();
|
||||
r->AddChunk(newchunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset)
|
||||
{
|
||||
SERIALISE_ELEMENT(uint32_t, Index, attribindex);
|
||||
SERIALISE_ELEMENT(int32_t, Size, size);
|
||||
SERIALISE_ELEMENT(bool, Norm, normalized ? true : false);
|
||||
SERIALISE_ELEMENT(GLenum, Type, type);
|
||||
SERIALISE_ELEMENT(uint32_t, Offset, relativeoffset);
|
||||
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.glVertexAttribFormat(Index, Size, Type, Norm, Offset);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WrappedOpenGL::glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset)
|
||||
{
|
||||
m_Real.glVertexAttribFormat(attribindex, size, type, normalized, relativeoffset);
|
||||
|
||||
GLResourceRecord *r = m_VertexArrayRecord ? m_VertexArrayRecord : m_DeviceRecord;
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
RDCASSERT(r);
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(VERTEXATTRIBFORMAT);
|
||||
Serialise_glVertexAttribFormat(attribindex, size, type, normalized, relativeoffset);
|
||||
|
||||
if(m_State == WRITING_CAPFRAME)
|
||||
{
|
||||
m_ContextRecord->AddChunk(scope.Get());
|
||||
}
|
||||
else
|
||||
{
|
||||
r->RemoveChunk(r->ptrchunks[attribindex]);
|
||||
delete r->ptrchunks[attribindex];
|
||||
Chunk *newchunk = r->ptrchunks[attribindex] = scope.Get();
|
||||
r->AddChunk(newchunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
|
||||
{
|
||||
SERIALISE_ELEMENT(uint32_t, Index, attribindex);
|
||||
SERIALISE_ELEMENT(int32_t, Size, size);
|
||||
SERIALISE_ELEMENT(GLenum, Type, type);
|
||||
SERIALISE_ELEMENT(uint32_t, Offset, relativeoffset);
|
||||
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.glVertexAttribIFormat(Index, Size, Type, Offset);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WrappedOpenGL::glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
|
||||
{
|
||||
m_Real.glVertexAttribIFormat(attribindex, size, type, relativeoffset);
|
||||
|
||||
GLResourceRecord *r = m_VertexArrayRecord ? m_VertexArrayRecord : m_DeviceRecord;
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
RDCASSERT(r);
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(VERTEXATTRIBIFORMAT);
|
||||
Serialise_glVertexAttribIFormat(attribindex, size, type, relativeoffset);
|
||||
|
||||
if(m_State == WRITING_CAPFRAME)
|
||||
{
|
||||
m_ContextRecord->AddChunk(scope.Get());
|
||||
}
|
||||
else
|
||||
{
|
||||
r->RemoveChunk(r->ptrchunks[attribindex]);
|
||||
delete r->ptrchunks[attribindex];
|
||||
Chunk *newchunk = r->ptrchunks[attribindex] = scope.Get();
|
||||
r->AddChunk(newchunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glEnableVertexAttribArray(GLuint index)
|
||||
{
|
||||
SERIALISE_ELEMENT(uint32_t, Index, index);
|
||||
|
||||
Reference in New Issue
Block a user