This is a new method for GLSL, HLSL, and MSL which returns patch
drawing shader source which excludes legacy shader source aspects.
This improves portability and compatibility and may also improve
shader compile times since the resulting shader source strings
are smaller without the legacy shader source aspects.
Tested with Vulkan and DX12 in addition to GL, DX11, and Metal.
Relocated from PatchCommon to PatchLegacy several aspects of the
shader source which can cause problems with typical use cases.
Specifically, things like resource bindings, input assembler and
interstage declarations are best left to client code.
These are not removed, just relocated and remain available for
backward compatibility. Updated the GLSL, HLSL, and MSL source.
Updated the CMake build to locate TBB using TBB's CMake config
and deleted the local cmake/FindTBB.cmake module.
While the source code remains compatible with earlier versions of
TBB, updated the minimum TBB version from 4.4 to 2018 since that
is the earliest TBB release to include a CMake config. This is
the version of TBB specified for the CY2019 VFX Reference Platform.
Tested on Windows, Linux, and macOS using TBB 2018 Update 6,
TBB 2020 Update 3, and oneTBB 2021.10.0
The existing implementation in Osd::TbbEvaluator has never been implemented
correctly and that implementation is incompatible with the oneTBB API.
These methods are now marked deprecated in the two places where defined
in Osd::TbbEvaluator and Osd::OmpEvaluator, but for consistency we preserve
the existing implementation when building with older versions of tbb.
We've already removed all use of these methods from the tests and examples.
- default flags include warnings enabled by -Wall and -Wextra
- suppressed newer warnings in public headers and internal files
(-Wclass-memaccess, -Wcast-function-type, -Wdeprecated-copy)
- suppressed -Wunused-function from internal source files
- normalized the rational weights for pairs of interior points
- fixed sign swap error in mixed partial of bilinear patches
- applied changes to both far/patchBasis and osd/patchBasisCommon
Client applications may keep track of the active shader program so as to
not unnecessarily bind and unbind the same shader consecutively as
switching shaders is costly.
The current behavior of the OpenGL compute evaluator is to set the
active shader to 0 (zero) after running its program(s) which might
interfere with the aforemoentioned client applications' behavior,
leading to bugs.
Instead of unsetting any previously set shader program, cache the
current program before using the evaluator program, and reset the active
program to the previous one when done.
In Blender, this lead to some rendering artifacts. See https://
developer.blender.org/D15064 for more details on it.
At build time, the preprocessor symbols: OSD_USES_GLEW or
OSD_USES_INTERNAL_GLAPILOADER determine the GL API loader
that will be used by the OSD library.
This introduces an internal glLoader library which allows
most of the implementation to be agnostic about the
implementation of the GL loading library. Specifically,
this removes references to the GLEW headers and libraries
from the rest of the source code and build system.
Several of the methods in osd/patchBasisCommon.h were
never intended as public API, and several have been
deprecated in favor of the newer OsdEvaluatePatchBasis()
and OsdEvaluatePatchBasisNormalized() methods. These
obsolete methods have now all be marked as deprecated.
Also, fixed a minor spelling typo in glslPatchBasisCommon.glsl
Updated the Gregory patch tessellation shaders to account for
transition edges.
Changed the implementation of OsdGetTessParameterizationTriangle()
to take the input parametric location as a 3-component value. This
allows the edge parameterization to be more numerically robust and
consistent.
Also, corrected some minor discrepancies between the various
tessellation shader configurations.
Refactored computation and drawing code used
for tessellated patches to improve readability
and extensibility.
- Updated mtlViewer.metal computation kernel to express
data indexing using familiar semantic concepts: i.e.
primitiveID, vertexID, etc. instead of threadgroup
semantics.
- Updated mtlViewer.mm to consolidate patch type
dispatch. Now, the configuration and execution
of the compute and drawing passes is controlled
by a PipelineConfig descriptor.
Updated Metal shaders to add support for drawing triangle
patches. This matches the current GLSL implementation.
- BoxSplineTriangle and GregoryTriangle patch shaders
- tess factor and tess evalutation for triangle patches
- improved adaptive tessellation code organization and function names
- quartic Bezier triangle patch evaluation
- OsdGetPatchIsTriangleRotated() function added
- OsdInterpolatePatchCoordTriangle() function added
Refactored the Metal viewer's implementation of
smooth face-varying uv interpolation so that the
face-varying patch basis is correctly determined
by inspecting the face-varying patch array type
descriptors.
Fixed smooth face-varying interpolation for the Metal viewer
when using screen-space tessellation. The location to evaluate
the face-varying value needs to match the computed tess location
instead of the intrinsic position_in_patch.
Moved Metal shader code used for evaluation of legacy gregory patches
to a separate source file.
These methods should not be used for new development, but are provided
for backward compatibility.
This matches the current GLSL implementation:
- BoxSplineTriangle and GregoryTriangle patch shaders
- tess factor and tess evalutation for triangle patches
- improved adaptive tessellation code organization and function names
- quartic Bezier triangle patch evaluation
- OsdGetPatchIsTriangleRotated() function added
- OsdInterpolatePatchCoordTriangle() function added
Moved shader code used for evaluation of legacy gregory patches.
These methods should not be used for new development, but are provided
for backward compatibility.
The computation to adjust patch evaluation weights
for box spline triangle patches to account for boundaries
has been updated to use simple conditional logic instead
of index indirection tables. This results in better register
resource usage for some shader compiler implementations.
Previously, these methods could fail to compile on some
systems.
- replaced use of "LimitPoints" functions in all patch shaders
- removed the unreleased "LimitPointsTriangle" functions
- added internal tess functions for processing patch boundaries
- updated Bezier quad and tri tess evaluation to use boundary functions
- renamed core "LimitPoints" functions to reflect the patch type (Bezier)
- overloaded new functions with the additionally computed tess level
- preserved stubs of all "LimitPoints" functions for compatibility
- changed Far::PatchDescriptor size for GREGORY_TRIANGLE to 18
- modified Far::LoopPatchBuilder to construct full quartic Gregory patch
- fixed Far::LoopPatchBuilder bug related to face points near boundaries
- updated Far patch basis evaluation for Gregory and Bezier triangles
- updated Osd patch basis evaluation to match Far
- updated Osd GLSL patch size for Gregory triangle to 18
- modified Osd GLSL Gregory triangle eval and tess settings for quartic
- updated sizes for the Box-spline triangle shader to generate 15 points
- updated conversion of Box-spline from hybrid Bezier to fully quartic
- added resolution of degenerate normal to Bezier triangle evaluation
- updated hybrid Gregory triangle conversion to quartic Bezier
- updated adaptive tessellation of Bezier triangle for quartic boundaries
- Added GLSL patch shaders for BoxSplineTriangle and GregoryTriangle
patches. These both convert to a hybrid Bezier patch for drawing
similar to the basis conversion done for quad patches.
- Added evaluation of hybrid Bezier triangle patches and
GregoryTriangle patches to the common shader source.
- Added OsdGetPatchIsTriangleRotated() to detect rotated triangles.
- Added OsdInterpolatePatchCoordTriangle() for eval of triangle patches.
- Added boundary point extrapolation for BoxSplineTriangle patches.
- Fixed boundary point extrapolation for unisolated BSpline patches.
- Added tess factor and tess evaluation location computation for
triangle patches.
- Limit surface edge mid points for both quad and triangle patches
are now computed directly.
Moved shader code used for evaluation of legacy gregory patches
to a separate source file along with macros which implement
simple linear face-varying interpolation.
These should not be used for new development, but are provided
for backward compatibility.
This updates the patch basis evaluation functions in Osd
to match recent changes to far/patchBasis.
This also exposes a common facility for dealing with PatchCoord,
PatchArray, and PatchParam. These are exposed as global functions
operating on struct data, since C++ style class methods are not
supported by all of the Osd shader and kernel execution envirionments.
Changes:
- Merged far/patchBasis.cpp to osd/patchBasisCommon{,Types,Eval}.h
- Exposed PatchCoord, PatchArray, and PatchParam to Osd kernels
- exposed OsdEvaluatePatchBasis and OsdEvaluatePatchBasisNormalized
- Updated CPU, TBB, Omp, CUDA, OpenCL, GLSL, HLSL, and Metal evaluators
- Updated glFVarViewer