Since unified shading work already removed subPatch info from
Osd::PatchDescriptor, the difference between Far::PatchDescriptor and
Osd::PatchDescriptor is just maxValence and numElements. They are used
for legacy gregory patch drawing.
Both maxValence and numElements are actually constant within a topology
(drawContext). This change move maxValence to DrawContext and let client
manage numElements, then we can eliminate Osd::PatchDescriptor and simply
use Far::PatchDescritor instead.
This is still an intermediate step toward further DrawRegistry refactoring.
For the time being, adding EffectDesc struct to include maxValence and
numValence to be maintained by the clients. They will be cleaned up later.
The side benefit of this change is we no longer need to recompile regular b-spline
shaders for the different max-valences.
- added Far::GetGregoryWeights() to work directly with 20 weights
- simplified tensor-product evaluation of Bezier and BSpline (will more
readily support higher order derivatives in near future)
- fixed Bezier derivative scaling issue (off by factor of 3.0)
* noted incorrectness of Gregory derivatives (correction will accompany
support for higher order derivatives in near future)
- Remove MeshPtexData bit from Osd::MeshBits. It's not used any more
- Rename ptexIndexBuffer in D3D11DrawContext to paramParamBuffer
- Remove Is/SetPtexEnabled from D3D11DrawRegistry
In OpenSubdiv 2.x, we encapsulated subdivision tables into
compute context in osd layer since those tables are order-dependent
and have to be applied in a certain manner. In 3.0, we adopted stencil
table based refinement. It's more simple and such an encapsulation is
no longer needed. Also 2.0 API has several ownership issues of GPU
kernel caching, and forces unnecessary instantiation of controllers
even though the cpu kernels typically don't need instances unlike GPU ones.
This change completely revisit osd client facing APIs. All contexts and
controllers were replaced with device-specific tables and evaluators.
While we can still use consistent API across various device backends,
unnecessary complexities have been removed. For example, cpu evaluator
is just a set of static functions and also there's no need to replicate
FarStencilTables to ComputeContext.
Also the new API delegates the ownership of compiled GPU kernels
to clients, for the better management of resources especially in multiple
GPU environment.
In addition to integrating ComputeController and EvalStencilController into
a single function Evaluator::EvalStencils(), EvalLimit API is also added
into Evaluator. This is working but still in progress, and we'll make a followup
change for the complete implementation.
-some naming convention changes:
GLSLTransformFeedback to GLXFBEvaluator
GLSLCompute to GLComputeEvaluator
-move LimitLocation struct into examples/glEvalLimit.
We're still discussing patch evaluation interface. Basically we'd like
to tease all ptex-specific parametrization out of far/osd layer.
TODO:
-implments EvalPatches() in the right way
-derivative evaluation API is still interim.
-VertexBufferDescriptor needs a better API to advance its location
-synchronization mechanism is not ideal (too global).
-OsdMesh class is hacky. need to fix it.
Changing all device kernels to take two buffer identifiers for
source and destination separately.
This change is an intermediate step toward upcoming context/controller
refactoring.
Previously we have a limitation that the source and destination
vertex buffer has to be a single buffer, since the subdivision
kernels are iteratively applied by level.
With stencil tables, we don't have such a limitation any more,
so we may want to apply stencils from seprate source buffer to
another.
To specifiy the output location within the destination buffer,
we can use VertexBufferDescriptor.offset. This allows us not only
configuring arbitrary batching scheme, but also relaxing the
limitation that source and destination buffers are in same
interleaved layout. For examples, we could include derivatives only
in the destination buffer, which doesn't need to be allocated in
the source buffer.
we're teasing out ptex specific data from core osd entities,
so there's no reason to keep ptex texturing utilities in core osd.
move them into example libs and let clients assemble shader snippets
as needed.
Also removing older ptex texturing code (without mipmap)
Each patch has a corresponding patchParam. This is a set of three values
specifying additional information about the patch:
faceId -- topological face identifier (e.g. Ptex FaceId)
bitfield -- refinement-level, non-quad, boundary, transition, uv-offset
sharpness -- crease sharpness for a single-crease patch
These are stored in OsdPatchParamBuffer indexed by the value returned
from OsdGetPatchIndex() which is a function of the current PrimitiveID
along with an optional client provided offset.
Accessors are provided to extract values from a patchParam. These are
all named OsdGetPatch*().
While drawing patches, the patchParam is condensed into a patchCoord which
has four values (u, v, faceLevel, faceId). These patchCoords are treated
as int values during per-prim processing but are converted to float values
during per-vertex processing where the values are interpolated.
Also, cleaned up more of the shader namespace by giving an Osd prefix
to public functions, and consolidated boundary and transition handling
code into the PatchCommon shader files. The functions determining
tessellation levels are now all named OsdGetTessLevel*().
- resolves DX-CL interop functions in Osd::ClD3D11VertexBuffer.
- enable CL kernels in DX build.
- more cleanup in test harnesses, adding D3D11 initializations into DeviceContext.
- add new defines OPENSUBDIV_HAS_OPENGL and OPENSUBDIV_HAS_DX for convenience.
- removed default value for its <SIZE> parameter
- updated all usage to specify a value for <SIZE>
- added explicit element destruction missing from destructor
- corrected comment regarding VLA's being non-standard
refactor CL/CUDA specific initialization stuffs into
examples/common/clDeviceContext and cudaDeviceContext, and
update examples to use those structs.
also
- remove CL/CUDA tests from osd_regression. The tests for those kernels will be covered by glImaging.
- update cuda initialization to use the GL-interoperable device if available.
- remove CL specialization from glShareTopology, following the same pattern as we took in the previous OsdGLMesh refactoring. (still something strange with XFB kernels though)
- fix file permissions.
The previous change to the gathering of patch points went
a bit too far. Near non-manifold features it is important
to be careful when traversing the faces in a level to avoid
assumptions that are valid only for manifold topology.
Also, removed Vtr::Level::gatherQuadRegularPatchPoints().
This method was added in my previous change, but it is
unsafe to use in the presence of non-manifold topology.
Removed OpenCL/D3D11 specialization and add DEVICE_CONTEXT as a template
parameter. For the kernels which don't need a context object (e.g.
CPU, OpenGL, cuda) just ignore the context, and for the kernels which
use a context (e.g. OpenCL, DirectX) takes a context or a user-defined
class as which encapsulates device contexts. Note that OpenCL requires
two objects, cl_context and cl_command_queue. The user-defined
class must provide GetContext() and GetCommandQueue() for strongly typed
binding to osd VertexBuffers and ComputeContexts.
Osd::Mesh and MeshInterface have been used as a handy harness to host
multiple GPU kernels and graphics APIs. However it has CL/DirectX
specializations and duplicates large amount of plubming code. With this
change, glMesh.h and d3d11Mesh.h become just typedefs and all logic is
put into mesh.h without specializations.
Also cleaned up unused header files and code formatting.
Now a boundary and corner patch remains
aligned with its underlying parametric
orientation. This simplifies both the
gathering of patch vertices and downstream
evaluation of patches.
Added a method to Vtr::Level which gathers
the 16 patch points for a B-spline patch
even if the patch has boundary or corner
edges. The undefined patch vertex index
values along boundary and corner edges are
assigned Vtr::INDEX_INVALID.
In order to simplifiy the process of drawing
B-spline patches with boundary or corner
edges, the Far::PatchTablesFactory will
replace any invalid vertex indices with
a known good value, i.e. the index of the
first patch face vertex.
Single-crease patches are still a slightly
special case, which will be resolved later.
- rename "Regular end cap" to "BSplineBasis end cap"
- revert templating and add EndCapType into PatchTablesFactory::Options.
- make EndCapFactories internal in PatchTablesFactory.
- move end cap stencils into PatchTables, keep them relative to the max level.
- add a utility StencilTablesFactory::AppendEndCapStencilTables to splice and factorize endcap stencil tables.
Remove the ptex-specific code from the Far::TopologyRefiner and instead provide it in a separate class Far::PtexIndices. Clients who need to use the Ptex API need to first build a Far::PtexIndices object by providing it with a refiner.
This has the advantage of keeping the API on the TopologyRefiner a little cleaner. The ptex methods were const but were mutating state with const_casts. The new mechanism still achieves the same lazy initialization behavior by forcing clients to instantiate them exactly when needed.
A disadvantage of this approach is that the PatchTablesFactory creates its own PtexIndices and throws it out after the patch tables are created. This is great if you're never going to need the ptex indices again, but not so great if you will need them again.
computes edge lengths using limit surface points. Made this
the default screen-space metric so that we avoid cracks when
using Gregory Basis or Regular B-spline end caps.
The alternative method which computes edge lengths using the
distance between B-spline control points is still available.
Added a diagram and comments to explain how the control
points and limit points are organized.
This change moves all gregory patch generation from Far::PatchTablesFactory
so that we can construct patch tables without stencil tables as well as client
can chose any end patch strategies (we have 3 options for now: legacy 2.x style
gregory patch, gregory basis patch and experimental regular patch approximation).
Also Far::EndCapGregoryBasisPatchFactory provides index mapping from patch index
to vtr face index, which can be used for single gregory patch evaluation on top
of refined points, without involving heavier stencil tables generation.
- modified main LimitMask queries to include subdivision Rule
- split internal mask assignments into corner, crease and smooth cases
- adapted all three schemes to the new structure
- completed limit tangents for Loop
- update TopologyRefiner Limit methods to pass newly required Rule
This is the first step to tease off Osd compute controller/contexts
from Far API.
Currently FarStencilTable only creates a kernelbatch for the entire range,
so we can use [0, numStencils) for all cases instead of KernelBatch.
This might not be true if we apply non-factorized level-wise stencils,
then we'll add another modular utility to serve those cases.
PatchTablesFactory fills 20 indices topology into patchtable, and use it for eval and draw.
note: currently screen-space adaptive tessellation of gregory basis patches is
broken and cracks appear around them.
- new Options for Refine() methods for base face and vertex ordering
- removed ignored/unused "full topology" choice from AdaptiveOptions
- added base face and vertex ordering logic to Refinement
- addition of TopologyRefiner members for component counts and max valence
- refactoring of Level additions to update all new member totals
- addition of GetMaxValence() to TopologyRefiner
- updated PatchTablesFactory to user new GetMaxValence() method
- renaming of "Hole" methods for TopologyRefiner and Vtr::Level
- updated original FVar inspection to deal witn non-manifold vertices
- updated FVar refinement to handle > 2 faces per edge
- couple of fixes to use parent topology when child not present
level before we do any further population from the parent as that may
further modify the child's _maxEdgeFaces. When _maxEdgeFaces is incorrect
we may end up with stack corruption problems when
Far::TopologyRefiner::interpolateChildVertsFromEdges() goes to use this data
to allocate some stack space.
- regular patches now generated for faces with non-manifold vertices
- non-manifold features treated as boundary edges and vertices
- other minor cleanup/improvement in patch identification method
- commented on approx of smooth x-ordinary corner with regular sharp patch
- added edge-face local-indices to Vtr::Level members
- added internal and public access to edge-face local-indices
- updated refinement methods to use and populate edge-face local-indices
- updated refinement methods to be sensitive to degenerate edges
- added Vtr::VALENCE_LIMIT constant for internal use
- updated Vtr::Level topology completion to fail on valence overflow
- simplfied non-manifold edge handling in Vtr::Level topology completion
- updated warnings for all topology construction failures
- added detection and warning when passing non-triangles for Loop
- changed return type of Vtr array empty() to bool
- renamed and adjusted arguments to Vtr gather methods for consistency
- removed lone Vtr gather method that took an explicit offset
- updated usage of revised Vtr gather methods in Far
- fixed warnings redeclaring names of local variables already in use
- extend Far::PatchTables data structures & interfaces to store requisite
information for channels of face-varying bi-cubic patches
- implement gather function in Far::PatchTablesFactory to populate face-varying
channels with adaptive patches
- extend accessor interface in Vtr::Level
- propagate code fall-out throughout OpenSubdiv code base, examples & tutorials
- extend vtrViewer code to visualize tessellated bi-cubic face-varying patches
- added new tag for sharp corner, now used in isolation
- split single semi-sharp tag in two for vertex and edge sharpness
- updated tag propagation and all tests of previous semi-sharp tag
- added clear() methods for all tags and simplified initialization
- added Vtr::FVarLevel method to resolve correct index in level 0 case
- updated tag retrieval methods that used face-value array as input
- changed signatures to accept face-verts when needed and updated usage
- added methods to FVarLevel to combine FVar tags with vertex tags
- use composite of combined tag to find FVar features needing isolation
- added more tagging related to the "linear borders" interpolation case
- added FVar channel consideration to TopologyRefiner's feature selection
- added more simple access methods to FVarLevel
- added _xordinary tag to FVarLevel::ValueTag; initialize and refine
- added composite tag method for FVarLevel::ValueTag similar to Level::VTag
- parameterize FVar topology initialization with regular valence
- move patch interpolation code out of Far::PatchTables into far/interpolate
- add bilinear quad interpolation function with derivatives
- switch OsdCpuEvalLimitController to far/interpolate
- add support for bilinear quad interpolation & clean varying interpolation
- changed ptex layout data types in shaders to match srv format
- changed ptex srv type to unorm format for uchar data
- fixed hlsl compiler warning: initialized edgeDistance of OutputVertex struct in domain shader even if we are not in wireframe mode
- added directx debug device and enabled automatic break points to easily spot dx errors
- all Factory<MESH> methods to specialize now return bool
- added topology validation of base level as indicated by option
- added populateBaseLevel() back to simplify premature failure
- renamed Sdc::Type to SchemeType and TypeTraits to SchemeTypeTraits
- renamed TYPE_ prefix to SCHEME_
- updated all usage within core library
- updated all usage in examples, tutorials, etc.
- fixed naming consistency of protected methods used by Factory
- removed other unused and/or redundant protected methods
- update Far Factories to reflect changes to Refiner methods
- updated usage in tutorials and regression
- changed template parameter to runtime method parameter
- added traits as static methods of all schemes
- constructed internal table of traits from all schemes
- move level of refinement / isolation into the Options structs
- fix splash damage in rest of the code
note 1: this is less than ideal, because most compilers accept the previous
call to these functions with an incorrect parameter list (ie. passing
the level instead of the struct issues no warnings and compiles...)
caveat emptor...
note 2: the level parameter names may not be final for adaptive modes
as we will likely want independent controls over crease vs.
extraordinary vertex isolation.
- don't rotate (s,t) coordinates but rotate the patch instead !
- refactor osd/cpuEvalLimitKernels to share Far::PatchTables cubic spline
interpolation functions : this replaces tensor product formulation with
weight matrices, which does not really impact performance here, but would
have to be replaced when implementing regular gridding functions.
- fix OsdCpuEvalLimitController to not rotate coordinates and pass the rotation bitfields
- expose Far::PatchTables spline interpolation API (protected -> public)
- fix glEvalLimit tangent buffers (remove empty padding - see below)
- change policy for tangent buffers : the output buffer descriptor is
**NO LONGER APPLIED** to tangent output buffers. Tangent primvar data
buffers are no longer applying the offset and stride from the descriptor
(because it doesn't make sense to share it). If more flexiblity is
required, we will consider adding independent descriptors for the tangent
buffers. This change will impact existing code that generates tangents
with the EvalLimit controller.
fixes#370
- change topology refiner to check for edge sharpnesses when selecting faces for isolation
- add face-aggregator for edge tags to Vtr::Level
- fix logic in Far::PatchTablesFactory to correctly tag single-crease patches along infinitely sharp edges
note : this fix is a bit of a cludge - barfowl confirms that the vertex crease tags (VTags) are intended to
carry neighborhood information, which they currently do not. we will revisit this shortly and fix the tags,
which will allow us to simplify the traversal logic when isolating topology features.
fixes#369
Const' declared instances of Vtr::Array do not protect the pointer held
privately by the class properly. In order to force the compiler to
protect this pointer, we removed all non-const accessors from Vtr::Array
(now renamed Vtr::ConstArray) and moved them to a child class (Vtr::Array),
which requires const_cast<> operators internally to allow access.
The change & renaming is then propagated to all internal dependencies.
- VVarBoundaryInterpolation is now VtxBoundaryInterpolation
- enum prefix change from VVAR to VTX
- generel cleanup / doxyfication
- update of beta / release notes
- add error reporting callback to Vtr::Level::validateTopology
- switch printfs to callback
- add error code enums to Vtr::Level
- route Far::TopologyRefinerFactory::reportInvalidTopology through Vtr::Level callback
note:
- Vtr::Level::validateTopology needs to check creaase tag indices
- topology validation should be client-code driver in TopologyRefinerFactory (turned off in the code at the moment)
- make sure we don't get conflicting enums (CODE_ERROR)
- fix template specialization for Far::TopologyRefinerFactory in regression/common/vtr_utils
- fix remaining error reporting code around osd
- change error codes from situational to general (fatal / coding / run-time...)
- pull error functions from Osd into Far
- add a templated topology validation reporting system to Far::TopologyRefinerFactory
- fix fallout on rest of code-base
- split Far::PatchDescriptor into its own class (mirrors Far::PatchParam)
- hide PatchArray as a private internal structure
- add public accessors patterned after Far::TopologyRefiner (returning Vtr::Arrays)
- propagate new API to all dependent code
note: some direct table accessors have not been removed *yet* - see code for details
This empty cpp file is added to address some cmake dependency resolution issues
with XCode project-based build generation.
I may add some functionality to version.cpp in the future
Thanks stopiccot for investigating the issue and doing most of the leg-work.
fixes#356
Torii (and other planar topologies) are made entirely of regular b-spline patches and do not
generate sub-patches through adaptive isolation: we need to make sure that we construct
stencil tables with singular stencils for the coarse vertices instead of returning empty
tables (and crash in the limit stencils factory)
- added detection of sharp corners in generic scheme limit mask query
- tweaked Loop limit mask to simplify the regular case
- updated TopologyRefiner::Limit() methods to support all schemes
- adding functionality to Far::PatchTablesFactory to generate topology indices
for Gregory basis end-caps (identify and index vertices along basis shared
edges)
- code is currently #ifdef'ed out until further work can be done to bring the
feature along all the way through to Osd::Draw
- added flag to Sdc MASK interface to interpret "face weights"
- updated Catmark and Bilinear schemes to be aware of new MASK flag
- added subdivision and limit masks for the Loop scheme
- subclassed Vtr::Refinement into QuadRefinement and TriRefinement
- updated tagging of components to be sensitive to applied scheme
- fixed some quad assumptions in FVar refinement to support N-sided
- internally generalized ::TopologyRefiner Interpolate() for <SCHEME>
- reorganized Refinement methods and pruned excessive comments
- removed and added assertions related to Catmark scheme
- added code to support alternate refined vertex ordering
- updated FVarRefinement to be more independent of vertex ordering
- updated Far::TopologyRefiner to fix face-varying ordering dependencies
- fixed a few miscellanous compiler warnings
- adding support for StencilTables creation from a Gregory basis
- fix a bug in the prot-stencil allocator (slow memory pool was not being cleared properly)
- added array accessors to properties of vertex values in vtr::FVarLevel
- updated construction of base level face-varying topology
- simplified population of face-varying properties in vtr::FVarRefinement
- updated Far::TopologyRefiner::Interpolate/LimitFaceVarying() accordingly
Setting start/end values of UpdateValues() produced incorrect primvar interpolation
because the stencil sizes array was not shifted properly to the 'start' location of
the batch.
- added ValueTag indicating sharpness dependency on another value
- updated base level tagging to identify dependent semi-sharp values
- updated refinement to consider dependency when reassessing semi-sharpness
- updated interpolation to use dependent fractional weight when necessary
- adaptive mode: remove faces tagged as holes from the selection of faces to isolate
- uniform mode: faces tagged as holes are still included in the refinement process,
however they are removed from patch tables
- future improvements: add a 'selective refinement' code path separate from 'uniform refinement'
to handle this case without un-necessary subdivision work.
- re-implement the pool allocator
- use templates to remove code redundancy between regular & limit stencils
- leverage [] operator overloading to simplify stencil factorization
- add the ability to treat subdivision levels independently (see below)
- refactor Far::TopologyRefiner::Interpolate<>() methods to pass buffers by reference
(allows overloading of [] operator)
- rename some of the stencil factory options
- propagate changes to Osd / examples / tutorials...
- remove #version declaration from the kernel code
- move it in front of shader sources before compiling to prevent some drivers from throwing errors
fixes#360
Cause: std::vector.resize() function invalidates Vtr::Level pointers held by FVarLevel
Fix: switch std::vector<Vtr::Level> to std::vector<Vtr::Level *> and cycle through
the vector with appropriate new/delete.
Catmull-Clark Subdivision Surfaces", Niessner et al, Eurographics 2012.
This change includes;
-topology identification for single-crease patch during adaptive refinement.
-patch array population (similar to boundary)
-sharpness buffer generation
-glsl shader
Eval stuffs will be coming.
- redefined and documented Sdc::Options::FVarLinearInterpolation
- included "corners only" mode not possible with Hbr
- updated usage within Vtr::FVarLevel