[Bf-blender-cvs] [5fdf69bae32] opensubdiv_compare: OpenSubdiv: Refactor, move device specific code to own files
Sergey Sharybin
noreply at git.blender.org
Mon May 25 15:46:19 CEST 2020
Commit: 5fdf69bae32fffee5716c13bca3f0ad9f08a56b1
Author: Sergey Sharybin
Date: Mon May 18 18:16:10 2020 +0200
Branches: opensubdiv_compare
https://developer.blender.org/rB5fdf69bae32fffee5716c13bca3f0ad9f08a56b1
OpenSubdiv: Refactor, move device specific code to own files
Also, move all device files to own folder.
Makes it so checks for device availability are done in a localized
place.
===================================================================
M intern/opensubdiv/CMakeLists.txt
A intern/opensubdiv/internal/device/device_context_cuda.cc
A intern/opensubdiv/internal/device/device_context_cuda.h
A intern/opensubdiv/internal/device/device_context_glsl_compute.cc
A intern/opensubdiv/internal/device/device_context_glsl_compute.h
A intern/opensubdiv/internal/device/device_context_glsl_transform_feedback.cc
A intern/opensubdiv/internal/device/device_context_glsl_transform_feedback.h
A intern/opensubdiv/internal/device/device_context_opencl.cc
A intern/opensubdiv/internal/device/device_context_opencl.h
A intern/opensubdiv/internal/device/device_context_openmp.cc
A intern/opensubdiv/internal/device/device_context_openmp.h
M intern/opensubdiv/internal/opensubdiv.cc
D intern/opensubdiv/internal/opensubdiv_device_context_cuda.cc
D intern/opensubdiv/internal/opensubdiv_device_context_cuda.h
D intern/opensubdiv/internal/opensubdiv_device_context_opencl.cc
D intern/opensubdiv/internal/opensubdiv_device_context_opencl.h
===================================================================
diff --git a/intern/opensubdiv/CMakeLists.txt b/intern/opensubdiv/CMakeLists.txt
index 13565a6ed28..3226d9e8931 100644
--- a/intern/opensubdiv/CMakeLists.txt
+++ b/intern/opensubdiv/CMakeLists.txt
@@ -50,11 +50,20 @@ if(WITH_OPENSUBDIV)
)
list(APPEND SRC
+ 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
+
internal/opensubdiv.cc
internal/opensubdiv_converter_factory.cc
internal/opensubdiv_converter_internal.cc
- internal/opensubdiv_device_context_cuda.cc
- internal/opensubdiv_device_context_opencl.cc
internal/opensubdiv_evaluator.cc
internal/opensubdiv_evaluator_internal.cc
internal/opensubdiv_topology_refiner.cc
@@ -63,8 +72,6 @@ if(WITH_OPENSUBDIV)
internal/opensubdiv_converter_factory.h
internal/opensubdiv_converter_internal.h
- internal/opensubdiv_device_context_cuda.h
- internal/opensubdiv_device_context_opencl.h
internal/opensubdiv_edge_map.h
internal/opensubdiv_evaluator_internal.h
internal/opensubdiv_internal.h
@@ -83,10 +90,8 @@ if(WITH_OPENSUBDIV)
endif()
OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_OPENMP)
- # 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_OPENCL)
+ OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_CUDA)
OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK)
OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_GLSL_COMPUTE)
@@ -97,21 +102,6 @@ if(WITH_OPENSUBDIV)
add_definitions(-DNOMINMAX)
add_definitions(-D_USE_MATH_DEFINES)
endif()
-
- # TODO(sergey): Put CUEW back when CUDA is officially supported by OSD.
- # if(OPENSUBDIV_HAS_CUDA)
- # list(APPEND INC
- # ../../extern/cuew/include
- # )
- # add_definitions(-DOPENSUBDIV_HAS_CUEW)
- # endif()
-
- if(OPENSUBDIV_HAS_OPENCL)
- list(APPEND INC
- ../../extern/clew/include
- )
- add_definitions(-DOPENSUBDIV_HAS_CLEW)
- endif()
else()
list(APPEND SRC
stub/opensubdiv_stub.cc
diff --git a/intern/opensubdiv/internal/device/device_context_cuda.cc b/intern/opensubdiv/internal/device/device_context_cuda.cc
new file mode 100644
index 00000000000..cd4336265a5
--- /dev/null
+++ b/intern/opensubdiv/internal/device/device_context_cuda.cc
@@ -0,0 +1,39 @@
+// 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
new file mode 100644
index 00000000000..d1bfb15fbcb
--- /dev/null
+++ b/intern/opensubdiv/internal/device/device_context_cuda.h
@@ -0,0 +1,38 @@
+// 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
new file mode 100644
index 00000000000..7b416976099
--- /dev/null
+++ b/intern/opensubdiv/internal/device/device_context_glsl_compute.cc
@@ -0,0 +1,40 @@
+// 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
new file mode 100644
index 00000000000..f64c7d1954b
--- /dev/null
+++ b/intern/opensubdiv/internal/device/device_context_glsl_compute.h
@@ -0,0 +1,38 @@
+// 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
new file mode 100644
index 00000000000..ef897608b6e
--- /dev/null
+++ b/intern/opensubdiv/internal/device/device_context_glsl_transform_feedback.cc
@@ -0,0 +1,40 @@
+// 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;
+}
+
+GLSLTransformFeed
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list