VPP  0.7
A high-level modern C++ API for Vulkan
vppShader.hpp
1 /*
2  Copyright 2016-2018 SOFT-ERG, Przemek Kuczmierczyk (www.softerg.com)
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without modification,
6  are permitted provided that the following conditions are met:
7 
8  1. Redistributions of source code must retain the above copyright notice,
9  this list of conditions and the following disclaimer.
10 
11  2. Redistributions in binary form must reproduce the above copyright notice,
12  this list of conditions and the following disclaimer in the documentation
13  and/or other materials provided with the distribution.
14 
15  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
24  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26 
27 // -----------------------------------------------------------------------------
28 namespace vpp {
29 // -----------------------------------------------------------------------------
30 
57 {
58 public:
72  template< class ClassT, typename... Args >
73  inline vertexShader (
74  ClassT* pParentClass,
75  void ( ClassT::* fMethodDef )( VertexShader*, Args... ),
76  Args... args );
77 };
78 
79 // -----------------------------------------------------------------------------
112 {
113 public:
127  template< class ClassT, typename... Args >
128  inline tessControlShader (
129  ClassT* pParentClass,
130  void ( ClassT::* fMethodDef )( TessControlShader*, Args... ),
131  Args... args );
132 
145  void setOutputPatchVertices ( int v );
146 
150  int getOutputPatchVertices() const;
151 
155  void setTopology ( ETessellationTopology topology );
156 
160  ETessellationTopology getTopology() const;
161 
167  void setSpacing ( ETessellationSpacing spacing );
168 
174  ETessellationSpacing getSpacing() const;
175 };
176 
177 // -----------------------------------------------------------------------------
212 {
213 public:
227  template< class ClassT, typename... Args >
228  inline tessEvalShader (
229  const tessControlShader& tcs,
230  ClassT* pParentClass,
231  void ( ClassT::* fMethodDef )( TessEvalShader*, Args... ),
232  Args... args );
233 
241  void setPointMode ( bool v );
242 
246  bool isPointMode() const;
247 
251  void setVertexOrderCW ( bool v );
252 
256  bool isVertexOrderCW() const;
257 };
258 
259 // -----------------------------------------------------------------------------
292 {
293 public:
307  template< class ClassT, typename... Args >
308  inline geometryShader (
309  ClassT* pParentClass,
310  void ( ClassT::* fMethodDef )( GeometryShader*, Args... ),
311  Args... args );
312 
318  void setOutputTopology ( EGeometryOutputTopology t );
319 
323  void setMaxOutputVertices ( int value );
324 
334  void setInvocations ( int inv );
335 };
336 
337 // -----------------------------------------------------------------------------
364 {
365 public:
379  template< class ClassT, typename... Args >
380  inline fragmentShader (
381  ClassT* pParentClass,
382  void ( ClassT::* fMethodDef )( FragmentShader*, Args... ),
383  Args... args );
384 };
385 
386 // -----------------------------------------------------------------------------
393 {
394 public:
395  struct SLocalSize
396  {
397  unsigned int x;
398  unsigned int y;
399  unsigned int z;
400  };
401 
415  template< class ClassT, typename... Args >
416  inline computeShader (
417  ClassT* pParentClass,
418  const SLocalSize& localSize,
419  void ( ClassT::* fMethodDef )( ComputeShader*, Args... ),
420  Args... args );
421 };
422 
423 // -----------------------------------------------------------------------------
424 } // namespace vpp
425 // -----------------------------------------------------------------------------
Binding point class for compute shaders. Place in your pipeline configuration class to declare a comp...
Definition: vppShader.hpp:392
Geometry shader interface.
Definition: vppLangIntInOut.hpp:306
Fragment shader interface.
Definition: vppLangIntInOut.hpp:369
bool isVertexOrderCW() const
Retrieves the orientation of triangles generated by the tessellator.
int getOutputPatchVertices() const
Retrieves the number of control points in the resulting patch.
Definition: vppShader.hpp:395
fragmentShader(ClassT *pParentClass, void(ClassT::*fMethodDef)(FragmentShader *, Args...), Args... args)
Constructor.
bool isPointMode() const
Retrieves the status of the point mode of the tessellator.
ETessellationSpacing getSpacing() const
Retrieves the spacing mode of tessellation.
The VPP namespace.
Definition: main.hpp:1
void setVertexOrderCW(bool v)
Sets the orientation of triangles generated by the tessellator.
Tessellation evaluation shader interface.
Definition: vppLangIntInOut.hpp:259
ETessellationTopology getTopology() const
Retrieves the topology of tessellation.
tessControlShader(ClassT *pParentClass, void(ClassT::*fMethodDef)(TessControlShader *, Args...), Args... args)
Constructor.
void setTopology(ETessellationTopology topology)
Configures the topology of tessellation.
void setSpacing(ETessellationSpacing spacing)
Configures the spacing mode of tessellation.
tessEvalShader(const tessControlShader &tcs, ClassT *pParentClass, void(ClassT::*fMethodDef)(TessEvalShader *, Args...), Args... args)
Constructor.
void setMaxOutputVertices(int value)
Configures the maximum vertex count this shader can output.
Binding point class for tessellation evaluation shaders. Place in your pipeline configuration class t...
Definition: vppShader.hpp:211
void setInvocations(int inv)
Enables multiple geometry shader invocations feature and sets the number of invocations.
void setPointMode(bool v)
Enables or disables the point mode of the tessellator.
Binding point class for tessellation control shaders. Place in your pipeline configuration class to d...
Definition: vppShader.hpp:111
geometryShader(ClassT *pParentClass, void(ClassT::*fMethodDef)(GeometryShader *, Args...), Args... args)
Constructor.
Vertex shader interface.
Definition: vppLangIntInOut.hpp:180
Compute shader interface.
Definition: vppLangIntInOut.hpp:429
Tessellation control shader interface.
Definition: vppLangIntInOut.hpp:222
void setOutputPatchVertices(int v)
Sets the number of control points in the resulting patch.
Binding point class for fragment shaders. Place in your pipeline configuration class to declare a fra...
Definition: vppShader.hpp:363
void setOutputTopology(EGeometryOutputTopology t)
Configures the topology of primitives generated by the shader.
Binding point class for vertex shaders. Place in your pipeline configuration class to declare a verte...
Definition: vppShader.hpp:56
vertexShader(ClassT *pParentClass, void(ClassT::*fMethodDef)(VertexShader *, Args...), Args... args)
Constructor.
Binding point class for geometry shaders. Place in your pipeline configuration class to declare a geo...
Definition: vppShader.hpp:291
computeShader(ClassT *pParentClass, const SLocalSize &localSize, void(ClassT::*fMethodDef)(ComputeShader *, Args...), Args... args)
Constructor.