Crates.io | opensubdiv-petite |
lib.rs | opensubdiv-petite |
version | 0.2.0 |
source | src |
created_at | 2021-04-13 10:28:58.266996 |
updated_at | 2023-02-21 17:38:40.830261 |
description | Wrapper around parts of Pixar’s OpenSubdiv |
homepage | https://graphics.pixar.com/opensubdiv/ |
repository | https://github.com/virtualritz/opensubdiv-petite/ |
max_upload_size | |
id | 382821 |
size | 171,084 |
A selective Rust wrapper for Pixar’s OpenSubdiv library.
For now crate versions reflect code maturity on the Rust side. They are not in any way related to the OpenSubdiv version that is wrapped.
v0.1.x
– OpenSubdiv v3.4.4
There are several features to gate the resp. build flags when OpenSubdiv is built.
Almost all of them are not yet implemented.
clew
– TBD. Adds support for
CLEW.cuda
– Adds support for the Nvidia CUDA
backend. Only valid on Linux/Windows.
CUDA support is almost done (Rust API wrappers are there).
It just require some more work in build.rs
.
Ideally, if the cuda
feature flag is present, build.rs
would detect a
CUDA installation on Linux/Windows and configure the OpenSubdiv
build resp. panic if no installation can be found.metal
– Adds support for the Apple
Metal backend. Only valid on
macOS.opencl
– TBD. Adds support for the
OpenCL backend.ptex
– TBD. Adds support for PTex.topology_validation
– Do (expensive) validation of topology. This
checks index bounds on the Rust side and activates a bunch of topology
checks on the FFI side. This is on by default!
Set default-features = false
in Cargo.toml
to switch this off –
suggested for release
builds.OpenMP detection is broken on the CMake side on macOS. There are a bunch of issues open in the CMake tracker. I added some comments here.
A workaround is likely possible. PRs welcome. If you need to make a fix on the OpenSubdiv side, Pixar will probably also welcome a PR.
The original library does make use of C++ templates in quite a few places. The wrapper has specializations that cover the most common use cases.
C++ factory classes have been collapsed into the new()
method of the resp.
struct that mirrors the class the C++ factory was building.
Many methods have slightly different names on the Rust side.
Renaming was done considering these constraints:
num_vertices()
becomes vertices_len()
).StencilTable::numStencils()
in C++
becomes StencilTable::len()
in Rust.usize
and u32
, instead of
signed ones (i32
) for anything that can only contain positive values
(indices, sizes/lengths/counts, valences, arities, etc.). Types should
express intent. See also
here.