Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-07-20 17:08:06 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-07-20 23:29:26 +0300
commit3d364896725db8336d785ba6cf977b62c0f2c0ce (patch)
treeb189cdc4956b557d19b0c2ea976c6f48affa1ed2 /intern
parent2466c4f8cebd3977f29524d79050feff44b40fff (diff)
OpenSubdiv: Commit of OpenSubdiv integration into Blender
This commit contains all the remained parts needed for initial integration of OpenSubdiv into Blender's subdivision surface code. Includes both GPU and CPU backends which works in the following way: - When SubSurf modifier is the last in the modifiers stack then GPU pipeline of OpenSubdiv is used, making viewport performance as fast as possible. This also requires graphscard with GLSL 1.5 support. If this requirement is not met, then no GPU pipeline is used at all. - If SubSurf is not a last modifier or if DerivesMesh is being evaluated for rendering then CPU limit evaluation API from OpenSubdiv is used. This only replaces the legacy evaluation code from CCGSubSurf_legacy, but keeps CCG structures exactly the same as they used to be for ages now. This integration is fully covered with ifdef and not enabled by default because there are several TODOs to be solved first: - Face varying data interpolation is not really cleanly implemented for GPU in OpenSubdiv 3.0. It is also not implemented for limit evaluation API. This basically means we'll have really hard time supporting UVs. - Limit evaluation only works with adaptivly subdivided meshes so far, which basically means all the points of CCG are pushed to the limit. This gives different result from old code. - There are some serious optimizations possible on the topology refiner creation, which would speed up initial OpenSubdiv mesh creation. - There are some hardcoded asumptions in the GPU and DerivedMesh areas which could be generalized. That's something where Antony and Campbell can help, making it so the code is structured in a way which is reusable by all planned viewport projects. - There are also some workarounds in the dependency graph to make sure OpenGL buffers are only freed from the main thread. Those who'll be wanting to make experiments with this code should grab dev branch (NOT master) from https://github.com/Nazg-Gul/OpenSubdiv/tree/dev There are some patches applied in there which we're working on on getting into upstream.
Diffstat (limited to 'intern')
-rw-r--r--intern/CMakeLists.txt5
-rw-r--r--intern/SConscript2
-rw-r--r--intern/opensubdiv/opensubdiv_converter.cc5
-rw-r--r--intern/opensubdiv/opensubdiv_gpu_capi.cc9
4 files changed, 13 insertions, 8 deletions
diff --git a/intern/CMakeLists.txt b/intern/CMakeLists.txt
index 74048c2a4cc..4ee3dff7695 100644
--- a/intern/CMakeLists.txt
+++ b/intern/CMakeLists.txt
@@ -77,8 +77,11 @@ if(WITH_OPENNL)
add_subdirectory(opennl)
endif()
+if(WITH_OPENSUBDIV)
+ add_subdirectory(opensubdiv)
+endif()
+
# only windows needs utf16 converter
if(WIN32)
add_subdirectory(utfconv)
endif()
-
diff --git a/intern/SConscript b/intern/SConscript
index c0dafe37855..a13f67537ac 100644
--- a/intern/SConscript
+++ b/intern/SConscript
@@ -63,3 +63,5 @@ if env['WITH_BF_BULLET']:
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-mingw', 'linuxcross', 'win64-vc'):
SConscript(['utfconv/SConscript'])
+if env['WITH_BF_OPENSUBDIV']:
+ SConscript (['opensubdiv/SConscript'])
diff --git a/intern/opensubdiv/opensubdiv_converter.cc b/intern/opensubdiv/opensubdiv_converter.cc
index f5f3547a9cb..6b245db2530 100644
--- a/intern/opensubdiv/opensubdiv_converter.cc
+++ b/intern/opensubdiv/opensubdiv_converter.cc
@@ -330,6 +330,10 @@ int openSubdiv_topologyRefnerCompareConverter(
}
}
/* Compare sharpness. */
+#if 0
+ /* TODO(sergey): For some reason shrapness is not being reported correctly
+ * from the base level, which cuases false-positive topology change detection.
+ */
for (int edge = 0; edge < num_edges; ++edge) {
float sharpness = base_level.GetEdgeSharpness(edge);
float conv_sharpness = converter->get_edge_sharpness(converter, edge);
@@ -337,5 +341,6 @@ int openSubdiv_topologyRefnerCompareConverter(
return false;
}
}
+#endif
return true;
}
diff --git a/intern/opensubdiv/opensubdiv_gpu_capi.cc b/intern/opensubdiv/opensubdiv_gpu_capi.cc
index 8b3f1446e73..d46211f3668 100644
--- a/intern/opensubdiv/opensubdiv_gpu_capi.cc
+++ b/intern/opensubdiv/opensubdiv_gpu_capi.cc
@@ -558,12 +558,12 @@ static void finish_patchDraw(bool fill_quads)
}
}
+#if 0
static void draw_partition_patches_range(PartitionedGLMeshInterface *mesh,
GLuint program,
int start_partition,
int num_partitions)
{
-#if 0
/* Glue patches from all partitions in the range together. */
int patch_index = -1, start_element = -1, num_elements = 0;
for (int partition = start_partition;
@@ -596,13 +596,8 @@ static void draw_partition_patches_range(PartitionedGLMeshInterface *mesh,
patch_index,
num_elements,
start_element);
-#else
- (void)mesh;
- (void)program;
- (void)start_partition;
- (void)num_partitions;
-#endif
}
+#endif
static void draw_all_patches(PartitionedGLMeshInterface *mesh,
GLuint program)