2017-11-29 00:30:04 +08:00
|
|
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2014 Robert Osfield
|
|
|
|
* Copyright (C) 2017 Julien Valentin
|
|
|
|
*
|
|
|
|
* This library is open source and may be redistributed and/or modified under
|
|
|
|
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
|
|
|
* (at your option) any later version. The full license is in LICENSE file
|
|
|
|
* included with this distribution, and on the openscenegraph.org website.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* OpenSceneGraph Public License for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OSG_COMPUTEDISPATCH
|
|
|
|
#define OSG_COMPUTEDISPATCH 1
|
|
|
|
|
|
|
|
#include <osg/Export>
|
|
|
|
|
|
|
|
#include <osg/Geometry>
|
|
|
|
|
|
|
|
namespace osg{
|
|
|
|
class OSG_EXPORT ComputeDispatch : public osg::Drawable
|
|
|
|
{
|
|
|
|
public:
|
2017-11-29 16:14:44 +08:00
|
|
|
ComputeDispatch(GLint numGroupsX=0, GLint numGroupsY=0, GLint numGroupsZ=0):
|
2017-11-29 00:30:04 +08:00
|
|
|
Drawable(),
|
|
|
|
_numGroupsX(numGroupsX),
|
|
|
|
_numGroupsY(numGroupsY),
|
|
|
|
_numGroupsZ(numGroupsZ)
|
|
|
|
{}
|
|
|
|
|
|
|
|
ComputeDispatch(const ComputeDispatch&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
|
|
|
|
|
|
|
|
META_Node(osg, ComputeDispatch);
|
|
|
|
|
2017-11-29 22:22:31 +08:00
|
|
|
virtual void compileGLObjects(RenderInfo&) const {}
|
2017-11-29 03:31:09 +08:00
|
|
|
|
2017-11-29 22:22:31 +08:00
|
|
|
virtual VertexArrayState* createVertexArrayStateImplememtation(RenderInfo&) const { return 0; }
|
2017-11-29 00:30:04 +08:00
|
|
|
|
|
|
|
virtual void drawImplementation(RenderInfo& renderInfo) const;
|
2017-11-29 03:31:09 +08:00
|
|
|
|
2017-11-29 16:14:44 +08:00
|
|
|
/** Set compute shader work groups */
|
|
|
|
void setComputeGroups( GLint numGroupsX, GLint numGroupsY, GLint numGroupsZ ) { _numGroupsX=numGroupsX; _numGroupsY=numGroupsY; _numGroupsZ=numGroupsZ; }
|
|
|
|
|
|
|
|
/** Get compute shader work groups */
|
2017-11-29 00:30:04 +08:00
|
|
|
void getComputeGroups( GLint& numGroupsX, GLint& numGroupsY, GLint& numGroupsZ ) const{ numGroupsX=_numGroupsX; numGroupsY=_numGroupsY; numGroupsZ=_numGroupsZ; }
|
2017-11-29 03:31:09 +08:00
|
|
|
|
2017-11-29 00:30:04 +08:00
|
|
|
protected:
|
|
|
|
GLint _numGroupsX, _numGroupsY, _numGroupsZ;
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|