All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
glslComputeContext.h
Go to the documentation of this file.
1 //
2 // Copyright 2013 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 
25 #ifndef OSD_GLSL_COMPUTE_CONTEXT_H
26 #define OSD_GLSL_COMPUTE_CONTEXT_H
27 
28 #include "../version.h"
29 
30 #include "../osd/nonCopyable.h"
31 #include "../osd/opengl.h"
32 
33 #include <vector>
34 
35 namespace OpenSubdiv {
36 namespace OPENSUBDIV_VERSION {
37 
38 namespace Far{ class StencilTables; }
39 
40 namespace Osd {
41 
52 
53 public:
62  static GLSLComputeContext * Create(Far::StencilTables const * vertexStencilTables,
63  Far::StencilTables const * varyingStencilTables=0);
64 
66  virtual ~GLSLComputeContext();
67 
69  bool HasVertexStencilTables() const;
70 
72  bool HasVaryingStencilTables() const;
73 
75  int GetNumControlVertices() const {
76  return _numControlVertices;
77  }
78 
80  GLuint GetVertexStencilTablesSizes() const;
81 
83  GLuint GetVertexStencilTablesOffsets() const;
84 
86  void BindVertexStencilTables() const;
87 
89  void BindVaryingStencilTables() const;
90 
92  void UnbindStencilTables() const;
93 
94 protected:
95 
96  explicit GLSLComputeContext(Far::StencilTables const * vertexStencilTables,
97  Far::StencilTables const * varyingStencilTables);
98 
99 private:
100 
101  class GLSLStencilTables;
102 
103  GLSLStencilTables * _vertexStencilTables,
104  * _varyingStencilTables;
105 
106  int _numControlVertices;
107 };
108 
109 } // end namespace Osd
110 
111 } // end namespace OPENSUBDIV_VERSION
112 using namespace OPENSUBDIV_VERSION;
113 
114 } // end namespace OpenSubdiv
115 
116 #endif // OSD_GLSL_COMPUTE_CONTEXT_H
117 
int GetNumControlVertices() const
Returns the number of control vertices.
GLuint GetVertexStencilTablesOffsets() const
Returns the Cuda buffer containing vertex-stencil stencil offsets.
GLSLComputeContext(Far::StencilTables const *vertexStencilTables, Far::StencilTables const *varyingStencilTables)
bool HasVertexStencilTables() const
Returns true if the Context has a &#39;vertex&#39; interpolation stencil table.
void BindVaryingStencilTables() const
Binds GL buffers containing stencils for &#39;varying&#39; interpolation.
bool HasVaryingStencilTables() const
Returns true if the Context has a &#39;varying&#39; interpolation stencil table.
GLuint GetVertexStencilTablesSizes() const
Returns the Cuda buffer containing vertex-stencil stencil sizes.
void BindVertexStencilTables() const
Binds GL buffers containing stencils for &#39;vertex&#39; interpolation.
static GLSLComputeContext * Create(Far::StencilTables const *vertexStencilTables, Far::StencilTables const *varyingStencilTables=0)
void UnbindStencilTables() const
Unbinds GL stencil buffers.