mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-12-24 00:40:33 +00:00
Refactor Far API.
* replace void* of all kernel applications with CONTEXT template parameter. It eliminates many static_casts from void* for both far and osd classes. * move the big switch-cases of far default kernel launches out of Refine so that osd controllers can arbitrary mix default kernels and custom kernels. * change FarKernelBatch::kernelType from enum to int, clients can add custom kernel types. * remove a back-pointer to farmesh from subdivision table. * untemplate all subdivision table classes and template their compute methods instead. Those methods take a typed vertex storage. * remove an unused argument FarMesh from the constructor of subdivision table factories.
This commit is contained in:
parent
1d8cb62255
commit
44a7cb6a45
@ -82,7 +82,7 @@ typedef HbrHalfedge<OsdVertex> OsdHbrHalfedge;
|
||||
|
||||
typedef FarMesh<OsdVertex> OsdFarMesh;
|
||||
typedef FarMeshFactory<OsdVertex> OsdFarMeshFactory;
|
||||
typedef FarSubdivisionTables<OsdVertex> OsdFarMeshSubdivision;
|
||||
typedef FarSubdivisionTables OsdFarMeshSubdivision;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
struct SimpleShape {
|
||||
|
@ -523,7 +523,7 @@ MStatus convertOsdFarToMayaMeshData(
|
||||
int numPolygons = farPatchTables->GetNumFaces(); // use the highest level stored in the patch tables
|
||||
const unsigned int *polygonConnects_orig = farPatchTables->GetFaceVertices(); // use the highest level stored in the patch tables
|
||||
|
||||
const OpenSubdiv::FarSubdivisionTables<OpenSubdiv::OsdVertex> *farSubdivTables = farMesh->GetSubdivisionTables();
|
||||
const OpenSubdiv::FarSubdivisionTables *farSubdivTables = farMesh->GetSubdivisionTables();
|
||||
unsigned int numVertices = farSubdivTables->GetNumVertices(subdivisionLevel);
|
||||
unsigned int vertexOffset = farSubdivTables->GetFirstVertexOffset(subdivisionLevel);
|
||||
|
||||
|
@ -42,7 +42,7 @@ namespace OPENSUBDIV_VERSION {
|
||||
/// structure. The advantage of this representation is its ability to be executed
|
||||
/// in a massively parallel environment without data dependencies.
|
||||
///
|
||||
template <class U> class FarBilinearSubdivisionTables : public FarSubdivisionTables<U> {
|
||||
class FarBilinearSubdivisionTables : public FarSubdivisionTables {
|
||||
|
||||
public:
|
||||
|
||||
@ -51,56 +51,57 @@ public:
|
||||
virtual int GetNumTables() const { return 7; }
|
||||
|
||||
/// \brief Returns the subdivision scheme of the tables
|
||||
virtual typename FarSubdivisionTables<U>::Scheme GetScheme() const {
|
||||
return FarSubdivisionTables<U>::BILINEAR;
|
||||
virtual FarSubdivisionTables::Scheme GetScheme() const {
|
||||
return FarSubdivisionTables::BILINEAR;
|
||||
}
|
||||
|
||||
private:
|
||||
template <class X, class Y> friend class FarBilinearSubdivisionTablesFactory;
|
||||
template <class X, class Y> friend class FarMultiMeshFactory;
|
||||
template <class CONTROLLER> friend class FarComputeController;
|
||||
friend class FarComputeController;
|
||||
|
||||
FarBilinearSubdivisionTables( FarMesh<U> * mesh, int maxlevel );
|
||||
FarBilinearSubdivisionTables( int maxlevel );
|
||||
|
||||
// Compute-kernel applied to vertices resulting from the refinement of a face.
|
||||
void computeFacePoints(int vertexOffset, int tableOffset, int start, int end, void * clientdata) const;
|
||||
template <class U>
|
||||
void computeFacePoints(int vertexOffset, int tableOffset, int start, int end, U *vsrc) const;
|
||||
|
||||
// Compute-kernel applied to vertices resulting from the refinement of an edge.
|
||||
void computeEdgePoints(int vertexOffset, int tableOffset, int start, int end, void * clientdata) const;
|
||||
template <class U>
|
||||
void computeEdgePoints(int vertexOffset, int tableOffset, int start, int end, U *vsrc) const;
|
||||
|
||||
// Compute-kernel applied to vertices resulting from the refinement of a vertex
|
||||
void computeVertexPoints(int vertexOffset, int tableOffset, int start, int end, void * clientdata) const;
|
||||
template <class U>
|
||||
void computeVertexPoints(int vertexOffset, int tableOffset, int start, int end, U *vsrc) const;
|
||||
|
||||
};
|
||||
|
||||
template <class U>
|
||||
FarBilinearSubdivisionTables<U>::FarBilinearSubdivisionTables( FarMesh<U> * mesh, int maxlevel ) :
|
||||
FarSubdivisionTables<U>(mesh, maxlevel)
|
||||
{ }
|
||||
inline
|
||||
FarBilinearSubdivisionTables::FarBilinearSubdivisionTables( int maxlevel) :
|
||||
FarSubdivisionTables(maxlevel) {
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Face-vertices compute Kernel - completely re-entrant
|
||||
//
|
||||
|
||||
template <class U> void
|
||||
FarBilinearSubdivisionTables<U>::computeFacePoints( int offset, int tableOffset, int start, int end, void * clientdata ) const {
|
||||
FarBilinearSubdivisionTables::computeFacePoints( int offset, int tableOffset, int start, int end, U *vsrc ) const {
|
||||
|
||||
assert(this->_mesh);
|
||||
|
||||
U * vsrc = &this->_mesh->GetVertices().at(0),
|
||||
* vdst = vsrc + offset + start;
|
||||
U * vdst = vsrc + offset + start;
|
||||
|
||||
for (int i=start+tableOffset; i<end+tableOffset; ++i, ++vdst ) {
|
||||
|
||||
vdst->Clear(clientdata);
|
||||
vdst->Clear();
|
||||
|
||||
int h = this->_F_ITa[2*i ],
|
||||
n = this->_F_ITa[2*i+1];
|
||||
float weight = 1.0f/n;
|
||||
|
||||
for (int j=0; j<n; ++j) {
|
||||
vdst->AddWithWeight( vsrc[ this->_F_IT[h+j] ], weight, clientdata );
|
||||
vdst->AddVaryingWithWeight( vsrc[ this->_F_IT[h+j] ], weight, clientdata );
|
||||
vdst->AddWithWeight( vsrc[ this->_F_IT[h+j] ], weight );
|
||||
vdst->AddVaryingWithWeight( vsrc[ this->_F_IT[h+j] ], weight );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -110,25 +111,22 @@ FarBilinearSubdivisionTables<U>::computeFacePoints( int offset, int tableOffset,
|
||||
//
|
||||
|
||||
template <class U> void
|
||||
FarBilinearSubdivisionTables<U>::computeEdgePoints( int offset, int tableOffset, int start, int end, void * clientdata ) const {
|
||||
FarBilinearSubdivisionTables::computeEdgePoints( int offset, int tableOffset, int start, int end, U *vsrc ) const {
|
||||
|
||||
assert(this->_mesh);
|
||||
|
||||
U * vsrc = &this->_mesh->GetVertices().at(0),
|
||||
* vdst = vsrc + offset + start;
|
||||
U * vdst = vsrc + offset + start;
|
||||
|
||||
for (int i=start+tableOffset; i<end+tableOffset; ++i, ++vdst ) {
|
||||
|
||||
vdst->Clear(clientdata);
|
||||
vdst->Clear();
|
||||
|
||||
int eidx0 = this->_E_IT[2*i+0],
|
||||
eidx1 = this->_E_IT[2*i+1];
|
||||
|
||||
vdst->AddWithWeight( vsrc[eidx0], 0.5f, clientdata );
|
||||
vdst->AddWithWeight( vsrc[eidx1], 0.5f, clientdata );
|
||||
vdst->AddWithWeight( vsrc[eidx0], 0.5f );
|
||||
vdst->AddWithWeight( vsrc[eidx1], 0.5f );
|
||||
|
||||
vdst->AddVaryingWithWeight( vsrc[eidx0], 0.5f, clientdata );
|
||||
vdst->AddVaryingWithWeight( vsrc[eidx1], 0.5f, clientdata );
|
||||
vdst->AddVaryingWithWeight( vsrc[eidx0], 0.5f );
|
||||
vdst->AddVaryingWithWeight( vsrc[eidx1], 0.5f );
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,21 +135,18 @@ FarBilinearSubdivisionTables<U>::computeEdgePoints( int offset, int tableOffset
|
||||
//
|
||||
|
||||
template <class U> void
|
||||
FarBilinearSubdivisionTables<U>::computeVertexPoints( int offset, int tableOffset, int start, int end, void * clientdata ) const {
|
||||
FarBilinearSubdivisionTables::computeVertexPoints( int offset, int tableOffset, int start, int end, U *vsrc ) const {
|
||||
|
||||
assert(this->_mesh);
|
||||
|
||||
U * vsrc = &this->_mesh->GetVertices().at(0),
|
||||
* vdst = vsrc + offset + start;
|
||||
U * vdst = vsrc + offset + start;
|
||||
|
||||
for (int i=start+tableOffset; i<end+tableOffset; ++i, ++vdst ) {
|
||||
|
||||
vdst->Clear(clientdata);
|
||||
vdst->Clear();
|
||||
|
||||
int p = this->_V_ITa[i]; // index of the parent vertex
|
||||
|
||||
vdst->AddWithWeight( vsrc[p], 1.0f, clientdata );
|
||||
vdst->AddVaryingWithWeight( vsrc[p], 1.0f, clientdata );
|
||||
vdst->AddWithWeight( vsrc[p], 1.0f );
|
||||
vdst->AddVaryingWithWeight( vsrc[p], 1.0f );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,21 +51,19 @@ protected:
|
||||
///
|
||||
/// @param meshFactory a valid FarMeshFactory instance
|
||||
///
|
||||
/// @param farMesh
|
||||
///
|
||||
/// @param batches a vector of Kernel refinement batches : the factory
|
||||
/// will reserve and append refinement tasks
|
||||
///
|
||||
static FarBilinearSubdivisionTables<U> * Create( FarMeshFactory<T,U> * meshFactory, FarMesh<U> * farMesh, FarKernelBatchVector *batches );
|
||||
static FarBilinearSubdivisionTables * Create( FarMeshFactory<T,U> * meshFactory, FarKernelBatchVector *batches );
|
||||
};
|
||||
|
||||
// This factory walks the Hbr vertices and accumulates the weights and adjacency
|
||||
// (valance) information specific to the bilinear subdivision scheme. The results
|
||||
// are stored in a FarBilinearSubdivisionTable<U>
|
||||
template <class T, class U> FarBilinearSubdivisionTables<U> *
|
||||
FarBilinearSubdivisionTablesFactory<T,U>::Create( FarMeshFactory<T,U> * meshFactory, FarMesh<U> * farMesh, FarKernelBatchVector * batches ) {
|
||||
template <class T, class U> FarBilinearSubdivisionTables *
|
||||
FarBilinearSubdivisionTablesFactory<T,U>::Create( FarMeshFactory<T,U> * meshFactory, FarKernelBatchVector * batches ) {
|
||||
|
||||
assert( meshFactory and farMesh );
|
||||
assert( meshFactory );
|
||||
|
||||
int maxlevel = meshFactory->GetMaxLevel();
|
||||
|
||||
@ -73,7 +71,7 @@ FarBilinearSubdivisionTablesFactory<T,U>::Create( FarMeshFactory<T,U> * meshFact
|
||||
|
||||
FarSubdivisionTablesFactory<T,U> tablesFactory( meshFactory->GetHbrMesh(), maxlevel, remap );
|
||||
|
||||
FarBilinearSubdivisionTables<U> * result = new FarBilinearSubdivisionTables<U>(farMesh, maxlevel);
|
||||
FarBilinearSubdivisionTables * result = new FarBilinearSubdivisionTables(maxlevel);
|
||||
|
||||
// Allocate memory for the indexing tables
|
||||
result->_F_ITa.resize(tablesFactory.GetNumFaceVerticesTotal(maxlevel)*2);
|
||||
|
@ -42,7 +42,7 @@ namespace OPENSUBDIV_VERSION {
|
||||
/// structure. The advantage of this representation is its ability to be executed
|
||||
/// in a massively parallel environment without data dependencies.
|
||||
///
|
||||
template <class U> class FarCatmarkSubdivisionTables : public FarSubdivisionTables<U> {
|
||||
class FarCatmarkSubdivisionTables : public FarSubdivisionTables {
|
||||
|
||||
public:
|
||||
|
||||
@ -51,62 +51,63 @@ public:
|
||||
virtual int GetNumTables() const { return 7; }
|
||||
|
||||
/// \brief Returns the subdivision scheme of the tables
|
||||
virtual typename FarSubdivisionTables<U>::Scheme GetScheme() const {
|
||||
return FarSubdivisionTables<U>::CATMARK;
|
||||
virtual FarSubdivisionTables::Scheme GetScheme() const {
|
||||
return FarSubdivisionTables::CATMARK;
|
||||
}
|
||||
|
||||
private:
|
||||
template <class X, class Y> friend class FarCatmarkSubdivisionTablesFactory;
|
||||
template <class X, class Y> friend class FarMultiMeshFactory;
|
||||
template <class CONTROLLER> friend class FarComputeController;
|
||||
friend class FarComputeController;
|
||||
|
||||
// Private constructor called by factory
|
||||
FarCatmarkSubdivisionTables( FarMesh<U> * mesh, int maxlevel );
|
||||
FarCatmarkSubdivisionTables( int maxlevel );
|
||||
|
||||
// Compute-kernel applied to vertices resulting from the refinement of a face.
|
||||
void computeFacePoints(int offset, int level, int start, int end, void * clientdata) const;
|
||||
template <class U>
|
||||
void computeFacePoints(int offset, int level, int start, int end, U * vsrc) const;
|
||||
|
||||
// Compute-kernel applied to vertices resulting from the refinement of an edge.
|
||||
void computeEdgePoints(int offset, int level, int start, int end, void * clientdata) const;
|
||||
template <class U>
|
||||
void computeEdgePoints(int offset, int level, int start, int end, U * vsrc) const;
|
||||
|
||||
// Compute-kernel applied to vertices resulting from the refinement of a vertex
|
||||
// Kernel "A" Handles the k_Smooth and k_Dart rules
|
||||
void computeVertexPointsA(int offset, bool pass, int level, int start, int end, void * clientdata) const;
|
||||
template <class U>
|
||||
void computeVertexPointsA(int offset, bool pass, int level, int start, int end, U * vsrc) const;
|
||||
|
||||
// Compute-kernel applied to vertices resulting from the refinement of a vertex
|
||||
// Kernel "B" Handles the k_Crease and k_Corner rules
|
||||
void computeVertexPointsB(int offset, int level, int start, int end, void * clientdata) const;
|
||||
template <class U>
|
||||
void computeVertexPointsB(int offset, int level, int start, int end, U * vsrc) const;
|
||||
|
||||
};
|
||||
|
||||
template <class U>
|
||||
FarCatmarkSubdivisionTables<U>::FarCatmarkSubdivisionTables( FarMesh<U> * mesh, int maxlevel ) :
|
||||
FarSubdivisionTables<U>(mesh, maxlevel)
|
||||
{ }
|
||||
inline
|
||||
FarCatmarkSubdivisionTables::FarCatmarkSubdivisionTables( int maxlevel ) :
|
||||
FarSubdivisionTables(maxlevel) {
|
||||
}
|
||||
|
||||
//
|
||||
// Face-vertices compute Kernel - completely re-entrant
|
||||
//
|
||||
|
||||
template <class U> void
|
||||
FarCatmarkSubdivisionTables<U>::computeFacePoints( int offset, int tableOffset, int start, int end, void * clientdata ) const {
|
||||
FarCatmarkSubdivisionTables::computeFacePoints( int offset, int tableOffset, int start, int end, U * vsrc ) const {
|
||||
|
||||
assert(this->_mesh);
|
||||
|
||||
U * vsrc = &this->_mesh->GetVertices().at(0),
|
||||
* vdst = vsrc + offset + start;
|
||||
U * vdst = vsrc + offset + start;
|
||||
|
||||
for (int i=start+tableOffset; i<end+tableOffset; ++i, ++vdst ) {
|
||||
|
||||
vdst->Clear(clientdata);
|
||||
vdst->Clear();
|
||||
|
||||
int h = this->_F_ITa[2*i ],
|
||||
n = this->_F_ITa[2*i+1];
|
||||
float weight = 1.0f/n;
|
||||
|
||||
for (int j=0; j<n; ++j) {
|
||||
vdst->AddWithWeight( vsrc[ this->_F_IT[h+j] ], weight, clientdata );
|
||||
vdst->AddVaryingWithWeight( vsrc[ this->_F_IT[h+j] ], weight, clientdata );
|
||||
vdst->AddWithWeight( vsrc[ this->_F_IT[h+j] ], weight );
|
||||
vdst->AddVaryingWithWeight( vsrc[ this->_F_IT[h+j] ], weight );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -116,16 +117,13 @@ FarCatmarkSubdivisionTables<U>::computeFacePoints( int offset, int tableOffset,
|
||||
//
|
||||
|
||||
template <class U> void
|
||||
FarCatmarkSubdivisionTables<U>::computeEdgePoints( int offset, int tableOffset, int start, int end, void * clientdata ) const {
|
||||
FarCatmarkSubdivisionTables::computeEdgePoints( int offset, int tableOffset, int start, int end, U * vsrc ) const {
|
||||
|
||||
assert(this->_mesh);
|
||||
|
||||
U * vsrc = &this->_mesh->GetVertices().at(0),
|
||||
* vdst = vsrc + offset + start;
|
||||
U * vdst = vsrc + offset + start;
|
||||
|
||||
for (int i=start+tableOffset; i<end+tableOffset; ++i, ++vdst ) {
|
||||
|
||||
vdst->Clear(clientdata);
|
||||
vdst->Clear();
|
||||
|
||||
int eidx0 = this->_E_IT[4*i+0],
|
||||
eidx1 = this->_E_IT[4*i+1],
|
||||
@ -135,19 +133,19 @@ FarCatmarkSubdivisionTables<U>::computeEdgePoints( int offset, int tableOffset,
|
||||
float vertWeight = this->_E_W[i*2+0];
|
||||
|
||||
// Fully sharp edge : vertWeight = 0.5f
|
||||
vdst->AddWithWeight( vsrc[eidx0], vertWeight, clientdata );
|
||||
vdst->AddWithWeight( vsrc[eidx1], vertWeight, clientdata );
|
||||
vdst->AddWithWeight( vsrc[eidx0], vertWeight );
|
||||
vdst->AddWithWeight( vsrc[eidx1], vertWeight );
|
||||
|
||||
if (eidx2!=-1) {
|
||||
// Apply fractional sharpness
|
||||
float faceWeight = this->_E_W[i*2+1];
|
||||
|
||||
vdst->AddWithWeight( vsrc[eidx2], faceWeight, clientdata );
|
||||
vdst->AddWithWeight( vsrc[eidx3], faceWeight, clientdata );
|
||||
vdst->AddWithWeight( vsrc[eidx2], faceWeight );
|
||||
vdst->AddWithWeight( vsrc[eidx3], faceWeight );
|
||||
}
|
||||
|
||||
vdst->AddVaryingWithWeight( vsrc[eidx0], 0.5f, clientdata );
|
||||
vdst->AddVaryingWithWeight( vsrc[eidx1], 0.5f, clientdata );
|
||||
vdst->AddVaryingWithWeight( vsrc[eidx0], 0.5f );
|
||||
vdst->AddVaryingWithWeight( vsrc[eidx1], 0.5f );
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,17 +155,14 @@ FarCatmarkSubdivisionTables<U>::computeEdgePoints( int offset, int tableOffset,
|
||||
|
||||
// multi-pass kernel handling k_Crease and k_Corner rules
|
||||
template <class U> void
|
||||
FarCatmarkSubdivisionTables<U>::computeVertexPointsA( int offset, bool pass, int tableOffset, int start, int end, void * clientdata ) const {
|
||||
FarCatmarkSubdivisionTables::computeVertexPointsA( int offset, bool pass, int tableOffset, int start, int end, U * vsrc ) const {
|
||||
|
||||
assert(this->_mesh);
|
||||
|
||||
U * vsrc = &this->_mesh->GetVertices().at(0),
|
||||
* vdst = vsrc + offset + start;
|
||||
U * vdst = vsrc + offset + start;
|
||||
|
||||
for (int i=start+tableOffset; i<end+tableOffset; ++i, ++vdst ) {
|
||||
|
||||
if (not pass)
|
||||
vdst->Clear(clientdata);
|
||||
vdst->Clear();
|
||||
|
||||
int n=this->_V_ITa[5*i+1], // number of vertices in the _VO_IT array (valence)
|
||||
p=this->_V_ITa[5*i+2], // index of the parent vertex
|
||||
@ -186,29 +181,26 @@ FarCatmarkSubdivisionTables<U>::computeVertexPointsA( int offset, bool pass, int
|
||||
// won't be null, so we use a -1 valence to detect that particular case
|
||||
if (eidx0==-1 or (pass==false and (n==-1)) ) {
|
||||
// k_Corner case
|
||||
vdst->AddWithWeight( vsrc[p], weight, clientdata );
|
||||
vdst->AddWithWeight( vsrc[p], weight );
|
||||
} else {
|
||||
// k_Crease case
|
||||
vdst->AddWithWeight( vsrc[p], weight * 0.75f, clientdata );
|
||||
vdst->AddWithWeight( vsrc[eidx0], weight * 0.125f, clientdata );
|
||||
vdst->AddWithWeight( vsrc[eidx1], weight * 0.125f, clientdata );
|
||||
vdst->AddWithWeight( vsrc[p], weight * 0.75f );
|
||||
vdst->AddWithWeight( vsrc[eidx0], weight * 0.125f );
|
||||
vdst->AddWithWeight( vsrc[eidx1], weight * 0.125f );
|
||||
}
|
||||
vdst->AddVaryingWithWeight( vsrc[p], 1.0f, clientdata );
|
||||
vdst->AddVaryingWithWeight( vsrc[p], 1.0f );
|
||||
}
|
||||
}
|
||||
|
||||
// multi-pass kernel handling k_Dart and k_Smooth rules
|
||||
template <class U> void
|
||||
FarCatmarkSubdivisionTables<U>::computeVertexPointsB( int offset, int tableOffset, int start, int end, void * clientdata ) const {
|
||||
FarCatmarkSubdivisionTables::computeVertexPointsB( int offset, int tableOffset, int start, int end, U * vsrc ) const {
|
||||
|
||||
assert(this->_mesh);
|
||||
|
||||
U * vsrc = &this->_mesh->GetVertices().at(0),
|
||||
* vdst = vsrc + offset + start;
|
||||
U * vdst = vsrc + offset + start;
|
||||
|
||||
for (int i=start+tableOffset; i<end+tableOffset; ++i, ++vdst ) {
|
||||
|
||||
vdst->Clear(clientdata);
|
||||
vdst->Clear();
|
||||
|
||||
int h = this->_V_ITa[5*i ], // offset of the vertices in the _V0_IT array
|
||||
n = this->_V_ITa[5*i+1], // number of vertices in the _VO_IT array (valence)
|
||||
@ -218,13 +210,13 @@ FarCatmarkSubdivisionTables<U>::computeVertexPointsB( int offset, int tableOffse
|
||||
wp = 1.0f/(n*n),
|
||||
wv = (n-2.0f)*n*wp;
|
||||
|
||||
vdst->AddWithWeight( vsrc[p], weight * wv, clientdata );
|
||||
vdst->AddWithWeight( vsrc[p], weight * wv );
|
||||
|
||||
for (int j=0; j<n; ++j) {
|
||||
vdst->AddWithWeight( vsrc[this->_V_IT[h+j*2 ]], weight * wp, clientdata );
|
||||
vdst->AddWithWeight( vsrc[this->_V_IT[h+j*2+1]], weight * wp, clientdata );
|
||||
vdst->AddWithWeight( vsrc[this->_V_IT[h+j*2 ]], weight * wp );
|
||||
vdst->AddWithWeight( vsrc[this->_V_IT[h+j*2+1]], weight * wp );
|
||||
}
|
||||
vdst->AddVaryingWithWeight( vsrc[p], 1.0f, clientdata );
|
||||
vdst->AddVaryingWithWeight( vsrc[p], 1.0f );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,21 +52,19 @@ protected:
|
||||
///
|
||||
/// @param meshFactory a valid FarMeshFactory instance
|
||||
///
|
||||
/// @param farMesh
|
||||
///
|
||||
/// @param batches a vector of Kernel refinement batches : the factory
|
||||
/// will reserve and append refinement tasks
|
||||
///
|
||||
static FarCatmarkSubdivisionTables<U> * Create( FarMeshFactory<T,U> * meshFactory, FarMesh<U> * farMesh, FarKernelBatchVector *batches );
|
||||
static FarCatmarkSubdivisionTables * Create( FarMeshFactory<T,U> * meshFactory, FarKernelBatchVector *batches );
|
||||
};
|
||||
|
||||
// This factory walks the Hbr vertices and accumulates the weights and adjacency
|
||||
// (valance) information specific to the catmark subdivision scheme. The results
|
||||
// are stored in a FarCatmarkSubdivisionTable<U>.
|
||||
template <class T, class U> FarCatmarkSubdivisionTables<U> *
|
||||
FarCatmarkSubdivisionTablesFactory<T,U>::Create( FarMeshFactory<T,U> * meshFactory, FarMesh<U> * farMesh, FarKernelBatchVector *batches ) {
|
||||
template <class T, class U> FarCatmarkSubdivisionTables *
|
||||
FarCatmarkSubdivisionTablesFactory<T,U>::Create( FarMeshFactory<T,U> * meshFactory, FarKernelBatchVector *batches ) {
|
||||
|
||||
assert( meshFactory and farMesh );
|
||||
assert( meshFactory );
|
||||
|
||||
int maxlevel = meshFactory->GetMaxLevel();
|
||||
|
||||
@ -74,7 +72,7 @@ FarCatmarkSubdivisionTablesFactory<T,U>::Create( FarMeshFactory<T,U> * meshFacto
|
||||
|
||||
FarSubdivisionTablesFactory<T,U> tablesFactory( meshFactory->GetHbrMesh(), maxlevel, remap );
|
||||
|
||||
FarCatmarkSubdivisionTables<U> * result = new FarCatmarkSubdivisionTables<U>(farMesh, maxlevel);
|
||||
FarCatmarkSubdivisionTables * result = new FarCatmarkSubdivisionTables(maxlevel);
|
||||
|
||||
// Allocate memory for the indexing tables
|
||||
result->_F_ITa.resize(tablesFactory.GetNumFaceVerticesTotal(maxlevel)*2);
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
#include "../far/mesh.h"
|
||||
#include "../far/bilinearSubdivisionTables.h"
|
||||
#include "../far/catmarkSubdivisionTables.h"
|
||||
#include "../far/loopSubdivisionTables.h"
|
||||
@ -54,72 +53,98 @@ namespace OPENSUBDIV_VERSION {
|
||||
///
|
||||
class FarDispatcher {
|
||||
public:
|
||||
/// \brief Launches the processing of a vector of kernel batches
|
||||
/// \brief Launches the processing of a kernel batch
|
||||
/// returns true if the batch is handled, otherwise returns false (i.e. user defined kernel)
|
||||
///
|
||||
/// @param controller refinement controller implementation
|
||||
///
|
||||
/// @param context refinement context implementation
|
||||
///
|
||||
/// @param batch a batch of kernel that need to be processed
|
||||
///
|
||||
template <class CONTROLLER, class CONTEXT>
|
||||
static bool ApplyKernel(CONTROLLER const *controller, CONTEXT *context, FarKernelBatch const &batch);
|
||||
|
||||
/// \brief Launches the processing of a vector of kernel batches
|
||||
/// this is a convenient API for controllers which don't have any user defined kernels.
|
||||
///
|
||||
/// @param controller refinement controller implementation
|
||||
///
|
||||
/// @param context refinement context implementation (vertex array and subdivision tables)
|
||||
/// passed to the controller.
|
||||
///
|
||||
/// @param batches batches of kernels that need to be processed
|
||||
///
|
||||
/// @param maxlevel process vertex batches up to this level
|
||||
///
|
||||
/// @param clientdata custom client data passed to the controller
|
||||
///
|
||||
template <class CONTROLLER>
|
||||
static void Refine(CONTROLLER const *controller, FarKernelBatchVector const & batches, int maxlevel, void * clientdata=0);
|
||||
template <class CONTROLLER, class CONTEXT>
|
||||
static void Refine(CONTROLLER const *controller, CONTEXT *context, FarKernelBatchVector const & batches, int maxlevel);
|
||||
|
||||
};
|
||||
|
||||
template <class CONTROLLER> void
|
||||
FarDispatcher::Refine(CONTROLLER const *controller, FarKernelBatchVector const & batches, int maxlevel, void * clientdata) {
|
||||
template <class CONTROLLER, class CONTEXT> bool
|
||||
FarDispatcher::ApplyKernel(CONTROLLER const *controller, CONTEXT *context, FarKernelBatch const &batch) {
|
||||
|
||||
switch(batch.GetKernelType()) {
|
||||
case FarKernelBatch::CATMARK_FACE_VERTEX:
|
||||
controller->ApplyCatmarkFaceVerticesKernel(batch, context);
|
||||
break;
|
||||
case FarKernelBatch::CATMARK_EDGE_VERTEX:
|
||||
controller->ApplyCatmarkEdgeVerticesKernel(batch, context);
|
||||
break;
|
||||
case FarKernelBatch::CATMARK_VERT_VERTEX_B:
|
||||
controller->ApplyCatmarkVertexVerticesKernelB(batch, context);
|
||||
break;
|
||||
case FarKernelBatch::CATMARK_VERT_VERTEX_A1:
|
||||
controller->ApplyCatmarkVertexVerticesKernelA1(batch, context);
|
||||
break;
|
||||
case FarKernelBatch::CATMARK_VERT_VERTEX_A2:
|
||||
controller->ApplyCatmarkVertexVerticesKernelA2(batch, context);
|
||||
break;
|
||||
|
||||
case FarKernelBatch::LOOP_EDGE_VERTEX:
|
||||
controller->ApplyLoopEdgeVerticesKernel(batch, context);
|
||||
break;
|
||||
case FarKernelBatch::LOOP_VERT_VERTEX_B:
|
||||
controller->ApplyLoopVertexVerticesKernelB(batch, context);
|
||||
break;
|
||||
case FarKernelBatch::LOOP_VERT_VERTEX_A1:
|
||||
controller->ApplyLoopVertexVerticesKernelA1(batch, context);
|
||||
break;
|
||||
case FarKernelBatch::LOOP_VERT_VERTEX_A2:
|
||||
controller->ApplyLoopVertexVerticesKernelA2(batch, context);
|
||||
break;
|
||||
|
||||
case FarKernelBatch::BILINEAR_FACE_VERTEX:
|
||||
controller->ApplyBilinearFaceVerticesKernel(batch, context);
|
||||
break;
|
||||
case FarKernelBatch::BILINEAR_EDGE_VERTEX:
|
||||
controller->ApplyBilinearEdgeVerticesKernel(batch, context);
|
||||
break;
|
||||
case FarKernelBatch::BILINEAR_VERT_VERTEX:
|
||||
controller->ApplyBilinearVertexVerticesKernel(batch, context);
|
||||
break;
|
||||
|
||||
case FarKernelBatch::HIERARCHICAL_EDIT:
|
||||
controller->ApplyVertexEdits(batch, context);
|
||||
break;
|
||||
|
||||
default: // user defined kernel type
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class CONTROLLER, class CONTEXT> void
|
||||
FarDispatcher::Refine(CONTROLLER const *controller, CONTEXT *context, FarKernelBatchVector const & batches, int maxlevel) {
|
||||
|
||||
for (int i = 0; i < (int)batches.size(); ++i) {
|
||||
const FarKernelBatch &batch = batches[i];
|
||||
|
||||
if (maxlevel >= 0 && batch.GetLevel() >= maxlevel) continue;
|
||||
|
||||
switch(batch.GetKernelType()) {
|
||||
case FarKernelBatch::CATMARK_FACE_VERTEX:
|
||||
controller->ApplyCatmarkFaceVerticesKernel(batch, clientdata);
|
||||
break;
|
||||
case FarKernelBatch::CATMARK_EDGE_VERTEX:
|
||||
controller->ApplyCatmarkEdgeVerticesKernel(batch, clientdata);
|
||||
break;
|
||||
case FarKernelBatch::CATMARK_VERT_VERTEX_B:
|
||||
controller->ApplyCatmarkVertexVerticesKernelB(batch, clientdata);
|
||||
break;
|
||||
case FarKernelBatch::CATMARK_VERT_VERTEX_A1:
|
||||
controller->ApplyCatmarkVertexVerticesKernelA1(batch, clientdata);
|
||||
break;
|
||||
case FarKernelBatch::CATMARK_VERT_VERTEX_A2:
|
||||
controller->ApplyCatmarkVertexVerticesKernelA2(batch, clientdata);
|
||||
break;
|
||||
|
||||
case FarKernelBatch::LOOP_EDGE_VERTEX:
|
||||
controller->ApplyLoopEdgeVerticesKernel(batch, clientdata);
|
||||
break;
|
||||
case FarKernelBatch::LOOP_VERT_VERTEX_B:
|
||||
controller->ApplyLoopVertexVerticesKernelB(batch, clientdata);
|
||||
break;
|
||||
case FarKernelBatch::LOOP_VERT_VERTEX_A1:
|
||||
controller->ApplyLoopVertexVerticesKernelA1(batch, clientdata);
|
||||
break;
|
||||
case FarKernelBatch::LOOP_VERT_VERTEX_A2:
|
||||
controller->ApplyLoopVertexVerticesKernelA2(batch, clientdata);
|
||||
break;
|
||||
|
||||
case FarKernelBatch::BILINEAR_FACE_VERTEX:
|
||||
controller->ApplyBilinearFaceVerticesKernel(batch, clientdata);
|
||||
break;
|
||||
case FarKernelBatch::BILINEAR_EDGE_VERTEX:
|
||||
controller->ApplyBilinearEdgeVerticesKernel(batch, clientdata);
|
||||
break;
|
||||
case FarKernelBatch::BILINEAR_VERT_VERTEX:
|
||||
controller->ApplyBilinearVertexVerticesKernel(batch, clientdata);
|
||||
break;
|
||||
|
||||
case FarKernelBatch::HIERARCHICAL_EDIT:
|
||||
controller->ApplyVertexEdits(batch, clientdata);
|
||||
break;
|
||||
}
|
||||
ApplyKernel(controller, context, batch);
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,92 +154,101 @@ FarDispatcher::Refine(CONTROLLER const *controller, FarKernelBatchVector const &
|
||||
///
|
||||
/// This is Far's default implementation of a kernal batch controller.
|
||||
///
|
||||
template <class U>
|
||||
class FarComputeController {
|
||||
|
||||
public:
|
||||
void Refine(FarMesh<U> * mesh, int maxlevel=-1) const;
|
||||
template <class CONTEXT>
|
||||
void Refine(CONTEXT * context, int maxlevel=-1) const;
|
||||
|
||||
void ApplyBilinearFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
template <class CONTEXT>
|
||||
void ApplyBilinearFaceVerticesKernel(FarKernelBatch const &batch, CONTEXT *context) const;
|
||||
|
||||
void ApplyBilinearEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
template <class CONTEXT>
|
||||
void ApplyBilinearEdgeVerticesKernel(FarKernelBatch const &batch, CONTEXT *context) const;
|
||||
|
||||
void ApplyBilinearVertexVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
template <class CONTEXT>
|
||||
void ApplyBilinearVertexVerticesKernel(FarKernelBatch const &batch, CONTEXT *context) const;
|
||||
|
||||
template <class CONTEXT>
|
||||
void ApplyCatmarkFaceVerticesKernel(FarKernelBatch const &batch, CONTEXT *context) const;
|
||||
|
||||
void ApplyCatmarkFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
template <class CONTEXT>
|
||||
void ApplyCatmarkEdgeVerticesKernel(FarKernelBatch const &batch, CONTEXT *context) const;
|
||||
|
||||
void ApplyCatmarkEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
template <class CONTEXT>
|
||||
void ApplyCatmarkVertexVerticesKernelB(FarKernelBatch const &batch, CONTEXT *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const;
|
||||
template <class CONTEXT>
|
||||
void ApplyCatmarkVertexVerticesKernelA1(FarKernelBatch const &batch, CONTEXT *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const;
|
||||
template <class CONTEXT>
|
||||
void ApplyCatmarkVertexVerticesKernelA2(FarKernelBatch const &batch, CONTEXT *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const;
|
||||
template <class CONTEXT>
|
||||
void ApplyLoopEdgeVerticesKernel(FarKernelBatch const &batch, CONTEXT *context) const;
|
||||
|
||||
void ApplyLoopEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
template <class CONTEXT>
|
||||
void ApplyLoopVertexVerticesKernelB(FarKernelBatch const &batch, CONTEXT *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const;
|
||||
template <class CONTEXT>
|
||||
void ApplyLoopVertexVerticesKernelA1(FarKernelBatch const &batch, CONTEXT *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const;
|
||||
template <class CONTEXT>
|
||||
void ApplyLoopVertexVerticesKernelA2(FarKernelBatch const &batch, CONTEXT *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const;
|
||||
template <class CONTEXT>
|
||||
void ApplyVertexEdits(FarKernelBatch const &batch, CONTEXT *context) const;
|
||||
|
||||
void ApplyVertexEdits(FarKernelBatch const &batch, void * clientdata) const;
|
||||
|
||||
static FarComputeController _DefaultController;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
template<class U> FarComputeController<U> FarComputeController<U>::_DefaultController;
|
||||
template <class CONTEXT> void
|
||||
FarComputeController::Refine(CONTEXT *context, int maxlevel) const {
|
||||
|
||||
template <class U> void
|
||||
FarComputeController<U>::Refine(FarMesh<U> *mesh, int maxlevel) const {
|
||||
FarDispatcher::Refine(this, context, context->GetKernelBatches(), maxlevel);
|
||||
|
||||
FarDispatcher::Refine(this, mesh->GetKernelBatches(), maxlevel, mesh);
|
||||
}
|
||||
|
||||
template <class U> void
|
||||
FarComputeController<U>::ApplyBilinearFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const {
|
||||
template <class CONTEXT> void
|
||||
FarComputeController::ApplyBilinearFaceVerticesKernel(FarKernelBatch const &batch, CONTEXT *context) const {
|
||||
|
||||
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
||||
typename CONTEXT::VertexType *vsrc = &context->GetVertices().at(0);
|
||||
|
||||
FarBilinearSubdivisionTables<U> const * subdivision =
|
||||
reinterpret_cast<FarBilinearSubdivisionTables<U> const *>(mesh->GetSubdivisionTables());
|
||||
FarBilinearSubdivisionTables const * subdivision =
|
||||
reinterpret_cast<FarBilinearSubdivisionTables const *>(context->GetSubdivisionTables());
|
||||
assert(subdivision);
|
||||
|
||||
subdivision->computeFacePoints( batch.GetVertexOffset(),
|
||||
batch.GetTableOffset(),
|
||||
batch.GetStart(),
|
||||
batch.GetEnd(),
|
||||
clientdata );
|
||||
vsrc );
|
||||
}
|
||||
|
||||
template <class U> void
|
||||
FarComputeController<U>::ApplyBilinearEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const {
|
||||
template <class CONTEXT> void
|
||||
FarComputeController::ApplyBilinearEdgeVerticesKernel(FarKernelBatch const &batch, CONTEXT *context) const {
|
||||
|
||||
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
||||
typename CONTEXT::VertexType *vsrc = &context->GetVertices().at(0);
|
||||
|
||||
FarBilinearSubdivisionTables<U> const * subdivision =
|
||||
reinterpret_cast<FarBilinearSubdivisionTables<U> const *>(mesh->GetSubdivisionTables());
|
||||
FarBilinearSubdivisionTables const * subdivision =
|
||||
reinterpret_cast<FarBilinearSubdivisionTables const *>(context->GetSubdivisionTables());
|
||||
assert(subdivision);
|
||||
|
||||
subdivision->computeEdgePoints( batch.GetVertexOffset(),
|
||||
batch.GetTableOffset(),
|
||||
batch.GetStart(),
|
||||
batch.GetEnd(),
|
||||
clientdata );
|
||||
vsrc );
|
||||
}
|
||||
|
||||
template <class U> void
|
||||
FarComputeController<U>::ApplyBilinearVertexVerticesKernel(FarKernelBatch const &batch, void * clientdata) const {
|
||||
template <class CONTEXT> void
|
||||
FarComputeController::ApplyBilinearVertexVerticesKernel(FarKernelBatch const &batch, CONTEXT *context) const {
|
||||
|
||||
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
||||
typename CONTEXT::VertexType *vsrc = &context->GetVertices().at(0);
|
||||
|
||||
FarBilinearSubdivisionTables<U> const * subdivision =
|
||||
reinterpret_cast<FarBilinearSubdivisionTables<U> const *>(mesh->GetSubdivisionTables());
|
||||
FarBilinearSubdivisionTables const * subdivision =
|
||||
reinterpret_cast<FarBilinearSubdivisionTables const *>(context->GetSubdivisionTables());
|
||||
|
||||
assert(subdivision);
|
||||
|
||||
@ -222,16 +256,16 @@ FarComputeController<U>::ApplyBilinearVertexVerticesKernel(FarKernelBatch const
|
||||
batch.GetTableOffset(),
|
||||
batch.GetStart(),
|
||||
batch.GetEnd(),
|
||||
clientdata );
|
||||
vsrc );
|
||||
}
|
||||
|
||||
template <class U> void
|
||||
FarComputeController<U>::ApplyCatmarkFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const {
|
||||
template <class CONTEXT> void
|
||||
FarComputeController::ApplyCatmarkFaceVerticesKernel(FarKernelBatch const &batch, CONTEXT *context) const {
|
||||
|
||||
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
||||
typename CONTEXT::VertexType *vsrc = &context->GetVertices().at(0);
|
||||
|
||||
FarCatmarkSubdivisionTables<U> const * subdivision =
|
||||
reinterpret_cast<FarCatmarkSubdivisionTables<U> const *>(mesh->GetSubdivisionTables());
|
||||
FarCatmarkSubdivisionTables const * subdivision =
|
||||
reinterpret_cast<FarCatmarkSubdivisionTables const *>(context->GetSubdivisionTables());
|
||||
|
||||
assert(subdivision);
|
||||
|
||||
@ -239,16 +273,16 @@ FarComputeController<U>::ApplyCatmarkFaceVerticesKernel(FarKernelBatch const &ba
|
||||
batch.GetTableOffset(),
|
||||
batch.GetStart(),
|
||||
batch.GetEnd(),
|
||||
clientdata );
|
||||
vsrc );
|
||||
}
|
||||
|
||||
template <class U> void
|
||||
FarComputeController<U>::ApplyCatmarkEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const {
|
||||
template <class CONTEXT> void
|
||||
FarComputeController::ApplyCatmarkEdgeVerticesKernel(FarKernelBatch const &batch, CONTEXT *context) const {
|
||||
|
||||
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
||||
typename CONTEXT::VertexType *vsrc = &context->GetVertices().at(0);
|
||||
|
||||
FarCatmarkSubdivisionTables<U> const * subdivision =
|
||||
reinterpret_cast<FarCatmarkSubdivisionTables<U> const *>(mesh->GetSubdivisionTables());
|
||||
FarCatmarkSubdivisionTables const * subdivision =
|
||||
reinterpret_cast<FarCatmarkSubdivisionTables const *>(context->GetSubdivisionTables());
|
||||
|
||||
assert(subdivision);
|
||||
|
||||
@ -256,16 +290,16 @@ FarComputeController<U>::ApplyCatmarkEdgeVerticesKernel(FarKernelBatch const &ba
|
||||
batch.GetTableOffset(),
|
||||
batch.GetStart(),
|
||||
batch.GetEnd(),
|
||||
clientdata );
|
||||
vsrc );
|
||||
}
|
||||
|
||||
template <class U> void
|
||||
FarComputeController<U>::ApplyCatmarkVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const {
|
||||
template <class CONTEXT> void
|
||||
FarComputeController::ApplyCatmarkVertexVerticesKernelB(FarKernelBatch const &batch, CONTEXT *context) const {
|
||||
|
||||
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
||||
typename CONTEXT::VertexType *vsrc = &context->GetVertices().at(0);
|
||||
|
||||
FarCatmarkSubdivisionTables<U> const * subdivision =
|
||||
reinterpret_cast<FarCatmarkSubdivisionTables<U> const *>(mesh->GetSubdivisionTables());
|
||||
FarCatmarkSubdivisionTables const * subdivision =
|
||||
reinterpret_cast<FarCatmarkSubdivisionTables const *>(context->GetSubdivisionTables());
|
||||
|
||||
assert(subdivision);
|
||||
|
||||
@ -273,16 +307,16 @@ FarComputeController<U>::ApplyCatmarkVertexVerticesKernelB(FarKernelBatch const
|
||||
batch.GetTableOffset(),
|
||||
batch.GetStart(),
|
||||
batch.GetEnd(),
|
||||
clientdata );
|
||||
vsrc );
|
||||
}
|
||||
|
||||
template <class U> void
|
||||
FarComputeController<U>::ApplyCatmarkVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const {
|
||||
template <class CONTEXT> void
|
||||
FarComputeController::ApplyCatmarkVertexVerticesKernelA1(FarKernelBatch const &batch, CONTEXT *context) const {
|
||||
|
||||
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
||||
typename CONTEXT::VertexType *vsrc = &context->GetVertices().at(0);
|
||||
|
||||
FarCatmarkSubdivisionTables<U> const * subdivision =
|
||||
reinterpret_cast<FarCatmarkSubdivisionTables<U> const *>(mesh->GetSubdivisionTables());
|
||||
FarCatmarkSubdivisionTables const * subdivision =
|
||||
reinterpret_cast<FarCatmarkSubdivisionTables const *>(context->GetSubdivisionTables());
|
||||
|
||||
assert(subdivision);
|
||||
|
||||
@ -291,16 +325,16 @@ FarComputeController<U>::ApplyCatmarkVertexVerticesKernelA1(FarKernelBatch const
|
||||
batch.GetTableOffset(),
|
||||
batch.GetStart(),
|
||||
batch.GetEnd(),
|
||||
clientdata );
|
||||
vsrc );
|
||||
}
|
||||
|
||||
template <class U> void
|
||||
FarComputeController<U>::ApplyCatmarkVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const {
|
||||
template <class CONTEXT> void
|
||||
FarComputeController::ApplyCatmarkVertexVerticesKernelA2(FarKernelBatch const &batch, CONTEXT *context) const {
|
||||
|
||||
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
||||
typename CONTEXT::VertexType *vsrc = &context->GetVertices().at(0);
|
||||
|
||||
FarCatmarkSubdivisionTables<U> const * subdivision =
|
||||
reinterpret_cast<FarCatmarkSubdivisionTables<U> const *>(mesh->GetSubdivisionTables());
|
||||
FarCatmarkSubdivisionTables const * subdivision =
|
||||
reinterpret_cast<FarCatmarkSubdivisionTables const *>(context->GetSubdivisionTables());
|
||||
|
||||
assert(subdivision);
|
||||
|
||||
@ -309,16 +343,16 @@ FarComputeController<U>::ApplyCatmarkVertexVerticesKernelA2(FarKernelBatch const
|
||||
batch.GetTableOffset(),
|
||||
batch.GetStart(),
|
||||
batch.GetEnd(),
|
||||
clientdata );
|
||||
vsrc );
|
||||
}
|
||||
|
||||
template <class U> void
|
||||
FarComputeController<U>::ApplyLoopEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const {
|
||||
template <class CONTEXT> void
|
||||
FarComputeController::ApplyLoopEdgeVerticesKernel(FarKernelBatch const &batch, CONTEXT *context) const {
|
||||
|
||||
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
||||
typename CONTEXT::VertexType *vsrc = &context->GetVertices().at(0);
|
||||
|
||||
FarLoopSubdivisionTables<U> const * subdivision =
|
||||
reinterpret_cast<FarLoopSubdivisionTables<U> const *>(mesh->GetSubdivisionTables());
|
||||
FarLoopSubdivisionTables const * subdivision =
|
||||
reinterpret_cast<FarLoopSubdivisionTables const *>(context->GetSubdivisionTables());
|
||||
|
||||
assert(subdivision);
|
||||
|
||||
@ -326,16 +360,16 @@ FarComputeController<U>::ApplyLoopEdgeVerticesKernel(FarKernelBatch const &batch
|
||||
batch.GetTableOffset(),
|
||||
batch.GetStart(),
|
||||
batch.GetEnd(),
|
||||
clientdata );
|
||||
vsrc );
|
||||
}
|
||||
|
||||
template <class U> void
|
||||
FarComputeController<U>::ApplyLoopVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const {
|
||||
template <class CONTEXT> void
|
||||
FarComputeController::ApplyLoopVertexVerticesKernelB(FarKernelBatch const &batch, CONTEXT *context) const {
|
||||
|
||||
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
||||
typename CONTEXT::VertexType *vsrc = &context->GetVertices().at(0);
|
||||
|
||||
FarLoopSubdivisionTables<U> const * subdivision =
|
||||
reinterpret_cast<FarLoopSubdivisionTables<U> const *>(mesh->GetSubdivisionTables());
|
||||
FarLoopSubdivisionTables const * subdivision =
|
||||
reinterpret_cast<FarLoopSubdivisionTables const *>(context->GetSubdivisionTables());
|
||||
|
||||
assert(subdivision);
|
||||
|
||||
@ -343,16 +377,16 @@ FarComputeController<U>::ApplyLoopVertexVerticesKernelB(FarKernelBatch const &ba
|
||||
batch.GetTableOffset(),
|
||||
batch.GetStart(),
|
||||
batch.GetEnd(),
|
||||
clientdata );
|
||||
vsrc );
|
||||
}
|
||||
|
||||
template <class U> void
|
||||
FarComputeController<U>::ApplyLoopVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const {
|
||||
template <class CONTEXT> void
|
||||
FarComputeController::ApplyLoopVertexVerticesKernelA1(FarKernelBatch const &batch, CONTEXT *context) const {
|
||||
|
||||
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
||||
typename CONTEXT::VertexType *vsrc = &context->GetVertices().at(0);
|
||||
|
||||
FarLoopSubdivisionTables<U> const * subdivision =
|
||||
reinterpret_cast<FarLoopSubdivisionTables<U> const *>(mesh->GetSubdivisionTables());
|
||||
FarLoopSubdivisionTables const * subdivision =
|
||||
reinterpret_cast<FarLoopSubdivisionTables const *>(context->GetSubdivisionTables());
|
||||
|
||||
assert(subdivision);
|
||||
|
||||
@ -361,16 +395,16 @@ FarComputeController<U>::ApplyLoopVertexVerticesKernelA1(FarKernelBatch const &b
|
||||
batch.GetTableOffset(),
|
||||
batch.GetStart(),
|
||||
batch.GetEnd(),
|
||||
clientdata );
|
||||
vsrc );
|
||||
}
|
||||
|
||||
template <class U> void
|
||||
FarComputeController<U>::ApplyLoopVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const {
|
||||
template <class CONTEXT> void
|
||||
FarComputeController::ApplyLoopVertexVerticesKernelA2(FarKernelBatch const &batch, CONTEXT *context) const {
|
||||
|
||||
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
||||
typename CONTEXT::VertexType *vsrc = &context->GetVertices().at(0);
|
||||
|
||||
FarLoopSubdivisionTables<U> const * subdivision =
|
||||
reinterpret_cast<FarLoopSubdivisionTables<U> const *>(mesh->GetSubdivisionTables());
|
||||
FarLoopSubdivisionTables const * subdivision =
|
||||
reinterpret_cast<FarLoopSubdivisionTables const *>(context->GetSubdivisionTables());
|
||||
|
||||
assert(subdivision);
|
||||
|
||||
@ -379,15 +413,15 @@ FarComputeController<U>::ApplyLoopVertexVerticesKernelA2(FarKernelBatch const &b
|
||||
batch.GetTableOffset(),
|
||||
batch.GetStart(),
|
||||
batch.GetEnd(),
|
||||
clientdata);
|
||||
vsrc );
|
||||
}
|
||||
|
||||
template <class U> void
|
||||
FarComputeController<U>::ApplyVertexEdits(FarKernelBatch const &batch, void * clientdata) const {
|
||||
template <class CONTEXT> void
|
||||
FarComputeController::ApplyVertexEdits(FarKernelBatch const &batch, CONTEXT *context) const {
|
||||
|
||||
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
||||
typename CONTEXT::VertexType *vsrc = &context->GetVertices().at(0);
|
||||
|
||||
FarVertexEditTables<U> const * vertEdit = mesh->GetVertexEdit();
|
||||
FarVertexEditTables const * vertEdit = context->GetVertexEdit();
|
||||
|
||||
if (vertEdit)
|
||||
vertEdit->computeVertexEdits( batch.GetTableIndex(),
|
||||
@ -395,7 +429,7 @@ FarComputeController<U>::ApplyVertexEdits(FarKernelBatch const &batch, void * cl
|
||||
batch.GetTableOffset(),
|
||||
batch.GetStart(),
|
||||
batch.GetEnd(),
|
||||
clientdata );
|
||||
vsrc );
|
||||
}
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
|
@ -65,7 +65,7 @@ class FarKernelBatch {
|
||||
public:
|
||||
|
||||
enum KernelType {
|
||||
CATMARK_FACE_VERTEX,
|
||||
CATMARK_FACE_VERTEX = 1,
|
||||
CATMARK_EDGE_VERTEX,
|
||||
CATMARK_VERT_VERTEX_A1,
|
||||
CATMARK_VERT_VERTEX_A2,
|
||||
@ -78,6 +78,7 @@ public:
|
||||
BILINEAR_EDGE_VERTEX,
|
||||
BILINEAR_VERT_VERTEX,
|
||||
HIERARCHICAL_EDIT,
|
||||
USER_DEFINED_KERNEL_START
|
||||
};
|
||||
|
||||
/// \brief Constructor.
|
||||
@ -98,7 +99,7 @@ public:
|
||||
///
|
||||
/// @param meshIndex XXXX
|
||||
///
|
||||
FarKernelBatch( KernelType kernelType,
|
||||
FarKernelBatch( int kernelType,
|
||||
int level,
|
||||
int tableIndex,
|
||||
int start,
|
||||
@ -117,7 +118,7 @@ public:
|
||||
}
|
||||
|
||||
/// \brief Returns the type of kernel to apply to the vertices in the batch.
|
||||
KernelType GetKernelType() const {
|
||||
int GetKernelType() const {
|
||||
return _kernelType;
|
||||
}
|
||||
|
||||
@ -192,7 +193,7 @@ private:
|
||||
friend class FarKernelBatchFactory;
|
||||
template <class X, class Y> friend class FarMultiMeshFactory;
|
||||
|
||||
KernelType _kernelType;
|
||||
int _kernelType;
|
||||
int _level;
|
||||
int _tableIndex;
|
||||
int _start;
|
||||
|
@ -43,54 +43,54 @@ namespace OPENSUBDIV_VERSION {
|
||||
/// structure. The advantage of this representation is its ability to be executed
|
||||
/// in a massively parallel environment without data dependencies.
|
||||
///
|
||||
template <class U> class FarLoopSubdivisionTables : public FarSubdivisionTables<U> {
|
||||
class FarLoopSubdivisionTables : public FarSubdivisionTables {
|
||||
|
||||
public:
|
||||
|
||||
/// \brief Returns the subdivision scheme of the tables
|
||||
virtual typename FarSubdivisionTables<U>::Scheme GetScheme() const {
|
||||
return FarSubdivisionTables<U>::LOOP;
|
||||
virtual FarSubdivisionTables::Scheme GetScheme() const {
|
||||
return FarSubdivisionTables::LOOP;
|
||||
}
|
||||
|
||||
private:
|
||||
template <class X, class Y> friend class FarLoopSubdivisionTablesFactory;
|
||||
template <class X, class Y> friend class FarMultiMeshFactory;
|
||||
template <class CONTROLLER> friend class FarComputeController;
|
||||
friend class FarComputeController;
|
||||
|
||||
FarLoopSubdivisionTables( FarMesh<U> * mesh, int maxlevel );
|
||||
FarLoopSubdivisionTables( int maxlevel );
|
||||
|
||||
// Compute-kernel applied to vertices resulting from the refinement of an edge.
|
||||
void computeEdgePoints(int offset, int level, int start, int end, void * clientdata) const;
|
||||
template <class U>
|
||||
void computeEdgePoints(int offset, int level, int start, int end, U *vsrc) const;
|
||||
|
||||
// Compute-kernel applied to vertices resulting from the refinement of a vertex
|
||||
// Kernel "A" Handles the k_Smooth and k_Dart rules
|
||||
void computeVertexPointsA(int offset, bool pass, int level, int start, int end, void * clientdata) const;
|
||||
template <class U>
|
||||
void computeVertexPointsA(int offset, bool pass, int level, int start, int end, U *vsrc) const;
|
||||
|
||||
// Compute-kernel applied to vertices resulting from the refinement of a vertex
|
||||
// Kernel "B" Handles the k_Crease and k_Corner rules
|
||||
void computeVertexPointsB(int offset,int level, int start, int end, void * clientdata) const;
|
||||
template <class U>
|
||||
void computeVertexPointsB(int offset,int level, int start, int end, U *vsrc) const;
|
||||
};
|
||||
|
||||
template <class U>
|
||||
FarLoopSubdivisionTables<U>::FarLoopSubdivisionTables( FarMesh<U> * mesh, int maxlevel ) :
|
||||
FarSubdivisionTables<U>(mesh, maxlevel)
|
||||
{ }
|
||||
inline
|
||||
FarLoopSubdivisionTables::FarLoopSubdivisionTables( int maxlevel ) :
|
||||
FarSubdivisionTables(maxlevel) {
|
||||
}
|
||||
|
||||
//
|
||||
// Edge-vertices compute Kernel - completely re-entrant
|
||||
//
|
||||
|
||||
template <class U> void
|
||||
FarLoopSubdivisionTables<U>::computeEdgePoints( int offset, int tableOffset, int start, int end, void * clientdata ) const {
|
||||
FarLoopSubdivisionTables::computeEdgePoints( int offset, int tableOffset, int start, int end, U * vsrc ) const {
|
||||
|
||||
assert(this->_mesh);
|
||||
|
||||
U * vsrc = &this->_mesh->GetVertices().at(0),
|
||||
* vdst = vsrc + offset + start;
|
||||
U * vdst = vsrc + offset + start;
|
||||
|
||||
for (int i=start+tableOffset; i<end+tableOffset; ++i, ++vdst ) {
|
||||
|
||||
vdst->Clear(clientdata);
|
||||
vdst->Clear();
|
||||
|
||||
int eidx0 = this->_E_IT[4*i+0],
|
||||
eidx1 = this->_E_IT[4*i+1],
|
||||
@ -100,19 +100,19 @@ FarLoopSubdivisionTables<U>::computeEdgePoints( int offset, int tableOffset, int
|
||||
float endPtWeight = this->_E_W[i*2+0];
|
||||
|
||||
// Fully sharp edge : endPtWeight = 0.5f
|
||||
vdst->AddWithWeight( vsrc[eidx0], endPtWeight, clientdata );
|
||||
vdst->AddWithWeight( vsrc[eidx1], endPtWeight, clientdata );
|
||||
vdst->AddWithWeight( vsrc[eidx0], endPtWeight );
|
||||
vdst->AddWithWeight( vsrc[eidx1], endPtWeight );
|
||||
|
||||
if (eidx2!=-1) {
|
||||
// Apply fractional sharpness
|
||||
float oppPtWeight = this->_E_W[i*2+1];
|
||||
|
||||
vdst->AddWithWeight( vsrc[eidx2], oppPtWeight, clientdata );
|
||||
vdst->AddWithWeight( vsrc[eidx3], oppPtWeight, clientdata );
|
||||
vdst->AddWithWeight( vsrc[eidx2], oppPtWeight );
|
||||
vdst->AddWithWeight( vsrc[eidx3], oppPtWeight );
|
||||
}
|
||||
|
||||
vdst->AddVaryingWithWeight( vsrc[eidx0], 0.5f, clientdata );
|
||||
vdst->AddVaryingWithWeight( vsrc[eidx1], 0.5f, clientdata );
|
||||
vdst->AddVaryingWithWeight( vsrc[eidx0], 0.5f );
|
||||
vdst->AddVaryingWithWeight( vsrc[eidx1], 0.5f );
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,17 +122,14 @@ FarLoopSubdivisionTables<U>::computeEdgePoints( int offset, int tableOffset, int
|
||||
|
||||
// multi-pass kernel handling k_Crease and k_Corner rules
|
||||
template <class U> void
|
||||
FarLoopSubdivisionTables<U>::computeVertexPointsA( int offset, bool pass, int tableOffset, int start, int end, void * clientdata ) const {
|
||||
FarLoopSubdivisionTables::computeVertexPointsA( int offset, bool pass, int tableOffset, int start, int end, U * vsrc ) const {
|
||||
|
||||
assert(this->_mesh);
|
||||
|
||||
U * vsrc = &this->_mesh->GetVertices().at(0),
|
||||
* vdst = vsrc + offset + start;
|
||||
U * vdst = vsrc + offset + start;
|
||||
|
||||
for (int i=start+tableOffset; i<end+tableOffset; ++i, ++vdst ) {
|
||||
|
||||
if (not pass)
|
||||
vdst->Clear(clientdata);
|
||||
vdst->Clear();
|
||||
|
||||
int n=this->_V_ITa[5*i+1], // number of vertices in the _VO_IT array (valence)
|
||||
p=this->_V_ITa[5*i+2], // index of the parent vertex
|
||||
@ -151,29 +148,26 @@ FarLoopSubdivisionTables<U>::computeVertexPointsA( int offset, bool pass, int ta
|
||||
// won't be null, so we use a -1 valence to detect that particular case
|
||||
if (eidx0==-1 or (pass==false and (n==-1)) ) {
|
||||
// k_Corner case
|
||||
vdst->AddWithWeight( vsrc[p], weight, clientdata );
|
||||
vdst->AddWithWeight( vsrc[p], weight );
|
||||
} else {
|
||||
// k_Crease case
|
||||
vdst->AddWithWeight( vsrc[p], weight * 0.75f, clientdata );
|
||||
vdst->AddWithWeight( vsrc[eidx0], weight * 0.125f, clientdata );
|
||||
vdst->AddWithWeight( vsrc[eidx1], weight * 0.125f, clientdata );
|
||||
vdst->AddWithWeight( vsrc[p], weight * 0.75f );
|
||||
vdst->AddWithWeight( vsrc[eidx0], weight * 0.125f );
|
||||
vdst->AddWithWeight( vsrc[eidx1], weight * 0.125f );
|
||||
}
|
||||
vdst->AddVaryingWithWeight( vsrc[p], 1.0f, clientdata );
|
||||
vdst->AddVaryingWithWeight( vsrc[p], 1.0f );
|
||||
}
|
||||
}
|
||||
|
||||
// multi-pass kernel handling k_Dart and k_Smooth rules
|
||||
template <class U> void
|
||||
FarLoopSubdivisionTables<U>::computeVertexPointsB( int offset, int tableOffset, int start, int end, void * clientdata ) const {
|
||||
FarLoopSubdivisionTables::computeVertexPointsB( int offset, int tableOffset, int start, int end, U *vsrc ) const {
|
||||
|
||||
assert(this->_mesh);
|
||||
|
||||
U * vsrc = &this->_mesh->GetVertices().at(0),
|
||||
* vdst = vsrc + offset + start;
|
||||
U * vdst = vsrc + offset + start;
|
||||
|
||||
for (int i=start+tableOffset; i<end+tableOffset; ++i, ++vdst ) {
|
||||
|
||||
vdst->Clear(clientdata);
|
||||
vdst->Clear();
|
||||
|
||||
int h = this->_V_ITa[5*i ], // offset of the vertices in the _V0_IT array
|
||||
n = this->_V_ITa[5*i+1], // number of vertices in the _VO_IT array (valence)
|
||||
@ -185,12 +179,12 @@ FarLoopSubdivisionTables<U>::computeVertexPointsB( int offset, int tableOffset,
|
||||
beta = beta*beta;
|
||||
beta = (0.625f-beta)*wp;
|
||||
|
||||
vdst->AddWithWeight( vsrc[p], weight * (1.0f-(beta*n)), clientdata);
|
||||
vdst->AddWithWeight( vsrc[p], weight * (1.0f-(beta*n)));
|
||||
|
||||
for (int j=0; j<n; ++j)
|
||||
vdst->AddWithWeight( vsrc[this->_V_IT[h+j]], weight * beta );
|
||||
|
||||
vdst->AddVaryingWithWeight( vsrc[p], 1.0f, clientdata );
|
||||
vdst->AddVaryingWithWeight( vsrc[p], 1.0f );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,21 +52,19 @@ protected:
|
||||
///
|
||||
/// @param meshFactory a valid FarMeshFactory instance
|
||||
///
|
||||
/// @param farMesh
|
||||
///
|
||||
/// @param batches a vector of Kernel refinement batches : the factory
|
||||
/// will reserve and append refinement tasks
|
||||
///
|
||||
static FarLoopSubdivisionTables<U> * Create( FarMeshFactory<T,U> * meshFactory, FarMesh<U> * farMesh, FarKernelBatchVector * batches );
|
||||
static FarLoopSubdivisionTables * Create( FarMeshFactory<T,U> * meshFactory, FarKernelBatchVector * batches );
|
||||
};
|
||||
|
||||
// This factory walks the Hbr vertices and accumulates the weights and adjacency
|
||||
// (valance) information specific to the loop subdivision scheme. The results
|
||||
// are stored in a FarLoopSubdivisionTable<U>.
|
||||
template <class T, class U> FarLoopSubdivisionTables<U> *
|
||||
FarLoopSubdivisionTablesFactory<T,U>::Create( FarMeshFactory<T,U> * meshFactory, FarMesh<U> * farMesh, FarKernelBatchVector * batches ) {
|
||||
// are stored in a FarLoopSubdivisionTable.
|
||||
template <class T, class U> FarLoopSubdivisionTables *
|
||||
FarLoopSubdivisionTablesFactory<T,U>::Create( FarMeshFactory<T,U> * meshFactory, FarKernelBatchVector * batches ) {
|
||||
|
||||
assert( meshFactory and farMesh );
|
||||
assert( meshFactory );
|
||||
|
||||
int maxlevel = meshFactory->GetMaxLevel();
|
||||
|
||||
@ -74,7 +72,7 @@ FarLoopSubdivisionTablesFactory<T,U>::Create( FarMeshFactory<T,U> * meshFactory,
|
||||
|
||||
FarSubdivisionTablesFactory<T,U> tablesFactory( meshFactory->GetHbrMesh(), maxlevel, remap );
|
||||
|
||||
FarLoopSubdivisionTables<U> * result = new FarLoopSubdivisionTables<U>(farMesh, maxlevel);
|
||||
FarLoopSubdivisionTables * result = new FarLoopSubdivisionTables(maxlevel);
|
||||
|
||||
// Allocate memory for the indexing tables
|
||||
result->_E_IT.resize(tablesFactory.GetNumEdgeVerticesTotal(maxlevel)*4);
|
||||
|
@ -48,11 +48,12 @@ namespace OPENSUBDIV_VERSION {
|
||||
///
|
||||
template <class U> class FarMesh {
|
||||
public:
|
||||
typedef U VertexType;
|
||||
|
||||
~FarMesh();
|
||||
|
||||
/// \brief Returns the subdivision method
|
||||
FarSubdivisionTables<U> const * GetSubdivisionTables() const { return _subdivisionTables; }
|
||||
FarSubdivisionTables const * GetSubdivisionTables() const { return _subdivisionTables; }
|
||||
|
||||
/// \brief Returns patch tables
|
||||
FarPatchTables const * GetPatchTables() const { return _patchTables; }
|
||||
@ -73,7 +74,7 @@ public:
|
||||
int GetTotalFVarWidth() const { return _totalFVarWidth; }
|
||||
|
||||
/// \brief Returns vertex edit tables
|
||||
FarVertexEditTables<U> const * GetVertexEdit() const { return _vertexEditTables; }
|
||||
FarVertexEditTables const * GetVertexEdit() const { return _vertexEditTables; }
|
||||
|
||||
/// \brief Returns the total number of vertices in the mesh across across all depths
|
||||
int GetNumPtexFaces() const { return _numPtexFaces; }
|
||||
@ -99,13 +100,13 @@ private:
|
||||
FarMesh<U> & operator = (FarMesh<U> const &);
|
||||
|
||||
// subdivision method used in this mesh
|
||||
FarSubdivisionTables<U> * _subdivisionTables;
|
||||
FarSubdivisionTables * _subdivisionTables;
|
||||
|
||||
// tables of vertex indices for feature adaptive patches
|
||||
FarPatchTables * _patchTables;
|
||||
|
||||
// hierarchical vertex edit tables
|
||||
FarVertexEditTables<U> * _vertexEditTables;
|
||||
FarVertexEditTables * _vertexEditTables;
|
||||
|
||||
// kernel execution batches
|
||||
FarKernelBatchVector _batches;
|
||||
|
@ -701,11 +701,11 @@ FarMeshFactory<T,U>::Create( bool requireFVarData ) {
|
||||
FarMesh<U> * result = new FarMesh<U>();
|
||||
|
||||
if ( isBilinear( GetHbrMesh() ) ) {
|
||||
result->_subdivisionTables = FarBilinearSubdivisionTablesFactory<T,U>::Create(this, result, &result->_batches);
|
||||
result->_subdivisionTables = FarBilinearSubdivisionTablesFactory<T,U>::Create(this, &result->_batches);
|
||||
} else if ( isCatmark( GetHbrMesh() ) ) {
|
||||
result->_subdivisionTables = FarCatmarkSubdivisionTablesFactory<T,U>::Create(this, result, &result->_batches);
|
||||
result->_subdivisionTables = FarCatmarkSubdivisionTablesFactory<T,U>::Create(this, &result->_batches);
|
||||
} else if ( isLoop(GetHbrMesh()) ) {
|
||||
result->_subdivisionTables = FarLoopSubdivisionTablesFactory<T,U>::Create(this, result, &result->_batches);
|
||||
result->_subdivisionTables = FarLoopSubdivisionTablesFactory<T,U>::Create(this, &result->_batches);
|
||||
} else
|
||||
assert(0);
|
||||
assert(result->_subdivisionTables);
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
private:
|
||||
|
||||
// splice subdivision tables
|
||||
FarSubdivisionTables<U> * spliceSubdivisionTables(FarMesh<U> *farmesh, FarMeshVector const &meshes);
|
||||
FarSubdivisionTables * spliceSubdivisionTables(FarMesh<U> *farmesh, FarMeshVector const &meshes);
|
||||
|
||||
// splice patch tables
|
||||
FarPatchTables * splicePatchTables(FarMeshVector const &meshes, bool hasFVarData);
|
||||
@ -82,7 +82,7 @@ private:
|
||||
std::vector<int> const &vertexOffsets);
|
||||
|
||||
// splice hierarchical edit tables
|
||||
FarVertexEditTables<U> * spliceVertexEditTables(FarMesh<U> *farmesh, FarMeshVector const &meshes);
|
||||
FarVertexEditTables * spliceVertexEditTables(FarMeshVector const &meshes);
|
||||
|
||||
int _maxlevel;
|
||||
int _maxvalence;
|
||||
@ -100,7 +100,7 @@ FarMultiMeshFactory<T, U>::Create(std::vector<FarMesh<U> const *> const &meshes)
|
||||
|
||||
int totalFVarWidth = meshes[0]->GetTotalFVarWidth();
|
||||
|
||||
typename FarSubdivisionTables<U>::Scheme scheme =
|
||||
typename FarSubdivisionTables::Scheme scheme =
|
||||
meshes[0]->GetSubdivisionTables()->GetScheme();
|
||||
|
||||
_maxlevel = 0;
|
||||
@ -137,7 +137,7 @@ FarMultiMeshFactory<T, U>::Create(std::vector<FarMesh<U> const *> const &meshes)
|
||||
result->_patchTables = splicePatchTables(meshes, totalFVarWidth > 0);
|
||||
|
||||
// splice vertex edit tables
|
||||
result->_vertexEditTables = spliceVertexEditTables(result, meshes);
|
||||
result->_vertexEditTables = spliceVertexEditTables(meshes);
|
||||
|
||||
// count total num vertices, numptex faces
|
||||
int numVertices = 0, numPtexFaces = 0;
|
||||
@ -221,7 +221,7 @@ copyWithOffsetVertexValence(IT dst_iterator, V const &src, int srcMaxValence, in
|
||||
return dst_iterator;
|
||||
}
|
||||
|
||||
template <class T, class U> FarSubdivisionTables<U> *
|
||||
template <class T, class U> FarSubdivisionTables *
|
||||
FarMultiMeshFactory<T, U>::spliceSubdivisionTables(FarMesh<U> *farMesh, FarMeshVector const &meshes) {
|
||||
|
||||
// count total table size
|
||||
@ -229,7 +229,7 @@ FarMultiMeshFactory<T, U>::spliceSubdivisionTables(FarMesh<U> *farMesh, FarMeshV
|
||||
size_t total_E_IT = 0, total_E_W = 0;
|
||||
size_t total_V_ITa = 0, total_V_IT = 0, total_V_W = 0;
|
||||
for (size_t i = 0; i < meshes.size(); ++i) {
|
||||
FarSubdivisionTables<U> const * tables = meshes[i]->GetSubdivisionTables();
|
||||
FarSubdivisionTables const * tables = meshes[i]->GetSubdivisionTables();
|
||||
assert(tables);
|
||||
|
||||
total_F_ITa += tables->Get_F_ITa().size();
|
||||
@ -241,21 +241,21 @@ FarMultiMeshFactory<T, U>::spliceSubdivisionTables(FarMesh<U> *farMesh, FarMeshV
|
||||
total_V_W += tables->Get_V_W().size();
|
||||
}
|
||||
|
||||
FarSubdivisionTables<U> *result = NULL;
|
||||
typename FarSubdivisionTables<U>::Scheme scheme =
|
||||
FarSubdivisionTables *result = NULL;
|
||||
typename FarSubdivisionTables::Scheme scheme =
|
||||
meshes[0]->GetSubdivisionTables()->GetScheme();
|
||||
|
||||
switch (scheme) {
|
||||
case FarSubdivisionTables<U>::CATMARK:
|
||||
result = new FarCatmarkSubdivisionTables<U>(farMesh, _maxlevel);
|
||||
case FarSubdivisionTables::CATMARK:
|
||||
result = new FarCatmarkSubdivisionTables(_maxlevel);
|
||||
_isLoop = false;
|
||||
break;
|
||||
case FarSubdivisionTables<U>::LOOP:
|
||||
result = new FarLoopSubdivisionTables<U>(farMesh, _maxlevel);
|
||||
case FarSubdivisionTables::LOOP:
|
||||
result = new FarLoopSubdivisionTables(_maxlevel);
|
||||
_isLoop = true;
|
||||
break;
|
||||
case FarSubdivisionTables<U>::BILINEAR:
|
||||
result = new FarBilinearSubdivisionTables<U>(farMesh, _maxlevel);
|
||||
case FarSubdivisionTables::BILINEAR:
|
||||
result = new FarBilinearSubdivisionTables(_maxlevel);
|
||||
_isLoop = false;
|
||||
break;
|
||||
default:
|
||||
@ -286,7 +286,7 @@ FarMultiMeshFactory<T, U>::spliceSubdivisionTables(FarMesh<U> *farMesh, FarMeshV
|
||||
int evOffset = 0;
|
||||
int vvOffset = 0;
|
||||
for (size_t i = 0; i < meshes.size(); ++i) {
|
||||
FarSubdivisionTables<U> const * tables = meshes[i]->GetSubdivisionTables();
|
||||
FarSubdivisionTables const * tables = meshes[i]->GetSubdivisionTables();
|
||||
assert(tables);
|
||||
|
||||
vertexOffsets.push_back(vertexOffset);
|
||||
@ -301,8 +301,8 @@ FarMultiMeshFactory<T, U>::spliceSubdivisionTables(FarMesh<U> *farMesh, FarMeshV
|
||||
fvOffset += (int)tables->Get_F_ITa().size()/2;
|
||||
V_IToffset += (int)tables->Get_V_IT().size();
|
||||
|
||||
if (scheme == FarSubdivisionTables<U>::CATMARK or
|
||||
scheme == FarSubdivisionTables<U>::LOOP) {
|
||||
if (scheme == FarSubdivisionTables::CATMARK or
|
||||
scheme == FarSubdivisionTables::LOOP) {
|
||||
|
||||
evOffset += (int)tables->Get_E_IT().size()/4;
|
||||
vvOffset += (int)tables->Get_V_ITa().size()/5;
|
||||
@ -319,7 +319,7 @@ FarMultiMeshFactory<T, U>::spliceSubdivisionTables(FarMesh<U> *farMesh, FarMeshV
|
||||
std::vector<unsigned int>::iterator V_IT = result->_V_IT.begin();
|
||||
|
||||
for (size_t i = 0; i < meshes.size(); ++i) {
|
||||
FarSubdivisionTables<U> const * tables = meshes[i]->GetSubdivisionTables();
|
||||
FarSubdivisionTables const * tables = meshes[i]->GetSubdivisionTables();
|
||||
|
||||
int vertexOffset = vertexOffsets[i];
|
||||
// remap F_IT, V_IT tables
|
||||
@ -335,7 +335,7 @@ FarMultiMeshFactory<T, U>::spliceSubdivisionTables(FarMesh<U> *farMesh, FarMeshV
|
||||
std::vector<int>::iterator V_ITa = result->_V_ITa.begin();
|
||||
|
||||
for (size_t i = 0; i < meshes.size(); ++i) {
|
||||
FarSubdivisionTables<U> const * tables = meshes[i]->GetSubdivisionTables();
|
||||
FarSubdivisionTables const * tables = meshes[i]->GetSubdivisionTables();
|
||||
|
||||
// copy face tables
|
||||
F_ITa = copyWithOffsetF_ITa(F_ITa, tables->Get_F_ITa(), F_IToffsets[i]);
|
||||
@ -345,8 +345,8 @@ FarMultiMeshFactory<T, U>::spliceSubdivisionTables(FarMesh<U> *farMesh, FarMeshV
|
||||
E_W = copyWithOffset(E_W, tables->Get_E_W(), 0);
|
||||
|
||||
// copy vert tables
|
||||
if (scheme == FarSubdivisionTables<U>::CATMARK or
|
||||
scheme == FarSubdivisionTables<U>::LOOP) {
|
||||
if (scheme == FarSubdivisionTables::CATMARK or
|
||||
scheme == FarSubdivisionTables::LOOP) {
|
||||
|
||||
V_ITa = copyWithOffsetV_ITa(V_ITa, tables->Get_V_ITa(), V_IToffsets[i], vertexOffsets[i]);
|
||||
} else {
|
||||
@ -398,7 +398,7 @@ FarMultiMeshFactory<T, U>::spliceSubdivisionTables(FarMesh<U> *farMesh, FarMeshV
|
||||
// count verts offsets
|
||||
result->_vertsOffsets.resize(_maxlevel+2);
|
||||
for (size_t i = 0; i < meshes.size(); ++i) {
|
||||
FarSubdivisionTables<U> const * tables = meshes[i]->GetSubdivisionTables();
|
||||
FarSubdivisionTables const * tables = meshes[i]->GetSubdivisionTables();
|
||||
for (size_t j = 0; j < tables->_vertsOffsets.size(); ++j) {
|
||||
result->_vertsOffsets[j] += tables->_vertsOffsets[j];
|
||||
}
|
||||
@ -616,14 +616,14 @@ FarMultiMeshFactory<T, U>::splicePatchTables(FarMeshVector const &meshes, bool h
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class T, class U> FarVertexEditTables<U> *
|
||||
FarMultiMeshFactory<T, U>::spliceVertexEditTables(FarMesh<U> *farMesh, FarMeshVector const &meshes) {
|
||||
template <class T, class U> FarVertexEditTables *
|
||||
FarMultiMeshFactory<T, U>::spliceVertexEditTables(FarMeshVector const &meshes) {
|
||||
|
||||
FarVertexEditTables<U> * result = new FarVertexEditTables<U>(farMesh);
|
||||
FarVertexEditTables * result = new FarVertexEditTables();
|
||||
|
||||
// at this moment, don't merge vertex edit tables (separate batch)
|
||||
for (size_t i = 0; i < meshes.size(); ++i) {
|
||||
const FarVertexEditTables<U> *vertexEditTables = meshes[i]->GetVertexEdit();
|
||||
const FarVertexEditTables *vertexEditTables = meshes[i]->GetVertexEdit();
|
||||
if (not vertexEditTables) continue;
|
||||
|
||||
// copy each edit batch XXX:inefficient copy
|
||||
|
@ -34,8 +34,6 @@
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
template <class U> class FarMesh;
|
||||
|
||||
/// \brief FarSubdivisionTables are a serialized topological data representation.
|
||||
///
|
||||
/// Subdivision tables store the indexing tables required in order to compute
|
||||
@ -62,7 +60,7 @@ template <class U> class FarMesh;
|
||||
/// For more details see : "Feature Adaptive GPU Rendering of Catmull-Clark
|
||||
/// Subdivision Surfaces" (p.3 - par. 3.2)
|
||||
///
|
||||
template <class U> class FarSubdivisionTables {
|
||||
class FarSubdivisionTables {
|
||||
|
||||
public:
|
||||
|
||||
@ -88,7 +86,7 @@ public:
|
||||
};
|
||||
|
||||
/// \brief Destructor
|
||||
virtual ~FarSubdivisionTables<U>() {}
|
||||
virtual ~FarSubdivisionTables() {}
|
||||
|
||||
/// \brief Return the highest level of subdivision possible with these tables
|
||||
int GetMaxLevel() const { return (int)(_vertsOffsets.size()-1); }
|
||||
@ -96,9 +94,6 @@ public:
|
||||
/// \brief Memory required to store the indexing tables
|
||||
int GetMemoryUsed() const;
|
||||
|
||||
/// \brief Pointer back to the mesh owning the table
|
||||
FarMesh<U> * GetMesh() { return _mesh; }
|
||||
|
||||
/// \brief The index of the first vertex that belongs to the level of subdivision
|
||||
/// represented by this set of FarCatmarkSubdivisionTables
|
||||
int GetFirstVertexOffset( int level ) const;
|
||||
@ -148,10 +143,7 @@ protected:
|
||||
template <class X, class Y> friend class FarMeshFactory;
|
||||
template <class X, class Y> friend class FarMultiMeshFactory;
|
||||
|
||||
FarSubdivisionTables<U>( FarMesh<U> * mesh, int maxlevel );
|
||||
|
||||
// mesh that owns this subdivisionTable
|
||||
FarMesh<U> * _mesh;
|
||||
FarSubdivisionTables( int maxlevel );
|
||||
|
||||
std::vector<int> _F_ITa; // vertices from face refinement
|
||||
std::vector<unsigned int> _F_IT; // indices of face vertices
|
||||
@ -166,22 +158,21 @@ protected:
|
||||
std::vector<int> _vertsOffsets; // offset to the first vertex of each level
|
||||
};
|
||||
|
||||
template <class U>
|
||||
FarSubdivisionTables<U>::FarSubdivisionTables( FarMesh<U> * mesh, int maxlevel ) :
|
||||
_mesh(mesh),
|
||||
inline
|
||||
FarSubdivisionTables::FarSubdivisionTables( int maxlevel ) :
|
||||
_vertsOffsets(maxlevel+2, 0)
|
||||
{
|
||||
assert( maxlevel > 0 );
|
||||
}
|
||||
|
||||
template <class U> int
|
||||
FarSubdivisionTables<U>::GetFirstVertexOffset( int level ) const {
|
||||
inline int
|
||||
FarSubdivisionTables::GetFirstVertexOffset( int level ) const {
|
||||
assert(level>=0 and level<(int)_vertsOffsets.size());
|
||||
return _vertsOffsets[level];
|
||||
}
|
||||
|
||||
template <class U> int
|
||||
FarSubdivisionTables<U>::GetNumVertices( ) const {
|
||||
inline int
|
||||
FarSubdivisionTables::GetNumVertices( ) const {
|
||||
if (_vertsOffsets.empty()) {
|
||||
return 0;
|
||||
} else {
|
||||
@ -191,20 +182,20 @@ FarSubdivisionTables<U>::GetNumVertices( ) const {
|
||||
}
|
||||
}
|
||||
|
||||
template <class U> int
|
||||
FarSubdivisionTables<U>::GetNumVertices( int level ) const {
|
||||
inline int
|
||||
FarSubdivisionTables::GetNumVertices( int level ) const {
|
||||
assert(level>=0 and level<((int)_vertsOffsets.size()-1));
|
||||
return _vertsOffsets[level+1] - _vertsOffsets[level];
|
||||
}
|
||||
|
||||
template <class U> int
|
||||
FarSubdivisionTables<U>::GetNumVerticesTotal( int level ) const {
|
||||
inline int
|
||||
FarSubdivisionTables::GetNumVerticesTotal( int level ) const {
|
||||
assert(level>=0 and level<((int)_vertsOffsets.size()-1));
|
||||
return _vertsOffsets[level+1];
|
||||
}
|
||||
|
||||
template <class U> int
|
||||
FarSubdivisionTables<U>::GetMemoryUsed() const {
|
||||
inline int
|
||||
FarSubdivisionTables::GetMemoryUsed() const {
|
||||
return (int)(_F_ITa.size() * sizeof(int) +
|
||||
_F_IT.size() * sizeof(unsigned int) +
|
||||
_E_IT.size() * sizeof(int) +
|
||||
|
@ -34,8 +34,6 @@
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
template <class U> class FarMesh;
|
||||
|
||||
/// \brief A serialized container for hierarchical edits.
|
||||
///
|
||||
/// Some of the hierarchical edits are resolved into the vertex weights computed
|
||||
@ -66,7 +64,7 @@ public:
|
||||
const float* GetEdit() const { return _edit; }
|
||||
|
||||
private:
|
||||
template <class U> friend class FarVertexEditTables;
|
||||
friend class FarVertexEditTables;
|
||||
|
||||
FarVertexEdit(Operation op, int index, int width) :
|
||||
_op(op), _edit(0), _index(index), _width(width)
|
||||
@ -80,10 +78,10 @@ private:
|
||||
_width;
|
||||
};
|
||||
|
||||
template <class U> class FarVertexEditTables {
|
||||
class FarVertexEditTables {
|
||||
public:
|
||||
/// \brief Constructor
|
||||
FarVertexEditTables( FarMesh<U> * mesh );
|
||||
FarVertexEditTables( ) { }
|
||||
|
||||
// Note : Subtract type edits are converted into Adds in order to save kernel calls.
|
||||
|
||||
@ -97,6 +95,7 @@ public:
|
||||
void Append(int level, int vertexID, const float *values, bool negate);
|
||||
|
||||
/// \brief Compute-kernel applied to vertices
|
||||
template <class U>
|
||||
void ApplyVertexEdits(U * vsrc, int offset, int tableOffset, int start, int end) const;
|
||||
|
||||
// Edit tables accessors
|
||||
@ -144,13 +143,11 @@ public:
|
||||
private:
|
||||
template <class X, class Y> friend class FarVertexEditTablesFactory;
|
||||
template <class X, class Y> friend class FarMultiMeshFactory;
|
||||
template <class CONTROLLER> friend class FarComputeController;
|
||||
friend class FarComputeController;
|
||||
|
||||
// Compute-kernel that applies the edits
|
||||
void computeVertexEdits(int tableIndex, int offset, int tableOffset, int start, int end, void *clientdata) const;
|
||||
|
||||
// mesh that owns this vertexEditTable
|
||||
FarMesh<U> * _mesh;
|
||||
template <class CONTEXT>
|
||||
void computeVertexEdits(int tableIndex, int offset, int tableOffset, int start, int end, CONTEXT *context) const;
|
||||
|
||||
#if defined(__GNUC__)
|
||||
// XXX(dyu): seems like there is a compiler bug in g++ that requires
|
||||
@ -160,16 +157,16 @@ public:
|
||||
std::vector<VertexEditBatch> _batches;
|
||||
};
|
||||
|
||||
template <class U>
|
||||
FarVertexEditTables<U>::VertexEditBatch::VertexEditBatch(int index, int width, FarVertexEdit::Operation op) :
|
||||
inline
|
||||
FarVertexEditTables::VertexEditBatch::VertexEditBatch(int index, int width, FarVertexEdit::Operation operation) :
|
||||
_primvarIndex(index),
|
||||
_primvarWidth(width),
|
||||
_op(op) {
|
||||
_op(operation) {
|
||||
}
|
||||
|
||||
template <class U>
|
||||
void
|
||||
FarVertexEditTables<U>::VertexEditBatch::ApplyVertexEdits(U * vsrc, int vertexOffset, int tableOffset, int start, int end) const
|
||||
FarVertexEditTables::VertexEditBatch::ApplyVertexEdits(U * vsrc, int vertexOffset, int tableOffset, int start, int end) const
|
||||
{
|
||||
int primvarWidth = GetPrimvarWidth();
|
||||
assert(tableOffset+end <= (int)_vertIndices.size());
|
||||
@ -185,17 +182,8 @@ FarVertexEditTables<U>::VertexEditBatch::ApplyVertexEdits(U * vsrc, int vertexOf
|
||||
}
|
||||
}
|
||||
|
||||
template <class U>
|
||||
FarVertexEditTables<U>::FarVertexEditTables( FarMesh<U> * mesh ) :
|
||||
_mesh(mesh) {
|
||||
}
|
||||
|
||||
template <class U> void
|
||||
FarVertexEditTables<U>::computeVertexEdits(int tableIndex, int offset, int tableOffset, int start, int end, void *clientdata) const {
|
||||
|
||||
assert(this->_mesh);
|
||||
|
||||
U * vsrc = &this->_mesh->GetVertices().at(0);
|
||||
FarVertexEditTables::computeVertexEdits(int tableIndex, int offset, int tableOffset, int start, int end, U * vsrc) const {
|
||||
|
||||
_batches[tableIndex].ApplyVertexEdits(vsrc, offset, tableOffset, start, end);
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ protected:
|
||||
static void insertHEditBatch(FarKernelBatchVector *batches, int batchIndex, int batchLevel, int batchCount, int tableOffset);
|
||||
|
||||
/// \brief Creates a FarVertexEditTables instance.
|
||||
static FarVertexEditTables<U> * Create( FarMeshFactory<T,U> const * factory, FarMesh<U> * mesh, FarKernelBatchVector *batches, int maxlevel );
|
||||
static FarVertexEditTables * Create( FarMeshFactory<T,U> const * factory, FarMesh<U> * mesh, FarKernelBatchVector *batches, int maxlevel );
|
||||
};
|
||||
|
||||
template <class T, class U> bool
|
||||
@ -76,12 +76,12 @@ FarVertexEditTablesFactory<T,U>::insertHEditBatch(FarKernelBatchVector *batches,
|
||||
batches->insert(it, FarKernelBatch( FarKernelBatch::HIERARCHICAL_EDIT, batchLevel+1, batchIndex, 0, batchCount, tableOffset, 0) );
|
||||
}
|
||||
|
||||
template <class T, class U> FarVertexEditTables<U> *
|
||||
template <class T, class U> FarVertexEditTables *
|
||||
FarVertexEditTablesFactory<T,U>::Create( FarMeshFactory<T,U> const * factory, FarMesh<U> * mesh, FarKernelBatchVector *batches, int maxlevel ) {
|
||||
|
||||
assert( factory and mesh );
|
||||
|
||||
FarVertexEditTables<U> * result = new FarVertexEditTables<U>(mesh);
|
||||
FarVertexEditTables* result = new FarVertexEditTables();
|
||||
|
||||
std::vector<HbrHierarchicalEdit<T>*> const & hEdits = factory->_hbrMesh->GetHierarchicalEdits();
|
||||
|
||||
@ -127,7 +127,7 @@ FarVertexEditTablesFactory<T,U>::Create( FarMeshFactory<T,U> const * factory, Fa
|
||||
if (batchIndex == -1) {
|
||||
// create new batch
|
||||
batchIndex = (int)result->_batches.size();
|
||||
result->_batches.push_back(typename FarVertexEditTables<U>::VertexEditBatch(vedit->GetIndex(), vedit->GetWidth(), op));
|
||||
result->_batches.push_back(typename FarVertexEditTables::VertexEditBatch(vedit->GetIndex(), vedit->GetWidth(), op));
|
||||
batchSizes.push_back(0);
|
||||
}
|
||||
batchSizes[batchIndex]++;
|
||||
@ -162,7 +162,7 @@ FarVertexEditTablesFactory<T,U>::Create( FarMeshFactory<T,U> const * factory, Fa
|
||||
int batchIndex = batchIndices[i];
|
||||
int & batchLevel = currentLevels[batchIndex];
|
||||
int & batchCount = currentCounts[batchIndex];
|
||||
typename FarVertexEditTables<U>::VertexEditBatch &batch = result->_batches[batchIndex];
|
||||
typename FarVertexEditTables::VertexEditBatch &batch = result->_batches[batchIndex];
|
||||
|
||||
// if a new batch is needed
|
||||
if (batchLevel != level-1) {
|
||||
|
@ -52,7 +52,7 @@ OsdCLTable::GetDevicePtr() const {
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
OsdCLHEditTable::OsdCLHEditTable(
|
||||
const FarVertexEditTables<OsdVertex>::VertexEditBatch &batch,
|
||||
const FarVertexEditTables::VertexEditBatch &batch,
|
||||
cl_context clContext)
|
||||
: _primvarIndicesTable(new OsdCLTable(batch.GetVertexIndices(), clContext)),
|
||||
_editValuesTable(new OsdCLTable(batch.GetValues(), clContext)) {
|
||||
@ -104,30 +104,29 @@ OsdCLComputeContext::OsdCLComputeContext(FarMesh<OsdVertex> const *farMesh,
|
||||
cl_context clContext)
|
||||
: _clQueue(NULL), _kernelBundle(NULL) {
|
||||
|
||||
FarSubdivisionTables<OsdVertex> const * farTables =
|
||||
farMesh->GetSubdivisionTables();
|
||||
FarSubdivisionTables const * farTables = farMesh->GetSubdivisionTables();
|
||||
|
||||
// allocate 5 or 7 tables
|
||||
_tables.resize(farTables->GetNumTables(), 0);
|
||||
|
||||
_tables[FarSubdivisionTables<OsdVertex>::E_IT] = new OsdCLTable(farTables->Get_E_IT(), clContext);
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_IT] = new OsdCLTable(farTables->Get_V_IT(), clContext);
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_ITa] = new OsdCLTable(farTables->Get_V_ITa(), clContext);
|
||||
_tables[FarSubdivisionTables<OsdVertex>::E_W] = new OsdCLTable(farTables->Get_E_W(), clContext);
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_W] = new OsdCLTable(farTables->Get_V_W(), clContext);
|
||||
_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);
|
||||
|
||||
if (farTables->GetNumTables() > 5) {
|
||||
_tables[FarSubdivisionTables<OsdVertex>::F_IT] = new OsdCLTable(farTables->Get_F_IT(), clContext);
|
||||
_tables[FarSubdivisionTables<OsdVertex>::F_ITa] = new OsdCLTable(farTables->Get_F_ITa(), clContext);
|
||||
_tables[FarSubdivisionTables::F_IT] = new OsdCLTable(farTables->Get_F_IT(), clContext);
|
||||
_tables[FarSubdivisionTables::F_ITa] = new OsdCLTable(farTables->Get_F_ITa(), clContext);
|
||||
}
|
||||
|
||||
// create hedit tables
|
||||
FarVertexEditTables<OsdVertex> const *editTables = farMesh->GetVertexEdit();
|
||||
FarVertexEditTables const *editTables = farMesh->GetVertexEdit();
|
||||
if (editTables) {
|
||||
int numEditBatches = editTables->GetNumBatches();
|
||||
_editTables.reserve(numEditBatches);
|
||||
for (int i = 0; i < numEditBatches; ++i) {
|
||||
const FarVertexEditTables<OsdVertex>::VertexEditBatch & edit =
|
||||
const FarVertexEditTables::VertexEditBatch & edit =
|
||||
editTables->GetBatch(i);
|
||||
_editTables.push_back(new OsdCLHEditTable(edit, clContext));
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
#include "../far/mesh.h"
|
||||
#include "../far/vertexEditTables.h"
|
||||
#include "../osd/vertex.h"
|
||||
#include "../osd/nonCopyable.h"
|
||||
@ -64,7 +65,7 @@ private:
|
||||
|
||||
class OsdCLHEditTable : OsdNonCopyable<OsdCLHEditTable> {
|
||||
public:
|
||||
OsdCLHEditTable(const FarVertexEditTables<OsdVertex>::
|
||||
OsdCLHEditTable(const FarVertexEditTables::
|
||||
VertexEditBatch &batch, cl_context clContext);
|
||||
|
||||
virtual ~OsdCLHEditTable();
|
||||
|
@ -92,17 +92,15 @@ OsdCLComputeController::getKernelBundle(int numVertexElements,
|
||||
|
||||
void
|
||||
OsdCLComputeController::ApplyBilinearFaceVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCLComputeContext *context) const {
|
||||
|
||||
ApplyCatmarkFaceVerticesKernel(batch, clientdata);
|
||||
ApplyCatmarkFaceVerticesKernel(batch, context);
|
||||
}
|
||||
|
||||
void
|
||||
OsdCLComputeController::ApplyBilinearEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCLComputeContext *context) const {
|
||||
|
||||
OsdCLComputeContext * context =
|
||||
static_cast<OsdCLComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
cl_int ciErrNum;
|
||||
@ -111,7 +109,7 @@ OsdCLComputeController::ApplyBilinearEdgeVerticesKernel(
|
||||
|
||||
cl_mem vertexBuffer = context->GetCurrentVertexBuffer();
|
||||
cl_mem varyingBuffer = context->GetCurrentVaryingBuffer();
|
||||
cl_mem E_IT = context->GetTable(FarSubdivisionTables<OsdVertex>::E_IT)->GetDevicePtr();
|
||||
cl_mem E_IT = context->GetTable(FarSubdivisionTables::E_IT)->GetDevicePtr();
|
||||
|
||||
clSetKernelArg(kernel, 0, sizeof(cl_mem), &vertexBuffer);
|
||||
clSetKernelArg(kernel, 1, sizeof(cl_mem), &varyingBuffer);
|
||||
@ -128,10 +126,8 @@ OsdCLComputeController::ApplyBilinearEdgeVerticesKernel(
|
||||
|
||||
void
|
||||
OsdCLComputeController::ApplyBilinearVertexVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCLComputeContext *context) const {
|
||||
|
||||
OsdCLComputeContext * context =
|
||||
static_cast<OsdCLComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
cl_int ciErrNum;
|
||||
@ -140,7 +136,7 @@ OsdCLComputeController::ApplyBilinearVertexVerticesKernel(
|
||||
|
||||
cl_mem vertexBuffer = context->GetCurrentVertexBuffer();
|
||||
cl_mem varyingBuffer = context->GetCurrentVaryingBuffer();
|
||||
cl_mem V_ITa = context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetDevicePtr();
|
||||
cl_mem V_ITa = context->GetTable(FarSubdivisionTables::V_ITa)->GetDevicePtr();
|
||||
|
||||
clSetKernelArg(kernel, 0, sizeof(cl_mem), &vertexBuffer);
|
||||
clSetKernelArg(kernel, 1, sizeof(cl_mem), &varyingBuffer);
|
||||
@ -157,10 +153,8 @@ OsdCLComputeController::ApplyBilinearVertexVerticesKernel(
|
||||
|
||||
void
|
||||
OsdCLComputeController::ApplyCatmarkFaceVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCLComputeContext *context) const {
|
||||
|
||||
OsdCLComputeContext * context =
|
||||
static_cast<OsdCLComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
cl_int ciErrNum;
|
||||
@ -169,8 +163,8 @@ OsdCLComputeController::ApplyCatmarkFaceVerticesKernel(
|
||||
|
||||
cl_mem vertexBuffer = context->GetCurrentVertexBuffer();
|
||||
cl_mem varyingBuffer = context->GetCurrentVaryingBuffer();
|
||||
cl_mem F_IT = context->GetTable(FarSubdivisionTables<OsdVertex>::F_IT)->GetDevicePtr();
|
||||
cl_mem F_ITa = context->GetTable(FarSubdivisionTables<OsdVertex>::F_ITa)->GetDevicePtr();
|
||||
cl_mem F_IT = context->GetTable(FarSubdivisionTables::F_IT)->GetDevicePtr();
|
||||
cl_mem F_ITa = context->GetTable(FarSubdivisionTables::F_ITa)->GetDevicePtr();
|
||||
|
||||
clSetKernelArg(kernel, 0, sizeof(cl_mem), &vertexBuffer);
|
||||
clSetKernelArg(kernel, 1, sizeof(cl_mem), &varyingBuffer);
|
||||
@ -189,10 +183,8 @@ OsdCLComputeController::ApplyCatmarkFaceVerticesKernel(
|
||||
|
||||
void
|
||||
OsdCLComputeController::ApplyCatmarkEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCLComputeContext *context) const {
|
||||
|
||||
OsdCLComputeContext * context =
|
||||
static_cast<OsdCLComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
cl_int ciErrNum;
|
||||
@ -201,8 +193,8 @@ OsdCLComputeController::ApplyCatmarkEdgeVerticesKernel(
|
||||
|
||||
cl_mem vertexBuffer = context->GetCurrentVertexBuffer();
|
||||
cl_mem varyingBuffer = context->GetCurrentVaryingBuffer();
|
||||
cl_mem E_IT = context->GetTable(FarSubdivisionTables<OsdVertex>::E_IT)->GetDevicePtr();
|
||||
cl_mem E_W = context->GetTable(FarSubdivisionTables<OsdVertex>::E_W)->GetDevicePtr();
|
||||
cl_mem E_IT = context->GetTable(FarSubdivisionTables::E_IT)->GetDevicePtr();
|
||||
cl_mem E_W = context->GetTable(FarSubdivisionTables::E_W)->GetDevicePtr();
|
||||
|
||||
clSetKernelArg(kernel, 0, sizeof(cl_mem), &vertexBuffer);
|
||||
clSetKernelArg(kernel, 1, sizeof(cl_mem), &varyingBuffer);
|
||||
@ -221,10 +213,8 @@ OsdCLComputeController::ApplyCatmarkEdgeVerticesKernel(
|
||||
|
||||
void
|
||||
OsdCLComputeController::ApplyCatmarkVertexVerticesKernelB(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCLComputeContext *context) const {
|
||||
|
||||
OsdCLComputeContext * context =
|
||||
static_cast<OsdCLComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
cl_int ciErrNum;
|
||||
@ -233,9 +223,9 @@ OsdCLComputeController::ApplyCatmarkVertexVerticesKernelB(
|
||||
|
||||
cl_mem vertexBuffer = context->GetCurrentVertexBuffer();
|
||||
cl_mem varyingBuffer = context->GetCurrentVaryingBuffer();
|
||||
cl_mem V_ITa = context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetDevicePtr();
|
||||
cl_mem V_IT = context->GetTable(FarSubdivisionTables<OsdVertex>::V_IT)->GetDevicePtr();
|
||||
cl_mem V_W = context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetDevicePtr();
|
||||
cl_mem V_ITa = context->GetTable(FarSubdivisionTables::V_ITa)->GetDevicePtr();
|
||||
cl_mem V_IT = context->GetTable(FarSubdivisionTables::V_IT)->GetDevicePtr();
|
||||
cl_mem V_W = context->GetTable(FarSubdivisionTables::V_W)->GetDevicePtr();
|
||||
|
||||
clSetKernelArg(kernel, 0, sizeof(cl_mem), &vertexBuffer);
|
||||
clSetKernelArg(kernel, 1, sizeof(cl_mem), &varyingBuffer);
|
||||
@ -255,10 +245,8 @@ OsdCLComputeController::ApplyCatmarkVertexVerticesKernelB(
|
||||
|
||||
void
|
||||
OsdCLComputeController::ApplyCatmarkVertexVerticesKernelA1(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCLComputeContext *context) const {
|
||||
|
||||
OsdCLComputeContext * context =
|
||||
static_cast<OsdCLComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
cl_int ciErrNum;
|
||||
@ -268,8 +256,8 @@ OsdCLComputeController::ApplyCatmarkVertexVerticesKernelA1(
|
||||
|
||||
cl_mem vertexBuffer = context->GetCurrentVertexBuffer();
|
||||
cl_mem varyingBuffer = context->GetCurrentVaryingBuffer();
|
||||
cl_mem V_ITa = context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetDevicePtr();
|
||||
cl_mem V_W = context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetDevicePtr();
|
||||
cl_mem V_ITa = context->GetTable(FarSubdivisionTables::V_ITa)->GetDevicePtr();
|
||||
cl_mem V_W = context->GetTable(FarSubdivisionTables::V_W)->GetDevicePtr();
|
||||
|
||||
clSetKernelArg(kernel, 0, sizeof(cl_mem), &vertexBuffer);
|
||||
clSetKernelArg(kernel, 1, sizeof(cl_mem), &varyingBuffer);
|
||||
@ -289,10 +277,8 @@ OsdCLComputeController::ApplyCatmarkVertexVerticesKernelA1(
|
||||
|
||||
void
|
||||
OsdCLComputeController::ApplyCatmarkVertexVerticesKernelA2(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCLComputeContext *context) const {
|
||||
|
||||
OsdCLComputeContext * context =
|
||||
static_cast<OsdCLComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
cl_int ciErrNum;
|
||||
@ -302,8 +288,8 @@ OsdCLComputeController::ApplyCatmarkVertexVerticesKernelA2(
|
||||
|
||||
cl_mem vertexBuffer = context->GetCurrentVertexBuffer();
|
||||
cl_mem varyingBuffer = context->GetCurrentVaryingBuffer();
|
||||
cl_mem V_ITa = context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetDevicePtr();
|
||||
cl_mem V_W = context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetDevicePtr();
|
||||
cl_mem V_ITa = context->GetTable(FarSubdivisionTables::V_ITa)->GetDevicePtr();
|
||||
cl_mem V_W = context->GetTable(FarSubdivisionTables::V_W)->GetDevicePtr();
|
||||
|
||||
clSetKernelArg(kernel, 0, sizeof(cl_mem), &vertexBuffer);
|
||||
clSetKernelArg(kernel, 1, sizeof(cl_mem), &varyingBuffer);
|
||||
@ -323,10 +309,8 @@ OsdCLComputeController::ApplyCatmarkVertexVerticesKernelA2(
|
||||
|
||||
void
|
||||
OsdCLComputeController::ApplyLoopEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCLComputeContext *context) const {
|
||||
|
||||
OsdCLComputeContext * context =
|
||||
static_cast<OsdCLComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
cl_int ciErrNum;
|
||||
@ -335,8 +319,8 @@ OsdCLComputeController::ApplyLoopEdgeVerticesKernel(
|
||||
|
||||
cl_mem vertexBuffer = context->GetCurrentVertexBuffer();
|
||||
cl_mem varyingBuffer = context->GetCurrentVaryingBuffer();
|
||||
cl_mem E_IT = context->GetTable(FarSubdivisionTables<OsdVertex>::E_IT)->GetDevicePtr();
|
||||
cl_mem E_W = context->GetTable(FarSubdivisionTables<OsdVertex>::E_W)->GetDevicePtr();
|
||||
cl_mem E_IT = context->GetTable(FarSubdivisionTables::E_IT)->GetDevicePtr();
|
||||
cl_mem E_W = context->GetTable(FarSubdivisionTables::E_W)->GetDevicePtr();
|
||||
|
||||
clSetKernelArg(kernel, 0, sizeof(cl_mem), &vertexBuffer);
|
||||
clSetKernelArg(kernel, 1, sizeof(cl_mem), &varyingBuffer);
|
||||
@ -355,10 +339,8 @@ OsdCLComputeController::ApplyLoopEdgeVerticesKernel(
|
||||
|
||||
void
|
||||
OsdCLComputeController::ApplyLoopVertexVerticesKernelB(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCLComputeContext *context) const {
|
||||
|
||||
OsdCLComputeContext * context =
|
||||
static_cast<OsdCLComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
cl_int ciErrNum;
|
||||
@ -367,9 +349,9 @@ OsdCLComputeController::ApplyLoopVertexVerticesKernelB(
|
||||
|
||||
cl_mem vertexBuffer = context->GetCurrentVertexBuffer();
|
||||
cl_mem varyingBuffer = context->GetCurrentVaryingBuffer();
|
||||
cl_mem V_ITa = context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetDevicePtr();
|
||||
cl_mem V_IT = context->GetTable(FarSubdivisionTables<OsdVertex>::V_IT)->GetDevicePtr();
|
||||
cl_mem V_W = context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetDevicePtr();
|
||||
cl_mem V_ITa = context->GetTable(FarSubdivisionTables::V_ITa)->GetDevicePtr();
|
||||
cl_mem V_IT = context->GetTable(FarSubdivisionTables::V_IT)->GetDevicePtr();
|
||||
cl_mem V_W = context->GetTable(FarSubdivisionTables::V_W)->GetDevicePtr();
|
||||
|
||||
clSetKernelArg(kernel, 0, sizeof(cl_mem), &vertexBuffer);
|
||||
clSetKernelArg(kernel, 1, sizeof(cl_mem), &varyingBuffer);
|
||||
@ -389,10 +371,8 @@ OsdCLComputeController::ApplyLoopVertexVerticesKernelB(
|
||||
|
||||
void
|
||||
OsdCLComputeController::ApplyLoopVertexVerticesKernelA1(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCLComputeContext *context) const {
|
||||
|
||||
OsdCLComputeContext * context =
|
||||
static_cast<OsdCLComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
cl_int ciErrNum;
|
||||
@ -402,8 +382,8 @@ OsdCLComputeController::ApplyLoopVertexVerticesKernelA1(
|
||||
|
||||
cl_mem vertexBuffer = context->GetCurrentVertexBuffer();
|
||||
cl_mem varyingBuffer = context->GetCurrentVaryingBuffer();
|
||||
cl_mem V_ITa = context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetDevicePtr();
|
||||
cl_mem V_W = context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetDevicePtr();
|
||||
cl_mem V_ITa = context->GetTable(FarSubdivisionTables::V_ITa)->GetDevicePtr();
|
||||
cl_mem V_W = context->GetTable(FarSubdivisionTables::V_W)->GetDevicePtr();
|
||||
|
||||
clSetKernelArg(kernel, 0, sizeof(cl_mem), &vertexBuffer);
|
||||
clSetKernelArg(kernel, 1, sizeof(cl_mem), &varyingBuffer);
|
||||
@ -423,10 +403,8 @@ OsdCLComputeController::ApplyLoopVertexVerticesKernelA1(
|
||||
|
||||
void
|
||||
OsdCLComputeController::ApplyLoopVertexVerticesKernelA2(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCLComputeContext *context) const {
|
||||
|
||||
OsdCLComputeContext * context =
|
||||
static_cast<OsdCLComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
cl_int ciErrNum;
|
||||
@ -436,8 +414,8 @@ OsdCLComputeController::ApplyLoopVertexVerticesKernelA2(
|
||||
|
||||
cl_mem vertexBuffer = context->GetCurrentVertexBuffer();
|
||||
cl_mem varyingBuffer = context->GetCurrentVaryingBuffer();
|
||||
cl_mem V_ITa = context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetDevicePtr();
|
||||
cl_mem V_W = context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetDevicePtr();
|
||||
cl_mem V_ITa = context->GetTable(FarSubdivisionTables::V_ITa)->GetDevicePtr();
|
||||
cl_mem V_W = context->GetTable(FarSubdivisionTables::V_W)->GetDevicePtr();
|
||||
|
||||
clSetKernelArg(kernel, 0, sizeof(cl_mem), &vertexBuffer);
|
||||
clSetKernelArg(kernel, 1, sizeof(cl_mem), &varyingBuffer);
|
||||
@ -457,10 +435,8 @@ OsdCLComputeController::ApplyLoopVertexVerticesKernelA2(
|
||||
|
||||
void
|
||||
OsdCLComputeController::ApplyVertexEdits(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCLComputeContext *context) const {
|
||||
|
||||
OsdCLComputeContext * context =
|
||||
static_cast<OsdCLComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
cl_int ciErrNum;
|
||||
|
@ -93,10 +93,9 @@ public:
|
||||
context->SetKernelBundle(getKernelBundle(numVertexElements, numVaryingElements));
|
||||
|
||||
context->Bind(vertexBuffer, varyingBuffer, _clQueue);
|
||||
FarDispatcher::Refine(this,
|
||||
batches,
|
||||
-1,
|
||||
context);
|
||||
|
||||
FarDispatcher::Refine(this, context, batches, /*maxlevel*/-1);
|
||||
|
||||
context->Unbind();
|
||||
}
|
||||
|
||||
@ -128,34 +127,34 @@ public:
|
||||
protected:
|
||||
friend class FarDispatcher;
|
||||
|
||||
void ApplyBilinearFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearFaceVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyBilinearEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyBilinearVertexVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearVertexVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
void ApplyCatmarkFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkFaceVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelB(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelA1(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelA2(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
void ApplyLoopEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelB(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelA1(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelA2(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
void ApplyVertexEdits(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyVertexEdits(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
OsdCLKernelBundle * getKernelBundle(int numVertexElements,
|
||||
|
@ -59,7 +59,7 @@ OsdCpuTable::GetBuffer() const {
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
OsdCpuHEditTable::OsdCpuHEditTable(
|
||||
const FarVertexEditTables<OsdVertex>::VertexEditBatch &batch)
|
||||
const FarVertexEditTables::VertexEditBatch &batch)
|
||||
: _primvarIndicesTable(new OsdCpuTable(batch.GetVertexIndices())),
|
||||
_editValuesTable(new OsdCpuTable(batch.GetValues())) {
|
||||
|
||||
@ -106,30 +106,30 @@ OsdCpuHEditTable::GetPrimvarWidth() const {
|
||||
|
||||
OsdCpuComputeContext::OsdCpuComputeContext(FarMesh<OsdVertex> const *farMesh) {
|
||||
|
||||
FarSubdivisionTables<OsdVertex> const * farTables =
|
||||
FarSubdivisionTables const * farTables =
|
||||
farMesh->GetSubdivisionTables();
|
||||
|
||||
// allocate 5 or 7 tables
|
||||
_tables.resize(farTables->GetNumTables(), 0);
|
||||
|
||||
_tables[FarSubdivisionTables<OsdVertex>::E_IT] = new OsdCpuTable(farTables->Get_E_IT());
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_IT] = new OsdCpuTable(farTables->Get_V_IT());
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_ITa] = new OsdCpuTable(farTables->Get_V_ITa());
|
||||
_tables[FarSubdivisionTables<OsdVertex>::E_W] = new OsdCpuTable(farTables->Get_E_W());
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_W] = new OsdCpuTable(farTables->Get_V_W());
|
||||
_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());
|
||||
|
||||
if (farTables->GetNumTables() > 5) {
|
||||
_tables[FarSubdivisionTables<OsdVertex>::F_IT] = new OsdCpuTable(farTables->Get_F_IT());
|
||||
_tables[FarSubdivisionTables<OsdVertex>::F_ITa] = new OsdCpuTable(farTables->Get_F_ITa());
|
||||
_tables[FarSubdivisionTables::F_IT] = new OsdCpuTable(farTables->Get_F_IT());
|
||||
_tables[FarSubdivisionTables::F_ITa] = new OsdCpuTable(farTables->Get_F_ITa());
|
||||
}
|
||||
|
||||
// create hedit tables
|
||||
FarVertexEditTables<OsdVertex> const *editTables = farMesh->GetVertexEdit();
|
||||
FarVertexEditTables const *editTables = farMesh->GetVertexEdit();
|
||||
if (editTables) {
|
||||
int numEditBatches = editTables->GetNumBatches();
|
||||
_editTables.reserve(numEditBatches);
|
||||
for (int i = 0; i < numEditBatches; ++i) {
|
||||
const FarVertexEditTables<OsdVertex>::VertexEditBatch & edit =
|
||||
const FarVertexEditTables::VertexEditBatch & edit =
|
||||
editTables->GetBatch(i);
|
||||
|
||||
_editTables.push_back(new OsdCpuHEditTable(edit));
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
#include "../far/mesh.h"
|
||||
#include "../far/subdivisionTables.h"
|
||||
#include "../far/vertexEditTables.h"
|
||||
#include "../osd/vertex.h"
|
||||
@ -59,8 +60,7 @@ private:
|
||||
|
||||
class OsdCpuHEditTable : OsdNonCopyable<OsdCpuHEditTable> {
|
||||
public:
|
||||
OsdCpuHEditTable(const FarVertexEditTables<OsdVertex>::
|
||||
VertexEditBatch &batch);
|
||||
OsdCpuHEditTable(const FarVertexEditTables::VertexEditBatch &batch);
|
||||
|
||||
virtual ~OsdCpuHEditTable();
|
||||
|
||||
|
@ -38,214 +38,188 @@ OsdCpuComputeController::~OsdCpuComputeController() {
|
||||
|
||||
void
|
||||
OsdCpuComputeController::ApplyBilinearFaceVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdCpuComputeFace(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::F_IT)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::F_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::F_IT)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::F_ITa)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd());
|
||||
}
|
||||
|
||||
void
|
||||
OsdCpuComputeController::ApplyBilinearEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdCpuComputeBilinearEdge(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::E_IT)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::E_IT)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd());
|
||||
}
|
||||
|
||||
void
|
||||
OsdCpuComputeController::ApplyBilinearVertexVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdCpuComputeBilinearVertex(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd());
|
||||
}
|
||||
|
||||
void
|
||||
OsdCpuComputeController::ApplyCatmarkFaceVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdCpuComputeFace(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::F_IT)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::F_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::F_IT)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::F_ITa)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd());
|
||||
}
|
||||
|
||||
void
|
||||
OsdCpuComputeController::ApplyCatmarkEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdCpuComputeEdge(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::E_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::E_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::E_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::E_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd());
|
||||
}
|
||||
|
||||
void
|
||||
OsdCpuComputeController::ApplyCatmarkVertexVerticesKernelB(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdCpuComputeVertexB(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::V_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd());
|
||||
}
|
||||
|
||||
void
|
||||
OsdCpuComputeController::ApplyCatmarkVertexVerticesKernelA1(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdCpuComputeVertexA(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::V_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd(), false);
|
||||
}
|
||||
|
||||
void
|
||||
OsdCpuComputeController::ApplyCatmarkVertexVerticesKernelA2(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdCpuComputeVertexA(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::V_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd(), true);
|
||||
}
|
||||
|
||||
void
|
||||
OsdCpuComputeController::ApplyLoopEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdCpuComputeEdge(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::E_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::E_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::E_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::E_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd());
|
||||
}
|
||||
|
||||
void
|
||||
OsdCpuComputeController::ApplyLoopVertexVerticesKernelB(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdCpuComputeLoopVertexB(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::V_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd());
|
||||
}
|
||||
|
||||
void
|
||||
OsdCpuComputeController::ApplyLoopVertexVerticesKernelA1(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdCpuComputeVertexA(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::V_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd(), false);
|
||||
}
|
||||
|
||||
void
|
||||
OsdCpuComputeController::ApplyLoopVertexVerticesKernelA2(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdCpuComputeVertexA(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::V_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd(), true);
|
||||
}
|
||||
|
||||
void
|
||||
OsdCpuComputeController::ApplyVertexEdits(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
const OsdCpuHEditTable *edit = context->GetEditTable(batch.GetTableIndex());
|
||||
|
@ -73,10 +73,9 @@ public:
|
||||
if (batches.empty()) return;
|
||||
|
||||
context->Bind(vertexBuffer, varyingBuffer);
|
||||
FarDispatcher::Refine(this,
|
||||
batches,
|
||||
-1,
|
||||
context);
|
||||
|
||||
FarDispatcher::Refine(this, context, batches, /*maxlevel*/-1);
|
||||
|
||||
context->Unbind();
|
||||
}
|
||||
|
||||
@ -101,34 +100,34 @@ public:
|
||||
|
||||
protected:
|
||||
friend class FarDispatcher;
|
||||
void ApplyBilinearFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearFaceVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyBilinearEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyBilinearVertexVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearVertexVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
void ApplyCatmarkFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkFaceVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelB(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelA1(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelA2(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
void ApplyLoopEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelB(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelA1(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelA2(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
void ApplyVertexEdits(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyVertexEdits(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
};
|
||||
|
||||
|
@ -71,8 +71,7 @@ OsdCudaHEditTable::~OsdCudaHEditTable() {
|
||||
}
|
||||
|
||||
OsdCudaHEditTable *
|
||||
OsdCudaHEditTable::Create(const FarVertexEditTables<OsdVertex>::
|
||||
VertexEditBatch &batch) {
|
||||
OsdCudaHEditTable::Create(const FarVertexEditTables::VertexEditBatch &batch) {
|
||||
|
||||
OsdCudaHEditTable *result = new OsdCudaHEditTable();
|
||||
|
||||
@ -139,21 +138,20 @@ OsdCudaComputeContext::~OsdCudaComputeContext() {
|
||||
bool
|
||||
OsdCudaComputeContext::initialize(FarMesh<OsdVertex> const *farMesh) {
|
||||
|
||||
FarSubdivisionTables<OsdVertex> const * farTables =
|
||||
farMesh->GetSubdivisionTables();
|
||||
FarSubdivisionTables const * farTables = farMesh->GetSubdivisionTables();
|
||||
|
||||
// allocate 5 or 7 tables
|
||||
_tables.resize(farTables->GetNumTables(), 0);
|
||||
|
||||
_tables[FarSubdivisionTables<OsdVertex>::E_IT] = OsdCudaTable::Create(farTables->Get_E_IT());
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_IT] = OsdCudaTable::Create(farTables->Get_V_IT());
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_ITa] = OsdCudaTable::Create(farTables->Get_V_ITa());
|
||||
_tables[FarSubdivisionTables<OsdVertex>::E_W] = OsdCudaTable::Create(farTables->Get_E_W());
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_W] = OsdCudaTable::Create(farTables->Get_V_W());
|
||||
_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());
|
||||
|
||||
if (farTables->GetNumTables() > 5) {
|
||||
_tables[FarSubdivisionTables<OsdVertex>::F_IT] = OsdCudaTable::Create(farTables->Get_F_IT());
|
||||
_tables[FarSubdivisionTables<OsdVertex>::F_ITa] = OsdCudaTable::Create(farTables->Get_F_ITa());
|
||||
_tables[FarSubdivisionTables::F_IT] = OsdCudaTable::Create(farTables->Get_F_IT());
|
||||
_tables[FarSubdivisionTables::F_ITa] = OsdCudaTable::Create(farTables->Get_F_ITa());
|
||||
}
|
||||
|
||||
// error check
|
||||
@ -164,12 +162,12 @@ OsdCudaComputeContext::initialize(FarMesh<OsdVertex> const *farMesh) {
|
||||
}
|
||||
|
||||
// create hedit tables
|
||||
FarVertexEditTables<OsdVertex> const *editTables = farMesh->GetVertexEdit();
|
||||
FarVertexEditTables const *editTables = farMesh->GetVertexEdit();
|
||||
if (editTables) {
|
||||
int numEditBatches = editTables->GetNumBatches();
|
||||
_editTables.reserve(numEditBatches);
|
||||
for (int i = 0; i < numEditBatches; ++i) {
|
||||
const FarVertexEditTables<OsdVertex>::VertexEditBatch & edit =
|
||||
const FarVertexEditTables::VertexEditBatch & edit =
|
||||
editTables->GetBatch(i);
|
||||
|
||||
_editTables.push_back(OsdCudaHEditTable::Create(edit));
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
#include "../far/mesh.h"
|
||||
#include "../far/vertexEditTables.h"
|
||||
#include "../osd/vertex.h"
|
||||
#include "../osd/vertexDescriptor.h"
|
||||
@ -64,8 +65,7 @@ private:
|
||||
|
||||
class OsdCudaHEditTable : OsdNonCopyable<OsdCudaHEditTable> {
|
||||
public:
|
||||
static OsdCudaHEditTable * Create(const FarVertexEditTables<OsdVertex>::
|
||||
VertexEditBatch &batch);
|
||||
static OsdCudaHEditTable * Create(const FarVertexEditTables::VertexEditBatch &batch);
|
||||
|
||||
virtual ~OsdCudaHEditTable();
|
||||
|
||||
|
@ -82,14 +82,12 @@ OsdCudaComputeController::~OsdCudaComputeController() {
|
||||
|
||||
void
|
||||
OsdCudaComputeController::ApplyBilinearFaceVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCudaComputeContext *context) const {
|
||||
|
||||
OsdCudaComputeContext * context =
|
||||
static_cast<OsdCudaComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
const OsdCudaTable * F_IT = context->GetTable(FarSubdivisionTables<OsdVertex>::F_IT);
|
||||
const OsdCudaTable * F_ITa = context->GetTable(FarSubdivisionTables<OsdVertex>::F_ITa);
|
||||
const OsdCudaTable * F_IT = context->GetTable(FarSubdivisionTables::F_IT);
|
||||
const OsdCudaTable * F_ITa = context->GetTable(FarSubdivisionTables::F_ITa);
|
||||
assert(F_IT);
|
||||
assert(F_ITa);
|
||||
|
||||
@ -105,13 +103,11 @@ OsdCudaComputeController::ApplyBilinearFaceVerticesKernel(
|
||||
|
||||
void
|
||||
OsdCudaComputeController::ApplyBilinearEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCudaComputeContext *context) const {
|
||||
|
||||
OsdCudaComputeContext * context =
|
||||
static_cast<OsdCudaComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
const OsdCudaTable * E_IT = context->GetTable(FarSubdivisionTables<OsdVertex>::E_IT);
|
||||
const OsdCudaTable * E_IT = context->GetTable(FarSubdivisionTables::E_IT);
|
||||
assert(E_IT);
|
||||
|
||||
OsdCudaComputeBilinearEdge(
|
||||
@ -125,13 +121,11 @@ OsdCudaComputeController::ApplyBilinearEdgeVerticesKernel(
|
||||
|
||||
void
|
||||
OsdCudaComputeController::ApplyBilinearVertexVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCudaComputeContext *context) const {
|
||||
|
||||
OsdCudaComputeContext * context =
|
||||
static_cast<OsdCudaComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
const OsdCudaTable * V_ITa = context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa);
|
||||
const OsdCudaTable * V_ITa = context->GetTable(FarSubdivisionTables::V_ITa);
|
||||
assert(V_ITa);
|
||||
|
||||
OsdCudaComputeBilinearVertex(
|
||||
@ -145,14 +139,12 @@ OsdCudaComputeController::ApplyBilinearVertexVerticesKernel(
|
||||
|
||||
void
|
||||
OsdCudaComputeController::ApplyCatmarkFaceVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCudaComputeContext *context) const {
|
||||
|
||||
OsdCudaComputeContext * context =
|
||||
static_cast<OsdCudaComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
const OsdCudaTable * F_IT = context->GetTable(FarSubdivisionTables<OsdVertex>::F_IT);
|
||||
const OsdCudaTable * F_ITa = context->GetTable(FarSubdivisionTables<OsdVertex>::F_ITa);
|
||||
const OsdCudaTable * F_IT = context->GetTable(FarSubdivisionTables::F_IT);
|
||||
const OsdCudaTable * F_ITa = context->GetTable(FarSubdivisionTables::F_ITa);
|
||||
assert(F_IT);
|
||||
assert(F_ITa);
|
||||
|
||||
@ -168,14 +160,12 @@ OsdCudaComputeController::ApplyCatmarkFaceVerticesKernel(
|
||||
|
||||
void
|
||||
OsdCudaComputeController::ApplyCatmarkEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCudaComputeContext *context) const {
|
||||
|
||||
OsdCudaComputeContext * context =
|
||||
static_cast<OsdCudaComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
const OsdCudaTable * E_IT = context->GetTable(FarSubdivisionTables<OsdVertex>::E_IT);
|
||||
const OsdCudaTable * E_W = context->GetTable(FarSubdivisionTables<OsdVertex>::E_W);
|
||||
const OsdCudaTable * E_IT = context->GetTable(FarSubdivisionTables::E_IT);
|
||||
const OsdCudaTable * E_W = context->GetTable(FarSubdivisionTables::E_W);
|
||||
assert(E_IT);
|
||||
assert(E_W);
|
||||
|
||||
@ -191,15 +181,13 @@ OsdCudaComputeController::ApplyCatmarkEdgeVerticesKernel(
|
||||
|
||||
void
|
||||
OsdCudaComputeController::ApplyCatmarkVertexVerticesKernelB(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCudaComputeContext *context) const {
|
||||
|
||||
OsdCudaComputeContext * context =
|
||||
static_cast<OsdCudaComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
const OsdCudaTable * V_ITa = context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa);
|
||||
const OsdCudaTable * V_IT = context->GetTable(FarSubdivisionTables<OsdVertex>::V_IT);
|
||||
const OsdCudaTable * V_W = context->GetTable(FarSubdivisionTables<OsdVertex>::V_W);
|
||||
const OsdCudaTable * V_ITa = context->GetTable(FarSubdivisionTables::V_ITa);
|
||||
const OsdCudaTable * V_IT = context->GetTable(FarSubdivisionTables::V_IT);
|
||||
const OsdCudaTable * V_W = context->GetTable(FarSubdivisionTables::V_W);
|
||||
assert(V_ITa);
|
||||
assert(V_IT);
|
||||
assert(V_W);
|
||||
@ -217,14 +205,12 @@ OsdCudaComputeController::ApplyCatmarkVertexVerticesKernelB(
|
||||
|
||||
void
|
||||
OsdCudaComputeController::ApplyCatmarkVertexVerticesKernelA1(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCudaComputeContext *context) const {
|
||||
|
||||
OsdCudaComputeContext * context =
|
||||
static_cast<OsdCudaComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
const OsdCudaTable * V_ITa = context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa);
|
||||
const OsdCudaTable * V_W = context->GetTable(FarSubdivisionTables<OsdVertex>::V_W);
|
||||
const OsdCudaTable * V_ITa = context->GetTable(FarSubdivisionTables::V_ITa);
|
||||
const OsdCudaTable * V_W = context->GetTable(FarSubdivisionTables::V_W);
|
||||
assert(V_ITa);
|
||||
assert(V_W);
|
||||
|
||||
@ -240,14 +226,12 @@ OsdCudaComputeController::ApplyCatmarkVertexVerticesKernelA1(
|
||||
|
||||
void
|
||||
OsdCudaComputeController::ApplyCatmarkVertexVerticesKernelA2(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCudaComputeContext *context) const {
|
||||
|
||||
OsdCudaComputeContext * context =
|
||||
static_cast<OsdCudaComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
const OsdCudaTable * V_ITa = context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa);
|
||||
const OsdCudaTable * V_W = context->GetTable(FarSubdivisionTables<OsdVertex>::V_W);
|
||||
const OsdCudaTable * V_ITa = context->GetTable(FarSubdivisionTables::V_ITa);
|
||||
const OsdCudaTable * V_W = context->GetTable(FarSubdivisionTables::V_W);
|
||||
assert(V_ITa);
|
||||
assert(V_W);
|
||||
|
||||
@ -263,14 +247,12 @@ OsdCudaComputeController::ApplyCatmarkVertexVerticesKernelA2(
|
||||
|
||||
void
|
||||
OsdCudaComputeController::ApplyLoopEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCudaComputeContext *context) const {
|
||||
|
||||
OsdCudaComputeContext * context =
|
||||
static_cast<OsdCudaComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
const OsdCudaTable * E_IT = context->GetTable(FarSubdivisionTables<OsdVertex>::E_IT);
|
||||
const OsdCudaTable * E_W = context->GetTable(FarSubdivisionTables<OsdVertex>::E_W);
|
||||
const OsdCudaTable * E_IT = context->GetTable(FarSubdivisionTables::E_IT);
|
||||
const OsdCudaTable * E_W = context->GetTable(FarSubdivisionTables::E_W);
|
||||
assert(E_IT);
|
||||
assert(E_W);
|
||||
|
||||
@ -286,15 +268,13 @@ OsdCudaComputeController::ApplyLoopEdgeVerticesKernel(
|
||||
|
||||
void
|
||||
OsdCudaComputeController::ApplyLoopVertexVerticesKernelB(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCudaComputeContext *context) const {
|
||||
|
||||
OsdCudaComputeContext * context =
|
||||
static_cast<OsdCudaComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
const OsdCudaTable * V_ITa = context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa);
|
||||
const OsdCudaTable * V_IT = context->GetTable(FarSubdivisionTables<OsdVertex>::V_IT);
|
||||
const OsdCudaTable * V_W = context->GetTable(FarSubdivisionTables<OsdVertex>::V_W);
|
||||
const OsdCudaTable * V_ITa = context->GetTable(FarSubdivisionTables::V_ITa);
|
||||
const OsdCudaTable * V_IT = context->GetTable(FarSubdivisionTables::V_IT);
|
||||
const OsdCudaTable * V_W = context->GetTable(FarSubdivisionTables::V_W);
|
||||
assert(V_ITa);
|
||||
assert(V_IT);
|
||||
assert(V_W);
|
||||
@ -312,14 +292,12 @@ OsdCudaComputeController::ApplyLoopVertexVerticesKernelB(
|
||||
|
||||
void
|
||||
OsdCudaComputeController::ApplyLoopVertexVerticesKernelA1(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCudaComputeContext *context) const {
|
||||
|
||||
OsdCudaComputeContext * context =
|
||||
static_cast<OsdCudaComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
const OsdCudaTable * V_ITa = context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa);
|
||||
const OsdCudaTable * V_W = context->GetTable(FarSubdivisionTables<OsdVertex>::V_W);
|
||||
const OsdCudaTable * V_ITa = context->GetTable(FarSubdivisionTables::V_ITa);
|
||||
const OsdCudaTable * V_W = context->GetTable(FarSubdivisionTables::V_W);
|
||||
assert(V_ITa);
|
||||
assert(V_W);
|
||||
|
||||
@ -335,14 +313,12 @@ OsdCudaComputeController::ApplyLoopVertexVerticesKernelA1(
|
||||
|
||||
void
|
||||
OsdCudaComputeController::ApplyLoopVertexVerticesKernelA2(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCudaComputeContext *context) const {
|
||||
|
||||
OsdCudaComputeContext * context =
|
||||
static_cast<OsdCudaComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
const OsdCudaTable * V_ITa = context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa);
|
||||
const OsdCudaTable * V_W = context->GetTable(FarSubdivisionTables<OsdVertex>::V_W);
|
||||
const OsdCudaTable * V_ITa = context->GetTable(FarSubdivisionTables::V_ITa);
|
||||
const OsdCudaTable * V_W = context->GetTable(FarSubdivisionTables::V_W);
|
||||
assert(V_ITa);
|
||||
assert(V_W);
|
||||
|
||||
@ -358,10 +334,8 @@ OsdCudaComputeController::ApplyLoopVertexVerticesKernelA2(
|
||||
|
||||
void
|
||||
OsdCudaComputeController::ApplyVertexEdits(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCudaComputeContext *context) const {
|
||||
|
||||
OsdCudaComputeContext * context =
|
||||
static_cast<OsdCudaComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
const OsdCudaHEditTable *edit = context->GetEditTable(batch.GetTableIndex());
|
||||
|
@ -73,10 +73,9 @@ public:
|
||||
if (batches.empty()) return;
|
||||
|
||||
context->Bind(vertexBuffer, varyingBuffer);
|
||||
FarDispatcher::Refine(this,
|
||||
batches,
|
||||
-1,
|
||||
context);
|
||||
|
||||
FarDispatcher::Refine(this, context, batches, /*maxlevel*/-1);
|
||||
|
||||
context->Unbind();
|
||||
}
|
||||
|
||||
@ -101,34 +100,34 @@ public:
|
||||
|
||||
protected:
|
||||
friend class FarDispatcher;
|
||||
void ApplyBilinearFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearFaceVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyBilinearEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyBilinearVertexVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearVertexVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
void ApplyCatmarkFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkFaceVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelB(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelA1(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelA2(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
void ApplyLoopEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelB(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelA1(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelA2(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
void ApplyVertexEdits(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyVertexEdits(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
};
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
|
@ -97,7 +97,7 @@ OsdD3D11ComputeTable::GetSRV() const {
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
OsdD3D11ComputeHEditTable::OsdD3D11ComputeHEditTable(
|
||||
const FarVertexEditTables<OsdVertex>::VertexEditBatch &batch, ID3D11DeviceContext *deviceContext)
|
||||
const FarVertexEditTables::VertexEditBatch &batch, ID3D11DeviceContext *deviceContext)
|
||||
: _primvarIndicesTable(new OsdD3D11ComputeTable(batch.GetVertexIndices(), deviceContext, DXGI_FORMAT_R32_UINT)),
|
||||
_editValuesTable(new OsdD3D11ComputeTable(batch.GetValues(), deviceContext, DXGI_FORMAT_R32_FLOAT)) {
|
||||
|
||||
@ -149,8 +149,7 @@ OsdD3D11ComputeContext::OsdD3D11ComputeContext(
|
||||
: _deviceContext(deviceContext),
|
||||
_currentVertexBufferUAV(0), _currentVaryingBufferUAV(0) {
|
||||
|
||||
FarSubdivisionTables<OsdVertex> const * farTables =
|
||||
farMesh->GetSubdivisionTables();
|
||||
FarSubdivisionTables const * farTables = farMesh->GetSubdivisionTables();
|
||||
|
||||
// allocate 5 or 7 tables
|
||||
// XXXtakahito: Although _tables size depends on table type, F_IT is set
|
||||
@ -158,27 +157,27 @@ OsdD3D11ComputeContext::OsdD3D11ComputeContext(
|
||||
// bindShaderStorageBuffer()...
|
||||
_tables.resize(7, 0);
|
||||
|
||||
_tables[FarSubdivisionTables<OsdVertex>::E_IT] = new OsdD3D11ComputeTable(farTables->Get_E_IT(), deviceContext, DXGI_FORMAT_R32_SINT);
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_IT] = new OsdD3D11ComputeTable(farTables->Get_V_IT(), deviceContext, DXGI_FORMAT_R32_UINT);
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_ITa] = new OsdD3D11ComputeTable(farTables->Get_V_ITa(), deviceContext, DXGI_FORMAT_R32_SINT);
|
||||
_tables[FarSubdivisionTables<OsdVertex>::E_W] = new OsdD3D11ComputeTable(farTables->Get_E_W(), deviceContext, DXGI_FORMAT_R32_FLOAT);
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_W] = new OsdD3D11ComputeTable(farTables->Get_V_W(), deviceContext, DXGI_FORMAT_R32_FLOAT);
|
||||
_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);
|
||||
|
||||
if (farTables->GetNumTables() > 5) {
|
||||
_tables[FarSubdivisionTables<OsdVertex>::F_IT] = new OsdD3D11ComputeTable(farTables->Get_F_IT(), deviceContext, DXGI_FORMAT_R32_UINT);
|
||||
_tables[FarSubdivisionTables<OsdVertex>::F_ITa] = new OsdD3D11ComputeTable(farTables->Get_F_ITa(), deviceContext, DXGI_FORMAT_R32_SINT);
|
||||
_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);
|
||||
} else {
|
||||
_tables[FarSubdivisionTables<OsdVertex>::F_IT] = NULL;
|
||||
_tables[FarSubdivisionTables<OsdVertex>::F_ITa] = NULL;
|
||||
_tables[FarSubdivisionTables::F_IT] = NULL;
|
||||
_tables[FarSubdivisionTables::F_ITa] = NULL;
|
||||
}
|
||||
|
||||
// create hedit tables
|
||||
FarVertexEditTables<OsdVertex> const *editTables = farMesh->GetVertexEdit();
|
||||
FarVertexEditTables const *editTables = farMesh->GetVertexEdit();
|
||||
if (editTables) {
|
||||
int numEditBatches = editTables->GetNumBatches();
|
||||
_editTables.reserve(numEditBatches);
|
||||
for (int i = 0; i < numEditBatches; ++i) {
|
||||
const FarVertexEditTables<OsdVertex>::VertexEditBatch & edit =
|
||||
const FarVertexEditTables::VertexEditBatch & edit =
|
||||
editTables->GetBatch(i);
|
||||
_editTables.push_back(new OsdD3D11ComputeHEditTable(edit, deviceContext));
|
||||
}
|
||||
@ -294,20 +293,20 @@ OsdD3D11ComputeContext::bindShaderStorageBuffers() {
|
||||
_deviceContext->CSSetUnorderedAccessViews(1, 1, &_currentVaryingBufferUAV, 0); // u1
|
||||
|
||||
// XXX: should be better handling for loop subdivision.
|
||||
if (_tables[FarSubdivisionTables<OsdVertex>::F_IT]) {
|
||||
if (_tables[FarSubdivisionTables::F_IT]) {
|
||||
ID3D11ShaderResourceView *SRViews[] = {
|
||||
_tables[FarSubdivisionTables<OsdVertex>::F_IT]->GetSRV(),
|
||||
_tables[FarSubdivisionTables<OsdVertex>::F_ITa]->GetSRV(),
|
||||
_tables[FarSubdivisionTables::F_IT]->GetSRV(),
|
||||
_tables[FarSubdivisionTables::F_ITa]->GetSRV(),
|
||||
};
|
||||
_deviceContext->CSSetShaderResources(2, 2, SRViews); // t2-t3
|
||||
}
|
||||
|
||||
ID3D11ShaderResourceView *SRViews[] = {
|
||||
_tables[FarSubdivisionTables<OsdVertex>::E_IT]->GetSRV(),
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_IT]->GetSRV(),
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_ITa]->GetSRV(),
|
||||
_tables[FarSubdivisionTables<OsdVertex>::E_W]->GetSRV(),
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_W]->GetSRV(),
|
||||
_tables[FarSubdivisionTables::E_IT]->GetSRV(),
|
||||
_tables[FarSubdivisionTables::V_IT]->GetSRV(),
|
||||
_tables[FarSubdivisionTables::V_ITa]->GetSRV(),
|
||||
_tables[FarSubdivisionTables::E_W]->GetSRV(),
|
||||
_tables[FarSubdivisionTables::V_W]->GetSRV(),
|
||||
};
|
||||
_deviceContext->CSSetShaderResources(4, 5, SRViews); // t4-t8
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
#include "../far/mesh.h"
|
||||
#include "../far/vertexEditTables.h"
|
||||
#include "../osd/vertex.h"
|
||||
#include "../osd/vertexDescriptor.h"
|
||||
@ -67,8 +68,8 @@ private:
|
||||
|
||||
class OsdD3D11ComputeHEditTable : OsdNonCopyable<OsdD3D11ComputeHEditTable> {
|
||||
public:
|
||||
OsdD3D11ComputeHEditTable(const FarVertexEditTables<OsdVertex>::
|
||||
VertexEditBatch &batch, ID3D11DeviceContext *deviceContext);
|
||||
OsdD3D11ComputeHEditTable(const FarVertexEditTables::VertexEditBatch &batch,
|
||||
ID3D11DeviceContext *deviceContext);
|
||||
|
||||
virtual ~OsdD3D11ComputeHEditTable();
|
||||
|
||||
|
@ -91,10 +91,8 @@ OsdD3D11ComputeController::getKernels(int numVertexElements,
|
||||
|
||||
void
|
||||
OsdD3D11ComputeController::ApplyBilinearFaceVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdD3D11ComputeContext *context) const {
|
||||
|
||||
OsdD3D11ComputeContext * context =
|
||||
static_cast<OsdD3D11ComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdD3D11ComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -105,10 +103,8 @@ OsdD3D11ComputeController::ApplyBilinearFaceVerticesKernel(
|
||||
|
||||
void
|
||||
OsdD3D11ComputeController::ApplyBilinearEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdD3D11ComputeContext *context) const {
|
||||
|
||||
OsdD3D11ComputeContext * context =
|
||||
static_cast<OsdD3D11ComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdD3D11ComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -119,10 +115,8 @@ OsdD3D11ComputeController::ApplyBilinearEdgeVerticesKernel(
|
||||
|
||||
void
|
||||
OsdD3D11ComputeController::ApplyBilinearVertexVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdD3D11ComputeContext *context) const {
|
||||
|
||||
OsdD3D11ComputeContext * context =
|
||||
static_cast<OsdD3D11ComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdD3D11ComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -133,10 +127,8 @@ OsdD3D11ComputeController::ApplyBilinearVertexVerticesKernel(
|
||||
|
||||
void
|
||||
OsdD3D11ComputeController::ApplyCatmarkFaceVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdD3D11ComputeContext *context) const {
|
||||
|
||||
OsdD3D11ComputeContext * context =
|
||||
static_cast<OsdD3D11ComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdD3D11ComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -149,10 +141,8 @@ OsdD3D11ComputeController::ApplyCatmarkFaceVerticesKernel(
|
||||
|
||||
void
|
||||
OsdD3D11ComputeController::ApplyCatmarkEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdD3D11ComputeContext *context) const {
|
||||
|
||||
OsdD3D11ComputeContext * context =
|
||||
static_cast<OsdD3D11ComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdD3D11ComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -163,10 +153,8 @@ OsdD3D11ComputeController::ApplyCatmarkEdgeVerticesKernel(
|
||||
|
||||
void
|
||||
OsdD3D11ComputeController::ApplyCatmarkVertexVerticesKernelB(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdD3D11ComputeContext *context) const {
|
||||
|
||||
OsdD3D11ComputeContext * context =
|
||||
static_cast<OsdD3D11ComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdD3D11ComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -177,10 +165,8 @@ OsdD3D11ComputeController::ApplyCatmarkVertexVerticesKernelB(
|
||||
|
||||
void
|
||||
OsdD3D11ComputeController::ApplyCatmarkVertexVerticesKernelA1(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdD3D11ComputeContext *context) const {
|
||||
|
||||
OsdD3D11ComputeContext * context =
|
||||
static_cast<OsdD3D11ComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdD3D11ComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -191,10 +177,8 @@ OsdD3D11ComputeController::ApplyCatmarkVertexVerticesKernelA1(
|
||||
|
||||
void
|
||||
OsdD3D11ComputeController::ApplyCatmarkVertexVerticesKernelA2(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdD3D11ComputeContext *context) const {
|
||||
|
||||
OsdD3D11ComputeContext * context =
|
||||
static_cast<OsdD3D11ComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdD3D11ComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -205,10 +189,8 @@ OsdD3D11ComputeController::ApplyCatmarkVertexVerticesKernelA2(
|
||||
|
||||
void
|
||||
OsdD3D11ComputeController::ApplyLoopEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdD3D11ComputeContext *context) const {
|
||||
|
||||
OsdD3D11ComputeContext * context =
|
||||
static_cast<OsdD3D11ComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdD3D11ComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -219,10 +201,8 @@ OsdD3D11ComputeController::ApplyLoopEdgeVerticesKernel(
|
||||
|
||||
void
|
||||
OsdD3D11ComputeController::ApplyLoopVertexVerticesKernelB(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdD3D11ComputeContext *context) const {
|
||||
|
||||
OsdD3D11ComputeContext * context =
|
||||
static_cast<OsdD3D11ComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdD3D11ComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -233,10 +213,8 @@ OsdD3D11ComputeController::ApplyLoopVertexVerticesKernelB(
|
||||
|
||||
void
|
||||
OsdD3D11ComputeController::ApplyLoopVertexVerticesKernelA1(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdD3D11ComputeContext *context) const {
|
||||
|
||||
OsdD3D11ComputeContext * context =
|
||||
static_cast<OsdD3D11ComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdD3D11ComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -247,10 +225,8 @@ OsdD3D11ComputeController::ApplyLoopVertexVerticesKernelA1(
|
||||
|
||||
void
|
||||
OsdD3D11ComputeController::ApplyLoopVertexVerticesKernelA2(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdD3D11ComputeContext *context) const {
|
||||
|
||||
OsdD3D11ComputeContext * context =
|
||||
static_cast<OsdD3D11ComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdD3D11ComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -261,10 +237,8 @@ OsdD3D11ComputeController::ApplyLoopVertexVerticesKernelA2(
|
||||
|
||||
void
|
||||
OsdD3D11ComputeController::ApplyVertexEdits(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdD3D11ComputeContext *context) const {
|
||||
|
||||
OsdD3D11ComputeContext * context =
|
||||
static_cast<OsdD3D11ComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdD3D11ComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
|
30
opensubdiv/osd/d3d11ComputeController.h
Normal file → Executable file
30
opensubdiv/osd/d3d11ComputeController.h
Normal file → Executable file
@ -89,9 +89,9 @@ public:
|
||||
context->SetKernelBundle(getKernels(numVertexElements, numVaryingElements));
|
||||
context->Bind(vertexBuffer, varyingBuffer);
|
||||
FarDispatcher::Refine(this,
|
||||
context,
|
||||
batches,
|
||||
-1,
|
||||
context);
|
||||
-1);
|
||||
context->Unbind();
|
||||
}
|
||||
|
||||
@ -116,34 +116,34 @@ public:
|
||||
|
||||
protected:
|
||||
friend class FarDispatcher;
|
||||
void ApplyBilinearFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearFaceVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyBilinearEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyBilinearVertexVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearVertexVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
void ApplyCatmarkFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkFaceVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelB(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelA1(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelA2(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
void ApplyLoopEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelB(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelA1(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelA2(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
void ApplyVertexEdits(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyVertexEdits(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
OsdD3D11ComputeKernelBundle * getKernels(int numVertexElements,
|
||||
int numVaryingElements);
|
||||
|
@ -64,7 +64,7 @@ OsdDrawContext::ConvertPatchArrays(FarPatchTables::PatchArrayVector const &farPa
|
||||
#if defined(GL_ES_VERSION_2_0)
|
||||
// XXX: farmesh should have FarDensePatchTable for dense mesh indices.
|
||||
// instead of GetFaceVertices().
|
||||
const FarSubdivisionTables<OsdVertex> *tables = farMesh->GetSubdivisionTables();
|
||||
const FarSubdivisionTables *tables = farMesh->GetSubdivisionTables();
|
||||
int level = tables->GetMaxLevel();
|
||||
const std::vector<int> &indices = farMesh->GetFaceVertices(level-1);
|
||||
|
||||
|
@ -35,227 +35,201 @@ OsdGcdComputeController::OsdGcdComputeController() {
|
||||
}
|
||||
|
||||
void
|
||||
OsdGcdComputeController::ApplyBilinearFaceVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
OsdGcdComputeController::ApplyBilinearFaceVerticesxKernel(
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGcdComputeFace(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::F_IT)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::F_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::F_IT)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::F_ITa)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd(),
|
||||
_gcd_queue);
|
||||
}
|
||||
|
||||
void
|
||||
OsdGcdComputeController::ApplyBilinearEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGcdComputeBilinearEdge(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::E_IT)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::E_IT)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd(),
|
||||
_gcd_queue);
|
||||
}
|
||||
|
||||
void
|
||||
OsdGcdComputeController::ApplyBilinearVertexVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGcdComputeBilinearVertex(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd(),
|
||||
_gcd_queue);
|
||||
}
|
||||
|
||||
void
|
||||
OsdGcdComputeController::ApplyCatmarkFaceVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGcdComputeFace(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::F_IT)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::F_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::F_IT)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::F_ITa)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd(),
|
||||
_gcd_queue);
|
||||
}
|
||||
|
||||
void
|
||||
OsdGcdComputeController::ApplyCatmarkEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGcdComputeEdge(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::E_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::E_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::E_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::E_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd(),
|
||||
_gcd_queue);
|
||||
}
|
||||
|
||||
void
|
||||
OsdGcdComputeController::ApplyCatmarkVertexVerticesKernelB(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGcdComputeVertexB(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::V_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd(),
|
||||
_gcd_queue);
|
||||
}
|
||||
|
||||
void
|
||||
OsdGcdComputeController::ApplyCatmarkVertexVerticesKernelA1(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGcdComputeVertexA(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::V_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd(), false,
|
||||
_gcd_queue);
|
||||
}
|
||||
|
||||
void
|
||||
OsdGcdComputeController::ApplyCatmarkVertexVerticesKernelA2(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGcdComputeVertexA(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::V_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd(), true,
|
||||
_gcd_queue);
|
||||
}
|
||||
|
||||
void
|
||||
OsdGcdComputeController::ApplyLoopEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGcdComputeEdge(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::E_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::E_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::E_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::E_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd(),
|
||||
_gcd_queue);
|
||||
}
|
||||
|
||||
void
|
||||
OsdGcdComputeController::ApplyLoopVertexVerticesKernelB(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGcdComputeLoopVertexB(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::V_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd(),
|
||||
_gcd_queue);
|
||||
}
|
||||
|
||||
void
|
||||
OsdGcdComputeController::ApplyLoopVertexVerticesKernelA1(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGcdComputeVertexA(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::V_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd(), false,
|
||||
_gcd_queue);
|
||||
}
|
||||
|
||||
void
|
||||
OsdGcdComputeController::ApplyLoopVertexVerticesKernelA2(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGcdComputeVertexA(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::V_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd(), true,
|
||||
_gcd_queue);
|
||||
}
|
||||
|
||||
void
|
||||
OsdGcdComputeController::ApplyVertexEdits(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
const OsdCpuHEditTable *edit = context->GetEditTable(batch.GetTableIndex());
|
||||
|
@ -73,10 +73,9 @@ public:
|
||||
if (batches.empty()) return;
|
||||
|
||||
context->Bind(vertexBuffer, varyingBuffer);
|
||||
FarDispatcher::Refine(this,
|
||||
batches,
|
||||
-1,
|
||||
context);
|
||||
|
||||
FarDispatcher::Refine(this, context, batches, /*maxlevel*/-1);
|
||||
|
||||
context->Unbind();
|
||||
}
|
||||
|
||||
@ -101,34 +100,34 @@ public:
|
||||
|
||||
protected:
|
||||
friend class FarDispatcher;
|
||||
void ApplyBilinearFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearFaceVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyBilinearEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyBilinearVertexVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearVertexVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
void ApplyCatmarkFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkFaceVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelB(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelA1(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelA2(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
void ApplyLoopEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelB(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelA1(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelA2(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
void ApplyVertexEdits(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyVertexEdits(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
private:
|
||||
dispatch_queue_t _gcd_queue;
|
||||
|
@ -124,7 +124,7 @@ OsdGLDrawContext::create(FarPatchTables const * patchTables, bool requireFVarDat
|
||||
#if defined(GL_ES_VERSION_2_0)
|
||||
// XXX: farmesh should have FarDensePatchTable for dense mesh indices.
|
||||
// instead of GetFaceVertices().
|
||||
const FarSubdivisionTables<OsdVertex> *tables = farMesh->GetSubdivisionTables();
|
||||
const FarSubdivisionTables *tables = farMesh->GetSubdivisionTables();
|
||||
int level = tables->GetMaxLevel();
|
||||
const std::vector<int> &indices = farMesh->GetFaceVertices(level-1);
|
||||
|
||||
|
@ -62,7 +62,7 @@ OsdGLSLComputeTable::GetBuffer() const {
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
OsdGLSLComputeHEditTable::OsdGLSLComputeHEditTable(
|
||||
const FarVertexEditTables<OsdVertex>::VertexEditBatch &batch)
|
||||
const FarVertexEditTables::VertexEditBatch &batch)
|
||||
: _primvarIndicesTable(new OsdGLSLComputeTable(batch.GetVertexIndices())),
|
||||
_editValuesTable(new OsdGLSLComputeTable(batch.GetValues())) {
|
||||
|
||||
@ -113,7 +113,7 @@ OsdGLSLComputeContext::OsdGLSLComputeContext(
|
||||
FarMesh<OsdVertex> const *farMesh)
|
||||
: _vertexTexture(0), _varyingTexture(0) {
|
||||
|
||||
FarSubdivisionTables<OsdVertex> const * farTables =
|
||||
FarSubdivisionTables const * farTables =
|
||||
farMesh->GetSubdivisionTables();
|
||||
|
||||
// allocate 5 or 7 tables
|
||||
@ -122,29 +122,29 @@ OsdGLSLComputeContext::OsdGLSLComputeContext(
|
||||
// bindShaderStorageBuffer()...
|
||||
_tables.resize(7, 0);
|
||||
|
||||
_tables[FarSubdivisionTables<OsdVertex>::E_IT] = new OsdGLSLComputeTable(farTables->Get_E_IT());
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_IT] = new OsdGLSLComputeTable(farTables->Get_V_IT());
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_ITa] = new OsdGLSLComputeTable(farTables->Get_V_ITa());
|
||||
_tables[FarSubdivisionTables<OsdVertex>::E_W] = new OsdGLSLComputeTable(farTables->Get_E_W());
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_W] = new OsdGLSLComputeTable(farTables->Get_V_W());
|
||||
_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());
|
||||
|
||||
if (farTables->GetNumTables() > 5) {
|
||||
// catmark, bilinear
|
||||
_tables[FarSubdivisionTables<OsdVertex>::F_IT] = new OsdGLSLComputeTable(farTables->Get_F_IT());
|
||||
_tables[FarSubdivisionTables<OsdVertex>::F_ITa] = new OsdGLSLComputeTable(farTables->Get_F_ITa());
|
||||
_tables[FarSubdivisionTables::F_IT] = new OsdGLSLComputeTable(farTables->Get_F_IT());
|
||||
_tables[FarSubdivisionTables::F_ITa] = new OsdGLSLComputeTable(farTables->Get_F_ITa());
|
||||
} else {
|
||||
// loop
|
||||
_tables[FarSubdivisionTables<OsdVertex>::F_IT] = NULL;
|
||||
_tables[FarSubdivisionTables<OsdVertex>::F_ITa] = NULL;
|
||||
_tables[FarSubdivisionTables::F_IT] = NULL;
|
||||
_tables[FarSubdivisionTables::F_ITa] = NULL;
|
||||
}
|
||||
|
||||
// create hedit tables
|
||||
FarVertexEditTables<OsdVertex> const *editTables = farMesh->GetVertexEdit();
|
||||
FarVertexEditTables const *editTables = farMesh->GetVertexEdit();
|
||||
if (editTables) {
|
||||
int numEditBatches = editTables->GetNumBatches();
|
||||
_editTables.reserve(numEditBatches);
|
||||
for (int i = 0; i < numEditBatches; ++i) {
|
||||
const FarVertexEditTables<OsdVertex>::VertexEditBatch & edit =
|
||||
const FarVertexEditTables::VertexEditBatch & edit =
|
||||
editTables->GetBatch(i);
|
||||
_editTables.push_back(new OsdGLSLComputeHEditTable(edit));
|
||||
}
|
||||
@ -242,23 +242,23 @@ OsdGLSLComputeContext::bindShaderStorageBuffers() {
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, _currentVaryingBuffer);
|
||||
|
||||
// XXX: should be better handling for loop subdivision.
|
||||
if (_tables[FarSubdivisionTables<OsdVertex>::F_IT]) {
|
||||
if (_tables[FarSubdivisionTables::F_IT]) {
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2,
|
||||
_tables[FarSubdivisionTables<OsdVertex>::F_IT]->GetBuffer());
|
||||
_tables[FarSubdivisionTables::F_IT]->GetBuffer());
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 3,
|
||||
_tables[FarSubdivisionTables<OsdVertex>::F_ITa]->GetBuffer());
|
||||
_tables[FarSubdivisionTables::F_ITa]->GetBuffer());
|
||||
}
|
||||
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 4,
|
||||
_tables[FarSubdivisionTables<OsdVertex>::E_IT]->GetBuffer());
|
||||
_tables[FarSubdivisionTables::E_IT]->GetBuffer());
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 5,
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_IT]->GetBuffer());
|
||||
_tables[FarSubdivisionTables::V_IT]->GetBuffer());
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 6,
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_ITa]->GetBuffer());
|
||||
_tables[FarSubdivisionTables::V_ITa]->GetBuffer());
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 7,
|
||||
_tables[FarSubdivisionTables<OsdVertex>::E_W]->GetBuffer());
|
||||
_tables[FarSubdivisionTables::E_W]->GetBuffer());
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 8,
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_W]->GetBuffer());
|
||||
_tables[FarSubdivisionTables::V_W]->GetBuffer());
|
||||
}
|
||||
|
||||
void
|
||||
@ -266,7 +266,7 @@ OsdGLSLComputeContext::unbindShaderStorageBuffers() {
|
||||
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, 0);
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, 0);
|
||||
if (_tables[FarSubdivisionTables<OsdVertex>::F_IT]) {
|
||||
if (_tables[FarSubdivisionTables::F_IT]) {
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, 0);
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 3, 0);
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
#include "../far/mesh.h"
|
||||
#include "../far/vertexEditTables.h"
|
||||
#include "../osd/vertex.h"
|
||||
#include "../osd/vertexDescriptor.h"
|
||||
@ -62,7 +63,7 @@ private:
|
||||
|
||||
class OsdGLSLComputeHEditTable : OsdNonCopyable<OsdGLSLComputeHEditTable> {
|
||||
public:
|
||||
OsdGLSLComputeHEditTable(const FarVertexEditTables<OsdVertex>::
|
||||
OsdGLSLComputeHEditTable(const FarVertexEditTables::
|
||||
VertexEditBatch &batch);
|
||||
|
||||
virtual ~OsdGLSLComputeHEditTable();
|
||||
|
@ -73,10 +73,8 @@ OsdGLSLComputeController::getKernels(int numVertexElements,
|
||||
|
||||
void
|
||||
OsdGLSLComputeController::ApplyBilinearFaceVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLComputeContext *context) const {
|
||||
|
||||
OsdGLSLComputeContext * context =
|
||||
static_cast<OsdGLSLComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -87,10 +85,8 @@ OsdGLSLComputeController::ApplyBilinearFaceVerticesKernel(
|
||||
|
||||
void
|
||||
OsdGLSLComputeController::ApplyBilinearEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLComputeContext *context) const {
|
||||
|
||||
OsdGLSLComputeContext * context =
|
||||
static_cast<OsdGLSLComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -101,10 +97,8 @@ OsdGLSLComputeController::ApplyBilinearEdgeVerticesKernel(
|
||||
|
||||
void
|
||||
OsdGLSLComputeController::ApplyBilinearVertexVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLComputeContext *context) const {
|
||||
|
||||
OsdGLSLComputeContext * context =
|
||||
static_cast<OsdGLSLComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -115,10 +109,8 @@ OsdGLSLComputeController::ApplyBilinearVertexVerticesKernel(
|
||||
|
||||
void
|
||||
OsdGLSLComputeController::ApplyCatmarkFaceVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLComputeContext *context) const {
|
||||
|
||||
OsdGLSLComputeContext * context =
|
||||
static_cast<OsdGLSLComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -131,10 +123,8 @@ OsdGLSLComputeController::ApplyCatmarkFaceVerticesKernel(
|
||||
|
||||
void
|
||||
OsdGLSLComputeController::ApplyCatmarkEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLComputeContext *context) const {
|
||||
|
||||
OsdGLSLComputeContext * context =
|
||||
static_cast<OsdGLSLComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -145,10 +135,8 @@ OsdGLSLComputeController::ApplyCatmarkEdgeVerticesKernel(
|
||||
|
||||
void
|
||||
OsdGLSLComputeController::ApplyCatmarkVertexVerticesKernelB(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLComputeContext *context) const {
|
||||
|
||||
OsdGLSLComputeContext * context =
|
||||
static_cast<OsdGLSLComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -159,10 +147,8 @@ OsdGLSLComputeController::ApplyCatmarkVertexVerticesKernelB(
|
||||
|
||||
void
|
||||
OsdGLSLComputeController::ApplyCatmarkVertexVerticesKernelA1(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLComputeContext *context) const {
|
||||
|
||||
OsdGLSLComputeContext * context =
|
||||
static_cast<OsdGLSLComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -173,10 +159,8 @@ OsdGLSLComputeController::ApplyCatmarkVertexVerticesKernelA1(
|
||||
|
||||
void
|
||||
OsdGLSLComputeController::ApplyCatmarkVertexVerticesKernelA2(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLComputeContext *context) const {
|
||||
|
||||
OsdGLSLComputeContext * context =
|
||||
static_cast<OsdGLSLComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -187,10 +171,8 @@ OsdGLSLComputeController::ApplyCatmarkVertexVerticesKernelA2(
|
||||
|
||||
void
|
||||
OsdGLSLComputeController::ApplyLoopEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLComputeContext *context) const {
|
||||
|
||||
OsdGLSLComputeContext * context =
|
||||
static_cast<OsdGLSLComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -201,10 +183,8 @@ OsdGLSLComputeController::ApplyLoopEdgeVerticesKernel(
|
||||
|
||||
void
|
||||
OsdGLSLComputeController::ApplyLoopVertexVerticesKernelB(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLComputeContext *context) const {
|
||||
|
||||
OsdGLSLComputeContext * context =
|
||||
static_cast<OsdGLSLComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -215,10 +195,8 @@ OsdGLSLComputeController::ApplyLoopVertexVerticesKernelB(
|
||||
|
||||
void
|
||||
OsdGLSLComputeController::ApplyLoopVertexVerticesKernelA1(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLComputeContext *context) const {
|
||||
|
||||
OsdGLSLComputeContext * context =
|
||||
static_cast<OsdGLSLComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -229,10 +207,8 @@ OsdGLSLComputeController::ApplyLoopVertexVerticesKernelA1(
|
||||
|
||||
void
|
||||
OsdGLSLComputeController::ApplyLoopVertexVerticesKernelA2(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLComputeContext *context) const {
|
||||
|
||||
OsdGLSLComputeContext * context =
|
||||
static_cast<OsdGLSLComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -243,10 +219,8 @@ OsdGLSLComputeController::ApplyLoopVertexVerticesKernelA2(
|
||||
|
||||
void
|
||||
OsdGLSLComputeController::ApplyVertexEdits(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLComputeContext *context) const {
|
||||
|
||||
OsdGLSLComputeContext * context =
|
||||
static_cast<OsdGLSLComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLComputeKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
|
@ -82,10 +82,9 @@ public:
|
||||
|
||||
context->SetKernelBundle(getKernels(numVertexElements, numVaryingElements));
|
||||
context->Bind(vertexBuffer, varyingBuffer);
|
||||
FarDispatcher::Refine(this,
|
||||
batches,
|
||||
-1,
|
||||
context);
|
||||
|
||||
FarDispatcher::Refine(this, context, batches, /*maxlevel*/-1);
|
||||
|
||||
context->Unbind();
|
||||
}
|
||||
|
||||
@ -110,34 +109,34 @@ public:
|
||||
|
||||
protected:
|
||||
friend class FarDispatcher;
|
||||
void ApplyBilinearFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearFaceVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyBilinearEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyBilinearVertexVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearVertexVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
void ApplyCatmarkFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkFaceVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelB(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelA1(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelA2(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
void ApplyLoopEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelB(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelA1(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelA2(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
void ApplyVertexEdits(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyVertexEdits(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
OsdGLSLComputeKernelBundle * getKernels(int numVertexElements,
|
||||
int numVaryingElements);
|
||||
|
@ -135,13 +135,13 @@ OsdGLSLComputeKernelBundle::Compile(int numVertexElements, int numVaryingElement
|
||||
_uniformIndexStart = glGetUniformLocation(_program, "indexStart");
|
||||
_uniformIndexEnd = glGetUniformLocation(_program, "indexEnd");
|
||||
|
||||
_tableUniforms[FarSubdivisionTables<OsdVertex>::F_IT] = glGetUniformLocation(_program, "_F0_IT");
|
||||
_tableUniforms[FarSubdivisionTables<OsdVertex>::F_ITa] = glGetUniformLocation(_program, "_F0_ITa");
|
||||
_tableUniforms[FarSubdivisionTables<OsdVertex>::E_IT] = glGetUniformLocation(_program, "_E0_IT");
|
||||
_tableUniforms[FarSubdivisionTables<OsdVertex>::V_IT] = glGetUniformLocation(_program, "_V0_IT");
|
||||
_tableUniforms[FarSubdivisionTables<OsdVertex>::V_ITa] = glGetUniformLocation(_program, "_V0_ITa");
|
||||
_tableUniforms[FarSubdivisionTables<OsdVertex>::E_W] = glGetUniformLocation(_program, "_E0_S");
|
||||
_tableUniforms[FarSubdivisionTables<OsdVertex>::V_W] = glGetUniformLocation(_program, "_V0_S");
|
||||
_tableUniforms[FarSubdivisionTables::F_IT] = glGetUniformLocation(_program, "_F0_IT");
|
||||
_tableUniforms[FarSubdivisionTables::F_ITa] = glGetUniformLocation(_program, "_F0_ITa");
|
||||
_tableUniforms[FarSubdivisionTables::E_IT] = glGetUniformLocation(_program, "_E0_IT");
|
||||
_tableUniforms[FarSubdivisionTables::V_IT] = glGetUniformLocation(_program, "_V0_IT");
|
||||
_tableUniforms[FarSubdivisionTables::V_ITa] = glGetUniformLocation(_program, "_V0_ITa");
|
||||
_tableUniforms[FarSubdivisionTables::E_W] = glGetUniformLocation(_program, "_E0_S");
|
||||
_tableUniforms[FarSubdivisionTables::V_W] = glGetUniformLocation(_program, "_V0_S");
|
||||
|
||||
// set unfiorm locations for edit
|
||||
_subEditAdd = glGetSubroutineIndex(_program,
|
||||
|
@ -105,7 +105,7 @@ protected:
|
||||
GLuint _program;
|
||||
|
||||
// uniform locations for compute
|
||||
GLuint _tableUniforms[FarSubdivisionTables<OsdVertex>::TABLE_TYPES_COUNT];
|
||||
GLuint _tableUniforms[FarSubdivisionTables::TABLE_TYPES_COUNT];
|
||||
GLuint _uniformVertexPass;
|
||||
GLuint _uniformVertexOffset;
|
||||
GLuint _uniformTableOffset;
|
||||
|
@ -69,7 +69,8 @@ OsdGLSLTransformFeedbackTable::GetTexture() const {
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
OsdGLSLTransformFeedbackHEditTable::OsdGLSLTransformFeedbackHEditTable(const FarVertexEditTables<OsdVertex>::VertexEditBatch &batch)
|
||||
OsdGLSLTransformFeedbackHEditTable::OsdGLSLTransformFeedbackHEditTable(
|
||||
const FarVertexEditTables::VertexEditBatch &batch)
|
||||
: _primvarIndicesTable(new OsdGLSLTransformFeedbackTable(batch.GetVertexIndices(), GL_R32UI)),
|
||||
_editValuesTable(new OsdGLSLTransformFeedbackTable(batch.GetValues(), GL_R32F)) {
|
||||
|
||||
@ -120,35 +121,35 @@ OsdGLSLTransformFeedbackComputeContext::OsdGLSLTransformFeedbackComputeContext(
|
||||
FarMesh<OsdVertex> const *farMesh) :
|
||||
_vertexTexture(0), _varyingTexture(0) {
|
||||
|
||||
FarSubdivisionTables<OsdVertex> const * farTables =
|
||||
FarSubdivisionTables const * farTables =
|
||||
farMesh->GetSubdivisionTables();
|
||||
|
||||
// allocate 5 or 7 tables
|
||||
_tables.resize(7, 0);
|
||||
|
||||
_tables[FarSubdivisionTables<OsdVertex>::E_IT] = new OsdGLSLTransformFeedbackTable(farTables->Get_E_IT(), GL_R32I);
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_IT] = new OsdGLSLTransformFeedbackTable(farTables->Get_V_IT(), GL_R32UI);
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_ITa] = new OsdGLSLTransformFeedbackTable(farTables->Get_V_ITa(), GL_R32I);
|
||||
_tables[FarSubdivisionTables<OsdVertex>::E_W] = new OsdGLSLTransformFeedbackTable(farTables->Get_E_W(), GL_R32F);
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_W] = new OsdGLSLTransformFeedbackTable(farTables->Get_V_W(), GL_R32F);
|
||||
_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);
|
||||
|
||||
if (farTables->GetNumTables() > 5) {
|
||||
// catmark, bilinear
|
||||
_tables[FarSubdivisionTables<OsdVertex>::F_IT] = new OsdGLSLTransformFeedbackTable(farTables->Get_F_IT(), GL_R32UI);
|
||||
_tables[FarSubdivisionTables<OsdVertex>::F_ITa] = new OsdGLSLTransformFeedbackTable(farTables->Get_F_ITa(), GL_R32I);
|
||||
_tables[FarSubdivisionTables::F_IT] = new OsdGLSLTransformFeedbackTable(farTables->Get_F_IT(), GL_R32UI);
|
||||
_tables[FarSubdivisionTables::F_ITa] = new OsdGLSLTransformFeedbackTable(farTables->Get_F_ITa(), GL_R32I);
|
||||
} else {
|
||||
// loop
|
||||
_tables[FarSubdivisionTables<OsdVertex>::F_IT] = NULL;
|
||||
_tables[FarSubdivisionTables<OsdVertex>::F_ITa] = NULL;
|
||||
_tables[FarSubdivisionTables::F_IT] = NULL;
|
||||
_tables[FarSubdivisionTables::F_ITa] = NULL;
|
||||
}
|
||||
|
||||
// create hedit tables
|
||||
FarVertexEditTables<OsdVertex> const *editTables = farMesh->GetVertexEdit();
|
||||
FarVertexEditTables const *editTables = farMesh->GetVertexEdit();
|
||||
if (editTables) {
|
||||
int numEditBatches = editTables->GetNumBatches();
|
||||
_editTables.reserve(numEditBatches);
|
||||
for (int i = 0; i < numEditBatches; ++i) {
|
||||
const FarVertexEditTables<OsdVertex>::VertexEditBatch & edit = editTables->GetBatch(i);
|
||||
const FarVertexEditTables::VertexEditBatch & edit = editTables->GetBatch(i);
|
||||
_editTables.push_back(new OsdGLSLTransformFeedbackHEditTable(edit));
|
||||
}
|
||||
}
|
||||
@ -278,23 +279,23 @@ OsdGLSLTransformFeedbackComputeContext::bind() {
|
||||
bindTexture(_kernelBundle->GetVaryingUniformLocation(), _varyingTexture, 1);
|
||||
|
||||
// XXX: loop...
|
||||
if (_tables[FarSubdivisionTables<OsdVertex>::F_IT]) {
|
||||
bindTexture(_kernelBundle->GetTableUniformLocation(FarSubdivisionTables<OsdVertex>::F_IT),
|
||||
_tables[FarSubdivisionTables<OsdVertex>::F_IT]->GetTexture(), 2);
|
||||
bindTexture(_kernelBundle->GetTableUniformLocation(FarSubdivisionTables<OsdVertex>::F_ITa),
|
||||
_tables[FarSubdivisionTables<OsdVertex>::F_ITa]->GetTexture(), 3);
|
||||
if (_tables[FarSubdivisionTables::F_IT]) {
|
||||
bindTexture(_kernelBundle->GetTableUniformLocation(FarSubdivisionTables::F_IT),
|
||||
_tables[FarSubdivisionTables::F_IT]->GetTexture(), 2);
|
||||
bindTexture(_kernelBundle->GetTableUniformLocation(FarSubdivisionTables::F_ITa),
|
||||
_tables[FarSubdivisionTables::F_ITa]->GetTexture(), 3);
|
||||
}
|
||||
|
||||
bindTexture(_kernelBundle->GetTableUniformLocation(FarSubdivisionTables<OsdVertex>::E_IT),
|
||||
_tables[FarSubdivisionTables<OsdVertex>::E_IT]->GetTexture(), 4);
|
||||
bindTexture(_kernelBundle->GetTableUniformLocation(FarSubdivisionTables<OsdVertex>::V_IT),
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_IT]->GetTexture(), 5);
|
||||
bindTexture(_kernelBundle->GetTableUniformLocation(FarSubdivisionTables<OsdVertex>::V_ITa),
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_ITa]->GetTexture(), 6);
|
||||
bindTexture(_kernelBundle->GetTableUniformLocation(FarSubdivisionTables<OsdVertex>::E_W),
|
||||
_tables[FarSubdivisionTables<OsdVertex>::E_W]->GetTexture(), 7);
|
||||
bindTexture(_kernelBundle->GetTableUniformLocation(FarSubdivisionTables<OsdVertex>::V_W),
|
||||
_tables[FarSubdivisionTables<OsdVertex>::V_W]->GetTexture(), 8);
|
||||
bindTexture(_kernelBundle->GetTableUniformLocation(FarSubdivisionTables::E_IT),
|
||||
_tables[FarSubdivisionTables::E_IT]->GetTexture(), 4);
|
||||
bindTexture(_kernelBundle->GetTableUniformLocation(FarSubdivisionTables::V_IT),
|
||||
_tables[FarSubdivisionTables::V_IT]->GetTexture(), 5);
|
||||
bindTexture(_kernelBundle->GetTableUniformLocation(FarSubdivisionTables::V_ITa),
|
||||
_tables[FarSubdivisionTables::V_ITa]->GetTexture(), 6);
|
||||
bindTexture(_kernelBundle->GetTableUniformLocation(FarSubdivisionTables::E_W),
|
||||
_tables[FarSubdivisionTables::E_W]->GetTexture(), 7);
|
||||
bindTexture(_kernelBundle->GetTableUniformLocation(FarSubdivisionTables::V_W),
|
||||
_tables[FarSubdivisionTables::V_W]->GetTexture(), 8);
|
||||
|
||||
// bind texture image (for edit kernel)
|
||||
glUniform1i(_kernelBundle->GetVertexBufferImageUniformLocation(), 0);
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
#include "../far/mesh.h"
|
||||
#include "../far/vertexEditTables.h"
|
||||
#include "../osd/vertex.h"
|
||||
#include "../osd/vertexDescriptor.h"
|
||||
@ -61,8 +62,8 @@ private:
|
||||
|
||||
class OsdGLSLTransformFeedbackHEditTable : OsdNonCopyable<OsdGLSLTransformFeedbackHEditTable> {
|
||||
public:
|
||||
OsdGLSLTransformFeedbackHEditTable(const FarVertexEditTables<OsdVertex>::
|
||||
VertexEditBatch &batch);
|
||||
OsdGLSLTransformFeedbackHEditTable(
|
||||
const FarVertexEditTables::VertexEditBatch &batch);
|
||||
|
||||
virtual ~OsdGLSLTransformFeedbackHEditTable();
|
||||
|
||||
|
@ -72,10 +72,8 @@ OsdGLSLTransformFeedbackComputeController::getKernels(int numVertexElements,
|
||||
|
||||
void
|
||||
OsdGLSLTransformFeedbackComputeController::ApplyBilinearFaceVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLTransformFeedbackComputeContext *context) const {
|
||||
|
||||
OsdGLSLTransformFeedbackComputeContext * context =
|
||||
static_cast<OsdGLSLTransformFeedbackComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLTransformFeedbackKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -90,10 +88,8 @@ OsdGLSLTransformFeedbackComputeController::ApplyBilinearFaceVerticesKernel(
|
||||
|
||||
void
|
||||
OsdGLSLTransformFeedbackComputeController::ApplyBilinearEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLTransformFeedbackComputeContext *context) const {
|
||||
|
||||
OsdGLSLTransformFeedbackComputeContext * context =
|
||||
static_cast<OsdGLSLTransformFeedbackComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLTransformFeedbackKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -108,10 +104,8 @@ OsdGLSLTransformFeedbackComputeController::ApplyBilinearEdgeVerticesKernel(
|
||||
|
||||
void
|
||||
OsdGLSLTransformFeedbackComputeController::ApplyBilinearVertexVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLTransformFeedbackComputeContext *context) const {
|
||||
|
||||
OsdGLSLTransformFeedbackComputeContext * context =
|
||||
static_cast<OsdGLSLTransformFeedbackComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLTransformFeedbackKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -126,10 +120,8 @@ OsdGLSLTransformFeedbackComputeController::ApplyBilinearVertexVerticesKernel(
|
||||
|
||||
void
|
||||
OsdGLSLTransformFeedbackComputeController::ApplyCatmarkFaceVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLTransformFeedbackComputeContext *context) const {
|
||||
|
||||
OsdGLSLTransformFeedbackComputeContext * context =
|
||||
static_cast<OsdGLSLTransformFeedbackComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLTransformFeedbackKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -146,10 +138,8 @@ OsdGLSLTransformFeedbackComputeController::ApplyCatmarkFaceVerticesKernel(
|
||||
|
||||
void
|
||||
OsdGLSLTransformFeedbackComputeController::ApplyCatmarkEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLTransformFeedbackComputeContext *context) const {
|
||||
|
||||
OsdGLSLTransformFeedbackComputeContext * context =
|
||||
static_cast<OsdGLSLTransformFeedbackComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLTransformFeedbackKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -164,10 +154,8 @@ OsdGLSLTransformFeedbackComputeController::ApplyCatmarkEdgeVerticesKernel(
|
||||
|
||||
void
|
||||
OsdGLSLTransformFeedbackComputeController::ApplyCatmarkVertexVerticesKernelB(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLTransformFeedbackComputeContext *context) const {
|
||||
|
||||
OsdGLSLTransformFeedbackComputeContext * context =
|
||||
static_cast<OsdGLSLTransformFeedbackComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLTransformFeedbackKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -182,10 +170,8 @@ OsdGLSLTransformFeedbackComputeController::ApplyCatmarkVertexVerticesKernelB(
|
||||
|
||||
void
|
||||
OsdGLSLTransformFeedbackComputeController::ApplyCatmarkVertexVerticesKernelA1(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLTransformFeedbackComputeContext *context) const {
|
||||
|
||||
OsdGLSLTransformFeedbackComputeContext * context =
|
||||
static_cast<OsdGLSLTransformFeedbackComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLTransformFeedbackKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -200,10 +186,8 @@ OsdGLSLTransformFeedbackComputeController::ApplyCatmarkVertexVerticesKernelA1(
|
||||
|
||||
void
|
||||
OsdGLSLTransformFeedbackComputeController::ApplyCatmarkVertexVerticesKernelA2(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLTransformFeedbackComputeContext *context) const {
|
||||
|
||||
OsdGLSLTransformFeedbackComputeContext * context =
|
||||
static_cast<OsdGLSLTransformFeedbackComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLTransformFeedbackKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -218,10 +202,8 @@ OsdGLSLTransformFeedbackComputeController::ApplyCatmarkVertexVerticesKernelA2(
|
||||
|
||||
void
|
||||
OsdGLSLTransformFeedbackComputeController::ApplyLoopEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLTransformFeedbackComputeContext *context) const {
|
||||
|
||||
OsdGLSLTransformFeedbackComputeContext * context =
|
||||
static_cast<OsdGLSLTransformFeedbackComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLTransformFeedbackKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -236,10 +218,8 @@ OsdGLSLTransformFeedbackComputeController::ApplyLoopEdgeVerticesKernel(
|
||||
|
||||
void
|
||||
OsdGLSLTransformFeedbackComputeController::ApplyLoopVertexVerticesKernelB(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLTransformFeedbackComputeContext *context) const {
|
||||
|
||||
OsdGLSLTransformFeedbackComputeContext * context =
|
||||
static_cast<OsdGLSLTransformFeedbackComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLTransformFeedbackKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -254,10 +234,8 @@ OsdGLSLTransformFeedbackComputeController::ApplyLoopVertexVerticesKernelB(
|
||||
|
||||
void
|
||||
OsdGLSLTransformFeedbackComputeController::ApplyLoopVertexVerticesKernelA1(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLTransformFeedbackComputeContext *context) const {
|
||||
|
||||
OsdGLSLTransformFeedbackComputeContext * context =
|
||||
static_cast<OsdGLSLTransformFeedbackComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLTransformFeedbackKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -272,10 +250,8 @@ OsdGLSLTransformFeedbackComputeController::ApplyLoopVertexVerticesKernelA1(
|
||||
|
||||
void
|
||||
OsdGLSLTransformFeedbackComputeController::ApplyLoopVertexVerticesKernelA2(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLTransformFeedbackComputeContext *context) const {
|
||||
|
||||
OsdGLSLTransformFeedbackComputeContext * context =
|
||||
static_cast<OsdGLSLTransformFeedbackComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLTransformFeedbackKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
@ -290,10 +266,8 @@ OsdGLSLTransformFeedbackComputeController::ApplyLoopVertexVerticesKernelA2(
|
||||
|
||||
void
|
||||
OsdGLSLTransformFeedbackComputeController::ApplyVertexEdits(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdGLSLTransformFeedbackComputeContext *context) const {
|
||||
|
||||
OsdGLSLTransformFeedbackComputeContext * context =
|
||||
static_cast<OsdGLSLTransformFeedbackComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdGLSLTransformFeedbackKernelBundle * kernelBundle = context->GetKernelBundle();
|
||||
|
@ -83,10 +83,9 @@ public:
|
||||
context->SetKernelBundle(getKernels(numVertexElements, numVaryingElements));
|
||||
|
||||
context->Bind(vertexBuffer, varyingBuffer);
|
||||
FarDispatcher::Refine(this,
|
||||
batches,
|
||||
-1,
|
||||
context);
|
||||
|
||||
FarDispatcher::Refine(this, context, batches, /*maxlevel*/-1);
|
||||
|
||||
context->Unbind();
|
||||
}
|
||||
|
||||
@ -111,34 +110,34 @@ public:
|
||||
|
||||
protected:
|
||||
friend class FarDispatcher;
|
||||
void ApplyBilinearFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearFaceVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyBilinearEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyBilinearVertexVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearVertexVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
void ApplyCatmarkFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkFaceVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelB(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelA1(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelA2(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
void ApplyLoopEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelB(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelA1(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelA2(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
void ApplyVertexEdits(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyVertexEdits(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
OsdGLSLTransformFeedbackKernelBundle * getKernels(int numVertexElements,
|
||||
int numVaryingElements);
|
||||
|
@ -157,13 +157,13 @@ OsdGLSLTransformFeedbackKernelBundle::Compile(int numVertexElements, int numVary
|
||||
_uniformTableOffset = glGetUniformLocation(_program, "tableOffset");
|
||||
_uniformIndexStart = glGetUniformLocation(_program, "indexStart");
|
||||
|
||||
_uniformTables[FarSubdivisionTables<OsdVertex>::F_IT] = glGetUniformLocation(_program, "_F0_IT");
|
||||
_uniformTables[FarSubdivisionTables<OsdVertex>::F_ITa] = glGetUniformLocation(_program, "_F0_ITa");
|
||||
_uniformTables[FarSubdivisionTables<OsdVertex>::E_IT] = glGetUniformLocation(_program, "_E0_IT");
|
||||
_uniformTables[FarSubdivisionTables<OsdVertex>::V_IT] = glGetUniformLocation(_program, "_V0_IT");
|
||||
_uniformTables[FarSubdivisionTables<OsdVertex>::V_ITa] = glGetUniformLocation(_program, "_V0_ITa");
|
||||
_uniformTables[FarSubdivisionTables<OsdVertex>::E_W] = glGetUniformLocation(_program, "_E0_S");
|
||||
_uniformTables[FarSubdivisionTables<OsdVertex>::V_W] = glGetUniformLocation(_program, "_V0_S");
|
||||
_uniformTables[FarSubdivisionTables::F_IT] = glGetUniformLocation(_program, "_F0_IT");
|
||||
_uniformTables[FarSubdivisionTables::F_ITa] = glGetUniformLocation(_program, "_F0_ITa");
|
||||
_uniformTables[FarSubdivisionTables::E_IT] = glGetUniformLocation(_program, "_E0_IT");
|
||||
_uniformTables[FarSubdivisionTables::V_IT] = glGetUniformLocation(_program, "_V0_IT");
|
||||
_uniformTables[FarSubdivisionTables::V_ITa] = glGetUniformLocation(_program, "_V0_ITa");
|
||||
_uniformTables[FarSubdivisionTables::E_W] = glGetUniformLocation(_program, "_E0_S");
|
||||
_uniformTables[FarSubdivisionTables::V_W] = glGetUniformLocation(_program, "_V0_S");
|
||||
|
||||
// set unfiorm locations for edit
|
||||
_subEditAdd = glGetSubroutineIndex(_program,
|
||||
|
@ -148,7 +148,7 @@ protected:
|
||||
GLuint _program;
|
||||
|
||||
// uniform locations
|
||||
GLint _uniformTables[FarSubdivisionTables<OsdVertex>::TABLE_TYPES_COUNT];
|
||||
GLint _uniformTables[FarSubdivisionTables::TABLE_TYPES_COUNT];
|
||||
GLint _uniformVertexPass;
|
||||
GLint _uniformVertexOffset;
|
||||
GLint _uniformTableOffset;
|
||||
|
@ -42,214 +42,188 @@ OsdOmpComputeController::OsdOmpComputeController(int numThreads) {
|
||||
|
||||
void
|
||||
OsdOmpComputeController::ApplyBilinearFaceVerticesKernel(
|
||||
FarKernelBatch const &batch, void *clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdOmpComputeFace(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::F_IT)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::F_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::F_IT)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::F_ITa)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd());
|
||||
}
|
||||
|
||||
void
|
||||
OsdOmpComputeController::ApplyBilinearEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void *clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdOmpComputeBilinearEdge(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::E_IT)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::E_IT)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd());
|
||||
}
|
||||
|
||||
void
|
||||
OsdOmpComputeController::ApplyBilinearVertexVerticesKernel(
|
||||
FarKernelBatch const &batch, void *clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdOmpComputeBilinearVertex(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd());
|
||||
}
|
||||
|
||||
void
|
||||
OsdOmpComputeController::ApplyCatmarkFaceVerticesKernel(
|
||||
FarKernelBatch const &batch, void *clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdOmpComputeFace(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::F_IT)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::F_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::F_IT)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::F_ITa)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd());
|
||||
}
|
||||
|
||||
void
|
||||
OsdOmpComputeController::ApplyCatmarkEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void *clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdOmpComputeEdge(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::E_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::E_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::E_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::E_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd());
|
||||
}
|
||||
|
||||
void
|
||||
OsdOmpComputeController::ApplyCatmarkVertexVerticesKernelB(
|
||||
FarKernelBatch const &batch, void *clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdOmpComputeVertexB(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::V_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd());
|
||||
}
|
||||
|
||||
void
|
||||
OsdOmpComputeController::ApplyCatmarkVertexVerticesKernelA1(
|
||||
FarKernelBatch const &batch, void *clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdOmpComputeVertexA(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::V_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd(), false);
|
||||
}
|
||||
|
||||
void
|
||||
OsdOmpComputeController::ApplyCatmarkVertexVerticesKernelA2(
|
||||
FarKernelBatch const &batch, void *clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdOmpComputeVertexA(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::V_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd(), true);
|
||||
}
|
||||
|
||||
void
|
||||
OsdOmpComputeController::ApplyLoopEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void *clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdOmpComputeEdge(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::E_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::E_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::E_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::E_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd());
|
||||
}
|
||||
|
||||
void
|
||||
OsdOmpComputeController::ApplyLoopVertexVerticesKernelB(
|
||||
FarKernelBatch const &batch, void *clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdOmpComputeLoopVertexB(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::V_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd());
|
||||
}
|
||||
|
||||
void
|
||||
OsdOmpComputeController::ApplyLoopVertexVerticesKernelA1(
|
||||
FarKernelBatch const &batch, void *clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdOmpComputeVertexA(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::V_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd(), false);
|
||||
}
|
||||
|
||||
void
|
||||
OsdOmpComputeController::ApplyLoopVertexVerticesKernelA2(
|
||||
FarKernelBatch const &batch, void *clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdOmpComputeVertexA(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::V_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd(), true);
|
||||
}
|
||||
|
||||
void
|
||||
OsdOmpComputeController::ApplyVertexEdits(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
const OsdCpuHEditTable *edit = context->GetEditTable(batch.GetTableIndex());
|
||||
|
@ -80,10 +80,9 @@ public:
|
||||
omp_set_num_threads(_numThreads);
|
||||
|
||||
context->Bind(vertexBuffer, varyingBuffer);
|
||||
FarDispatcher::Refine(this,
|
||||
batches,
|
||||
-1,
|
||||
context);
|
||||
|
||||
FarDispatcher::Refine(this, context, batches, /*maxlevel*/-1);
|
||||
|
||||
context->Unbind();
|
||||
}
|
||||
|
||||
@ -109,33 +108,33 @@ public:
|
||||
protected:
|
||||
friend class FarDispatcher;
|
||||
|
||||
void ApplyBilinearFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearFaceVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyBilinearEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyBilinearVertexVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearVertexVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
void ApplyCatmarkFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkFaceVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelB(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelA1(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelA2(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
void ApplyLoopEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelB(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelA1(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelA2(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyVertexEdits(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyVertexEdits(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
int _numThreads;
|
||||
};
|
||||
|
@ -22,6 +22,8 @@
|
||||
// language governing permissions and limitations under the Apache License.
|
||||
//
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "../osd/cpuComputeContext.h"
|
||||
#include "../osd/tbbComputeController.h"
|
||||
#include "../osd/tbbKernel.h"
|
||||
@ -45,214 +47,188 @@ OsdTbbComputeController::OsdTbbComputeController(int numThreads) {
|
||||
|
||||
void
|
||||
OsdTbbComputeController::ApplyBilinearFaceVerticesKernel(
|
||||
FarKernelBatch const &batch, void *clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdTbbComputeFace(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::F_IT)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::F_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::F_IT)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::F_ITa)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd());
|
||||
}
|
||||
|
||||
void
|
||||
OsdTbbComputeController::ApplyBilinearEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void *clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdTbbComputeBilinearEdge(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::E_IT)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::E_IT)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd());
|
||||
}
|
||||
|
||||
void
|
||||
OsdTbbComputeController::ApplyBilinearVertexVerticesKernel(
|
||||
FarKernelBatch const &batch, void *clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdTbbComputeBilinearVertex(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd());
|
||||
}
|
||||
|
||||
void
|
||||
OsdTbbComputeController::ApplyCatmarkFaceVerticesKernel(
|
||||
FarKernelBatch const &batch, void *clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdTbbComputeFace(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::F_IT)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::F_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::F_IT)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::F_ITa)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd());
|
||||
}
|
||||
|
||||
void
|
||||
OsdTbbComputeController::ApplyCatmarkEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void *clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdTbbComputeEdge(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::E_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::E_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::E_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::E_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd());
|
||||
}
|
||||
|
||||
void
|
||||
OsdTbbComputeController::ApplyCatmarkVertexVerticesKernelB(
|
||||
FarKernelBatch const &batch, void *clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdTbbComputeVertexB(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::V_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd());
|
||||
}
|
||||
|
||||
void
|
||||
OsdTbbComputeController::ApplyCatmarkVertexVerticesKernelA1(
|
||||
FarKernelBatch const &batch, void *clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdTbbComputeVertexA(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::V_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd(), false);
|
||||
}
|
||||
|
||||
void
|
||||
OsdTbbComputeController::ApplyCatmarkVertexVerticesKernelA2(
|
||||
FarKernelBatch const &batch, void *clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdTbbComputeVertexA(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::V_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd(), true);
|
||||
}
|
||||
|
||||
void
|
||||
OsdTbbComputeController::ApplyLoopEdgeVerticesKernel(
|
||||
FarKernelBatch const &batch, void *clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdTbbComputeEdge(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::E_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::E_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::E_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::E_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd());
|
||||
}
|
||||
|
||||
void
|
||||
OsdTbbComputeController::ApplyLoopVertexVerticesKernelB(
|
||||
FarKernelBatch const &batch, void *clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdTbbComputeLoopVertexB(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_IT)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::V_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd());
|
||||
}
|
||||
|
||||
void
|
||||
OsdTbbComputeController::ApplyLoopVertexVerticesKernelA1(
|
||||
FarKernelBatch const &batch, void *clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdTbbComputeVertexA(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::V_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd(), false);
|
||||
}
|
||||
|
||||
void
|
||||
OsdTbbComputeController::ApplyLoopVertexVerticesKernelA2(
|
||||
FarKernelBatch const &batch, void *clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
OsdTbbComputeVertexA(
|
||||
context->GetVertexDescriptor(),
|
||||
context->GetCurrentVertexBuffer(),
|
||||
context->GetCurrentVaryingBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables<OsdVertex>::V_W)->GetBuffer(),
|
||||
(const int*)context->GetTable(FarSubdivisionTables::V_ITa)->GetBuffer(),
|
||||
(const float*)context->GetTable(FarSubdivisionTables::V_W)->GetBuffer(),
|
||||
batch.GetVertexOffset(), batch.GetTableOffset(), batch.GetStart(), batch.GetEnd(), true);
|
||||
}
|
||||
|
||||
void
|
||||
OsdTbbComputeController::ApplyVertexEdits(
|
||||
FarKernelBatch const &batch, void * clientdata) const {
|
||||
FarKernelBatch const &batch, OsdCpuComputeContext *context) const {
|
||||
|
||||
OsdCpuComputeContext * context =
|
||||
static_cast<OsdCpuComputeContext*>(clientdata);
|
||||
assert(context);
|
||||
|
||||
const OsdCpuHEditTable *edit = context->GetEditTable(batch.GetTableIndex());
|
||||
|
@ -72,10 +72,9 @@ public:
|
||||
VARYING_BUFFER * varyingBuffer) {
|
||||
|
||||
context->Bind(vertexBuffer, varyingBuffer);
|
||||
FarDispatcher::Refine(this,
|
||||
batches,
|
||||
-1,
|
||||
context);
|
||||
|
||||
FarDispatcher::Refine(this, context, batches, /*maxlevel*/-1);
|
||||
|
||||
context->Unbind();
|
||||
}
|
||||
|
||||
@ -101,33 +100,33 @@ public:
|
||||
protected:
|
||||
friend class FarDispatcher;
|
||||
|
||||
void ApplyBilinearFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearFaceVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyBilinearEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyBilinearVertexVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyBilinearVertexVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
void ApplyCatmarkFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkFaceVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelB(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelA1(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyCatmarkVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyCatmarkVertexVerticesKernelA2(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
|
||||
void ApplyLoopEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopEdgeVerticesKernel(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelB(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelA1(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyLoopVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyLoopVertexVerticesKernelA2(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
void ApplyVertexEdits(FarKernelBatch const &batch, void * clientdata) const;
|
||||
void ApplyVertexEdits(FarKernelBatch const &batch, ComputeContext *context) const;
|
||||
|
||||
int _numThreads;
|
||||
};
|
||||
|
@ -98,8 +98,7 @@ PxOsdUtilRefiner::Initialize(
|
||||
|
||||
// Subdivision tables describe the addition steps with coefficients
|
||||
// needed to perform subdivision
|
||||
const FarSubdivisionTables<OsdVertex>* ftable =
|
||||
_farMesh->GetSubdivisionTables();
|
||||
const FarSubdivisionTables* ftable = _farMesh->GetSubdivisionTables();
|
||||
|
||||
// Find quads array at given level
|
||||
const FarPatchTables * ptables = _farMesh->GetPatchTables();
|
||||
|
@ -111,11 +111,10 @@ shim::Subdivider::getRefinedQuads(Buffer* refinedQuads)
|
||||
return;
|
||||
}
|
||||
|
||||
const OpenSubdiv::FarSubdivisionTables<OpenSubdiv::OsdVertex> *tables =
|
||||
const OpenSubdiv::FarSubdivisionTables *tables =
|
||||
self->farMesh->GetSubdivisionTables();
|
||||
|
||||
bool loop = dynamic_cast<const OpenSubdiv::FarLoopSubdivisionTables<
|
||||
OpenSubdiv::OsdVertex>*>(tables);
|
||||
bool loop = dynamic_cast<const OpenSubdiv::FarLoopSubdivisionTables*>(tables);
|
||||
|
||||
if (loop) {
|
||||
cerr << "loop subdivision not supported" << endl;
|
||||
|
@ -56,13 +56,13 @@ struct xyzVV {
|
||||
|
||||
~xyzVV( ) { }
|
||||
|
||||
void AddWithWeight(const xyzVV& src, float weight, void * =0 ) {
|
||||
void AddWithWeight(const xyzVV& src, float weight) {
|
||||
_pos[0]+=weight*src._pos[0];
|
||||
_pos[1]+=weight*src._pos[1];
|
||||
_pos[2]+=weight*src._pos[2];
|
||||
}
|
||||
|
||||
void AddVaryingWithWeight(const xyzVV& , float, void * =0 ) { }
|
||||
void AddVaryingWithWeight(const xyzVV& , float) { }
|
||||
|
||||
void Clear( void * =0 ) { _pos[0]=_pos[1]=_pos[2]=0.0f; }
|
||||
|
||||
@ -124,7 +124,7 @@ typedef OpenSubdiv::HbrVertexOperator<xyzVV> xyzVertexOperator;
|
||||
|
||||
typedef OpenSubdiv::FarMesh<xyzVV> fMesh;
|
||||
typedef OpenSubdiv::FarMeshFactory<xyzVV> fMeshFactory;
|
||||
typedef OpenSubdiv::FarSubdivisionTables<xyzVV> fSubdivision;
|
||||
typedef OpenSubdiv::FarSubdivisionTables fSubdivision;
|
||||
typedef OpenSubdiv::FarPatchTables fPatches;
|
||||
|
||||
static bool g_debugmode = false;
|
||||
@ -309,7 +309,8 @@ int checkMesh( char const * msg, xyzmesh * hmesh, int levels, Scheme scheme=kCat
|
||||
|
||||
fMeshFactory fact( hmesh, levels );
|
||||
fMesh * m = fact.Create( );
|
||||
OpenSubdiv::FarComputeController<xyzVV>::_DefaultController.Refine(m);
|
||||
static OpenSubdiv::FarComputeController computeController;
|
||||
computeController.Refine(m);
|
||||
|
||||
if (g_debugmode) {
|
||||
for (int i=1; i<=levels; ++i)
|
||||
|
Loading…
Reference in New Issue
Block a user