diff options
Diffstat (limited to 'intern/opensubdiv')
16 files changed, 5 insertions, 461 deletions
diff --git a/intern/opensubdiv/CMakeLists.txt b/intern/opensubdiv/CMakeLists.txt index bb3aa16a9fe..14cc6a70cd5 100644 --- a/intern/opensubdiv/CMakeLists.txt +++ b/intern/opensubdiv/CMakeLists.txt @@ -42,18 +42,6 @@ if(WITH_OPENSUBDIV) internal/base/util.cc internal/base/util.h - # Device. - internal/device/device_context_cuda.cc - internal/device/device_context_cuda.h - internal/device/device_context_glsl_compute.cc - internal/device/device_context_glsl_compute.h - internal/device/device_context_glsl_transform_feedback.cc - internal/device/device_context_glsl_transform_feedback.h - internal/device/device_context_opencl.cc - internal/device/device_context_opencl.h - internal/device/device_context_openmp.cc - internal/device/device_context_openmp.h - # Evaluator. internal/evaluator/eval_output.cc internal/evaluator/eval_output.h diff --git a/intern/opensubdiv/internal/base/opensubdiv_capi.cc b/intern/opensubdiv/internal/base/opensubdiv_capi.cc index 85f8120c76b..40d820836b9 100644 --- a/intern/opensubdiv/internal/base/opensubdiv_capi.cc +++ b/intern/opensubdiv/internal/base/opensubdiv_capi.cc @@ -21,55 +21,15 @@ #endif #include "internal/base/util.h" -#include "internal/device/device_context_cuda.h" -#include "internal/device/device_context_glsl_compute.h" -#include "internal/device/device_context_glsl_transform_feedback.h" -#include "internal/device/device_context_opencl.h" -#include "internal/device/device_context_openmp.h" - -using blender::opensubdiv::CUDADeviceContext; -using blender::opensubdiv::GLSLComputeDeviceContext; -using blender::opensubdiv::GLSLTransformFeedbackDeviceContext; -using blender::opensubdiv::OpenCLDeviceContext; -using blender::opensubdiv::OpenMPDeviceContext; void openSubdiv_init() { - // Ensure all OpenGL strings are cached. - openSubdiv_getAvailableEvaluators(); } void openSubdiv_cleanup() { } -int openSubdiv_getAvailableEvaluators() -{ - int flags = OPENSUBDIV_EVALUATOR_CPU; - - if (OpenMPDeviceContext::isSupported()) { - flags |= OPENSUBDIV_EVALUATOR_OPENMP; - } - - if (OpenCLDeviceContext::isSupported()) { - flags |= OPENSUBDIV_EVALUATOR_OPENCL; - } - - if (CUDADeviceContext::isSupported()) { - flags |= OPENSUBDIV_EVALUATOR_CUDA; - } - - if (GLSLTransformFeedbackDeviceContext::isSupported()) { - flags |= OPENSUBDIV_EVALUATOR_GLSL_TRANSFORM_FEEDBACK; - } - - if (GLSLComputeDeviceContext::isSupported()) { - flags |= OPENSUBDIV_EVALUATOR_GLSL_COMPUTE; - } - - return flags; -} - int openSubdiv_getVersionHex() { #if defined(OPENSUBDIV_VERSION_NUMBER) diff --git a/intern/opensubdiv/internal/device/device_context_cuda.cc b/intern/opensubdiv/internal/device/device_context_cuda.cc deleted file mode 100644 index cd4336265a5..00000000000 --- a/intern/opensubdiv/internal/device/device_context_cuda.cc +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2020 Blender Foundation. All rights reserved. -// -// 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. -// -// Author: Sergey Sharybin - -#include "internal/device/device_context_cuda.h" - -namespace blender { -namespace opensubdiv { - -bool CUDADeviceContext::isSupported() -{ - // TODO(sergey): Add CUDA device support, using CUDA-RT API. - return false; -} - -CUDADeviceContext::CUDADeviceContext() -{ -} - -CUDADeviceContext::~CUDADeviceContext() -{ -} - -} // namespace opensubdiv -} // namespace blender diff --git a/intern/opensubdiv/internal/device/device_context_cuda.h b/intern/opensubdiv/internal/device/device_context_cuda.h deleted file mode 100644 index d1bfb15fbcb..00000000000 --- a/intern/opensubdiv/internal/device/device_context_cuda.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2020 Blender Foundation. All rights reserved. -// -// 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. -// -// Author: Sergey Sharybin - -#ifndef OPENSUBDIV_DEVICE_CONTEXT_CUDA_H_ -#define OPENSUBDIV_DEVICE_CONTEXT_CUDA_H_ - -namespace blender { -namespace opensubdiv { - -class CUDADeviceContext { - public: - // Stateless check to see whether CUDA functionality is available on this - // platform. - static bool isSupported(); - - CUDADeviceContext(); - ~CUDADeviceContext(); -}; - -} // namespace opensubdiv -} // namespace blender - -#endif // _OPENSUBDIV_DEVICE_CONTEXT_CUDA_H_ diff --git a/intern/opensubdiv/internal/device/device_context_glsl_compute.cc b/intern/opensubdiv/internal/device/device_context_glsl_compute.cc deleted file mode 100644 index 7b416976099..00000000000 --- a/intern/opensubdiv/internal/device/device_context_glsl_compute.cc +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2020 Blender Foundation. All rights reserved. -// -// 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. -// -// Author: Sergey Sharybin - -#include "internal/device/device_context_glsl_compute.h" - -#include <GL/glew.h> - -namespace blender { -namespace opensubdiv { - -bool GLSLComputeDeviceContext::isSupported() -{ - return GLEW_VERSION_4_3 || GLEW_ARB_compute_shader; -} - -GLSLComputeDeviceContext::GLSLComputeDeviceContext() -{ -} - -GLSLComputeDeviceContext::~GLSLComputeDeviceContext() -{ -} - -} // namespace opensubdiv -} // namespace blender diff --git a/intern/opensubdiv/internal/device/device_context_glsl_compute.h b/intern/opensubdiv/internal/device/device_context_glsl_compute.h deleted file mode 100644 index f64c7d1954b..00000000000 --- a/intern/opensubdiv/internal/device/device_context_glsl_compute.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2020 Blender Foundation. All rights reserved. -// -// 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. -// -// Author: Sergey Sharybin - -#ifndef OPENSUBDIV_DEVICE_CONTEXT_GLSL_COMPUTE_H_ -#define OPENSUBDIV_DEVICE_CONTEXT_GLSL_COMPUTE_H_ - -namespace blender { -namespace opensubdiv { - -class GLSLComputeDeviceContext { - public: - // Stateless check to see whether GLSL compute functionality is - // available on this platform. - static bool isSupported(); - - GLSLComputeDeviceContext(); - ~GLSLComputeDeviceContext(); -}; - -} // namespace opensubdiv -} // namespace blender - -#endif // _OPENSUBDIV_DEVICE_CONTEXT_GLSL_COMPUTE_H_ diff --git a/intern/opensubdiv/internal/device/device_context_glsl_transform_feedback.cc b/intern/opensubdiv/internal/device/device_context_glsl_transform_feedback.cc deleted file mode 100644 index ef897608b6e..00000000000 --- a/intern/opensubdiv/internal/device/device_context_glsl_transform_feedback.cc +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2020 Blender Foundation. All rights reserved. -// -// 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. -// -// Author: Sergey Sharybin - -#include "internal/device/device_context_glsl_transform_feedback.h" - -#include <GL/glew.h> - -namespace blender { -namespace opensubdiv { - -bool GLSLTransformFeedbackDeviceContext::isSupported() -{ - return GLEW_VERSION_4_1; -} - -GLSLTransformFeedbackDeviceContext::GLSLTransformFeedbackDeviceContext() -{ -} - -GLSLTransformFeedbackDeviceContext::~GLSLTransformFeedbackDeviceContext() -{ -} - -} // namespace opensubdiv -} // namespace blender diff --git a/intern/opensubdiv/internal/device/device_context_glsl_transform_feedback.h b/intern/opensubdiv/internal/device/device_context_glsl_transform_feedback.h deleted file mode 100644 index 7bbbba1380f..00000000000 --- a/intern/opensubdiv/internal/device/device_context_glsl_transform_feedback.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2020 Blender Foundation. All rights reserved. -// -// 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. -// -// Author: Sergey Sharybin - -#ifndef OPENSUBDIV_DEVICE_CONTEXT_GLSL_TRANSFORM_FEEDBACK_H_ -#define OPENSUBDIV_DEVICE_CONTEXT_GLSL_TRANSFORM_FEEDBACK_H_ - -namespace blender { -namespace opensubdiv { - -class GLSLTransformFeedbackDeviceContext { - public: - // Stateless check to see whether GLSL transform feedback functionality is - // available on this platform. - static bool isSupported(); - - GLSLTransformFeedbackDeviceContext(); - ~GLSLTransformFeedbackDeviceContext(); -}; - -} // namespace opensubdiv -} // namespace blender - -#endif // _OPENSUBDIV_DEVICE_CONTEXT_GLSL_TRANSFORM_FEEDBACK_H_ diff --git a/intern/opensubdiv/internal/device/device_context_opencl.cc b/intern/opensubdiv/internal/device/device_context_opencl.cc deleted file mode 100644 index 1670ea3c9d0..00000000000 --- a/intern/opensubdiv/internal/device/device_context_opencl.cc +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2020 Blender Foundation. All rights reserved. -// -// 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. -// -// Author: Sergey Sharybin - -#include "internal/device/device_context_opencl.h" - -namespace blender { -namespace opensubdiv { - -bool OpenCLDeviceContext::isSupported() -{ - // TODO(sergey): Add support of OpenCL devices. - return false; -} - -OpenCLDeviceContext::OpenCLDeviceContext() -{ -} - -OpenCLDeviceContext::~OpenCLDeviceContext() -{ -} - -} // namespace opensubdiv -} // namespace blender diff --git a/intern/opensubdiv/internal/device/device_context_opencl.h b/intern/opensubdiv/internal/device/device_context_opencl.h deleted file mode 100644 index 57ec6ed3bb6..00000000000 --- a/intern/opensubdiv/internal/device/device_context_opencl.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2020 Blender Foundation. All rights reserved. -// -// 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. -// -// Author: Sergey Sharybin - -#ifndef OPENSUBDIV_DEVICE_CONTEXT_OPENCL_H_ -#define OPENSUBDIV_DEVICE_CONTEXT_OPENCL_H_ - -namespace blender { -namespace opensubdiv { - -class OpenCLDeviceContext { - public: - // Stateless check to see whether OpenCL functionality is available on this - // platform. - static bool isSupported(); - - OpenCLDeviceContext(); - ~OpenCLDeviceContext(); -}; - -} // namespace opensubdiv -} // namespace blender - -#endif // _OPENSUBDIV_DEVICE_CONTEXT_OPENCL_H_ diff --git a/intern/opensubdiv/internal/device/device_context_openmp.cc b/intern/opensubdiv/internal/device/device_context_openmp.cc deleted file mode 100644 index e01312fefaf..00000000000 --- a/intern/opensubdiv/internal/device/device_context_openmp.cc +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2020 Blender Foundation. All rights reserved. -// -// 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. -// -// Author: Sergey Sharybin - -#include "internal/device/device_context_openmp.h" - -namespace blender { -namespace opensubdiv { - -bool OpenMPDeviceContext::isSupported() -{ -#ifdef OPENSUBDIV_HAS_OPENMP - return true; -#else - return false; -#endif -} - -OpenMPDeviceContext::OpenMPDeviceContext() -{ -} - -OpenMPDeviceContext::~OpenMPDeviceContext() -{ -} - -} // namespace opensubdiv -} // namespace blender diff --git a/intern/opensubdiv/internal/device/device_context_openmp.h b/intern/opensubdiv/internal/device/device_context_openmp.h deleted file mode 100644 index 2bebbdf40bc..00000000000 --- a/intern/opensubdiv/internal/device/device_context_openmp.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2020 Blender Foundation. All rights reserved. -// -// 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. -// -// Author: Sergey Sharybin - -#ifndef OPENSUBDIV_DEVICE_CONTEXT_OPENMP_H_ -#define OPENSUBDIV_DEVICE_CONTEXT_OPENMP_H_ - -namespace blender { -namespace opensubdiv { - -class OpenMPDeviceContext { - public: - // Stateless check to see whether OpenMP functionality is available on this - // platform. - static bool isSupported(); - - OpenMPDeviceContext(); - ~OpenMPDeviceContext(); -}; - -} // namespace opensubdiv -} // namespace blender - -#endif // _OPENSUBDIV_DEVICE_CONTEXT_OPENMP_H_ diff --git a/intern/opensubdiv/internal/evaluator/evaluator_cache_impl.cc b/intern/opensubdiv/internal/evaluator/evaluator_cache_impl.cc index 2fffcefa460..efac0926fef 100644 --- a/intern/opensubdiv/internal/evaluator/evaluator_cache_impl.cc +++ b/intern/opensubdiv/internal/evaluator/evaluator_cache_impl.cc @@ -30,7 +30,7 @@ OpenSubdiv_EvaluatorCacheImpl::~OpenSubdiv_EvaluatorCacheImpl() OpenSubdiv_EvaluatorCacheImpl *openSubdiv_createEvaluatorCacheInternal( eOpenSubdivEvaluator evaluator_type) { - if (evaluator_type != eOpenSubdivEvaluator::OPENSUBDIV_EVALUATOR_GLSL_COMPUTE) { + if (evaluator_type != eOpenSubdivEvaluator::OPENSUBDIV_EVALUATOR_GPU) { return nullptr; } OpenSubdiv_EvaluatorCacheImpl *evaluator_cache; diff --git a/intern/opensubdiv/internal/evaluator/evaluator_impl.cc b/intern/opensubdiv/internal/evaluator/evaluator_impl.cc index 49a59c44be8..262b418169d 100644 --- a/intern/opensubdiv/internal/evaluator/evaluator_impl.cc +++ b/intern/opensubdiv/internal/evaluator/evaluator_impl.cc @@ -442,11 +442,6 @@ OpenSubdiv_EvaluatorImpl *openSubdiv_createEvaluatorInternal( eOpenSubdivEvaluator evaluator_type, OpenSubdiv_EvaluatorCacheImpl *evaluator_cache_descr) { - // Only CPU and GLCompute are implemented at the moment. - if (evaluator_type != OPENSUBDIV_EVALUATOR_CPU && - evaluator_type != OPENSUBDIV_EVALUATOR_GLSL_COMPUTE) { - return NULL; - } using blender::opensubdiv::vector; TopologyRefiner *refiner = topology_refiner->impl->topology_refiner; if (refiner == NULL) { @@ -551,8 +546,8 @@ OpenSubdiv_EvaluatorImpl *openSubdiv_createEvaluatorInternal( // Create OpenSubdiv's CPU side evaluator. blender::opensubdiv::EvalOutputAPI::EvalOutput *eval_output = nullptr; - const bool use_gl_evaluator = evaluator_type == OPENSUBDIV_EVALUATOR_GLSL_COMPUTE; - if (use_gl_evaluator) { + const bool use_gpu_evaluator = evaluator_type == OPENSUBDIV_EVALUATOR_GPU; + if (use_gpu_evaluator) { blender::opensubdiv::GpuEvalOutput::EvaluatorCache *evaluator_cache = nullptr; if (evaluator_cache_descr) { evaluator_cache = static_cast<blender::opensubdiv::GpuEvalOutput::EvaluatorCache *>( diff --git a/intern/opensubdiv/opensubdiv_capi.h b/intern/opensubdiv/opensubdiv_capi.h index a26ea36b863..1fa75a9a8c2 100644 --- a/intern/opensubdiv/opensubdiv_capi.h +++ b/intern/opensubdiv/opensubdiv_capi.h @@ -31,9 +31,6 @@ extern "C" { void openSubdiv_init(void); void openSubdiv_cleanup(void); -// Bitmask of eOpenSubdivEvaluator. -int openSubdiv_getAvailableEvaluators(void); - int openSubdiv_getVersionHex(void); #ifdef __cplusplus diff --git a/intern/opensubdiv/opensubdiv_capi_type.h b/intern/opensubdiv/opensubdiv_capi_type.h index e78842036be..585d9bc49df 100644 --- a/intern/opensubdiv/opensubdiv_capi_type.h +++ b/intern/opensubdiv/opensubdiv_capi_type.h @@ -23,15 +23,9 @@ extern "C" { #endif -// Keep this a bitmask so it's possible to pass available -// evaluators to Blender. typedef enum eOpenSubdivEvaluator { - OPENSUBDIV_EVALUATOR_CPU = (1 << 0), - OPENSUBDIV_EVALUATOR_OPENMP = (1 << 1), - OPENSUBDIV_EVALUATOR_OPENCL = (1 << 2), - OPENSUBDIV_EVALUATOR_CUDA = (1 << 3), - OPENSUBDIV_EVALUATOR_GLSL_TRANSFORM_FEEDBACK = (1 << 4), - OPENSUBDIV_EVALUATOR_GLSL_COMPUTE = (1 << 5), + OPENSUBDIV_EVALUATOR_CPU = 0, + OPENSUBDIV_EVALUATOR_GPU = 1, } eOpenSubdivEvaluator; typedef enum OpenSubdiv_SchemeType { |