All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
clComputeContext.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_CL_COMPUTE_CONTEXT_H
26 #define OSD_CL_COMPUTE_CONTEXT_H
27 
28 #include "../version.h"
29 
30 #include "../osd/nonCopyable.h"
31 #include "../osd/opencl.h"
32 
33 #include <vector>
34 
35 namespace OpenSubdiv {
36 namespace OPENSUBDIV_VERSION {
37 
38 namespace Far{ class StencilTables; }
39 
40 namespace Osd {
41 
51 class CLComputeContext : public NonCopyable<CLComputeContext> {
52 
53 public:
64  static CLComputeContext * Create(cl_context clContext,
65  Far::StencilTables const * vertexStencilTables,
66  Far::StencilTables const * varyingStencilTables=0);
67 
69  virtual ~CLComputeContext();
70 
71 
73  bool HasVertexStencilTables() const;
74 
76  bool HasVaryingStencilTables() const;
77 
79  int GetNumControlVertices() const {
80  return _numControlVertices;
81  }
82 
84  cl_mem GetVertexStencilTablesSizes() const;
85 
87  cl_mem GetVertexStencilTablesOffsets() const;
88 
90  cl_mem GetVertexStencilTablesIndices() const;
91 
93  cl_mem GetVertexStencilTablesWeights() const;
94 
95 
97  cl_mem GetVaryingStencilTablesSizes() const;
98 
100  cl_mem GetVaryingStencilTablesOffsets() const;
101 
103  cl_mem GetVaryingStencilTablesIndices() const;
104 
106  cl_mem GetVaryingStencilTablesWeights() const;
107 
108 
109 protected:
110  explicit CLComputeContext(Far::StencilTables const * vertexStencilTables,
111  Far::StencilTables const * varyingStencilTables,
112  cl_context clContext);
113 
114 private:
115 
116  class CLStencilTables;
117 
118  CLStencilTables * _vertexStencilTables,
119  * _varyingStencilTables;
120 
121  int _numControlVertices;
122 };
123 
124 } // end namespace Osd
125 
126 } // end namespace OPENSUBDIV_VERSION
127 using namespace OPENSUBDIV_VERSION;
128 
129 } // end namespace OpenSubdiv
130 
131 #endif // OSD_CL_COMPUTE_CONTEXT_H
132 
cl_mem GetVaryingStencilTablesOffsets() const
Returns the Cuda buffer containing Varying-stencil stencil offsets.
cl_mem GetVertexStencilTablesIndices() const
Returns the Cuda buffer containing vertex-stencil stencil indices.
static CLComputeContext * Create(cl_context clContext, Far::StencilTables const *vertexStencilTables, Far::StencilTables const *varyingStencilTables=0)
bool HasVaryingStencilTables() const
Returns true if the Context has a &#39;varying&#39; interpolation stencil table.
cl_mem GetVertexStencilTablesSizes() const
Returns the Cuda buffer containing vertex-stencil stencil sizes.
cl_mem GetVaryingStencilTablesIndices() const
Returns the Cuda buffer containing Varying-stencil stencil indices.
CLComputeContext(Far::StencilTables const *vertexStencilTables, Far::StencilTables const *varyingStencilTables, cl_context clContext)
cl_mem GetVaryingStencilTablesSizes() const
Returns the Cuda buffer containing Varying-stencil stencil sizes.
cl_mem GetVertexStencilTablesWeights() const
Returns the Cuda buffer containing vertex-stencil stencil weights.
int GetNumControlVertices() const
Returns the number of control vertices.
cl_mem GetVaryingStencilTablesWeights() const
Returns the Cuda buffer containing Varying-stencil stencil weights.
cl_mem GetVertexStencilTablesOffsets() const
Returns the Cuda buffer containing vertex-stencil stencil offsets.
bool HasVertexStencilTables() const
Returns true if the Context has a &#39;vertex&#39; interpolation stencil table.