Commit Graph

26 Commits

Author SHA1 Message Date
Sergey Sharybin
c81a5f58f8 OpenSubdiv: Refactor, move topology refiner factory to topology folder 2020-05-27 12:07:15 +02:00
Sergey Sharybin
67fe31d751 OpenSubdiv: Refactor, move topology refiner to own folder
In the future factory will also be moved there.
2020-05-27 12:07:15 +02:00
Sergey Sharybin
7c0bea0d65 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.
2020-05-27 12:07:15 +02:00
Sebastián Barschkis
0a19b8a5b4 OpenSubdiv: Remove old GPU code
This code was accidentally reintroduced in e73d7d27dc66.
2020-05-19 21:35:47 +02:00
Sebastián Barschkis
e73d7d27dc Merge branch 'blender-v2.83-release' 2020-05-19 21:23:54 +02:00
Jacques Lucke
cfb7664d5b Fix: build error due to missing definitions
Reviewers: sergey, brecht

Differential Revision: https://developer.blender.org/D7787
2020-05-19 17:36:40 +02:00
Sergey Sharybin
2ad5131f77 OpenSubdiv: Cleanyp, remove old GPU code
All parts of drawing (shaders, GL mesh descriptor, material partitioner
and so on) needs to be redone for the draw manager and new OpenSubdiv
library.

Removing untested code which is doomed to be replaced to make localized
refactoring easier.
2020-05-18 17:06:48 +02:00
Sergey Sharybin
22f68f85a4 OpenSubdiv: Cleanup, remove unused topology orientation code
The code was trying to make winding consistent and manifold, same as
OpenSubdiv expects it to.

Unfortunately, the code was having some issues in corner cases so the
winding wasn't really correct.
Fortunately, the latter (compared to when this code was originally
written) supports orientation on OpenSubdiv side.

Removing code which is currently unused in Blender and which had
known issues. Is simple enough to bring the code from Git history
if the functionality is needed in the future.
2020-05-18 17:06:48 +02:00
3788901107 Cleanup: fix compiler warnings 2020-01-27 12:19:49 +01:00
Sergey Sharybin
517870a4a1 CMake: Refactor external dependencies handling
This is a more correct fix to the issue Brecht was fixing in D6600.

While the fix in that patch worked fine for linking it broke ASAN
runtime under some circumstances.
For example, `make full debug developer` would compile, but trying
to start blender will cause assert failure in ASAN (related on check
that ASAN is not running already).

Top-level idea: leave it to CMake to keep track of dependency graph.

The root of the issue comes to the fact that target like "blender" is
configured to use a lot of static libraries coming from Blender sources
and to use external static libraries. There is nothing which ensures
order between blender's and external libraries. Only order of blender
libraries is guaranteed.

It was possible that due to a cycle or other circumstances some of
blender libraries would have been passed to linker after libraries
it uses, causing linker errors.

For example, this order will likely fail:

  libbf_blenfont.a libfreetype6.a libbf_blenfont.a

This change makes it so blender libraries are explicitly provided
their dependencies to an external libraries, which allows CMake to
ensure they are always linked against them.

General rule here: if bf_foo depends on an external library it is
to be provided to LIBS for bf_foo.
For example, if bf_blenkernel depends on opensubdiv then LIBS in
blenkernel's CMakeLists.txt is to include OPENSUBDIB_LIBRARIES.

The change is made based on searching for used include folders
such as OPENSUBDIV_INCLUDE_DIRS and adding corresponding libraries
to LIBS ion that CMakeLists.txt. Transitive dependencies are not
simplified by this approach, but I am not aware of any downside of
this: CMake should be smart enough to simplify them on its side.
And even if not, this shouldn't affect linking time.

Benefit of not relying on transitive dependencies is that build
system is more robust towards future changes. For example, if
bf_intern_opensubiv is no longer depends on OPENSUBDIV_LIBRARIES
and all such code is moved to bf_blenkernel this will not break
linking.

The not-so-trivial part is change to blender_add_lib (and its
version in Cycles). The complexity is caused by libraries being
provided as a single list argument which doesn't allow to use
different release and debug libraries on Windows. The idea is:

- Have every library prefixed as "optimized" or "debug" if
  separation is needed (non-prefixed libraries will be considered
  "generic").

- Loop through libraries passed to function and do simple parsing
  which will look for "optimized" and "debug" words and specify
  following library to corresponding category.

This isn't something particularly great. Alternative would be to
use target_link_libraries() directly, which sounds like more code
but which is more explicit and allows to have more flexibility
and control comparing to wrapper approach.

Tested the following configurations on Linux, macOS and Windows:

- make full debug developer
- make full release developer
- make lite debug developer
- make lite release developer

NOTE: Linux libraries needs to be compiled with D6641 applied,
otherwise, depending on configuration, it's possible to run into
duplicated zlib symbols error.

Differential Revision: https://developer.blender.org/D6642
2020-01-23 16:59:18 +01:00
Campbell Barton
312075e688 CMake: add missing headers, use space before comments 2019-10-29 01:33:44 +11:00
Campbell Barton
e12c08e8d1 ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.

For details on usage and instructions for migrating branches
without conflicts, see:

https://wiki.blender.org/wiki/Tools/ClangFormat
2019-04-17 06:21:24 +02:00
Campbell Barton
47adab4f99 CMake: prepare for BLENDER_SORTED_LIBS removal
No functional change, this adds LIB definition and args to cmake files.
Without this it's difficult to migrate away from 'BLENDER_SORTED_LIBS'
since there are many platforms/configurations that could break when
changing linking order.

Manually add and enable WITHOUT_SORTED_LIBS to try building
without sorted libs (currently fails since all variables are empty).
This check will eventually be removed.

See T46725.
2019-04-14 15:37:24 +02:00
Campbell Barton
ab5e69e660 Cleanup: remove contributors for CMake files
Following removal from C source code.

See: 8c68ed6df16d8893
2019-02-05 09:10:32 +11:00
Sergey Sharybin
e064777cac OpenSubdiv: Correct topology cpmparator
This fixes following errors:

- The code didn't work correctly for edges reconstructed by
  the OpenSubdiv's topology refiner (due to indexing
  difference).

- Sharpness of non-manifold and boundary edges was not
  working correctly.
2019-01-16 11:00:42 +01:00
Campbell Barton
1450a37555 CMake: add missing headers 2018-09-06 21:23:25 +10:00
Sergey Sharybin
f8a499b596 OpenSubdiv: Add stub implementation of C-API
C-API is way smaller than the rest of the code which uses it.
So better to conditionally compile stub implementation than
to keep adding ifdef everywhere.
2018-08-13 12:37:18 +02:00
Sergey Sharybin
d920382046 OpenSubdiv: Re-work C-API integration
Main goal is to make API simpler to follow (at least ion terms what
is defined/declared where, as opposite of handful big headers which
includes all the declarations), and also avoid a big set of long and
obscure functions.

Now C-API files are split into smaller ones, following OpenSubdiv
behavior more closely, and also function pointers in structures
used a lot more, which shortens functions names,

UV integration part in GL Mesh is mainly stripped away, it needs
to be done differently. On a related topic, UV coordinates API in
converter needs to be removed as well, we do not need coordinates,
only island connectivity information there.

Additional changes:

- Varying interpolation in evaluator API are temporarily disabled,
  need to extend API somewhere (probably, evaluator's API) to inform
  layout information of vertex data (whether it contains varying
  data, width, stride and such).

- Evaluator now can interpolate face-varying data.
  Only works for adaptive refiner, since some issues in OpenSubdiv
  itself.

Planned changes:

- Remove uv coordinates from TopologyConverter.
- Support evaluation of patches (as opposite to individual coordinates
  as it happens currently).
- Support more flexible layout of varying and face-varying data.
  It is stupid to assume varying is 3 floats and face-varying 2 floats.
- Support of second order derivatives.
- Everything else what i'm missing in this list.
2018-07-16 09:52:37 +02:00
Sergey Sharybin
a27b54f6e2 OpenSubdiv: Split shader source files
Was a bit annoying to do tweaks in a file which contained all
vertex, geometry and fragment shaders.
2016-09-16 12:28:35 +02:00
Kévin Dietrich
1deb01a9b9 Attempt to fix compilation on Windows, take 2
Previous patch was wrong apparently... :|
2016-07-21 16:12:31 +02:00
Kévin Dietrich
be1c854019 Attempt to fix compilation error on Windows.
Patch from @fjuhec.
2016-07-21 15:45:07 +02:00
Sergey Sharybin
9a0634a253 OpenSubdiv: Wrap OSD's TopologyRefier with own struct
This is a way for us to store extra data, such as UVs which we can
collect now on topology refiner stage.
2016-07-20 12:38:33 +02:00
Sergey Sharybin
fef53c74b5 CMake: Remove per-module Werror settings
Seems i was the only one who was really up to using it and
i do have gcc-5 finally backported and installed here so
such a fine-tune flags are no longer needed.
2016-01-30 00:04:52 +01:00
Sergey Sharybin
669f2f0088 OpenSubdiv: Remove partitioned mesh interface
It's hopefully no longer needed, at least not needed for as long as
single ptex face corresponds to a single patch which should be always
correct for uniform subdivisions as far as i know.
2015-08-25 15:12:12 +02:00
Sergey Sharybin
820d191626 OpenSubdiv: Add CMake option to enable -Werror in subsurf code 2015-07-30 10:31:22 +02:00
Sergey Sharybin
a040157e5d OpenSubdiv: Add new OpenSubdiv related files
This includes C-API bindings in intern/opensubdiv and CMAke module
which finds the OpenSubdiv library. This filea are not in use so
far, making it a separate commit to make actual integration commit
more clear.
2015-07-20 22:29:25 +02:00