[Bf-blender-cvs] [26e8589] opensubdiv-modifier: OpenSubdiv: Add back device enumeration for evaluator creation

Sergey Sharybin noreply at git.blender.org
Sat Jul 11 20:02:23 CEST 2015


Commit: 26e8589186e6e12f7cc9ed95e42929ffa2a45bac
Author: Sergey Sharybin
Date:   Fri Jul 10 16:38:37 2015 +0200
Branches: opensubdiv-modifier
https://developer.blender.org/rB26e8589186e6e12f7cc9ed95e42929ffa2a45bac

OpenSubdiv: Add back device enumeration for evaluator creation

===================================================================

M	intern/opensubdiv/CMakeLists.txt
M	intern/opensubdiv/opensubdiv_capi.cc

===================================================================

diff --git a/intern/opensubdiv/CMakeLists.txt b/intern/opensubdiv/CMakeLists.txt
index d01ca75..08ee65a 100644
--- a/intern/opensubdiv/CMakeLists.txt
+++ b/intern/opensubdiv/CMakeLists.txt
@@ -61,7 +61,8 @@ macro(OPENSUBDIV_DEFINE_COMPONENT component)
 endmacro()
 
 OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_OPENMP)
-OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_OPENCL)
+# TODO(sergey): OpenCL is not tested and totally unstable atm.
+#OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_OPENCL)
 # TODO(sergey): CUDA stays disabled for util it's ported to drievr API.
 # OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_CUDA)
 OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK)
diff --git a/intern/opensubdiv/opensubdiv_capi.cc b/intern/opensubdiv/opensubdiv_capi.cc
index fd90683..683dde4 100644
--- a/intern/opensubdiv/opensubdiv_capi.cc
+++ b/intern/opensubdiv/opensubdiv_capi.cc
@@ -236,11 +236,41 @@ struct OpenSubdiv_GLMesh *openSubdiv_createOsdGLMeshFromEvaluator(
 	GLMeshInterface *mesh = NULL;
 	OpenSubdiv::Far::TopologyRefiner *refiner = openSubdiv_topologyRefinerFromDM(dm);
 
-	mesh = new OsdCpuMesh(refiner,
-	                      num_vertex_elements,
-	                      num_varying_elements,
-	                      level,
-	                      bits);
+	switch(evaluator_type) {
+#define CHECK_EVALUATOR_TYPE(type, class) \
+		case OPENSUBDIV_EVALUATOR_ ## type: \
+			mesh = new class(refiner, \
+			                 num_vertex_elements, \
+			                 num_varying_elements, \
+			                 level, \
+			                 bits); \
+			break;
+
+		CHECK_EVALUATOR_TYPE(CPU, OsdCpuMesh)
+
+#ifdef OPENSUBDIV_HAS_OPENMP
+		CHECK_EVALUATOR_TYPE(OPENMP, OsdOmpMesh)
+#endif
+
+#ifdef OPENSUBDIV_HAS_OPENCL
+		CHECK_EVALUATOR_TYPE(OPENCL, OsdCLMesh)
+#endif
+
+#ifdef OPENSUBDIV_HAS_CUDA
+		CHECK_EVALUATOR_TYPE(CUDA, OsdCudaMesh)
+#endif
+
+#ifdef OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK
+		CHECK_EVALUATOR_TYPE(GLSL_TRANSFORM_FEEDBACK,
+		                     OsdGLSLTransformFeedbackMesh)
+#endif
+
+#ifdef OPENSUBDIV_HAS_GLSL_COMPUTE
+		CHECK_EVALUATOR_TYPE(GLSL_COMPUTE, OsdGLSLComputeMesh)
+#endif
+
+#undef CHECK_EVALUATOR_TYPE
+	}
 
 	if (mesh == NULL) {
 		return NULL;




More information about the Bf-blender-cvs mailing list