openscenegraph
DispatchCompute
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2014 Robert Osfield
2 * Copyright (C) 2017 Julien Valentin
3 *
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.
8 *
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.
13*/
14
15#ifndef OSG_DispatchCompute
16#define OSG_DispatchCompute 1
17
18#include <osg/Export>
19
20#include <osg/Geometry>
21
22namespace osg
23{
24
25/** Wrapper around glDispatchCompute.*/
26class OSG_EXPORT DispatchCompute : public osg::Drawable
27{
28 public:
29 DispatchCompute(GLint numGroupsX=0, GLint numGroupsY=0, GLint numGroupsZ=0):
30 Drawable(),
31 _numGroupsX(numGroupsX),
32 _numGroupsY(numGroupsY),
33 _numGroupsZ(numGroupsZ)
34 {}
35
36 DispatchCompute(const DispatchCompute&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
37
38 META_Node(osg, DispatchCompute);
39
40 virtual void compileGLObjects(RenderInfo&) const {}
41
42 virtual VertexArrayState* createVertexArrayStateImplememtation(RenderInfo&) const { return 0; }
43
44 virtual void drawImplementation(RenderInfo& renderInfo) const;
45
46 /** Set compute shader work groups */
47 void setComputeGroups( GLint numGroupsX, GLint numGroupsY, GLint numGroupsZ ) { _numGroupsX=numGroupsX; _numGroupsY=numGroupsY; _numGroupsZ=numGroupsZ; }
48
49 /** Get compute shader work groups */
50 void getComputeGroups( GLint& numGroupsX, GLint& numGroupsY, GLint& numGroupsZ ) const{ numGroupsX=_numGroupsX; numGroupsY=_numGroupsY; numGroupsZ=_numGroupsZ; }
51
52 protected:
53 GLint _numGroupsX, _numGroupsY, _numGroupsZ;
54
55};
56
57}
58#endif
59