From Marcus Hein, Added support for OpenGL SSBO and SSBB via osg::ShaderStorageBufferObject and osg::ShaderStorageBufferBinding to core OSG library, and added new osgSSBO example

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14599 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2014-12-10 12:23:04 +00:00
parent 92e2d849ed
commit 1b6e50a2dd
8 changed files with 1040 additions and 0 deletions

View File

@@ -164,6 +164,35 @@ class OSG_EXPORT AtomicCounterBufferBinding : public BufferIndexBinding
}
};
class OSG_EXPORT ShaderStorageBufferBinding : public BufferIndexBinding
{
public:
ShaderStorageBufferBinding(GLuint index=0);
/** Create a binding for a shader storage buffer index target.
* @param index the index target
* @param bo associated buffer object
* @param offset offset into buffer object
* @param size size of data in buffer object
*/
ShaderStorageBufferBinding(GLuint index, BufferObject* bo, GLintptr offset, GLsizeiptr size);
ShaderStorageBufferBinding(const ShaderStorageBufferBinding& rhs, const CopyOp& copyop=CopyOp::SHALLOW_COPY);
META_StateAttribute(osg, ShaderStorageBufferBinding, SHADERSTORAGEBUFFERBINDING);
virtual int compare(const StateAttribute& bb) const
{
COMPARE_StateAttribute_Types(ShaderStorageBufferBinding, bb)
COMPARE_StateAttribute_Parameter(_target)
COMPARE_StateAttribute_Parameter(_index)
COMPARE_StateAttribute_Parameter(_bufferObject)
COMPARE_StateAttribute_Parameter(_offset)
COMPARE_StateAttribute_Parameter(_size)
return 0;
}
};
} // namespace osg
#endif

View File

@@ -732,6 +732,7 @@ class OSG_EXPORT PixelDataBufferObject : public BufferObject
};
class OSG_EXPORT UniformBufferObject : public BufferObject
{
public:
@@ -759,6 +760,20 @@ inline void GLBufferObject::bindBuffer()
if (_set) _set->moveToBack(this);
}
class OSG_EXPORT ShaderStorageBufferObject : public BufferObject
{
public:
ShaderStorageBufferObject();
ShaderStorageBufferObject(const ShaderStorageBufferObject& ubo, const CopyOp& copyop=CopyOp::SHALLOW_COPY);
META_Object(osg, ShaderStorageBufferObject);
protected:
virtual ~ShaderStorageBufferObject();
};
}
#endif

View File

@@ -199,6 +199,8 @@ class OSG_EXPORT StateAttribute : public Object
VERTEX_ATTRIB_DIVISOR,
SHADERSTORAGEBUFFERBINDING,
CAPABILITY = 100
};