Remove FarMesh dependency from Osd*Context. The context constructor takes

subdivision tables and vertex edit tables directly.
This commit is contained in:
Takahito Tejima 2014-03-28 12:10:13 -07:00
parent 061c861dbf
commit d960990063
35 changed files with 201 additions and 182 deletions

View File

@ -69,7 +69,8 @@ public:
int numVertices = farMesh->GetNumVertices();
_vertexBuffer = OpenSubdiv::OsdCpuGLVertexBuffer::Create(3, numVertices);
_computeContext = OpenSubdiv::OsdCpuComputeContext::Create(farMesh);
_computeContext = OpenSubdiv::OsdCpuComputeContext::Create(
farMesh->GetSubdivisionTables(), farMesh->GetVertexEditTables());
_kernelBatches = farMesh->GetKernelBatches();
OpenSubdiv::OsdUtilPatchPartitioner partitioner(farMesh->GetPatchTables(), partitionPerFace);

View File

@ -518,7 +518,7 @@ createOsdMesh( const std::string &shape, int level, Scheme scheme=kCatmark ) {
// Create a Compute context, used to "pose" the vertices
delete g_computeCtx;
g_computeCtx = OsdCpuComputeContext::Create(g_fmesh);
g_computeCtx = OsdCpuComputeContext::Create(g_fmesh->GetSubdivisionTables(), g_fmesh->GetVertexEditTables());
g_computeCtrl.Refine( g_computeCtx, g_fmesh->GetKernelBatches(), g_vertexData, g_varyingData );
@ -526,7 +526,7 @@ createOsdMesh( const std::string &shape, int level, Scheme scheme=kCatmark ) {
// Create eval context & data buffers
delete g_evalCtx;
g_evalCtx = OsdCpuEvalLimitContext::Create(g_fmesh, /*requireFVarData*/ true);
g_evalCtx = OsdCpuEvalLimitContext::Create(g_fmesh->GetPatchTables(), /*requireFVarData*/ true);
delete g_Q;
g_Q = OsdCpuGLVertexBuffer::Create(6,nsamples);

View File

@ -843,7 +843,7 @@ MStatus OsdPolySmooth::compute( const MPlug& plug, MDataBlock& data ) {
static OpenSubdiv::OsdCpuComputeController computeController = OpenSubdiv::OsdCpuComputeController();
OpenSubdiv::OsdCpuComputeController::ComputeContext *computeContext =
OpenSubdiv::OsdCpuComputeController::ComputeContext::Create(farMesh);
OpenSubdiv::OsdCpuComputeController::ComputeContext::Create(farMesh->GetSubdivisionTables(), farMesh->GetVertexEditTables());
OpenSubdiv::OsdCpuVertexBuffer *vertexBuffer =
OpenSubdiv::OsdCpuVertexBuffer::Create(numVertexElements, numFarVerts );

View File

@ -338,7 +338,8 @@ createOsdContext(int level)
g_farmesh = meshFactory.Create();
g_osdComputeContext = OpenSubdiv::OsdCpuComputeContext::Create(g_farmesh);
g_osdComputeContext = OpenSubdiv::OsdCpuComputeContext::Create(
g_farmesh->GetSubdivisionTables(), g_farmesh->GetVertexEditTables());
delete hmesh;

View File

@ -397,7 +397,7 @@ FarComputeController::ApplyVertexEdits(FarKernelBatch const &batch, CONTEXT *con
typename CONTEXT::VertexType *vsrc = &context->GetVertices().at(0);
FarVertexEditTables const * vertEdit = context->GetVertexEdit();
FarVertexEditTables const * vertEdit = context->GetVertexEditTables();
if (vertEdit)
vertEdit->computeVertexEdits( batch.GetTableIndex(),

View File

@ -77,7 +77,7 @@ public:
U & GetVertex(int index) { return _vertices[index]; }
/// \brief Returns vertex edit tables
FarVertexEditTables const * GetVertexEdit() const { return _vertexEditTables; }
FarVertexEditTables const * GetVertexEditTables() const { return _vertexEditTables; }
/// \brief True if the mesh tables support the feature-adaptive mode.
bool IsFeatureAdaptive() const { return _patchTables->IsFeatureAdaptive(); }

View File

@ -565,8 +565,8 @@ FarSubdivisionTablesFactory<T,U>::Splice(FarMeshVector const &meshes, FarKernelB
}
batches->push_back(batch);
}
editTableIndexOffset += meshes[i]->GetVertexEdit() ?
meshes[i]->GetVertexEdit()->GetNumBatches() : 0;
editTableIndexOffset += meshes[i]->GetVertexEditTables() ?
meshes[i]->GetVertexEditTables()->GetNumBatches() : 0;
}
// count verts offsets

View File

@ -215,7 +215,7 @@ FarVertexEditTablesFactory<T, U>::Splice(FarMeshVector const &meshes) {
// at this moment, don't merge vertex edit tables (separate batch)
for (size_t i = 0; i < meshes.size(); ++i) {
const FarVertexEditTables *vertexEditTables = meshes[i]->GetVertexEdit();
const FarVertexEditTables *vertexEditTables = meshes[i]->GetVertexEditTables();
if (not vertexEditTables) continue;
// copy each edit batch XXX:inefficient copy

View File

@ -22,7 +22,6 @@
// language governing permissions and limitations under the Apache License.
//
#include "../far/mesh.h"
#include "../osd/clComputeContext.h"
#include "../osd/clKernelBundle.h"
@ -100,34 +99,32 @@ OsdCLHEditTable::GetPrimvarWidth() const {
// ----------------------------------------------------------------------------
OsdCLComputeContext::OsdCLComputeContext(FarMesh<OsdVertex> const *farMesh,
cl_context clContext)
OsdCLComputeContext::OsdCLComputeContext(FarSubdivisionTables const *subdivisionTables,
FarVertexEditTables const *vertexEditTables,
cl_context clContext)
: _clQueue(NULL), _kernelBundle(NULL) {
FarSubdivisionTables const * farTables = farMesh->GetSubdivisionTables();
// allocate 5 or 7 tables
_tables.resize(farTables->GetNumTables(), 0);
_tables.resize(subdivisionTables->GetNumTables(), 0);
_tables[FarSubdivisionTables::E_IT] = new OsdCLTable(farTables->Get_E_IT(), clContext);
_tables[FarSubdivisionTables::V_IT] = new OsdCLTable(farTables->Get_V_IT(), clContext);
_tables[FarSubdivisionTables::V_ITa] = new OsdCLTable(farTables->Get_V_ITa(), clContext);
_tables[FarSubdivisionTables::E_W] = new OsdCLTable(farTables->Get_E_W(), clContext);
_tables[FarSubdivisionTables::V_W] = new OsdCLTable(farTables->Get_V_W(), clContext);
_tables[FarSubdivisionTables::E_IT] = new OsdCLTable(subdivisionTables->Get_E_IT(), clContext);
_tables[FarSubdivisionTables::V_IT] = new OsdCLTable(subdivisionTables->Get_V_IT(), clContext);
_tables[FarSubdivisionTables::V_ITa] = new OsdCLTable(subdivisionTables->Get_V_ITa(), clContext);
_tables[FarSubdivisionTables::E_W] = new OsdCLTable(subdivisionTables->Get_E_W(), clContext);
_tables[FarSubdivisionTables::V_W] = new OsdCLTable(subdivisionTables->Get_V_W(), clContext);
if (farTables->GetNumTables() > 5) {
_tables[FarSubdivisionTables::F_IT] = new OsdCLTable(farTables->Get_F_IT(), clContext);
_tables[FarSubdivisionTables::F_ITa] = new OsdCLTable(farTables->Get_F_ITa(), clContext);
if (subdivisionTables->GetNumTables() > 5) {
_tables[FarSubdivisionTables::F_IT] = new OsdCLTable(subdivisionTables->Get_F_IT(), clContext);
_tables[FarSubdivisionTables::F_ITa] = new OsdCLTable(subdivisionTables->Get_F_ITa(), clContext);
}
// create hedit tables
FarVertexEditTables const *editTables = farMesh->GetVertexEdit();
if (editTables) {
int numEditBatches = editTables->GetNumBatches();
if (vertexEditTables) {
int numEditBatches = vertexEditTables->GetNumBatches();
_editTables.reserve(numEditBatches);
for (int i = 0; i < numEditBatches; ++i) {
const FarVertexEditTables::VertexEditBatch & edit =
editTables->GetBatch(i);
vertexEditTables->GetBatch(i);
_editTables.push_back(new OsdCLHEditTable(edit, clContext));
}
}
@ -198,9 +195,11 @@ OsdCLComputeContext::GetCommandQueue() const {
}
OsdCLComputeContext *
OsdCLComputeContext::Create(FarMesh<OsdVertex> const *farmesh, cl_context clContext) {
OsdCLComputeContext::Create(FarSubdivisionTables const *subdivisionTables,
FarVertexEditTables const *vertexEditTables,
cl_context clContext) {
return new OsdCLComputeContext(farmesh, clContext);
return new OsdCLComputeContext(subdivisionTables, vertexEditTables, clContext);
}
} // end namespace OPENSUBDIV_VERSION

View File

@ -27,7 +27,7 @@
#include "../version.h"
#include "../far/mesh.h"
#include "../far/subdivisionTables.h"
#include "../far/vertexEditTables.h"
#include "../osd/vertex.h"
#include "../osd/nonCopyable.h"
@ -103,11 +103,14 @@ class OsdCLComputeContext : public OsdNonCopyable<OsdCLComputeContext> {
public:
/// Creates an OsdCLComputeContext instance
///
/// @param farmesh the FarMesh used for this Context.
/// @param subdivisionTables the FarSubdivisionTables used for this Context.
///
/// @param vertexEditTables the FarVertexEditTables used for this Context.
///
/// @param clContext a valid active OpenCL context
///
static OsdCLComputeContext * Create(FarMesh<OsdVertex> const *farmesh,
static OsdCLComputeContext * Create(FarSubdivisionTables const *subdivisionTables,
FarVertexEditTables const *vertexEditTables,
cl_context clContext);
/// Destructor
@ -170,7 +173,8 @@ public:
void SetCommandQueue(cl_command_queue queue);
protected:
explicit OsdCLComputeContext(FarMesh<OsdVertex> const *farMesh,
explicit OsdCLComputeContext(FarSubdivisionTables const *subdivisionTables,
FarVertexEditTables const *vertexEditTables,
cl_context clContext);
private:

View File

@ -22,7 +22,6 @@
// language governing permissions and limitations under the Apache License.
//
#include "../far/mesh.h"
#include "../far/dispatcher.h"
#include "../far/subdivisionTables.h"
@ -103,33 +102,30 @@ OsdCpuHEditTable::GetPrimvarWidth() const {
return _primvarWidth;
}
OsdCpuComputeContext::OsdCpuComputeContext(FarMesh<OsdVertex> const *farMesh) {
FarSubdivisionTables const * farTables =
farMesh->GetSubdivisionTables();
OsdCpuComputeContext::OsdCpuComputeContext(FarSubdivisionTables const *subdivisionTables,
FarVertexEditTables const *vertexEditTables) {
// allocate 5 or 7 tables
_tables.resize(farTables->GetNumTables(), 0);
_tables.resize(subdivisionTables->GetNumTables(), 0);
_tables[FarSubdivisionTables::E_IT] = new OsdCpuTable(farTables->Get_E_IT());
_tables[FarSubdivisionTables::V_IT] = new OsdCpuTable(farTables->Get_V_IT());
_tables[FarSubdivisionTables::V_ITa] = new OsdCpuTable(farTables->Get_V_ITa());
_tables[FarSubdivisionTables::E_W] = new OsdCpuTable(farTables->Get_E_W());
_tables[FarSubdivisionTables::V_W] = new OsdCpuTable(farTables->Get_V_W());
_tables[FarSubdivisionTables::E_IT] = new OsdCpuTable(subdivisionTables->Get_E_IT());
_tables[FarSubdivisionTables::V_IT] = new OsdCpuTable(subdivisionTables->Get_V_IT());
_tables[FarSubdivisionTables::V_ITa] = new OsdCpuTable(subdivisionTables->Get_V_ITa());
_tables[FarSubdivisionTables::E_W] = new OsdCpuTable(subdivisionTables->Get_E_W());
_tables[FarSubdivisionTables::V_W] = new OsdCpuTable(subdivisionTables->Get_V_W());
if (farTables->GetNumTables() > 5) {
_tables[FarSubdivisionTables::F_IT] = new OsdCpuTable(farTables->Get_F_IT());
_tables[FarSubdivisionTables::F_ITa] = new OsdCpuTable(farTables->Get_F_ITa());
if (subdivisionTables->GetNumTables() > 5) {
_tables[FarSubdivisionTables::F_IT] = new OsdCpuTable(subdivisionTables->Get_F_IT());
_tables[FarSubdivisionTables::F_ITa] = new OsdCpuTable(subdivisionTables->Get_F_ITa());
}
// create hedit tables
FarVertexEditTables const *editTables = farMesh->GetVertexEdit();
if (editTables) {
int numEditBatches = editTables->GetNumBatches();
if (vertexEditTables) {
int numEditBatches = vertexEditTables->GetNumBatches();
_editTables.reserve(numEditBatches);
for (int i = 0; i < numEditBatches; ++i) {
const FarVertexEditTables::VertexEditBatch & edit =
editTables->GetBatch(i);
vertexEditTables->GetBatch(i);
_editTables.push_back(new OsdCpuHEditTable(edit));
}
@ -179,9 +175,10 @@ OsdCpuComputeContext::GetCurrentVaryingBuffer() const {
}
OsdCpuComputeContext *
OsdCpuComputeContext::Create(FarMesh<OsdVertex> const *farmesh) {
OsdCpuComputeContext::Create(FarSubdivisionTables const *subdivisionTables,
FarVertexEditTables const *vertexEditTables) {
return new OsdCpuComputeContext(farmesh);
return new OsdCpuComputeContext(subdivisionTables, vertexEditTables);
}
} // end namespace OPENSUBDIV_VERSION

View File

@ -27,7 +27,6 @@
#include "../version.h"
#include "../far/mesh.h"
#include "../far/subdivisionTables.h"
#include "../far/vertexEditTables.h"
#include "../osd/vertex.h"
@ -97,9 +96,12 @@ class OsdCpuComputeContext : OsdNonCopyable<OsdCpuComputeContext> {
public:
/// Creates an OsdCpuComputeContext instance
///
/// @param farmesh the FarMesh used for this Context.
/// @param subdivisionTables the FarSubdivisionTables used for this Context.
///
static OsdCpuComputeContext * Create(FarMesh<OsdVertex> const *farmesh);
/// @param vertexEditTables the FarVertexEditTables used for this Context.
///
static OsdCpuComputeContext * Create(FarSubdivisionTables const *subdivisionTables,
FarVertexEditTables const *vertexEditTables);
/// Destructor
virtual ~OsdCpuComputeContext();
@ -160,7 +162,8 @@ public:
float * GetCurrentVaryingBuffer() const;
protected:
explicit OsdCpuComputeContext(FarMesh<OsdVertex> const *farMesh);
explicit OsdCpuComputeContext(FarSubdivisionTables const *subdivisionTables,
FarVertexEditTables const *vertexEditTables);
private:
std::vector<OsdCpuTable*> _tables;

View File

@ -34,21 +34,20 @@ namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
OsdCpuEvalLimitContext *
OsdCpuEvalLimitContext::Create(FarMesh<OsdVertex> const * farmesh, bool requireFVarData) {
OsdCpuEvalLimitContext::Create(FarPatchTables const *patchTables, bool requireFVarData) {
assert(farmesh);
assert(patchTables);
// we do not support uniform yet
if (not farmesh->GetPatchTables())
if (not patchTables->IsFeatureAdaptive())
return NULL;
return new OsdCpuEvalLimitContext(farmesh, requireFVarData);
return new OsdCpuEvalLimitContext(patchTables, requireFVarData);
}
OsdCpuEvalLimitContext::OsdCpuEvalLimitContext(FarMesh<OsdVertex> const * farmesh, bool requireFVarData) :
OsdEvalLimitContext(farmesh) {
OsdCpuEvalLimitContext::OsdCpuEvalLimitContext(FarPatchTables const *patchTables, bool requireFVarData) :
OsdEvalLimitContext(patchTables) {
FarPatchTables const * patchTables = farmesh->GetPatchTables();
assert(patchTables);
// copy the data from the FarTables

View File

@ -42,15 +42,15 @@ class OsdCpuEvalLimitContext : public OsdEvalLimitContext {
public:
/// \brief Factory
/// Returns an EvalLimitContext from the given farmesh.
/// Note : the farmesh is expected to be feature-adaptive and have ptex
/// Returns an EvalLimitContext from the given far patch tables.
/// Note : the patchtables is expected to be feature-adaptive and have ptex
/// coordinates tables.
///
/// @param farmesh a pointer to an initialized farmesh
/// @param patchTables a pointer to an initialized FarPatchTables
///
/// @param requireFVarData flag for generating face-varying data
///
static OsdCpuEvalLimitContext * Create(FarMesh<OsdVertex> const * farmesh,
static OsdCpuEvalLimitContext * Create(FarPatchTables const *patchTables,
bool requireFVarData=false);
virtual ~OsdCpuEvalLimitContext();
@ -315,7 +315,7 @@ public:
}
protected:
explicit OsdCpuEvalLimitContext(FarMesh<OsdVertex> const * farmesh, bool requireFVarData);
explicit OsdCpuEvalLimitContext(FarPatchTables const *patchTables, bool requireFVarData);
private:

View File

@ -22,7 +22,6 @@
// language governing permissions and limitations under the Apache License.
//
#include "../far/mesh.h"
#include "../osd/cudaComputeContext.h"
#include <cuda_runtime.h>
@ -136,22 +135,21 @@ OsdCudaComputeContext::~OsdCudaComputeContext() {
}
bool
OsdCudaComputeContext::initialize(FarMesh<OsdVertex> const *farMesh) {
FarSubdivisionTables const * farTables = farMesh->GetSubdivisionTables();
OsdCudaComputeContext::initialize(FarSubdivisionTables const *subdivisionTables,
FarVertexEditTables const *vertexEditTables) {
// allocate 5 or 7 tables
_tables.resize(farTables->GetNumTables(), 0);
_tables.resize(subdivisionTables->GetNumTables(), 0);
_tables[FarSubdivisionTables::E_IT] = OsdCudaTable::Create(farTables->Get_E_IT());
_tables[FarSubdivisionTables::V_IT] = OsdCudaTable::Create(farTables->Get_V_IT());
_tables[FarSubdivisionTables::V_ITa] = OsdCudaTable::Create(farTables->Get_V_ITa());
_tables[FarSubdivisionTables::E_W] = OsdCudaTable::Create(farTables->Get_E_W());
_tables[FarSubdivisionTables::V_W] = OsdCudaTable::Create(farTables->Get_V_W());
_tables[FarSubdivisionTables::E_IT] = OsdCudaTable::Create(subdivisionTables->Get_E_IT());
_tables[FarSubdivisionTables::V_IT] = OsdCudaTable::Create(subdivisionTables->Get_V_IT());
_tables[FarSubdivisionTables::V_ITa] = OsdCudaTable::Create(subdivisionTables->Get_V_ITa());
_tables[FarSubdivisionTables::E_W] = OsdCudaTable::Create(subdivisionTables->Get_E_W());
_tables[FarSubdivisionTables::V_W] = OsdCudaTable::Create(subdivisionTables->Get_V_W());
if (farTables->GetNumTables() > 5) {
_tables[FarSubdivisionTables::F_IT] = OsdCudaTable::Create(farTables->Get_F_IT());
_tables[FarSubdivisionTables::F_ITa] = OsdCudaTable::Create(farTables->Get_F_ITa());
if (subdivisionTables->GetNumTables() > 5) {
_tables[FarSubdivisionTables::F_IT] = OsdCudaTable::Create(subdivisionTables->Get_F_IT());
_tables[FarSubdivisionTables::F_ITa] = OsdCudaTable::Create(subdivisionTables->Get_F_ITa());
}
// error check
@ -162,13 +160,12 @@ OsdCudaComputeContext::initialize(FarMesh<OsdVertex> const *farMesh) {
}
// create hedit tables
FarVertexEditTables const *editTables = farMesh->GetVertexEdit();
if (editTables) {
int numEditBatches = editTables->GetNumBatches();
if (vertexEditTables) {
int numEditBatches = vertexEditTables->GetNumBatches();
_editTables.reserve(numEditBatches);
for (int i = 0; i < numEditBatches; ++i) {
const FarVertexEditTables::VertexEditBatch & edit =
editTables->GetBatch(i);
vertexEditTables->GetBatch(i);
_editTables.push_back(OsdCudaHEditTable::Create(edit));
}
@ -213,11 +210,12 @@ OsdCudaComputeContext::GetCurrentVaryingBuffer() const {
}
OsdCudaComputeContext *
OsdCudaComputeContext::Create(FarMesh<OsdVertex> const *farmesh) {
OsdCudaComputeContext::Create(FarSubdivisionTables const *subdivisionTables,
FarVertexEditTables const *vertexEditTables) {
OsdCudaComputeContext *result = new OsdCudaComputeContext();
if (result->initialize(farmesh) == false) {
if (result->initialize(subdivisionTables, vertexEditTables) == false) {
delete result;
return NULL;
}

View File

@ -27,7 +27,7 @@
#include "../version.h"
#include "../far/mesh.h"
#include "../far/subdivisionTables.h"
#include "../far/vertexEditTables.h"
#include "../osd/vertex.h"
#include "../osd/vertexDescriptor.h"
@ -104,9 +104,12 @@ class OsdCudaComputeContext : public OsdNonCopyable<OsdCudaComputeContext> {
public:
/// Creates an OsdCudaComputeContext instance
///
/// @param farmesh the FarMesh used for this Context.
/// @param subdivisionTables the FarSubdivisionTables used for this Context.
///
static OsdCudaComputeContext * Create(FarMesh<OsdVertex> const *farmesh);
/// @param vertexEditTables the FarVertexEditTables used for this Context.
///
static OsdCudaComputeContext * Create(FarSubdivisionTables const *subdivisionTables,
FarVertexEditTables const *vertexEditTables);
/// Destructor
virtual ~OsdCudaComputeContext();
@ -178,7 +181,8 @@ public:
protected:
OsdCudaComputeContext();
bool initialize(FarMesh<OsdVertex> const *farMesh);
bool initialize(FarSubdivisionTables const *subdivisionTables,
FarVertexEditTables const *vertexEditTables);
private:
std::vector<OsdCudaTable*> _tables;

View File

@ -22,8 +22,8 @@
// language governing permissions and limitations under the Apache License.
//
#include "../far/mesh.h"
#include "../far/subdivisionTables.h"
#include "../far/vertexEditTables.h"
#include "../osd/debug.h"
#include "../osd/error.h"
#include "../osd/d3d11ComputeContext.h"
@ -145,40 +145,39 @@ OsdD3D11ComputeHEditTable::GetPrimvarWidth() const {
// ----------------------------------------------------------------------------
OsdD3D11ComputeContext::OsdD3D11ComputeContext(
FarMesh<OsdVertex> const *farMesh, ID3D11DeviceContext *deviceContext)
FarSubdivisionTables const *subdivisionTables,
FarVertexEditTables const *vertexEditTables,
ID3D11DeviceContext *deviceContext)
: _deviceContext(deviceContext),
_currentVertexBufferUAV(0), _currentVaryingBufferUAV(0) {
FarSubdivisionTables const * farTables = farMesh->GetSubdivisionTables();
// allocate 5 or 7 tables
// XXXtakahito: Although _tables size depends on table type, F_IT is set
// to NULL even in loop case, to determine the condition in
// bindShaderStorageBuffer()...
_tables.resize(7, 0);
_tables[FarSubdivisionTables::E_IT] = new OsdD3D11ComputeTable(farTables->Get_E_IT(), deviceContext, DXGI_FORMAT_R32_SINT);
_tables[FarSubdivisionTables::V_IT] = new OsdD3D11ComputeTable(farTables->Get_V_IT(), deviceContext, DXGI_FORMAT_R32_UINT);
_tables[FarSubdivisionTables::V_ITa] = new OsdD3D11ComputeTable(farTables->Get_V_ITa(), deviceContext, DXGI_FORMAT_R32_SINT);
_tables[FarSubdivisionTables::E_W] = new OsdD3D11ComputeTable(farTables->Get_E_W(), deviceContext, DXGI_FORMAT_R32_FLOAT);
_tables[FarSubdivisionTables::V_W] = new OsdD3D11ComputeTable(farTables->Get_V_W(), deviceContext, DXGI_FORMAT_R32_FLOAT);
_tables[FarSubdivisionTables::E_IT] = new OsdD3D11ComputeTable(subdivisionTables->Get_E_IT(), deviceContext, DXGI_FORMAT_R32_SINT);
_tables[FarSubdivisionTables::V_IT] = new OsdD3D11ComputeTable(subdivisionTables->Get_V_IT(), deviceContext, DXGI_FORMAT_R32_UINT);
_tables[FarSubdivisionTables::V_ITa] = new OsdD3D11ComputeTable(subdivisionTables->Get_V_ITa(), deviceContext, DXGI_FORMAT_R32_SINT);
_tables[FarSubdivisionTables::E_W] = new OsdD3D11ComputeTable(subdivisionTables->Get_E_W(), deviceContext, DXGI_FORMAT_R32_FLOAT);
_tables[FarSubdivisionTables::V_W] = new OsdD3D11ComputeTable(subdivisionTables->Get_V_W(), deviceContext, DXGI_FORMAT_R32_FLOAT);
if (farTables->GetNumTables() > 5) {
_tables[FarSubdivisionTables::F_IT] = new OsdD3D11ComputeTable(farTables->Get_F_IT(), deviceContext, DXGI_FORMAT_R32_UINT);
_tables[FarSubdivisionTables::F_ITa] = new OsdD3D11ComputeTable(farTables->Get_F_ITa(), deviceContext, DXGI_FORMAT_R32_SINT);
if (subdivisionTables->GetNumTables() > 5) {
_tables[FarSubdivisionTables::F_IT] = new OsdD3D11ComputeTable(subdivisionTables->Get_F_IT(), deviceContext, DXGI_FORMAT_R32_UINT);
_tables[FarSubdivisionTables::F_ITa] = new OsdD3D11ComputeTable(subdivisionTables->Get_F_ITa(), deviceContext, DXGI_FORMAT_R32_SINT);
} else {
_tables[FarSubdivisionTables::F_IT] = NULL;
_tables[FarSubdivisionTables::F_ITa] = NULL;
}
// create hedit tables
FarVertexEditTables const *editTables = farMesh->GetVertexEdit();
if (editTables) {
int numEditBatches = editTables->GetNumBatches();
if (vertexEditTables) {
int numEditBatches = vertexEditTables->GetNumBatches();
_editTables.reserve(numEditBatches);
for (int i = 0; i < numEditBatches; ++i) {
const FarVertexEditTables::VertexEditBatch & edit =
editTables->GetBatch(i);
vertexEditTables->GetBatch(i);
_editTables.push_back(new OsdD3D11ComputeHEditTable(edit, deviceContext));
}
}
@ -248,9 +247,11 @@ OsdD3D11ComputeContext::SetDeviceContext(ID3D11DeviceContext *deviceContext) {
}
OsdD3D11ComputeContext *
OsdD3D11ComputeContext::Create(FarMesh<OsdVertex> const *farmesh, ID3D11DeviceContext *deviceContext) {
OsdD3D11ComputeContext::Create(FarSubdivisionTables const *subdivisionTables,
FarVertexEditTables const *vertexEditTables,
ID3D11DeviceContext *deviceContext) {
return new OsdD3D11ComputeContext(farmesh, deviceContext);
return new OsdD3D11ComputeContext(subdivisionTables, vertexEditTables, deviceContext);
}
void

View File

@ -27,7 +27,7 @@
#include "../version.h"
#include "../far/mesh.h"
#include "../far/subdivisionTables.h"
#include "../far/vertexEditTables.h"
#include "../osd/vertex.h"
#include "../osd/vertexDescriptor.h"
@ -105,11 +105,14 @@ class OsdD3D11ComputeContext : public OsdNonCopyable<OsdD3D11ComputeContext> {
public:
/// Creates an OsdD3D11ComputeContext instance
///
/// @param farmesh the FarMesh used for this Context.
/// @param subdivisionTables the FarSubdivisionTables used for this Context.
///
/// @param vertexEditTables the FarVertexEditTables used for this Context.
///
/// @param deviceContext D3D device
///
static OsdD3D11ComputeContext * Create(FarMesh<OsdVertex> const *farmesh,
static OsdD3D11ComputeContext * Create(FarSubdivisionTables const *subdivisionTables,
FarVertexEditTables const *vertexEditTables,
ID3D11DeviceContext *deviceContext);
/// Destructor
@ -185,7 +188,9 @@ public:
void UnbindEditShaderStorageBuffers();
protected:
explicit OsdD3D11ComputeContext(FarMesh<OsdVertex> const *farMesh, ID3D11DeviceContext *deviceContext);
explicit OsdD3D11ComputeContext(FarSubdivisionTables const *subdivisionTables,
FarVertexEditTables const *vertexEditTables,
ID3D11DeviceContext *deviceContext);
void bindShaderStorageBuffers();

View File

@ -27,7 +27,7 @@
#include "../version.h"
#include "../far/mesh.h"
#include "../far/patchTables.h"
#include "../osd/drawContext.h"
#include "../osd/vertex.h"

View File

@ -27,7 +27,7 @@
#include "../version.h"
#include "../far/mesh.h"
#include "../far/patchTables.h"
#include "../osd/drawRegistry.h"
#include "../osd/vertex.h"

View File

@ -72,7 +72,8 @@ public:
_vertexBuffer = VertexBuffer::Create(numVertexElements, numVertices, pd3d11Device);
if (numVaryingElements)
_vertexBuffer = VertexBuffer::Create(numVaryingElements, numVertices, pd3d11Device);
_computeContext = ComputeContext::Create(_farMesh);
_computeContext = ComputeContext::Create(_farMesh->GetSubdivisionTables(),
_farMesh->GetVertexEditTables());
_drawContext = DrawContext::Create(_farMesh->GetPatchTables(),
_pd3d11DeviceContext,
bits.test(MeshFVarData));
@ -158,7 +159,9 @@ public:
_vertexBuffer = VertexBuffer::Create(numVertexElements, numVertices, pd3d11Device);
if (numVaryingElements)
_varyingBuffer = VertexBuffer::Create(numVaryingElements, numVertices, pd3d11Device);
_computeContext = ComputeContext::Create(_farMesh, _pd3d11DeviceContext);
_computeContext = ComputeContext::Create(_farMesh->GetSubdivisionTables(),
_farMesh->GetVertexEditTables(),
_pd3d11DeviceContext);
_drawContext = DrawContext::Create(_farMesh->GetPatchTables(),
_pd3d11DeviceContext,
bits.test(MeshFVarData));

View File

@ -28,9 +28,9 @@
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
OsdEvalLimitContext::OsdEvalLimitContext(FarMesh<OsdVertex> const * farmesh) {
OsdEvalLimitContext::OsdEvalLimitContext(FarPatchTables const *patchTables) {
_adaptive = farmesh->GetPatchTables()->IsFeatureAdaptive();
_adaptive = patchTables->IsFeatureAdaptive();
}
OsdEvalLimitContext::~OsdEvalLimitContext() {

View File

@ -27,7 +27,7 @@
#include "../version.h"
#include "../far/mesh.h"
#include "../far/patchTables.h"
#include "../osd/nonCopyable.h"
#include "../osd/vertex.h"
@ -70,7 +70,7 @@ public:
virtual ~OsdEvalLimitContext();
protected:
explicit OsdEvalLimitContext(FarMesh<OsdVertex> const * farmesh);
explicit OsdEvalLimitContext(FarPatchTables const *patchTables);
private:
bool _adaptive;

View File

@ -27,7 +27,7 @@
#include "../version.h"
#include "../far/mesh.h"
#include "../far/patchTables.h"
#include "../osd/drawContext.h"
#include "../osd/drawRegistry.h"
#include "../osd/vertex.h"

View File

@ -27,7 +27,6 @@
#include "../version.h"
#include "../far/mesh.h"
#include "../osd/drawRegistry.h"
#include "../osd/vertex.h"

View File

@ -143,7 +143,7 @@ private:
_vertexBuffer = VertexBuffer::Create(numVertexElements, numVertices);
if (numVaryingElements)
_varyingBuffer = VertexBuffer::Create(numVaryingElements, numVertices);
_computeContext = ComputeContext::Create(_farMesh);
_computeContext = ComputeContext::Create(_farMesh->GetSubdivisionTables(), _farMesh->GetVertexEditTables());
_drawContext = DrawContext::Create(_farMesh->GetPatchTables(), bits.test(MeshFVarData));
_drawContext->UpdateVertexTexture(_vertexBuffer);
}
@ -264,7 +264,7 @@ private:
_vertexBuffer = VertexBuffer::Create(numVertexElements, numVertices, _clContext);
if (numVaryingElements)
_varyingBuffer = VertexBuffer::Create(numVaryingElements, numVertices, _clContext);
_computeContext = ComputeContext::Create(_farMesh, _clContext);
_computeContext = ComputeContext::Create(_farMesh->GetSubdivisionTables(), _farMesh->GetVertexEditTables(), _clContext);
_drawContext = DrawContext::Create(_farMesh->GetPatchTables(), bits.test(MeshFVarData));
_drawContext->UpdateVertexTexture(_vertexBuffer);
}

View File

@ -22,7 +22,6 @@
// language governing permissions and limitations under the Apache License.
//
#include "../far/mesh.h"
#include "../osd/debug.h"
#include "../osd/error.h"
#include "../osd/glslComputeContext.h"
@ -110,28 +109,26 @@ OsdGLSLComputeHEditTable::GetPrimvarWidth() const {
// ----------------------------------------------------------------------------
OsdGLSLComputeContext::OsdGLSLComputeContext(
FarMesh<OsdVertex> const *farMesh)
FarSubdivisionTables const *subdivisionTables,
FarVertexEditTables const *vertexEditTables)
: _vertexTexture(0), _varyingTexture(0) {
FarSubdivisionTables const * farTables =
farMesh->GetSubdivisionTables();
// allocate 5 or 7 tables
// XXXtakahito: Although _tables size depends on table type, F_IT is set
// to NULL even in loop case, to determine the condition in
// bindShaderStorageBuffer()...
_tables.resize(7, 0);
_tables[FarSubdivisionTables::E_IT] = new OsdGLSLComputeTable(farTables->Get_E_IT());
_tables[FarSubdivisionTables::V_IT] = new OsdGLSLComputeTable(farTables->Get_V_IT());
_tables[FarSubdivisionTables::V_ITa] = new OsdGLSLComputeTable(farTables->Get_V_ITa());
_tables[FarSubdivisionTables::E_W] = new OsdGLSLComputeTable(farTables->Get_E_W());
_tables[FarSubdivisionTables::V_W] = new OsdGLSLComputeTable(farTables->Get_V_W());
_tables[FarSubdivisionTables::E_IT] = new OsdGLSLComputeTable(subdivisionTables->Get_E_IT());
_tables[FarSubdivisionTables::V_IT] = new OsdGLSLComputeTable(subdivisionTables->Get_V_IT());
_tables[FarSubdivisionTables::V_ITa] = new OsdGLSLComputeTable(subdivisionTables->Get_V_ITa());
_tables[FarSubdivisionTables::E_W] = new OsdGLSLComputeTable(subdivisionTables->Get_E_W());
_tables[FarSubdivisionTables::V_W] = new OsdGLSLComputeTable(subdivisionTables->Get_V_W());
if (farTables->GetNumTables() > 5) {
if (subdivisionTables->GetNumTables() > 5) {
// catmark, bilinear
_tables[FarSubdivisionTables::F_IT] = new OsdGLSLComputeTable(farTables->Get_F_IT());
_tables[FarSubdivisionTables::F_ITa] = new OsdGLSLComputeTable(farTables->Get_F_ITa());
_tables[FarSubdivisionTables::F_IT] = new OsdGLSLComputeTable(subdivisionTables->Get_F_IT());
_tables[FarSubdivisionTables::F_ITa] = new OsdGLSLComputeTable(subdivisionTables->Get_F_ITa());
} else {
// loop
_tables[FarSubdivisionTables::F_IT] = NULL;
@ -139,13 +136,12 @@ OsdGLSLComputeContext::OsdGLSLComputeContext(
}
// create hedit tables
FarVertexEditTables const *editTables = farMesh->GetVertexEdit();
if (editTables) {
int numEditBatches = editTables->GetNumBatches();
if (vertexEditTables) {
int numEditBatches = vertexEditTables->GetNumBatches();
_editTables.reserve(numEditBatches);
for (int i = 0; i < numEditBatches; ++i) {
const FarVertexEditTables::VertexEditBatch & edit =
editTables->GetBatch(i);
vertexEditTables->GetBatch(i);
_editTables.push_back(new OsdGLSLComputeHEditTable(edit));
}
}
@ -205,9 +201,10 @@ OsdGLSLComputeContext::SetKernelBundle(
}
OsdGLSLComputeContext *
OsdGLSLComputeContext::Create(FarMesh<OsdVertex> const *farmesh) {
OsdGLSLComputeContext::Create(FarSubdivisionTables const *subdivisionTables,
FarVertexEditTables const *vertexEditTables) {
return new OsdGLSLComputeContext(farmesh);
return new OsdGLSLComputeContext(subdivisionTables, vertexEditTables);
}
void

View File

@ -27,7 +27,8 @@
#include "../version.h"
#include "../far/mesh.h"
#include "../far/subdivisionTables.h"
#include "../far/vertexEditTables.h"
#include "../far/vertexEditTables.h"
#include "../osd/vertex.h"
#include "../osd/vertexDescriptor.h"
@ -102,9 +103,12 @@ class OsdGLSLComputeContext {
public:
/// Creates an OsdGLSLComputeContext instance
///
/// @param farmesh the FarMesh used for this Context.
/// @param subdivisionTables the FarSubdivisionTables used for this Context.
///
static OsdGLSLComputeContext * Create(FarMesh<OsdVertex> const *farmesh);
/// @param vertexEditTables the FarVertexEditTables used for this Context.
///
static OsdGLSLComputeContext * Create(FarSubdivisionTables const *subdivisionTables,
FarVertexEditTables const *vertexEditTables);
/// Destructor
virtual ~OsdGLSLComputeContext();
@ -197,7 +201,8 @@ public:
void UnbindEditShaderStorageBuffers();
protected:
explicit OsdGLSLComputeContext(FarMesh<OsdVertex> const *farMesh);
explicit OsdGLSLComputeContext(FarSubdivisionTables const *subdivisionTables,
FarVertexEditTables const *vertexEditTables);
void bindShaderStorageBuffers();

View File

@ -24,7 +24,6 @@
#include "../version.h"
#include "../far/mesh.h"
#include "../far/subdivisionTables.h"
#include "../osd/debug.h"
#include "../osd/glslTransformFeedbackComputeContext.h"
@ -118,25 +117,23 @@ OsdGLSLTransformFeedbackHEditTable::GetPrimvarWidth() const {
// ----------------------------------------------------------------------------
OsdGLSLTransformFeedbackComputeContext::OsdGLSLTransformFeedbackComputeContext(
FarMesh<OsdVertex> const *farMesh) :
FarSubdivisionTables const *subdivisionTables,
FarVertexEditTables const *vertexEditTables) :
_vertexTexture(0), _varyingTexture(0) {
FarSubdivisionTables const * farTables =
farMesh->GetSubdivisionTables();
// allocate 5 or 7 tables
_tables.resize(7, 0);
_tables[FarSubdivisionTables::E_IT] = new OsdGLSLTransformFeedbackTable(farTables->Get_E_IT(), GL_R32I);
_tables[FarSubdivisionTables::V_IT] = new OsdGLSLTransformFeedbackTable(farTables->Get_V_IT(), GL_R32UI);
_tables[FarSubdivisionTables::V_ITa] = new OsdGLSLTransformFeedbackTable(farTables->Get_V_ITa(), GL_R32I);
_tables[FarSubdivisionTables::E_W] = new OsdGLSLTransformFeedbackTable(farTables->Get_E_W(), GL_R32F);
_tables[FarSubdivisionTables::V_W] = new OsdGLSLTransformFeedbackTable(farTables->Get_V_W(), GL_R32F);
_tables[FarSubdivisionTables::E_IT] = new OsdGLSLTransformFeedbackTable(subdivisionTables->Get_E_IT(), GL_R32I);
_tables[FarSubdivisionTables::V_IT] = new OsdGLSLTransformFeedbackTable(subdivisionTables->Get_V_IT(), GL_R32UI);
_tables[FarSubdivisionTables::V_ITa] = new OsdGLSLTransformFeedbackTable(subdivisionTables->Get_V_ITa(), GL_R32I);
_tables[FarSubdivisionTables::E_W] = new OsdGLSLTransformFeedbackTable(subdivisionTables->Get_E_W(), GL_R32F);
_tables[FarSubdivisionTables::V_W] = new OsdGLSLTransformFeedbackTable(subdivisionTables->Get_V_W(), GL_R32F);
if (farTables->GetNumTables() > 5) {
if (subdivisionTables->GetNumTables() > 5) {
// catmark, bilinear
_tables[FarSubdivisionTables::F_IT] = new OsdGLSLTransformFeedbackTable(farTables->Get_F_IT(), GL_R32UI);
_tables[FarSubdivisionTables::F_ITa] = new OsdGLSLTransformFeedbackTable(farTables->Get_F_ITa(), GL_R32I);
_tables[FarSubdivisionTables::F_IT] = new OsdGLSLTransformFeedbackTable(subdivisionTables->Get_F_IT(), GL_R32UI);
_tables[FarSubdivisionTables::F_ITa] = new OsdGLSLTransformFeedbackTable(subdivisionTables->Get_F_ITa(), GL_R32I);
} else {
// loop
_tables[FarSubdivisionTables::F_IT] = NULL;
@ -144,12 +141,11 @@ OsdGLSLTransformFeedbackComputeContext::OsdGLSLTransformFeedbackComputeContext(
}
// create hedit tables
FarVertexEditTables const *editTables = farMesh->GetVertexEdit();
if (editTables) {
int numEditBatches = editTables->GetNumBatches();
if (vertexEditTables) {
int numEditBatches = vertexEditTables->GetNumBatches();
_editTables.reserve(numEditBatches);
for (int i = 0; i < numEditBatches; ++i) {
const FarVertexEditTables::VertexEditBatch & edit = editTables->GetBatch(i);
const FarVertexEditTables::VertexEditBatch & edit = vertexEditTables->GetBatch(i);
_editTables.push_back(new OsdGLSLTransformFeedbackHEditTable(edit));
}
}
@ -210,9 +206,10 @@ OsdGLSLTransformFeedbackComputeContext::SetKernelBundle(OsdGLSLTransformFeedback
}
OsdGLSLTransformFeedbackComputeContext *
OsdGLSLTransformFeedbackComputeContext::Create(FarMesh<OsdVertex> const *farmesh) {
OsdGLSLTransformFeedbackComputeContext::Create(FarSubdivisionTables const *subdivisionTables,
FarVertexEditTables const *vertexEditTables) {
return new OsdGLSLTransformFeedbackComputeContext(farmesh);
return new OsdGLSLTransformFeedbackComputeContext(subdivisionTables, vertexEditTables);
}
void

View File

@ -27,7 +27,7 @@
#include "../version.h"
#include "../far/mesh.h"
#include "../far/subdivisionTables.h"
#include "../far/vertexEditTables.h"
#include "../osd/vertex.h"
#include "../osd/vertexDescriptor.h"
@ -99,9 +99,12 @@ class OsdGLSLTransformFeedbackComputeContext {
public:
/// Creates an OsdGLSLTransformFeedbackComputeContext instance
///
/// @param farmesh the FarMesh used for this Context.
/// @param subdivisionTables the FarSubdivisionTables used for this Context.
///
static OsdGLSLTransformFeedbackComputeContext * Create(FarMesh<OsdVertex> const *farmesh);
/// @param vertexEditTables the FarVertexEditTables used for this Context.
///
static OsdGLSLTransformFeedbackComputeContext * Create(FarSubdivisionTables const *subdivisionTables,
FarVertexEditTables const *vertexEditTabes);
/// Destructor
virtual ~OsdGLSLTransformFeedbackComputeContext();
@ -171,7 +174,8 @@ public:
void UnbindEditTextures();
protected:
explicit OsdGLSLTransformFeedbackComputeContext(FarMesh<OsdVertex> const *farMesh);
explicit OsdGLSLTransformFeedbackComputeContext(FarSubdivisionTables const *subdivisionTables,
FarVertexEditTables const *vertexEditTabes);
void bindTexture(GLint samplerUniform, GLuint texture, int unit);

View File

@ -126,7 +126,8 @@ OsdUtilAdaptiveEvaluator::Initialize(
}
_computeContext = OsdCpuComputeContext::Create(fmesh);
_computeContext = OsdCpuComputeContext::Create(fmesh->GetSubdivisionTables(),
fmesh->GetVertexEditTables());
// Three elements (x/y/z) per refined point at every subdivision level
// defined by the farMesh. The coarse vertices seed the beginning of
@ -156,14 +157,15 @@ OsdUtilAdaptiveEvaluator::Initialize(
*/
// A context object used to store data used in refinement
_computeContext = OsdCpuComputeContext::Create(fmesh);
_computeContext = OsdCpuComputeContext::Create(fmesh->GetSubdivisionTables(),
fmesh->GetVertexEditTables());
// A context object used to store data used in fast limit surface
// evaluation. This contains vectors of patches and associated
// tables pulled and computed from the adaptive farMesh.
// It also holds onto vertex buffer data through binds
_evalLimitContext = OsdCpuEvalLimitContext::Create(
fmesh, /*requierFVarData*/ false);
fmesh->GetPatchTables(), /*requierFVarData*/ false);
// A buffer with one float per target point to use when
// evaluating interpolated weights

View File

@ -359,7 +359,7 @@ OsdUtilMeshBatch<VERTEX_BUFFER, DRAW_CONTEXT, COMPUTE_CONTROLLER>::initialize(Co
Base::setKernelBatches(farMultiMesh->GetKernelBatches());
// create compute contexts
_computeContext = ComputeContext::Create(farMultiMesh);
_computeContext = ComputeContext::Create(farMultiMesh->GetSubdivisionTables(), farMultiMesh->GetVertexEditTables());
if (not _computeContext) return false;

View File

@ -156,7 +156,7 @@ OsdUtilMeshBatch<VERTEX_BUFFER, DRAW_CONTEXT, OsdCLComputeController>::initializ
Base::setKernelBatches(farMultiMesh->GetKernelBatches());
// create compute contexts
_computeContext = ComputeContext::Create(farMultiMesh, _computeController->GetContext());
_computeContext = ComputeContext::Create(farMultiMesh->GetSubdivisionTables(), farMultiMesh->GetVertexEditTables(), _computeController->GetContext());
if (not _computeContext) return false;

View File

@ -136,7 +136,7 @@ OsdUtilUniformEvaluator::Initialize(
return true;
}
_computeContext = OsdCpuComputeContext::Create(fmesh);
_computeContext = OsdCpuComputeContext::Create(fmesh->GetSubdivisionTables(), fmesh->GetVertexEditTables());
// Three elements per refined point
_vertexBuffer = OsdCpuVertexBuffer::Create(

View File

@ -315,7 +315,7 @@ checkMeshCPU( OpenSubdiv::FarMesh<OpenSubdiv::OsdVertex>* farmesh,
static OpenSubdiv::OsdCpuComputeController *controller = new OpenSubdiv::OsdCpuComputeController();
OpenSubdiv::OsdCpuComputeContext *context = OpenSubdiv::OsdCpuComputeContext::Create(farmesh);
OpenSubdiv::OsdCpuComputeContext *context = OpenSubdiv::OsdCpuComputeContext::Create(farmesh->GetSubdivisionTables(), farmesh->GetVertexEditTables());
OpenSubdiv::OsdCpuVertexBuffer * vb = OpenSubdiv::OsdCpuVertexBuffer::Create(3, farmesh->GetNumVertices());
@ -335,7 +335,7 @@ checkMeshCPUGL( OpenSubdiv::FarMesh<OpenSubdiv::OsdVertex>* farmesh,
static OpenSubdiv::OsdCpuComputeController *controller = new OpenSubdiv::OsdCpuComputeController();
OpenSubdiv::OsdCpuComputeContext *context = OpenSubdiv::OsdCpuComputeContext::Create(farmesh);
OpenSubdiv::OsdCpuComputeContext *context = OpenSubdiv::OsdCpuComputeContext::Create(farmesh->GetSubdivisionTables(), farmesh->GetVertexEditTables());
OpenSubdiv::OsdCpuGLVertexBuffer * vb = OpenSubdiv::OsdCpuGLVertexBuffer::Create(3, farmesh->GetNumVertices());
@ -357,7 +357,7 @@ checkMeshCL( OpenSubdiv::FarMesh<OpenSubdiv::OsdVertex>* farmesh,
static OpenSubdiv::OsdCLComputeController *controller = new OpenSubdiv::OsdCLComputeController(g_clContext, g_clQueue);
OpenSubdiv::OsdCLComputeContext *context = OpenSubdiv::OsdCLComputeContext::Create(farmesh, g_clContext);
OpenSubdiv::OsdCLComputeContext *context = OpenSubdiv::OsdCLComputeContext::Create(farmesh->GetSubdivisionTables(), farmesh->GetVertexEditTables(), g_clContext);
OpenSubdiv::OsdCLGLVertexBuffer * vb = OpenSubdiv::OsdCLGLVertexBuffer::Create(3, farmesh->GetNumVertices(), g_clContext);