[Bf-blender-cvs] SVN commit: /data/svn/repos/bf-blender [61404] trunk/lib/win64_vc12/ opensubdiv: Windoes 64bit: Use latest version of OpenSubdiv
Sergey Sharybin
sergey.vfx at gmail.com
Mon Aug 4 17:21:26 CEST 2014
Revision: 61404
https://developer.blender.org/rBL61404
Author: sergey
Date: 2014-08-04 15:21:26 +0000 (Mon, 04 Aug 2014)
Log Message:
-----------
Windoes 64bit: Use latest version of OpenSubdiv
Modified Paths:
--------------
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/far/catmarkSubdivisionTablesFactory.h
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/far/dispatcher.h
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/far/kernelBatch.h
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/far/kernelBatchFactory.h
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/far/meshFactory.h
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/far/patchTablesFactory.h
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/far/stencilTablesFactory.h
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/far/subdivisionTables.h
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/far/subdivisionTablesFactory.h
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/osd/clComputeContext.h
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/osd/clComputeController.h
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/osd/cpuComputeController.h
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/osd/cudaComputeController.h
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/osd/glslComputeController.h
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/osd/glslKernelBundle.h
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/osd/glslTransformFeedbackComputeController.h
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/osd/glslTransformFeedbackKernelBundle.h
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/osd/mesh.h
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/osd/ompComputeController.h
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/osd/ompKernel.h
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/osd/opengl.h
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/osdutil/adaptiveEvaluator.h
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/osdutil/evaluator_capi.h
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/osdutil/mesh.h
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/osdutil/refiner.h
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/version.h
trunk/lib/win64_vc12/opensubdiv/lib/osdCPU.lib
trunk/lib/win64_vc12/opensubdiv/lib/osdCPU_d.lib
trunk/lib/win64_vc12/opensubdiv/lib/osdGPU.lib
trunk/lib/win64_vc12/opensubdiv/lib/osdGPU_d.lib
trunk/lib/win64_vc12/opensubdiv/lib/osdutil.lib
trunk/lib/win64_vc12/opensubdiv/lib/osdutil_d.lib
trunk/lib/win64_vc12/opensubdiv/readme.txt
Added Paths:
-----------
trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/osdutil/vertexSplit.h
Modified: trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/far/catmarkSubdivisionTablesFactory.h
===================================================================
--- trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/far/catmarkSubdivisionTablesFactory.h 2014-08-04 14:25:19 UTC (rev 61403)
+++ trunk/lib/win64_vc12/opensubdiv/include/opensubdiv/far/catmarkSubdivisionTablesFactory.h 2014-08-04 15:21:26 UTC (rev 61404)
@@ -26,6 +26,7 @@
#define FAR_CATMARK_SUBDIVISION_TABLES_FACTORY_H
#include <cassert>
+#include <map>
#include <vector>
#include "../version.h"
@@ -48,6 +49,9 @@
protected:
template <class X, class Y> friend class FarMeshFactory;
+ typedef std::vector<unsigned int> VertexList;
+ typedef std::map<unsigned int, unsigned int> VertexPermutation;
+
/// \brief Creates a FarSubdivisiontables instance with Catmark scheme.
///
/// @param meshFactory a valid FarMeshFactory instance
@@ -56,6 +60,94 @@
/// will reserve and append refinement tasks
///
static FarSubdivisionTables * Create( FarMeshFactory<T,U> * meshFactory, FarKernelBatchVector *batches );
+
+ // Compares vertices based on their topological configuration
+ // (see subdivisionTables::GetMaskRanking for more details)
+ static bool CompareVertices( HbrVertex<T> const *x, HbrVertex<T> const *y );
+
+ /// \brief Duplicates vertices in a kernel batch
+ ///
+ /// @param subdivisionTables the subdivision tables to modify
+ ///
+ /// @param kernelBatch kernel batch at the finest subdivision level
+ ///
+ /// @param vertexList the list of vertices to duplicate
+ ///
+ static void DuplicateVertices( FarSubdivisionTables * subdivisionTables,
+ FarKernelBatch &kernelBatch,
+ VertexList const &vertexList );
+
+ /// \brief Rearranges vertices in a kernel batch to process them in a
+ /// \brief specific order
+ ///
+ /// @param subdivisionTables the subdivision tables to modify
+ ///
+ /// @param kernelBatch the kernel batch
+ ///
+ /// @param vertexPermutation permutation of the vertices
+ ///
+ static bool PermuteVertices( FarSubdivisionTables * subdivisionTables,
+ FarKernelBatch const &kernelBatch,
+ VertexPermutation const &vertexPermutation );
+
+ /// \brief Remaps the vertices in a kernel batch
+ ///
+ /// @param subdivisionTables the subdivision tables to modify
+ ///
+ /// @param kernelBatch the kernel batch
+ ///
+ /// @param vertexPermutation permutation of the vertices
+ ///
+ static void RemapVertices( FarSubdivisionTables * subdivisionTables,
+ FarKernelBatch const &kernelBatch,
+ VertexPermutation const& vertexPermutation);
+
+ /// \brief Shifts the vertices in a kernel batch
+ ///
+ /// @param subdivisionTables the subdivision tables to modify
+ ///
+ /// @param kernelBatch the kernel batch
+ ///
+ /// @param expandedKernelBatch the kernel batch whose range was expanded
+ ///
+ /// @param numVertices the number of vertices to shift
+ ///
+ static void ShiftVertices( FarSubdivisionTables * subdivisionTables,
+ FarKernelBatch &kernelBatch,
+ FarKernelBatch const &expandedKernelBatch,
+ int numVertices );
+
+private:
+ /// \brief Duplicates vertices in an edge-vertex kernel batch
+ static void duplicateEdgeVertexKernelBatch( FarSubdivisionTables * subdivisionTables,
+ FarKernelBatch &kernelBatch,
+ VertexList const &vertexList );
+
+ /// \brief Duplicates vertices in a vertex-vertex kernel batch
+ static void duplicateVertexVertexKernelBatch( FarSubdivisionTables * subdivisionTables,
+ FarKernelBatch &kernelBatch,
+ VertexList const &vertexList );
+
+ /// \brief Rearranges vertices in an edge-vertex kernel batch
+ static void permuteEdgeVertexKernelBatch( FarSubdivisionTables * subdivisionTables,
+ FarKernelBatch const &kernelBatch,
+ VertexPermutation const &inversePermutation );
+
+ /// \brief Rearranges vertices in a face-vertex kernel batch
+ static void permuteFaceVertexKernelBatch( FarSubdivisionTables * subdivisionTables,
+ FarKernelBatch const &kernelBatch,
+ VertexPermutation const &inversePermutation );
+
+ /// \brief Rearranges vertices in a vertex-vertex kernel batch
+ static void permuteVertexVertexKernelBatch( FarSubdivisionTables * subdivisionTables,
+ FarKernelBatch const &kernelBatch,
+ VertexPermutation const &inversePermutation );
+
+ /// \brief Remaps a vertex index
+ static void remapVertex( VertexPermutation const& vertexPermutation, int& vertex );
+
+ /// \brief Remaps a vertex index
+ static void remapVertex( VertexPermutation const& vertexPermutation, unsigned int& vertex );
};
// This factory walks the Hbr vertices and accumulates the weights and adjacency
@@ -70,22 +162,59 @@
std::vector<int> & remap = meshFactory->getRemappingTable();
- FarSubdivisionTablesFactory<T,U> tablesFactory( meshFactory->GetHbrMesh(), maxlevel, remap );
+ FarSubdivisionTablesFactory<T,U> tablesFactory( meshFactory->GetHbrMesh(), maxlevel, remap, CompareVertices );
FarSubdivisionTables * result = new FarSubdivisionTables(maxlevel, FarSubdivisionTables::CATMARK);
+ // Calculate the size of the face-vertex indexing tables
+ int minCoarseFaceValence = tablesFactory.GetMinCoarseFaceValence();
+ int maxCoarseFaceValence = tablesFactory.GetMaxCoarseFaceValence();
+ bool coarseMeshAllQuadFaces = minCoarseFaceValence == 4 and maxCoarseFaceValence == 4;
+ bool coarseMeshAllTriQuadFaces = minCoarseFaceValence >= 3 and maxCoarseFaceValence <= 4;
+ bool hasQuadFaceVertexKernel = meshFactory->IsKernelTypeSupported(FarKernelBatch::CATMARK_QUAD_FACE_VERTEX);
+ bool hasTriQuadFaceVertexKernel = meshFactory->IsKernelTypeSupported(FarKernelBatch::CATMARK_TRI_QUAD_FACE_VERTEX);
+
+ int F_ITa_size = 0;
+ if (not hasQuadFaceVertexKernel and not hasTriQuadFaceVertexKernel)
+ F_ITa_size = tablesFactory.GetNumFaceVerticesTotal(maxlevel) * 2;
+ else if (not coarseMeshAllTriQuadFaces or not hasTriQuadFaceVertexKernel)
+ F_ITa_size = tablesFactory.GetNumFaceVerticesTotal(1) * 2;
+
+ int F_IT_size = tablesFactory.GetFaceVertsValenceSum();
+ if (coarseMeshAllTriQuadFaces and hasTriQuadFaceVertexKernel)
+ F_IT_size += tablesFactory.GetNumCoarseTriangleFaces(); // add padding for tri faces
+
+ // Triangular interpolation mode :
+ // see "smoothtriangle" tag introduced in prman 3.9 and HbrCatmarkSubdivision<T>
+ typename HbrCatmarkSubdivision<T>::TriangleSubdivision triangleMethod =
+ dynamic_cast<HbrCatmarkSubdivision<T> *>(meshFactory->GetHbrMesh()->GetSubdivision())->GetTriangleSubdivisionMethod();
+ bool hasFractionalEdgeSharpness = tablesFactory.HasFractionalEdgeSharpness();
+ bool useRestrictedEdgeVertexKernel = meshFactory->IsKernelTypeSupported(FarKernelBatch::CATMARK_RESTRICTED_EDGE_VERTEX);
+ useRestrictedEdgeVertexKernel &= not hasFractionalEdgeSharpness and triangleMethod != HbrCatmarkSubdivision<T>::k_New;
+
+ bool hasFractionalVertexSharpness = tablesFactory.HasFractionalVertexSharpness();
+ bool hasStandardVertexVertexKernels = meshFactory->IsKernelTypeSupported(FarKernelBatch::CATMARK_VERT_VERTEX_A1) and
+ meshFactory->IsKernelTypeSupported(FarKernelBatch::CATMARK_VERT_VERTEX_A2) and
+ meshFactory->IsKernelTypeSupported(FarKernelBatch::CATMARK_VERT_VERTEX_B);
+ bool useRestrictedVertexVertexKernels = meshFactory->IsKernelTypeSupported(FarKernelBatch::CATMARK_RESTRICTED_VERT_VERTEX_A) and
+ meshFactory->IsKernelTypeSupported(FarKernelBatch::CATMARK_RESTRICTED_VERT_VERTEX_B1) and
+ meshFactory->IsKernelTypeSupported(FarKernelBatch::CATMARK_RESTRICTED_VERT_VERTEX_B2);
+ useRestrictedVertexVertexKernels &= not hasFractionalVertexSharpness and not hasFractionalEdgeSharpness;
+
// Allocate memory for the indexing tables
- result->_F_ITa.resize(tablesFactory.GetNumFaceVerticesTotal(maxlevel)*2);
- result->_F_IT.resize(tablesFactory.GetFaceVertsValenceSum());
+ result->_F_ITa.resize(F_ITa_size);
+ result->_F_IT.resize(F_IT_size);
result->_E_IT.resize(tablesFactory.GetNumEdgeVerticesTotal(maxlevel)*4);
- result->_E_W.resize(tablesFactory.GetNumEdgeVerticesTotal(maxlevel)*2);
+ if (not useRestrictedEdgeVertexKernel)
+ result->_E_W.resize(tablesFactory.GetNumEdgeVerticesTotal(maxlevel)*2);
result->_V_ITa.resize((tablesFactory.GetNumVertexVerticesTotal(maxlevel)
- - tablesFactory.GetNumVertexVerticesTotal(0))*5); // subtract corase cage vertices
+ - tablesFactory.GetNumVertexVerticesTotal(0))*5); // subtract coarse cage vertices
result->_V_IT.resize(tablesFactory.GetVertVertsValenceSum()*2);
- result->_V_W.resize(tablesFactory.GetNumVertexVerticesTotal(maxlevel)
- - tablesFactory.GetNumVertexVerticesTotal(0));
+ if (not useRestrictedVertexVertexKernels)
+ result->_V_W.resize(tablesFactory.GetNumVertexVerticesTotal(maxlevel)
+ - tablesFactory.GetNumVertexVerticesTotal(0));
// Prepare batch table
batches->reserve(maxlevel*5);
@@ -115,18 +244,46 @@
// "For each vertex, gather all the vertices from the parent face."
int nFaceVertices = (int)tablesFactory._faceVertsList[level].size();
+ // choose the kernel type that best fits the face topology
+ int kernelType = FarKernelBatch::CATMARK_FACE_VERTEX;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list