add DrawIndirectBufferObject as State variable in order to minimize call to glBindBuffer(GL_DRAW_INDIRECT_BUFFER,X)

TODO: Promote PrimitiveSetIndirect's VBO to target explicited DIBO (in order to benefit from BOSet queue management)
This commit is contained in:
mp3butcher
2017-07-27 01:54:25 +02:00
parent 9b53775840
commit 7606159a78
3 changed files with 31 additions and 8 deletions

View File

@@ -591,6 +591,27 @@ class OSG_EXPORT State : public Referenced
}
inline void bindDrawIndirectBufferObject(osg::GLBufferObject* ibo)
{
if (ibo->isDirty())
{
ibo->compileBuffer();
_currentDIBO = ibo;
}
else if (ibo != _currentDIBO)
{
_glBindBuffer(GL_DRAW_INDIRECT_BUFFER, ibo->getGLObjectID());
_currentDIBO = ibo;
}
}
inline void unbindDrawIndirectBufferObject()
{
if (!_currentDIBO) return;
_glBindBuffer(GL_DRAW_INDIRECT_BUFFER,0);
_currentDIBO = 0;
}
void setCurrentVertexArrayObject(GLuint vao) { _currentVAO = vao; }
GLuint getCurrentVertexArrayObject() const { return _currentVAO; }
@@ -1259,6 +1280,7 @@ class OSG_EXPORT State : public Referenced
unsigned int _currentActiveTextureUnit;
unsigned int _currentClientActiveTextureUnit;
GLBufferObject* _currentPBO;
GLBufferObject* _currentDIBO;
GLuint _currentVAO;