From Wang Rui, "In the attached files I've added the Compute Shader support for OSG, as well as serializer updates and a new osgcomputeshaders example. My submission also include a setComputeGroups() function in Program for setting compute-shader work groups, and a bindToImageUnit() function in Texture for binding textures as image variables in shaders.
All code are tested on Windows 7 + NVIDIA GFX 570 with the latest GeForce 310.70 Driver (BETA), which could support OpenGL 4.3. Compute shader information can be found at "http://www.opengl.org/registry/specs/ARB/compute_shader.txt" "
This commit is contained in:
@@ -101,6 +101,10 @@ class OSG_EXPORT Program : public osg::StateAttribute
|
||||
|
||||
void setParameterfv( GLenum pname, const GLfloat* value );
|
||||
const GLfloat* getParameterfv( GLenum pname ) const;
|
||||
|
||||
/** Set/get compute shader work groups */
|
||||
void setComputeGroups( GLint numGroupsX, GLint numGroupsY, GLint numGroupsZ );
|
||||
void getComputeGroups( GLint& numGroupsX, GLint& numGroupsY, GLint& numGroupsZ ) const;
|
||||
|
||||
/** Add an attribute location binding. */
|
||||
void addBindAttribLocation( const std::string& name, GLuint index );
|
||||
@@ -388,6 +392,11 @@ class OSG_EXPORT Program : public osg::StateAttribute
|
||||
// todo add tessellation default level
|
||||
//GLfloat _patchDefaultInnerLevel[2];
|
||||
//GLfloat _patchDefaultOuterLevel[4];
|
||||
|
||||
/** Parameter maintained with glDispatchCompute */
|
||||
GLint _numGroupsX;
|
||||
GLint _numGroupsY;
|
||||
GLint _numGroupsZ;
|
||||
|
||||
private:
|
||||
Program& operator=(const Program&); // disallowed
|
||||
|
||||
Reference in New Issue
Block a user