mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-13 05:20:45 +00:00
Handle implementations on capture without ARB_vertex_binding
This commit is contained in:
@@ -507,7 +507,7 @@ void DoVendorChecks(GLPlatform &platform, GLWindowingData context)
|
||||
|
||||
RDCEraseEl(VendorCheck);
|
||||
|
||||
if(GL.glGetError && GL.glGetIntegeri_v)
|
||||
if(GL.glGetError && GL.glGetIntegeri_v && HasExt[ARB_vertex_attrib_binding])
|
||||
{
|
||||
// clear all error flags.
|
||||
GLenum err = eGL_NONE;
|
||||
@@ -1332,11 +1332,24 @@ void ClearGLErrors()
|
||||
}
|
||||
}
|
||||
|
||||
GLint GetNumVertexBuffers()
|
||||
{
|
||||
GLint numBindings = 16;
|
||||
|
||||
// when the extension isn't present we pretend attribs == vertex buffers
|
||||
if(HasExt[ARB_vertex_attrib_binding])
|
||||
GL.glGetIntegerv(eGL_MAX_VERTEX_ATTRIB_BINDINGS, &numBindings);
|
||||
else
|
||||
GL.glGetIntegerv(eGL_MAX_VERTEX_ATTRIBS, &numBindings);
|
||||
|
||||
return numBindings;
|
||||
}
|
||||
|
||||
GLuint GetBoundVertexBuffer(GLuint i)
|
||||
{
|
||||
GLuint buffer = 0;
|
||||
|
||||
if(VendorCheck[VendorCheck_AMD_vertex_buffer_query])
|
||||
if(VendorCheck[VendorCheck_AMD_vertex_buffer_query] || !HasExt[ARB_vertex_attrib_binding])
|
||||
GL.glGetVertexAttribiv(i, eGL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, (GLint *)&buffer);
|
||||
else
|
||||
GL.glGetIntegeri_v(eGL_VERTEX_BINDING_BUFFER, i, (GLint *)&buffer);
|
||||
|
||||
@@ -492,6 +492,7 @@ const char *SamplerString(GLenum smpenum);
|
||||
void ClearGLErrors();
|
||||
|
||||
GLuint GetBoundVertexBuffer(GLuint idx);
|
||||
GLint GetNumVertexBuffers();
|
||||
|
||||
void GetBindpointMapping(GLuint curProg, int shadIdx, ShaderReflection *refl,
|
||||
ShaderBindpointMapping &mapping);
|
||||
|
||||
@@ -4435,8 +4435,7 @@ void WrappedOpenGL::AddUsage(const DrawcallDescription &d)
|
||||
}
|
||||
|
||||
// Vertex buffers and attributes
|
||||
GLint numVBufferBindings = 16;
|
||||
GL.glGetIntegerv(eGL_MAX_VERTEX_ATTRIB_BINDINGS, &numVBufferBindings);
|
||||
GLint numVBufferBindings = GetNumVertexBuffers();
|
||||
|
||||
for(GLuint i = 0; i < (GLuint)numVBufferBindings; i++)
|
||||
{
|
||||
|
||||
@@ -325,23 +325,46 @@ void GLResourceManager::ContextPrepare_InitialState(GLResource res)
|
||||
{
|
||||
GL.glGetVertexAttribiv(i, eGL_VERTEX_ATTRIB_ARRAY_ENABLED,
|
||||
(GLint *)&data.VertexAttribs[i].enabled);
|
||||
GL.glGetVertexAttribiv(i, eGL_VERTEX_ATTRIB_BINDING, (GLint *)&data.VertexAttribs[i].vbslot);
|
||||
GL.glGetVertexAttribiv(i, eGL_VERTEX_ATTRIB_RELATIVE_OFFSET,
|
||||
(GLint *)&data.VertexAttribs[i].offset);
|
||||
GL.glGetVertexAttribiv(i, eGL_VERTEX_ATTRIB_ARRAY_TYPE, (GLint *)&data.VertexAttribs[i].type);
|
||||
GL.glGetVertexAttribiv(i, eGL_VERTEX_ATTRIB_ARRAY_NORMALIZED,
|
||||
(GLint *)&data.VertexAttribs[i].normalized);
|
||||
GL.glGetVertexAttribiv(i, eGL_VERTEX_ATTRIB_ARRAY_INTEGER,
|
||||
(GLint *)&data.VertexAttribs[i].integer);
|
||||
|
||||
// no extension for this, it just appeared in GL & GLES 3.0, along with glVertexAttribIPointer
|
||||
if(GLCoreVersion >= 3.0)
|
||||
GL.glGetVertexAttribiv(i, eGL_VERTEX_ATTRIB_ARRAY_INTEGER,
|
||||
(GLint *)&data.VertexAttribs[i].integer);
|
||||
else
|
||||
data.VertexAttribs[i].integer = 0;
|
||||
|
||||
GL.glGetVertexAttribiv(i, eGL_VERTEX_ATTRIB_ARRAY_SIZE, (GLint *)&data.VertexAttribs[i].size);
|
||||
|
||||
GLuint buffer = GetBoundVertexBuffer(i);
|
||||
|
||||
data.VertexBuffers[i].Buffer = BufferRes(ctx, buffer);
|
||||
|
||||
GL.glGetIntegeri_v(eGL_VERTEX_BINDING_STRIDE, i, (GLint *)&data.VertexBuffers[i].Stride);
|
||||
GL.glGetIntegeri_v(eGL_VERTEX_BINDING_OFFSET, i, (GLint *)&data.VertexBuffers[i].Offset);
|
||||
GL.glGetIntegeri_v(eGL_VERTEX_BINDING_DIVISOR, i, (GLint *)&data.VertexBuffers[i].Divisor);
|
||||
if(HasExt[ARB_vertex_attrib_binding])
|
||||
{
|
||||
GL.glGetIntegeri_v(eGL_VERTEX_BINDING_STRIDE, i, (GLint *)&data.VertexBuffers[i].Stride);
|
||||
GL.glGetIntegeri_v(eGL_VERTEX_BINDING_OFFSET, i, (GLint *)&data.VertexBuffers[i].Offset);
|
||||
GL.glGetIntegeri_v(eGL_VERTEX_BINDING_DIVISOR, i, (GLint *)&data.VertexBuffers[i].Divisor);
|
||||
|
||||
GL.glGetVertexAttribiv(i, eGL_VERTEX_ATTRIB_RELATIVE_OFFSET,
|
||||
(GLint *)&data.VertexAttribs[i].offset);
|
||||
GL.glGetVertexAttribiv(i, eGL_VERTEX_ATTRIB_BINDING, (GLint *)&data.VertexAttribs[i].vbslot);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL.glGetVertexAttribiv(i, eGL_VERTEX_ATTRIB_ARRAY_STRIDE,
|
||||
(GLint *)&data.VertexBuffers[i].Stride);
|
||||
GL.glGetVertexAttribiv(i, eGL_VERTEX_ATTRIB_ARRAY_DIVISOR,
|
||||
(GLint *)&data.VertexBuffers[i].Divisor);
|
||||
data.VertexBuffers[i].Offset = 0;
|
||||
|
||||
void *ptr = NULL;
|
||||
GL.glGetVertexAttribPointerv(i, eGL_VERTEX_ATTRIB_ARRAY_POINTER, &ptr);
|
||||
|
||||
data.VertexAttribs[i].offset = (uint32_t)(uintptr_t)ptr;
|
||||
}
|
||||
}
|
||||
|
||||
GLuint buffer = 0;
|
||||
|
||||
@@ -41,8 +41,7 @@ void GLResourceManager::MarkVAOReferenced(GLResource res, FrameRefType ref, bool
|
||||
|
||||
MarkResourceFrameReferenced(res, ref == eFrameRef_Unknown ? eFrameRef_Unknown : eFrameRef_Read);
|
||||
|
||||
GLint numVBufferBindings = 16;
|
||||
GL.glGetIntegerv(eGL_MAX_VERTEX_ATTRIB_BINDINGS, &numVBufferBindings);
|
||||
GLint numVBufferBindings = GetNumVertexBuffers();
|
||||
|
||||
for(GLuint i = 0; i < (GLuint)numVBufferBindings; i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user