[Bf-blender-cvs] [f920ce2] opensubdiv-modifier: Major refactor of the current state of the patch

Sergey Sharybin noreply at git.blender.org
Fri Apr 25 15:10:37 CEST 2014


Commit: f920ce2d6bb2232e804921655a081d2d499ef79d
Author: Sergey Sharybin
Date:   Wed Apr 16 16:18:02 2014 +0600
https://developer.blender.org/rBf920ce2d6bb2232e804921655a081d2d499ef79d

Major refactor of the current state of the patch

- Using new OpenSubdiv C-API from the Dirk's patch D132
- Split ccgSubSurf__syncOpenSubdiv into set of smaller functions.
- Drop intern/opensubdiv, it needs to be ported to current
  OpenSubdiv code anyway and currently not really needed.
- Use smarter detection of OpenSubdiv libraries since now we're
  not only using osdCPU library.

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

M	build_files/cmake/Modules/FindOpenSubdiv.cmake
M	build_files/scons/config/linux-config.py
M	intern/CMakeLists.txt
D	intern/opensubdiv/CMakeLists.txt
D	intern/opensubdiv/SConscript
D	intern/opensubdiv/opensubdiv_capi.cc
D	intern/opensubdiv/opensubdiv_capi.h
M	source/blender/blenkernel/CMakeLists.txt
M	source/blender/blenkernel/SConscript
M	source/blender/blenkernel/intern/CCGSubSurf.c
M	source/blender/modifiers/intern/MOD_subsurf.c
M	source/blenderplayer/CMakeLists.txt
M	source/creator/CMakeLists.txt

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

diff --git a/build_files/cmake/Modules/FindOpenSubdiv.cmake b/build_files/cmake/Modules/FindOpenSubdiv.cmake
index b0e8137..10ba575 100644
--- a/build_files/cmake/Modules/FindOpenSubdiv.cmake
+++ b/build_files/cmake/Modules/FindOpenSubdiv.cmake
@@ -27,6 +27,12 @@ IF(NOT OPENSUBDIV_ROOT_DIR AND NOT $ENV{OPENSUBDIV_ROOT_DIR} STREQUAL "")
   SET(OPENSUBDIV_ROOT_DIR $ENV{OPENSUBDIV_ROOT_DIR})
 ENDIF()
 
+SET(_opensubdiv_FIND_COMPONENTS
+  osdCPU
+  osdGPU
+  osdutil
+)
+
 SET(_opensubdiv_SEARCH_DIRS
   ${OPENSUBDIV_ROOT_DIR}
   /usr/local
@@ -45,27 +51,36 @@ FIND_PATH(OPENSUBDIV_INCLUDE_DIR
     include
 )
 
-FIND_LIBRARY(OPENSUBDIV_LIBRARY
-  NAMES
-    osdCPU
-  HINTS
-    ${_opensubdiv_SEARCH_DIRS}
-  PATH_SUFFIXES
-    lib64 lib
-  )
+SET(_opensubdiv_LIBRARIES)
+FOREACH(COMPONENT ${_opensubdiv_FIND_COMPONENTS})
+  STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
+
+  FIND_LIBRARY(OPENSUBDIV_${UPPERCOMPONENT}_LIBRARY
+    NAMES
+      ${COMPONENT}
+    HINTS
+      ${_opensubdiv_SEARCH_DIRS}
+    PATH_SUFFIXES
+      lib64 lib
+    )
+  LIST(APPEND _opensubdiv_LIBRARIES "${OPENSUBDIV_${UPPERCOMPONENT}_LIBRARY}")
+ENDFOREACH()
 
 # handle the QUIETLY and REQUIRED arguments and set OPENSUBDIV_FOUND to TRUE if
 # all listed variables are TRUE
 INCLUDE(FindPackageHandleStandardArgs)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenSubdiv DEFAULT_MSG
-    OPENSUBDIV_LIBRARY OPENSUBDIV_INCLUDE_DIR)
+    _opensubdiv_LIBRARIES OPENSUBDIV_INCLUDE_DIR)
 
 IF(OPENSUBDIV_FOUND)
-  SET(OPENSUBDIV_LIBRARIES ${OPENSUBDIV_LIBRARY})
+  SET(OPENSUBDIV_LIBRARIES ${_opensubdiv_LIBRARIES})
   SET(OPENSUBDIV_INCLUDE_DIRS ${OPENSUBDIV_INCLUDE_DIR})
 ENDIF(OPENSUBDIV_FOUND)
 
 MARK_AS_ADVANCED(
   OPENSUBDIV_INCLUDE_DIR
-  OPENSUBDIV_LIBRARY
 )
+FOREACH(COMPONENT ${_opensubdiv_FIND_COMPONENTS})
+  STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
+  MARK_AS_ADVANCED(OPENSUBDIV_${UPPERCOMPONENT}_LIBRARY)
+ENDFOREACH()
diff --git a/build_files/scons/config/linux-config.py b/build_files/scons/config/linux-config.py
index bd11e85..954bca4 100644
--- a/build_files/scons/config/linux-config.py
+++ b/build_files/scons/config/linux-config.py
@@ -230,8 +230,8 @@ WITH_BF_OPENSUBDIV = False
 WITH_BF_STATICOPENSUBDIV = False
 BF_OPENSUBDIV = '/usr'
 BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
-BF_OPENSUBDIV_LIB = 'osdCPU'
-BF_OPENSUBDIV_LIB_STATIC = '${BF_OPENSUBDIV_LIBPATH}/libosdCPU.a'
+BF_OPENSUBDIV_LIB = 'osdCPU osdGPU osdutil'
+BF_OPENSUBDIV_LIB_STATIC = '${BF_OPENSUBDIV_LIBPATH}/libosdCPU.a ${BF_OPENSUBDIV_LIBPATH}/libosdGPU.a ${BF_OPENSUBDIV_LIBPATH}/libosdutil.a'
 BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
 
 ##
diff --git a/intern/CMakeLists.txt b/intern/CMakeLists.txt
index c80e299..7f54ccc 100644
--- a/intern/CMakeLists.txt
+++ b/intern/CMakeLists.txt
@@ -84,7 +84,3 @@ endif()
 if(WIN32)
 	add_subdirectory(utfconv)
 endif()
-
-if(WITH_OPENSUBDIV)
-	add_subdirectory(opensubdiv)
-endif()
diff --git a/intern/opensubdiv/CMakeLists.txt b/intern/opensubdiv/CMakeLists.txt
deleted file mode 100644
index 01174f6..0000000
--- a/intern/opensubdiv/CMakeLists.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# The Original Code is Copyright (C) 2013, Blender Foundation
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Sergey Sharybin.
-#
-# ***** END GPL LICENSE BLOCK *****
-
-set(INC
-	.
-	../guardedalloc
-)
-
-set(INC_SYS
-	${OPENSUBDIV_INCLUDE_DIR}
-)
-
-set(SRC
-	opensubdiv_capi.cc
-	opensubdiv_capi.h
-)
-
-blender_add_lib(bf_intern_opensubdiv "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/intern/opensubdiv/SConscript b/intern/opensubdiv/SConscript
deleted file mode 100644
index 71923a9..0000000
--- a/intern/opensubdiv/SConscript
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env python
-#
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# The Original Code is Copyright (C) 2013, Blender Foundation
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Sergey Sharybin.
-#
-# ***** END GPL LICENSE BLOCK *****
-
-Import('env')
-
-sources = env.Glob('*.cc')
-
-defs = []
-
-incs = '. ../guardedalloc'
-incs += ' ' + env['BF_OPENSUBDIV_INC']
-
-env.BlenderLib('bf_intern_opensubdiv', sources, Split(incs), defs, libtype=['extern','player'], priority=[10, 185])
diff --git a/intern/opensubdiv/opensubdiv_capi.cc b/intern/opensubdiv/opensubdiv_capi.cc
deleted file mode 100644
index 57786a9..0000000
--- a/intern/opensubdiv/opensubdiv_capi.cc
+++ /dev/null
@@ -1,392 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2013 Blender Foundation.
- * All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *                 Brecht van Lommel
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include "opensubdiv_capi.h"
-
-#include <vector>
-
-#include <opensubdiv/osd/vertex.h>
-#include <opensubdiv/osd/mesh.h>
-#include <opensubdiv/osd/cpuComputeController.h>
-#include <opensubdiv/osd/cpuVertexBuffer.h>
-#include <opensubdiv/osd/cpuEvalLimitController.h>
-#include <opensubdiv/osd/evalLimitContext.h>
-
-#include "MEM_guardedalloc.h"
-
-#if !defined(WITH_ASSERT_ABORT)
-#  define OSD_abort()
-#else
-#  include <stdlib.h>
-#  define OSD_abort() abort()
-#endif
-
-#if defined(_MSC_VER)
-#  define __func__ __FUNCTION__
-#endif
-
-/* TODO(sergey): de-duplicate from OpenColorIO C-API. */
-#define OBJECT_NEW(type, args ...) new(MEM_mallocN(sizeof(type), __func__)) type
-#define OBJECT_DELETE(what, type) if(what) { ((type*)(what))->~type(); MEM_freeN(what); } (void)0
-
-/* Define this when you want to have additional verbosity
- * about what's being passed to OpenSubdiv.
- */
-#undef DEBUG_PRINT
-
-/* **************** Types declaration **************** */
-
-typedef OpenSubdiv::OsdVertex OsdVertex;
-typedef OpenSubdiv::FarMesh<OsdVertex> OsdFarMesh;
-typedef OpenSubdiv::FarMeshFactory<OsdVertex> OsdFarMeshFactory;
-typedef OpenSubdiv::HbrCatmarkSubdivision<OsdVertex> OsdHbrCatmarkSubdivision;
-typedef OpenSubdiv::HbrFace<OsdVertex> OsdHbrFace;
-typedef OpenSubdiv::HbrHalfedge<OsdVertex> OsdHbrHalfEdge;
-typedef OpenSubdiv::HbrMesh<OsdVertex> OsdHbrMesh;
-typedef OpenSubdiv::HbrVertex<OsdVertex> OsdHbrVertex;
-typedef OpenSubdiv::OsdCpuComputeContext OsdCpuComputeContext;
-typedef OpenSubdiv::OsdCpuComputeController OsdCpuComputeController;
-typedef OpenSubdiv::OsdCpuEvalLimitContext OsdCpuEvalLimitContext;
-typedef OpenSubdiv::OsdCpuEvalLimitController OsdCpuEvalLimitController;
-typedef OpenSubdiv::OsdCpuVertexBuffer OsdCpuVertexBuffer;
-typedef OpenSubdiv::OsdEvalCoords OsdEvalCoords;
-typedef OpenSubdiv::OsdVertexBufferDescriptor OsdVertexBufferDescriptor;
-
-typedef struct OpenSubdiv_MeshDescr {
-	OpenSubdiv_HbrCatmarkSubdivision *subdivision;
-	OpenSubdiv_HbrMesh *hbr_mesh;
-	std::vector<float> positions;
-    int num_verts, num_ptex_faces;
-} OpenSubdiv_MeshDescr;
-
-typedef struct OpenSubdiv_EvaluationDescr {
-	/* This are allocated by OpenSubdiv, not guarded alloacated */
-	OsdFarMesh *farmesh;
-	OsdCpuComputeContext *compute_context;
-	OsdCpuEvalLimitContext *evalctx;
-	OsdCpuVertexBuffer *vbuf_base;
-	OsdCpuVertexBuffer *vbuf_P;
-	OsdCpuVertexBuffer *vbuf_dPdu;
-	OsdCpuVertexBuffer *vbuf_dPdv;
-	float *P;
-	float *dPdu;
-	float *dPdv;
-
-	/* This are guarded allocated */
-	OsdCpuComputeController *compute_controller;
-	OsdCpuEvalLimitController *evalctrl;
-} OpenSubdiv_EvaluationDescr;
-
-/* **************** HBR Catmark functions **************** */
-
-struct OpenSubdiv_HbrCatmarkSubdivision *openSubdiv_createHbrCatmarkSubdivision(void)
-{
-	OsdHbrCatmarkSubdivision *catmark_subdivision = OBJECT_NEW(OsdHbrCatmarkSubdivision)();
-	return (OpenSubdiv_HbrCatmarkSubdivision *) catmark_subdivision;
-}
-
-void openSubdiv_deleteHbrCatmarkSubdivision(struct OpenSubdiv_HbrCatmarkSubdivision *sundivision)
-{
-	OBJECT_DELETE(sundivision, OsdHbrCatmarkSubdivision);
-}
-
-/* **************** HBR mesh functions **************** */
-
-struct OpenSubdiv_HbrMesh *openSubdiv_createCatmarkHbrMesh(struct OpenSubdiv_HbrCatmarkSubdivision *subdivision)
-{


@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list