Commit Graph

15 Commits

Author SHA1 Message Date
Brecht Van Lommel
c7f788b877 Subdiv: remove unused GPU device choice, fix crash with libepoxy on init
openSubdiv_init() would detect available evaluators before any OpenGL context
exists, causing a crash with libepoxy. This test however is redundant as we
already check the requirements on the Blender side through the GPU API.

To simplify things, completely remove the device detection in the opensubdiv
module and reduce the evaluators to just CPU and GPU. The plan here is to move
to the GPU module abstraction over OpenGL/Metal/Vulkan and so all these
different backends no longer make sense.

This also removes the user preference for OpenSubdiv compute device, which was
not used for the new GPU subdivision implementation.

Ref D15291

Differential Revision: https://developer.blender.org/D15470
2022-07-18 13:59:08 +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
c37ca43720 OpenSubdiv: Changes in C-API
- Made OpenSubdiv_GLMesh private
  Previously, it was still accessible via C-API from C++ code.

- Don't implicitly refine evaluator when updating coarse positions,
  now there is an explicit call to do this.

  Allows to first apply all changes to the coarse mesh and then
  refine once.

- Added coarse positions update from a continuous buffer with given
  starts offset and stride.

  Allows to update coarse positions directly from MVert array.

- Refiner is no longer freed when CPU evaluator is created.
  Allows to re-use refiner for multiple purposes.
2018-07-11 12:55:22 +02:00
Sergey Sharybin
00b009ca74 Merge branch 'master' into blender2.8 2017-06-07 12:18:07 +02:00
Sergey Sharybin
5489b40a5a Report OpenSubdiv version Blender is compiled against 2017-06-07 12:16:48 +02:00
Mike Erwin
ff8673399e OpenSubdiv: remove legacy support & display queries
OSD display needs more work, since it uses some legacy OpenGL light and material functions.
2017-05-18 18:30:23 -04:00
Sergey Sharybin
48c4b700dc OpenSubdiv: Lay down fundamentals to support multiple UV maps 2016-07-22 14:56:15 +02:00
Sergey Sharybin
f0f60d775d OpenSubdiv: Initial work to support UV maps in textured OSD viewport
A bit work in progress, currently the following limitations:

- Texture shading only, Material shading will come later

- No UVs subdivision yet

- Always uses active UV and currently changing active UV will
  not properly update the viewport.

Well, need to start somewhere :)
2016-07-20 14:16:38 +02:00
Sergey Sharybin
82921ce420 OpenSubdiv: Avoid having bad-level call
This is always asking for problems. Additionally, that call was leading
to OpenGL calls happening from threads.
2015-12-18 23:16:52 +05:00
Mike Erwin
a048d5f945 OpenSubdiv: refine OpenGL version & extension checks
Use new GPU_legacy_support() function.

Determine GLSL version once instead of per shader.

For Texture Buffers, allow ARB or EXT version of the extension. Either
one will do.
2015-12-06 18:47:58 -05:00
Sergey Sharybin
89de6e9eac OpenSubdiv: Fix crash caused by accessing OpenGL vendor from non-main thread 2015-09-16 22:25:13 +05:00
Sergey Sharybin
145617c5eb OpenSubdiv: More graceful handling of shader compile/linking errors 2015-09-09 17:27:08 +05: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
f1e68474e0 OpenSubdiv: Support for multiple materials in solid shading mode
Implementation is less optimal compared to non-opensubdiv drawing but
it is now as good as we can do it without affecting on how patches are
being created by OpenSubdiv.
2015-08-25 15:11:56 +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