1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2014 Robert Osfield
2 * Copyright (C) 2017 Julien Valentin
4 * This library is open source and may be redistributed and/or modified under
5 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
6 * (at your option) any later version. The full license is in LICENSE file
7 * included with this distribution, and on the openscenegraph.org website.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * OpenSceneGraph Public License for more details.
15#ifndef OSG_DispatchCompute
16#define OSG_DispatchCompute 1
20#include <osg/Geometry>
25/** Wrapper around glDispatchCompute.*/
26class OSG_EXPORT DispatchCompute : public osg::Drawable
29 DispatchCompute(GLint numGroupsX=0, GLint numGroupsY=0, GLint numGroupsZ=0):
31 _numGroupsX(numGroupsX),
32 _numGroupsY(numGroupsY),
33 _numGroupsZ(numGroupsZ)
36 DispatchCompute(const DispatchCompute&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
38 META_Node(osg, DispatchCompute);
40 virtual void compileGLObjects(RenderInfo&) const {}
42 virtual VertexArrayState* createVertexArrayStateImplememtation(RenderInfo&) const { return 0; }
44 virtual void drawImplementation(RenderInfo& renderInfo) const;
46 /** Set compute shader work groups */
47 void setComputeGroups( GLint numGroupsX, GLint numGroupsY, GLint numGroupsZ ) { _numGroupsX=numGroupsX; _numGroupsY=numGroupsY; _numGroupsZ=numGroupsZ; }
49 /** Get compute shader work groups */
50 void getComputeGroups( GLint& numGroupsX, GLint& numGroupsY, GLint& numGroupsZ ) const{ numGroupsX=_numGroupsX; numGroupsY=_numGroupsY; numGroupsZ=_numGroupsZ; }
53 GLint _numGroupsX, _numGroupsY, _numGroupsZ;