Promote PrimitiveSetIndirect's VBO to a target explicited DIBO (in order to benefit from BOSet queue management)
This commit is contained in:
@@ -189,7 +189,7 @@ struct IndirectTarget
|
||||
}
|
||||
void endRegister(unsigned int index, unsigned int rowsPerInstance, GLenum pixelFormat, GLenum type, GLint internalFormat, bool useMultiDrawArraysIndirect )
|
||||
{
|
||||
osg::VertexBufferObject * indirectCommandbuffer=new osg::VertexBufferObject();
|
||||
osg::DrawIndirectBufferObject * indirectCommandbuffer = new osg::DrawIndirectBufferObject();
|
||||
indirectCommandbuffer->setUsage(GL_DYNAMIC_DRAW);
|
||||
indirectCommands->setBufferObject(indirectCommandbuffer);
|
||||
|
||||
|
||||
@@ -635,6 +635,28 @@ class OSG_EXPORT ElementBufferObject : public BufferObject
|
||||
virtual ~ElementBufferObject();
|
||||
};
|
||||
|
||||
class OSG_EXPORT DrawIndirectBufferObject : public BufferObject
|
||||
{
|
||||
public:
|
||||
|
||||
DrawIndirectBufferObject();
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
DrawIndirectBufferObject(const DrawIndirectBufferObject& vbo,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
||||
|
||||
META_Object(osg,DrawIndirectBufferObject);
|
||||
|
||||
unsigned int addArray(osg::Array* array);
|
||||
void removeArray(osg::Array* array);
|
||||
|
||||
void setArray(unsigned int i, Array* array);
|
||||
Array* getArray(unsigned int i);
|
||||
const Array* getArray(unsigned int i) const;
|
||||
|
||||
protected:
|
||||
virtual ~DrawIndirectBufferObject();
|
||||
};
|
||||
|
||||
class Image;
|
||||
class OSG_EXPORT PixelBufferObject : public BufferObject
|
||||
{
|
||||
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
inline void setIndirectCommandArray(IndirectCommandDrawElements*idc) {
|
||||
_indirectCommandArray = idc;
|
||||
if(!_indirectCommandArray->getBufferObject())
|
||||
_indirectCommandArray->setBufferObject(new osg::VertexBufferObject());
|
||||
_indirectCommandArray->setBufferObject(new osg::DrawIndirectBufferObject());
|
||||
}
|
||||
/// get command array of this indirect primitive set
|
||||
inline IndirectCommandDrawElements* getIndirectCommandArray() { return _indirectCommandArray; }
|
||||
@@ -656,7 +656,7 @@ public:
|
||||
inline void setIndirectCommandArray(IndirectCommandDrawArrays*idc) {
|
||||
_indirectCommandArray = idc;
|
||||
if(!_indirectCommandArray->getBufferObject())
|
||||
_indirectCommandArray->setBufferObject(new osg::VertexBufferObject());
|
||||
_indirectCommandArray->setBufferObject(new osg::DrawIndirectBufferObject());
|
||||
}
|
||||
inline const IndirectCommandDrawArrays* getIndirectCommandArray() const {
|
||||
return _indirectCommandArray;
|
||||
|
||||
@@ -600,7 +600,7 @@ class OSG_EXPORT State : public Referenced
|
||||
}
|
||||
else if (ibo != _currentDIBO)
|
||||
{
|
||||
_glBindBuffer(GL_DRAW_INDIRECT_BUFFER, ibo->getGLObjectID());
|
||||
ibo->bindBuffer();
|
||||
_currentDIBO = ibo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1358,6 +1358,50 @@ const DrawElements* ElementBufferObject::getDrawElements(unsigned int i) const
|
||||
return dynamic_cast<const DrawElements*>(getBufferData(i));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DrawIndirectBufferObject
|
||||
//
|
||||
DrawIndirectBufferObject::DrawIndirectBufferObject()
|
||||
{
|
||||
setTarget(GL_DRAW_INDIRECT_BUFFER);
|
||||
setUsage(GL_STATIC_DRAW_ARB);
|
||||
// setUsage(GL_STREAM_DRAW_ARB);
|
||||
}
|
||||
|
||||
DrawIndirectBufferObject::DrawIndirectBufferObject(const DrawIndirectBufferObject& vbo,const CopyOp& copyop):
|
||||
BufferObject(vbo,copyop)
|
||||
{
|
||||
}
|
||||
|
||||
DrawIndirectBufferObject::~DrawIndirectBufferObject()
|
||||
{
|
||||
}
|
||||
|
||||
unsigned int DrawIndirectBufferObject::addArray(osg::Array* array)
|
||||
{
|
||||
return addBufferData(array);
|
||||
}
|
||||
|
||||
void DrawIndirectBufferObject::removeArray(osg::Array* array)
|
||||
{
|
||||
removeBufferData(array);
|
||||
}
|
||||
|
||||
void DrawIndirectBufferObject::setArray(unsigned int i, Array* array)
|
||||
{
|
||||
setBufferData(i,array);
|
||||
}
|
||||
|
||||
Array* DrawIndirectBufferObject::getArray(unsigned int i)
|
||||
{
|
||||
return dynamic_cast<osg::Array*>(getBufferData(i));
|
||||
}
|
||||
|
||||
const Array* DrawIndirectBufferObject::getArray(unsigned int i) const
|
||||
{
|
||||
return dynamic_cast<const osg::Array*>(getBufferData(i));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user