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