* The CATMARK_QUAD_FACE_VERTEX kernel calculates the face-vertex for a quadrilateral face. It applies to every face after the first subdivision step, and may be applied for the first subdivision step of a quadrilateral coarse mesh.
* The CATMARK_TRI_QUAD_FACE_VERTEX kernel calculates the face-vertex for a triangle or quadrilateral face. It may be applied for the first subdivision step of a coarse mesh composed of triangles and/or quadrilaterals.
* Both kernels calculate each face-vertex using four vertex indices (triangles are specified by repeating the third index). Therefore neither kernel uses the F_ITa codex table, and instead the first vertex offset in the F_IT index table is stored in the FarKernelBatch's table offset.
If the system has CLEW installed (which is detected by recently
added FindCLEW routines) then OpenSubduv would be compiled against
this library.
It makes binaries and libraries more portable across the systems,
so it's possible to run the same binary on systems with and without
OpenCL SDK installed.
The most annoying part of the change is updating examples to load
OpenCL libraries, but ideally code around controllers and interface
creation is to be de-duplicated anyway.
Based on the pull request #303 from Martijn Berger
- Some missing includes of <algorithms> in order to have
stdd::min() and similar functions.
- Need to cast numIndices and numNVerts to int explicitly
in order to solve warning treated as an error about
precision loss.
- Can't do vector[0] for an empty vector, it'll generate
a runtime range check error.
- MSVC only works fine with make_pair(foo, bar) syntax,
without explicit template substitution here. Otherwise
weird 'can't cast int to int&&' errors are happening.
- It used to create _computeContext twice.
- Ownership of refiner didn't set properly, because
Initialize() forces evaluator to drop ownership.
So now ownership sets after initialization from
topology.
Moved transient states (current vertex buffer etc) to controller.
ComputeContext becomes constant so that it's well suited for coarse-grain
parallelism on cpu.
Client-facing API has changed slightly - limitEval example has been adjusted
- fix some variable names (private vs. public)
- implement constructors to guarantee initialized pointers (d'oh)
- add a 'Reset' method to unbind buffers
Note: while the new contexts have been cleaned up, we now have a fair amount of duplicated code in the controllers...
Moved transient states (current vertex buffer etc) to controller.
ComputeContext becomes constant so that it's well suited for coarse-grain
parallelism on cpu.
Useful for cases when some parts of the pipeline needs to know the
topology object. Simply helps saving memory so topology from the
evaluatgor can be re-used for stuff like HbrMesh creation.
This way external application might check whether it need to
re-create evaluator from scratch or it might re-use existing
one without storing extra data from it's side.
TODO: Tags are still not accessible via C-API, it's marked as
to be solved later when it becomes more clear what is the best
way to expose them and when there'll be a real application to
test the tags.
All kernels take offset/length/stride to apply subdivision partially in each vertex elements.
Also the offset can be used for client-based VBO aggregation, without modifying index buffers.
This is useful for topology sharing, in conjunction with glDrawElementsBaseVertex etc.
However, gregory patch shader fetches vertex buffer via texture buffer, which index should also
be offsetted too. Although gl_BaseVertexARB extension should be able to do that job, it's a
relatively new extension. So we use OsdBaseVertex() call to mitigate the compatibility
issue as clients can provide it in their way at least for the time being.
Moved transient states (current vertex buffer etc) to controller.
ComputeContext becomes constant so that it's well suited for coarse-grain
parallelism on cpu. The prims sharing same topology (ComputeContext) can
be refined simultaneously by having mutiple compute controllers.
Client facing API doesn't change.
- fix the vertesIsBSpline logic to correctly recognize these sharp corner vertices
- fix another bug where a loop was missing vertices from from quad faces with 2
non-consecutive boundaries
fixes#294
- add a limit evaluation method to EvalLimitController that allows
client code to directly pass the output buffer without binding it
to the Context (the call only computes vertex interpolation of a
single sample)
- switch the OsdUtilAdaptiveEvaluator to use the new method from the controller
and stop stomping member
- cleanup buffer and member variables no longer used
- cleanup initialization logic to be better aware of uniform / adaptive
- add some assert sanity checks in the cpuEvalLimitKernels
fixes#293
* rolled getNumFVarVertices into allocateTables
* renamed tessellate to triangulateQuads (technically speaking, Loop scheme uses a trivial triangulation)
* condensed the pointer arithmetic used for triangulating the data tables
* maintainance work on the D3D11 specialization of OsdMesh to bring it in line with the other template specializations
* updated the facePartition example to derive PartitionedMesh from OsdMesh in order to allow other vertex buffer and compute controller configurations
* added the numVertexElements argument to Osd*DrawContext::Create, which is used to initialize the patch arrays when calling OsdDrawContext::ConvertPatchArrays
* removed the unused level argument from Osd*DrawContext::_initialize
* maintenance work on CL/D3D11 bindings to get them to compile
Before this change the given function used to fail silently in
cases topology is bad or uniform evaluator initialization failed.
This used to leave evaluator in a state which is not usable for
further processing but callee function would never know this and
will likely crash later when evaluating subdivision limit surface.
Ideally error message or code need to be passed to the calle, but
that's marked as TODO for now.
Issue was that evaluator.SetCoarsePositions() is expecting number
of floats in the array to be passed, but the C-API function used
to pass number of vertices there.
* instantiates FarPatchTables with face-varying data for a single uniform subdivision level, or for an adaptively subdivided mesh
* face-varying data is not regenerated if data for multiple uniform subdivision levels is present
Delete scheme specialized subdivision tables. The base class FarSubdivisionTables
already has all tables, so we just need scheme enum to identify which scheme
the subdivision tables belong to.
This brings a lot of code cleanups around far factory classes.
* replace void* of all kernel applications with CONTEXT template parameter.
It eliminates many static_casts from void* for both far and osd classes.
* move the big switch-cases of far default kernel launches out of Refine so
that osd controllers can arbitrary mix default kernels and custom kernels.
* change FarKernelBatch::kernelType from enum to int, clients can add
custom kernel types.
* remove a back-pointer to farmesh from subdivision table.
* untemplate all subdivision table classes and template their compute methods
instead. Those methods take a typed vertex storage.
* remove an unused argument FarMesh from the constructor of subdivision
table factories.
minor code cleanups:
- change Descriptor::iterator to use a static vector instead of overly complicated logic
- change the private factory PatchType struct for better readability
- variable name changes
Prevent boundaryEdgeNeighbors[2] from being overrun when an interior
vertex has more than 2 boundary neighbor vertices. The fix is applied
to the GLSL / HLSL and CPU implementations.
Note: this appears to fix long-standing problems with Gregory patches,
but i am not entirely convinced that this fixes the general case.
fixes#259
Also:
- Add a _numVertices member to cpuSmoothNormalContext (for memory reset function)
- Fix memory reset function in cpuSmoothNormalContext (was performing redundant memsets)
- Add a resetMemory boolean to cpuSmoothNormalContext to make reset step optional (default is off)
- added a _stringify function to top CMakeLists
- switched all stringification tasks to use the macro
- all suffixes are now .gen.h instead of .inc (to help cmake track dependencies)
Further leverage cmake object libraries to share object files for CPU
and GPU OSD libraries, avoiding duplicate complation for dynamic/static
build passes.
CMake restricts object library inputs to header and source files, so the
.inc files were renamed to .gen.h (which seems like a better name
anyway) to make CMake happy.
Also updated the .gitignore file to ignore .gen.h files.
Conflicts:
opensubdiv/osd/CMakeLists.txt
- set OBJECT targets for osd cpu & gpu libs, and use the obj target for
static and dynamic linking
- add a new examples_common_obj OBJECT target
- replace direct source dependencies to obj target in all examples CMakeLists
This change makes it possible to not re-compile the same source files
multiple times when they are used in multiple targets. Thanks to jcowles
for uncovering the CMake functionality.
Note: it seems that multi-process build is working again (gmake -j <x>)
An object library allows other build targets to use the object files
from this library.
The change introduces osd_static_cpu_obj which is consumed by
osd_static_cpu.
This will be useful for emscripten integration where we cant use the
compiled library, rather it will use the object files, targeting
osd_static_cpu_obj.