Commit Graph

1205 Commits

Author SHA1 Message Date
xiao-deng
73b5883d02 Add events control to clVertexBuffer and clEvaluator 2015-11-23 17:54:03 +08:00
David G. Yu
d1b9e45c13 Fixed potential crash in Far::StencilTableFactory
Now StencilTableFactory::AppendLocalPointStencilTable() does
nothing when the localPointStencilTable is empty. This avoids
a potential crash (failed assertion) when both the baseStencilTable
and the localPointStencilTable are empty, as is the case for
simple geometry like the all-quads torus regression test shape.
2015-11-18 18:57:47 -08:00
David G. Yu
c588e95e13 Disabled fractional spacing w/o screen space tess
For now, the common patch shader code supports fractional spacing
modes only when screen-space tessellation is also enabled.

It's possible to relax this restriction, but that requires changing
the client shader interface.
2015-11-18 18:54:19 -08:00
Dave Clyde
9e144d5b15 allow limit surface evaluation without tangents 2015-11-16 14:43:49 -08:00
Dave Clyde
afde3b2d10 LimitStencilTable now also computes stencils for second partials. 2015-11-16 14:43:44 -08:00
Dave Clyde
c095f48d65 Comment typos / whitespace. 2015-11-16 14:39:58 -08:00
Jeremy Cowles
cf7135eb2a Merge pull request #756 from davidgyu/limitStencilFix
Added missing LimitStencil accessor methods
2015-10-30 13:21:33 -07:00
Jeremy Cowles
53696858c7 Merge pull request #755 from takahito-tejima/gregory
Reduce the transient memory consumption in endcap construction.
2015-10-30 13:21:14 -07:00
David G Yu
b9a7d40559 Added missing LimitStencil accessor methods
Now Far::LimitStencilTable provides proper accessor
methods for retrieving individual LimitStencils from
the table.
2015-10-26 14:17:53 -07:00
David G. Yu
b0d612f837 Restored support for fractional tessellation
This change includes support for both fractional_even_spacing
and fractional_odd_spacing.

The implementation follows the existing pattern of re-parameterizing
the tessellation domain only along transition boundary edges. This
allows for crack-free tessellation, but it might be better to
consistently re-parameterize all of the outer edges of all patches,
which also would be required for numerically watertight tessellation.

This is implemented in a way that requires no changes to the client
shader API. It should be more efficient to move some computations to
the control/hull shaders and reduce divergence in the execution of
eval/domain shaders.
2015-10-23 15:24:35 -07:00
Takahito Tejima
024da1f729 Reduce the transient memory consumption in endcap construction.
- instead of accumulating GregoryBasis::Point (fixed size stencils
  backed by stackbuffer), pack the stencils into StencilTable as they
  are evaluated
- use single integer for varying stencils of patch points, not
  a GregoryBasis::Point
- cap the reserved stencil entry size.
2015-10-23 15:05:02 -07:00
jcowles
9f0e49edc6 Release 3.0.3 2015-10-05 16:27:09 -07:00
Jeremy Cowles
caaff5d85b Merge pull request #748 from davidgyu/assertFix
Fixed out of bounds mem access for OMP and TBB
2015-09-30 13:41:53 -07:00
David G. Yu
6bbf0f78ce Fixed out of bounds mem access for OMP and TBB 2015-09-30 13:26:35 -07:00
David G. Yu
287441118e Fixed double to float conversion warnings 2015-09-30 13:15:42 -07:00
Takahito Tejima
f5810bac97 Fix windows build 2015-09-30 11:20:03 -07:00
barfowl
0aea00a2e8 Improved patch approximations around non-manifold features
- use regular corner patches around non-manifold verts that were sharpened
2015-09-22 17:26:09 -07:00
Jeremy Cowles
f744e20c4b Merge pull request #742 from anshuarya/dev
Set layout to std430 for GLSL Compute kernel
2015-09-21 23:50:56 -07:00
Takahito Tejima
007a2e8885 Removing debug code that mistakenly slipped into glPatchTable.cpp.
Also use GL_ARRAY_BUFFER for the binding point of updating indices instead of GL_ELEMENT_ARRAY_BUFFER
2015-09-21 14:33:11 -07:00
Anshu Arya
4be4b25cc9 Set layout to std430 for GLSL Compute kernel
Fixes corrupted mesh issues with GLSL Compute
on AMD platforms.
2015-09-21 09:01:47 -07:00
Jeremy Cowles
fb4f3f6a62 Merge pull request #741 from takahito-tejima/bspline
optimize PatchTableFactory::Create performance

The primary hesitation here is that this change alters the approximation for BSpline end caps, however the consensus is that BSpline end caps were already the most extreme approximation, so it makes sense to sacrifice quality for speed.

Reviewed by David, Barry, George and myself.
2015-09-20 22:51:30 -07:00
Jeremy Cowles
84ff9d3604 Merge pull request #728 from significant-bit/win32-lean
use WIN32_LEAN_AND_MEAN properly
2015-09-20 22:36:25 -07:00
Takahito Tejima
37bce3be14 Fix the reserve size for BSpline patch (16, not 20) 2015-09-17 15:14:54 -07:00
Takahito Tejima
c380a0d67e BSpline endcap optimization. 2015-09-16 15:32:50 -07:00
Takahito Tejima
5e96a9ba31 GregoryBasis optimization. Replace arithmetic operators which uses a temporary
object.
2015-09-16 15:28:58 -07:00
Takahito Tejima
0e91dcd177 Optimize gregory basis endcap generation.
- replace std::vector with vtr::StackBuffer in GregoryBasis::Point
- remote getQuadOffsets call from ProtoBasis
- rewrite some inefficient code in the endcap generation.

Note that this is a temporary remedy for the performance issue in 3.0.
We'll fix it again in the later release.
2015-09-16 15:28:55 -07:00
Sergey Sharybin
b25c0dd777 Fix GLSL program being deleted twice in GLSL Compute controller
GLSL programs used by stencil and patch kernels were freed from
both GLSL Compute Evaluator and from kernel classes themselves.
2015-09-10 20:00:42 +05:00
Mike Erwin
585858c1e4 use WIN32_LEAN_AND_MEAN properly
Misspelled W32_LEAN_AND_MEAN in osd/opengl.h had no effect on windows.h.

Also added to example code wherever windows.h is included.
2015-08-07 17:45:41 -04:00
David G Yu
6c437ae077 Release 3.0.2 2015-08-05 18:21:20 -07:00
David G Yu
b1ab8e3f8b Fixed single crease patch classification
This fixes a regression in the function used to identify single crease
patches. This also updates the patch color values used by the glImaging
regression test to match the colors used in other example viewers so
that patch types can be more easily identified during automated testing.
2015-08-04 17:50:51 -07:00
David G Yu
869c006b70 Release 3.0.1 2015-08-04 14:50:31 -07:00
David G Yu
e897a1c0e5 Merge pull request #702 from daz3d/cmake_error_on_no_gpu
Fixes cmake projects for non-gpu use case
2015-08-04 08:00:58 -07:00
Jeremy Cowles
5f393dbf23 Merge pull request #703 from Nazg-Gul/dev
Fixing linking errors on both Linux and WIndows
2015-08-03 22:51:52 -07:00
David G Yu
c8943d12b3 Merge pull request #719 from barfowl/far_errors
Minor content and formatting changes to Far error strings
2015-07-31 18:04:44 -07:00
David G Yu
bd95246032 Merge pull request #709 from jcowles/dev-stencilfix2
Respect factorizeIntermediatLevels option
2015-07-31 16:57:39 -07:00
barfowl
a094281541 Minor content and formatting changes to Far error strings
- made Far error strings consistent, including clearer source of error
    - minor formatting changes to the default error callback
2015-07-31 12:47:49 -07:00
David G Yu
2d16bfa5fc Fixed an incorrect comment in far/patchParam.h 2015-07-30 17:41:36 -07:00
George ElKoura
0cfc822c30 Merge pull request #714 from barfowl/topology_asserts
Replaced topology initialization assertions with errors
2015-07-30 16:59:15 -07:00
barfowl
0f9819d503 Changed use of Warning() to Error() in Far::TopologyRefinerFactory 2015-07-30 15:05:49 -07:00
David G Yu
e6b03f68a9 Merge pull request #712 from takahito-tejima/boundary
Retains boundary faces of bilinear scheme mesh with VTX_BOUNDARY_NONE
2015-07-30 10:59:54 -07:00
David G Yu
38c5940b21 Merge pull request #710 from takahito-tejima/bilinear
Fix a bug in PatchTableFactory of uniform refinement containing all-levels
2015-07-30 10:52:43 -07:00
barfowl
a811fb9a80 Replaced topology initialization assertions with errors:
- TopologyRefinerFactory now issues errors for its minimum requirements
2015-07-29 19:38:05 -07:00
barfowl
db3fe9a8e8 Reduced warnings resulting from GCC's -Wshadow option
- eliminated warnings from core libraries and regression code
2015-07-29 18:46:18 -07:00
Takahito Tejima
ccfcca9abf Retains boundary faces of bilinear scheme mesh with VTX_BOUNDARY_NONE
We mark boundary faces as holes only if the vertex boundary interpolation
is none and the subdivision scheme has local neighborhood.
2015-07-29 17:21:26 -07:00
Takahito Tejima
168139d4ca Fix bug when PatchTableFactory::Options.generateAllLevels is set
generateAllLevels flags is used when we want to have uniform refined
patch array containing all levels together. There's an index offsetting
bug when this flag is enabled.
2015-07-29 14:49:51 -07:00
Jeremy Cowles
55565cca84 Respect factorizeIntermediateLevels option
Previously, this flag was being ignored during stencil table
construction.

Fixes issue #694
2015-07-23 00:45:47 -07:00
barfowl
ad6b1f9117 Eliminate or encapsulate ICC pragmas:
- eliminated need for disabling warning 177 in far/patchTableFactory.cpp
    - encapsulated all floating point equality tests (1572) in local functions
    - bracketed all ICC specific warning pragmas with #ifdef __INTEL_COMPILER
    - avoided GCC's stricter shadowing warning in vtr/array.h
2015-07-20 17:56:00 -07:00
Takahito Tejima
8a8771c97d Revert "Add ISPC limit surface evaluation" 2015-07-20 17:13:51 -07:00
Sheng Fu
d3f8725e79 Add ISPC limit surface evaluation 2015-07-20 14:12:11 -07:00
Sergey Sharybin
2f694727c3 Remove workaround for duplicated symbols with MSVC
This workaround actually caused linking errors related on missing
symbols and removing the workaround does not cause any duplicated
symbols with MSVC 2013.
2015-07-19 18:10:09 +02:00
Sergey Sharybin
a095ebf1f0 Fix linking error when using GCC and including osd/mesh.h from several places
Te issue here is that some of the functions were not considered templated
anymore because all their template arguments were specified, which made it
so compiler was creating implementation for them in every file from where
the header was included. This causes errors during linking related on the
same symbol implemented in several places.

Marking those functions as inlined solves the problem and should not cause
any bad side effects because they're small enough and likely being inlined
by an optimizer anyway.
2015-07-19 18:06:54 +02:00
Sheng Fu
51a9da3bf0 fix ICC compile warning 2015-07-16 09:27:49 -07:00
Sheng Fu
fe20023989 minimize the scope of disabled warnings 2015-07-16 09:27:48 -07:00
Sheng Fu
59382abeaa Fix Intel compiler warning 2015-07-16 09:27:48 -07:00
Christopher Jones
87dc09e769 Fix cmake projects to not require GLFW when NO_OPENGL provided and not build gpu lib if not needed. 2015-07-15 23:55:14 -06:00
Jeremy Cowles
0443db73b8 Merge pull request #700 from barfowl/fvar_unconnected
Fixed initialization of unconnected vertices in FVar channels
2015-07-13 11:46:39 -07:00
Takahito Tejima
51e1833139 Merge pull request #699 from daz3d/tbb_offset_fixes
Fix offsets in TbbEvalStencils when start is non-zero.
2015-07-13 11:40:49 -07:00
Takahito Tejima
cd212125df Merge pull request #696 from daz3d/omp_offset_fixes
Fix offsets in OmpEvalStencils when start is non-zero.
2015-07-13 11:40:33 -07:00
barfowl
50e2623b91 Fixed initialization of unconnected vertices in FVar channels
- correctly initialize FVar tag and source entry for unconnected verts
    - added regression/shape with unconnected vertices and fvar data
    - fixed edge-face vector access when unconnected edges are last
2015-07-12 18:30:26 -07:00
Christopher Jones
89b698e519 Fix offsets in TbbEvalStencils when start is non-zero. 2015-07-12 16:03:09 -06:00
Christopher Jones
d317cbc86b Fix offsets in OmpEvalStencils when start is non-zero. 2015-07-05 11:22:38 -06:00
Christopher Jones
8a74831b2e Fix out of range access issues when a non-connected vertex occurs at the end of mesh's vertex list or mesh has face varying data. 2015-07-05 10:43:00 -06:00
Jeremy Cowles
8dd7563060 Some minor compiler warning fixes
In one case, we were comparing int and unsigned int.

In primvarRefiner, some values were safely uninitialized, but older compilers
(GCC 4.1) were complaining.
2015-06-25 22:29:23 -07:00
Takahito Tejima
f39ee21147 version 3.0.0 release 2015-06-23 10:56:01 -07:00
David G Yu
0679161bf5 Fixed a few doxygen param mismatches and errors. 2015-06-22 13:45:55 -07:00
Takahito Tejima
e008776325 fix legacy gregory patch shader to support higher valence
Note that the actual limitation stays same, due to hardware capability
(GL_MAX_VARYING_VECTORS)
2015-06-22 11:08:11 -07:00
George ElKoura
7d801408a7 Merge pull request #651 from barfowl/string_concat
Code tweak to prevent build failure in iOS with XCode7
2015-06-18 22:19:17 -07:00
barfowl
c08f6a502f Code tweak to prevent build failure in iOS with XCode7
- added space between literal strings in macro using concatenation
2015-06-18 19:47:19 -07:00
Takahito Tejima
8b7e55b6f5 Fix undesirable doxygen annotations in osd. 2015-06-18 18:12:08 -07:00
barfowl
4543c9f8bc A few incremental updates to a number of documentation pages 2015-06-18 17:30:15 -07:00
David G Yu
5c914a0622 Fixed misspelled point indices in shader comments 2015-06-17 11:18:52 -07:00
David G Yu
48f52dbeaf Removed commented out face-varying options
This was already commented out and is not intended for release.
2015-06-17 09:59:03 -07:00
barfowl
e1673ebbf3 Doxygen tweaks to prevent it mangling Far::TopologyRefinerFactory<MESH>
- suppressed forward declarations for Factory<TopologyDescriptor>
    - moved typedef out of Doxygen group of Factory<MESH> to preserve ordering
2015-06-12 14:33:21 -07:00
Takahito Tejima
bb1fa6a9ee RC2.
- changed the namespace version
- updated release notes
2015-06-11 18:30:55 -07:00
David G. Yu
d4a18a6c98 Fixed crash in GL viewers w/ LegacyGregory
Fixed a crash (assertion failure on Windows) that occurs when
creating GLLegacyGregoryPatchTable for a mesh that requires
no Gregory patches.
2015-06-11 17:30:14 -07:00
Takahito Tejima
34fab03921 Merge pull request #629 from davidgyu/patchParamFix
Fixed Far::PatchParam encoding of refinement level
2015-06-11 15:33:50 -07:00
David G. Yu
f0128a5f5e Fixed Far::PatchParam encoding of refinement level
This change restores the use of 4-bits in Far::PatchParam to
encode the refinement level of a patch. This restores one bit
that was stolen to allow for more general encoding of boundary
edge and transition edge masks. In order to accommodate all
of the bits that are required, the transition edge mask bits
are now stored along with the faceId bits.

Also, accessors are now exposed directly as members of Far::PatchParam
and the internal bitfield class is no longer directly exposed.
2015-06-11 15:10:30 -07:00
Takahito Tejima
12f3e5a384 Fix a bug in LimitStencilTableFactory
If the input cv stencil is given and it includes the local point
stencils for endcaps, LimitStencilTableFactory::Create failed
because of incorrect sanity checking.
2015-06-11 13:41:20 -07:00
barfowl
bae35a9f1e Removed StackBuffer::operator[] to remove MSVC overloading ambiguity error
- removed operator[] -- now rely on (TYPE*)[]
    - added comments regarding reliance on implicit casting
2015-06-10 18:14:14 -07:00
Takahito Tejima
5bf1c3a396 Fix a bug in limit stencil table creation
LimitStencilTableFactory::Create was returning fewer number of
stencils, off by the number of coarse vertices.
2015-06-09 17:07:18 -07:00
Jeremy Cowles
40e7d206ab Merge pull request #601 from c64kernal/dev_ver
Getting ready for RC1.
2015-06-03 21:47:10 -07:00
George ElKoura
aa6ba33281 Getting ready for RC1.
- changed the namespace version
- updated release notes documentation
2015-06-03 20:06:21 -07:00
Jeremy Cowles
d716431b64 Merge pull request #600 from barfowl/fvar_channel
Made channel argument non-optional for internal face-varying methods
2015-06-03 19:37:00 -07:00
barfowl
c748cf6cfa Made channel argument non-optional for internal face-varying methods
- removed default value assignment in Vtr::Level and Far::PatchTable
    - fixed one place where the expected channel argument was omitted
2015-06-03 19:23:50 -07:00
David G. Yu
80fe31225c Fixed the tessellation metrics calculations
Unified transition patch drawing affects the calculation of
tessellation level metrics. Because a single edge of a shader
patch might be split into two halfs along a transition edge,
the effective maximum number of spans along any adaptive edge
is limited to half of the device maximum.
2015-06-03 18:01:19 -07:00
Takahito Tejima
815e54edd0 Suppress erroneous drawing around valence 2 interior vertex
Although valence 2 gregory patch is not well supported yet, this fix
mitigates artifacts around such a vertex.
Adding a shape catmark_gregory_test8 to see this issue.
2015-06-03 13:56:29 -07:00
Jeremy Cowles
12f260adad Merge pull request #593 from davidgyu/fvarSmoothPatchPostpone
Removed WIP face-varying bicubic patches
2015-06-03 13:46:39 -07:00
jcowles
b081055fe9 Clean up compiler warnings.
stb - potential use of uninitialized variable (this may have been safe)
farViewer - unused variable
patchTableFactory - _channelIndices potentially used uninitialized
FVarLevel - valueIndexInFace0 potentially used used uninitialized (was safe)
2015-06-03 13:17:40 -07:00
David G Yu
521f31468b Removed WIP face-varying bicubic patches
We'll restore this code and finish it up for the next release.

For now, removing this code restores parity with the 3.0 beta,
i.e. face-varying patches are always all bilinear.
2015-06-03 12:49:01 -07:00
Takahito Tejima
ef55c48123 Merge pull request #587 from davidgyu/fvarSmoothPatchPostpone
Prepare to defer face-varying bicubic patches
2015-06-03 12:33:05 -07:00
Jeremy Cowles
f35849ef4b Merge pull request #592 from barfowl/far_doxygen
Added Doxygen tags to some Far headers
2015-06-03 12:03:43 -07:00
barfowl
35f64d085d Added Doxygen tags to some Far headers 2015-06-02 23:35:39 -07:00
Takahito Tejima
16d566884a Fix gregory patch shader: wrong tangents on corner corners
Besides we've not been computing accurate derivatives on gregory patch,
there was a separate bug in shaders which gives completely bogus dUdV on
corner vertices. This change fixes that significant artifact, however,
is still approximating derivatives by ignoring rational components.
2015-06-02 18:27:36 -07:00
David G Yu
5590c62f0a Merge pull request #590 from takahito-tejima/dev
Fix tessellation cracks when screen space tesselation is turned off.
2015-06-02 17:27:30 -07:00
Takahito Tejima
670ce267f3 Fix tessellation cracks when screen space tesselation is turned off.
The tess factor of transition edges has to be clamped to 2.
2015-06-02 17:08:17 -07:00
Jeremy Cowles
8966519b8b Merge pull request #589 from barfowl/topology_descriptor
Separated Far's TopologyDescriptor from the RefinerFactory classes
2015-06-02 17:07:18 -07:00
barfowl
6c61f1b006 Separated Far's TopologyDescriptor from the RefinerFactory classes:
- moved TopologyRefiner out of the RefinerFactoryBase into Far
    - moved implementation of its Factory<MESH> to far/topologyDescriptor.*
    - updated examples and tutorials (no more references to FactoryBase)
2015-06-02 16:27:19 -07:00
Takahito Tejima
5c54962d3b Improve OpenCL/DX interop configuration
build osd and examples with DX/CL interop only of cmake finds
cl_d3d11.h or cl_d3d11_ext.h.
2015-06-02 16:20:59 -07:00
David G Yu
1c4bdbb726 Prepare to defer face-varying bicubic patches
There's a lot of good foundational work here to eventually support
smooth interpolation of face-varying patches. Unfortunately, this
is not quite ready to release. Therefore, we've decided to defer this
feature until a later release.

This change hides this code behind the FAR_FVAR_SMOOTH_PATCH macro.
2015-06-02 15:28:31 -07:00
Takahito Tejima
36465ed96c Merge pull request #586 from davidgyu/fvarRename
Renamed per-patch face-varying access methods
2015-06-02 14:26:25 -07:00
David G Yu
0243f54b29 Updated patch table face-varying interface
Now the channel specifier is the last parameter in a method's
parameter list with a default of 0.  This is consistent with the
topological face-varying queries and also simplifies the common
case of just a single face-varying channel.
2015-06-02 13:51:32 -07:00
David G Yu
d0f8975117 Merge pull request #584 from takahito-tejima/singleCrease
Unlabel rotation of single crease patch.
2015-06-02 13:06:21 -07:00
Takahito Tejima
1e02fbebf8 Sync HLSL shaders for the single crease orientation fix.
- add HLSL equivalents of the previous GLSL change
- rename OsdGetSingleCreaseSegmentParameter to
OsdGetPatchSingleCreaseSegmentParameter.
- add shadingMode UI for dxViewer similar to glViewer
2015-06-02 12:03:27 -07:00
David G Yu
385df434ec Renamed per-patch face-varying access methods
This matches more closely the pattern used elsewhere in Far:
    GetFVarPatchValues() --> GetPatchFVarValues()
    GetFVarPatchesValues() --> GetFVarValues()
2015-06-02 09:13:17 -07:00
Takahito Tejima
fe92265db9 Unlabel the rotation of single crease patch.
use boundaryMask to identify the crease edge from 4 edges.
with this change, single-crease patch no longer needs to be rotated on
its population.

In shader, experimentally use same infinite sharp matrix for both
boundary and single-crease patch.
2015-06-01 21:26:39 -07:00
barfowl
39eae0195f Renamed internal face-varying methods for consistency with public
- renamed Vtr::Level::getFVarFaceValues() to getFaceFVarValues()
    - updated all usage
2015-06-01 20:31:27 -07:00
George ElKoura
4536d44c31 Merge pull request #582 from barfowl/catmark_adaptive
Disabling feature-adaptive refinement for non-Catmark schemes
2015-06-01 19:02:57 -07:00
George ElKoura
8f7dc4ae8f Merge pull request #581 from barfowl/vtr_members
Re-protected members of all major Vtr classes
2015-06-01 19:01:11 -07:00
barfowl
d8f139ae47 Disabling feature-adaptive refinement for non-Catmark schemes 2015-06-01 18:21:55 -07:00
barfowl
13e0850ac6 Re-protected members of all major Vtr classes:
- change public status of members back to protected/private
    - mimized friends (primarily Refinements as builders for Levels)
    - added any missing accessors to prevent member access (mainly Tags)
    - added the Tri/Quad refinement subclasses to private header list
2015-06-01 17:38:11 -07:00
barfowl
dc5056fe76 Renaming of face-varying methods to access values per face:
- replaced FVarFaceValues with FaceFVarValues in a couple Far methods
    - rewrote face-varying Factory assignement to be clearer with terminology
2015-06-01 16:25:44 -07:00
David G. Yu
2bad68e029 Added include of algorithm for min/max 2015-06-01 11:12:20 -07:00
barfowl
e52dd83b14 Removed unnecessary files include by public headers in Far 2015-06-01 00:14:19 -07:00
barfowl
2e6cab8df4 Eliminated direct member access to Vtr classes from Far:
- added required/missing access methods to Vtr
    - replaced direct member access in Far with appropriate methods
2015-05-31 18:26:13 -07:00
David G. Yu
1b6d9ba409 Workaround GLSL shader compiler on AMD
Added a size specifier to the shader output array declaration
in the GregoryBasis and Gregory control shaders. This seems
to be required by the GLSL compiler on AMD and is harmless elsewhere.
2015-05-31 10:59:01 -07:00
David G. Yu
99b214ca92 Workaround GLSL shader compiler on AMD
Added a size specifier to the shader output array declaration
in the BSpline control shader. This seems to be required by the
GLSL compiler on AMD and is harmless elsewhere.
2015-05-31 10:26:50 -07:00
David G. Yu
bd6d9b4ea9 Sync'd screen-space single-crease patch fix to DX 2015-05-31 08:18:18 -07:00
David G Yu
4bf1ef722c Merge pull request #564 from takahito-tejima/singlecrease
Fix screen-space tessellation on single crease patch.
2015-05-30 23:58:39 -07:00
George ElKoura
cb5044c462 Fix out of bounds mem access in CPU stencil eval.
When the stencil table contains no stencils, bail out
on the EvalStencil before indexing into the stencil table.
2015-05-30 22:55:43 -07:00
Takahito Tejima
2102b4f6b2 Fix screen-space tessellation on single crease patch.
- Rename OsdPerPatchVertexBSpline to OsdPerPatchVertexBezier
- Split OsdGetTessLevels into 3 functions,
  OsdGetTessLevelUniform, OsdGetTessLevelAdaptiveRefinedPoints,
  OsdGetTessLevelAdaptiveLimitPoints.
- Add a regression test shape : catmark_single_crease
2015-05-30 22:41:24 -07:00
Takahito Tejima
997d6035b9 Merge pull request #558 from davidgyu/fvarFix
Fixed a couple of problems with FVar handling
2015-05-30 12:00:32 -07:00
Jeremy Cowles
de69c5100c Merge pull request #556 from barfowl/primvar_interpolate
Removed multi-level interpolation methods of Far::PrimvarRefiner
2015-05-30 10:26:33 -07:00
David G Yu
cd782e3728 Fixed a couple of problems with the FVar handling
This fixes a couple of minor regressions with linear FVar
display in the glViewer and glFVarViewer.
2015-05-29 23:58:40 -07:00
David G. Yu
c245407854 Re-organized patch tessellation shader code
This change refactors the GLSL and HLSL patch shader code so that
most of the work is implemented within a library of common functions
and the remaining shader snippets just manage plumbing.

There is more to do here:
  - varying and face-varying data can be managed entirely by the client
  - similarly, displacement can be implemented in client code
  - there's still quite a bit of residual boiler-plate code needed
    in each shader stage that we should be able to wrap up in a more
    convenient form.
2015-05-29 23:00:19 -07:00
barfowl
5b854c8534 Removed multi-level interpolation methods of Far::PrimvarRefiner
- removed all of the multi-level Interpolate...() methods taking T*, U*
    - made all single-level methods consistent wrt usage of T&, U&
    - replaced usage in regressions, tutorials and examples
    - additional minor improvements to far/tutorials
2015-05-29 22:21:50 -07:00
Takahito Tejima
4e807a776d Add Far::PatchTable::ComputeLocalPointValues() to compute endcap patch points.
To encapsulate endcap functions from public API, add methods to
tell the number of patch points needed (GetNumLocalPoints()) and
to compute those patch points as a result of change of basis from
the refined vertices (ComputeLocalPointValues()).

ComputeLocalPointValues takes contiguous source data of all levels
including level0 control vertices.
2015-05-29 12:41:22 -07:00
Takahito Tejima
7e82df37b2 Far: make internal header files private.
- fixing CMakeLists to install only public headers.
- remove unnecessary includes from examples.
2015-05-29 12:41:21 -07:00
Takahito Tejima
a81497b8db Merge pull request #548 from barfowl/add_varying
Removed primvar interpolation dependency on varying interface
2015-05-29 12:40:22 -07:00
barfowl
42245f4b20 Removed primvar interpolation dependency on varying interface:
- removed AddVaryingWithWeight from Far::PrimvarRefiner interpolation
    - removed Far::StencilBuilder dependencies on varying
    - updated Far::StencilTableFactory use of StencilBuilder constructor
    - updated far/tutorial_2 to use vertex colors vs varying (for now)
2015-05-29 10:48:19 -07:00
Takahito Tejima
f9523f916f osdlayer: rename Osd::VertexBufferDescriptor to Osd::BufferDescriptor.
A mechanical substitution of VertexBufferDescriptor with BufferDescriptor.
Also removing unused files from osd.
2015-05-29 09:21:14 -07:00
barfowl
ff490cc131 Moved protected TopologyRefiner modifiers to its Factory class:
- added TopologyRefiner base level modifiers to TopologyRefinerFactoryBase
    - removed old modifiers from TopologyRefiner (unused by anything else)
    - updated existing Factory<MESH> definitions to use new methods
2015-05-28 22:39:45 -07:00
barfowl
506900e59f Added more public constants to <far/types.h>
- added constants for Vtr::INDEX_INVALID and VALENCE_LIMIT
    - added inline equivalent to Vtr::IndexIsValid()
2015-05-28 17:55:34 -07:00
David G Yu
c65995b834 Merge pull request #541 from barfowl/mask_interface
Moved Vtr::MaskInterface into Far::PrimvarRefiner
2015-05-28 13:50:30 -07:00
Takahito Tejima
9cfdb6c5c1 Mac build and shader compiler error fix. 2015-05-28 10:27:23 -07:00
David G Yu
7d51c1d2e9 Merge pull request #539 from takahito-tejima/osdapi
Add GPU stencil/patch derivative kernels
2015-05-28 10:04:26 -07:00
Jeremy Cowles
30fb3260ec Merge pull request #540 from barfowl/boundary_none
Fixed refinement when using BoundaryInterpolation mode "None"
2015-05-27 21:02:55 -07:00
barfowl
6ce3292576 Moved Vtr::MaskInterface into Far::PrimvarRefiner:
- updated PrimvarRefiner to make use of now-local Mask class
    - renamed vtr/maskInterfaces.h to vtr/componentInterfaces.h
    - updated usage of renamed header file and CMakeLists.txt
2015-05-27 20:44:06 -07:00
barfowl
9cd082fde1 Tag faces as holes when using BoundaryInterpolation setting of "none" 2015-05-27 19:42:27 -07:00
Takahito Tejima
9dcbaee147 Add GPU stencil/patch derivative kernels
implements cuda, CL, GLXFB and GLCompute kernels of derivative
evaluation for both limit stencils and patches.
2015-05-27 17:23:36 -07:00
barfowl
9a14bf72d4 Added missing scaling to derivatives of Bilinear patches 2015-05-27 15:11:35 -07:00
David G Yu
7f03b864b7 Merge pull request #534 from barfowl/face_uniform
Moved base-face propagation to Far::PrimvarRefiner
2015-05-27 15:32:01 -04:00
Takahito Tejima
49a16539dd A workaround for the GLSL compute crash on some nvidia drivers
It looks like there's a compiler bug in some earlier nvidia driver 340/346 releases.
It has been fixed in 348.07 (win) as far as I can tell.

Following code behaves incorrectly.

void f(int a) {
  for (int i=0; i<3; ++i) doSomething(a, i);
}
void g() {
  for (int i=0; i<100; ++i) f(i);
}

The workaround is to use different identifiers for each function.
2015-05-27 08:57:47 -07:00
barfowl
0a86d6fe44 Moved base-face propagation to Far::PrimvarRefiner:
- removed TopologyRefiner options to propagate base face in Refinememt
    - removed all Vtr storage and management of base face
    - added PrimvarRefiner methods to "interpolate" per-face primvar data
2015-05-26 19:56:39 -07:00
David G Yu
22936eff56 Merge pull request #533 from c64kernal/dev_internal
Lower-case Internal namespace to match convention.
2015-05-26 21:27:28 -04:00
George ElKoura
a8568fc983 Lower-case Internal namespace to match convention.
Renamed "Internal" namespace to "internal" to match the convention in the rest
of the library.
2015-05-26 18:19:45 -07:00
George ElKoura
e9507b9fd6 Merge pull request #525 from barfowl/vtr_internal
Moved Vtr classes within internal namespace:
2015-05-26 18:09:41 -07:00
Takahito Tejima
47f79e54fc Merge pull request #528 from davidgyu/memfix
Fixed buffer access into empty container
2015-05-26 14:55:27 -07:00
Takahito Tejima
62b7197389 Merge branch '358' of https://github.com/ielillo/OpenSubdiv into ielillo-358
Conflicts:
	opensubdiv/far/stencilBuilder.cpp
2015-05-26 14:22:36 -07:00
Takahito Tejima
749bbf4271 Fix OpenCL and CUDA EvalPatches kernels. 2015-05-26 11:13:30 -07:00
David G. Yu
8568370630 Fixed buffer access into empty container
Raised as a run-time error by the VS2013 debug STL implementation.
2015-05-26 11:03:21 -07:00
Takahito Tejima
541aeddd3a Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.

with this change, Eval API in the osd layer consists of following parts:

- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
  implements EvalStencils and EvalPatches(*). Both supports derivatives
  (not fully implemented though)

- Interop vertex buffer classes (optional, same as before)
  Note that these classes are not necessary to use Evaluators.
  All evaluators have EvalStencils/Patches which take device-specific
  buffer objects. For example, GLXFBEvaluator can take GLuint directly
  for both stencil tables and input primvars. Although using these
  interop classes makes it easy to integrate osd into relatively
  simple applications.

- device-dependent StencilTable and PatchTable (optional)
  These are also optional, but can be used simply a substitute of
  Far::StencilTable and Far::PatchTable for osd evaluators.

- PatchArray, PatchCoord, PatchParam
  They are tiny structs used for GPU based patch evaluation.

(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
   There's a technical difficulty for the multi-stream output.
2015-05-25 22:43:43 -07:00
barfowl
85b65bd2ef Moved Vtr classes within internal namespace:
- moved all major Vtr classes within namespace internal
    - updated all Vtr class access with Far
2015-05-25 20:34:50 -07:00
Jeremy Cowles
d335c7249e Merge pull request #522 from barfowl/primvarRefiner
Moved primvar interpolation methods to new Far::PrimvarRefiner class
2015-05-24 22:18:26 -07:00
George ElKoura
670a48fd86 Fix build breakage on MSVC due to implicit downcasting.
Be explicit about the casting from size_t to int in stencilBuilder.cpp.
2015-05-24 01:21:48 -07:00
Jeremy Cowles
15020c2c4c Fix StencilBuilder copyright (2015) 2015-05-23 20:34:59 -07:00
Jeremy Cowles
befbc282db Add stencilTable.cpp, minor cleanup
* Added stencilTable.cpp
 * Fixed the "off" variable shadow warning
 * Moved constructors to cpp file
 * Made LimitStencilTable constructor private
 * other minor clean up.
2015-05-23 20:31:18 -07:00
barfowl
a15edc1f2c Moved primvar interpolation methods to new Far::PrimvarRefiner class
- created new class Far::PrimvarRefiner with interpolation methods
    - removed interpolation and limit methods from Far::TopologyRefiner
    - replaced internal usage in Far::StencilTableFactory
    - replaced usage in regressions, tutorials and examples
2015-05-23 18:56:36 -07:00
Ignacio Lillo
e6733580ba Fixed warning that prevented building the project. 2015-05-23 00:48:58 -03:00
George ElKoura
7a97d7be5d Merge pull request #520 from barfowl/vtr_friends
Removing friends from Vtr classes
2015-05-22 18:49:47 -07:00
jcowles
909757ca9b Faster, simpler stencil table construction.
This is a new implementation of the stencil table construction algorithm found
in protoStencil.h. In local tests with production assets, the new algorithm is
~25% faster and significantly more stable, in terms of average performance

In one asset test, generating stencils for level 10 adaptive refinement of
BuzzLightyear was reduced from 18s to 13s.
2015-05-22 16:36:12 -07:00
barfowl
b64eb5e2e0 Removing friends from Vtr classes and making more accessible internally:
- removed all friend declarations (no more Far declarations with Vtr)
    - all protected methods made public
    - intent is to move these into namespace internal
    - access between Vtr classes is under review
2015-05-22 15:52:47 -07:00
Takahito Tejima
a7c5179ef9 renaming (2/2) PatchTables and StencilTables to PatchTable and StencilTable
replace all occurrences reffering PatchTables, StencilTables, and their factories.
2015-05-22 11:50:01 -07:00
Takahito Tejima
e6f951c010 renaming (1/2) PatchTables and StencilTables to PatchTable and StencilTable
this commit just changes filenames (for better diffs)
2015-05-22 11:02:58 -07:00
Jeremy Cowles
bec60d5500 Merge pull request #512 from takahito-tejima/dev
remove maximum valence limitation in gregory basis and bspline basis end caps.
2015-05-21 23:38:40 -07:00
barfowl
3d80cc56f5 Replaced and removed remaining use of TopologyRefiner level methods:
- replaced all remaining usage internal to far with TopologyLevel
    - removed the obsolete methods from TopologyRefiner
2015-05-21 21:26:41 -07:00
barfowl
ff13665a02 Introduced Far::TopologyLevel methods in place of TopologyRefiner in Osd 2015-05-21 20:20:16 -07:00
David G Yu
2b33de38f8 Merge pull request #513 from takahito-tejima/refactor2
implements Osd::CpuEvaluator::EvalPatches function.
2015-05-21 18:55:09 -07:00
David G Yu
71055dbdd9 Merge pull request #510 from takahito-tejima/refactor
glStencilViewer crash fix
2015-05-21 18:53:45 -07:00
Takahito Tejima
2e26f932e1 implements Osd::CpuEvaluator::EvalPatches function.
- it takes number and pointer for the input PatchCoords.
- add derivative evaluations.
- enhance glEvalLimit example to see the derivative evaluation works.
2015-05-21 17:45:13 -07:00
Takahito Tejima
2008e6ca05 Merge pull request #511 from davidgyu/shadingRefactor
Sync'ed up GLSL and HLSL patch shader source.
2015-05-21 11:51:40 -07:00
Takahito Tejima
b15762204a remove maxvalence limitation in FarGregoryBasis. 2015-05-21 10:59:40 -07:00
David G Yu
f4a8cafe86 Sync'ed up GLSL and HLSL patch shader source.
Cleaned up the Legacy Gregory shader source by accessing buffer
data through helper functions.

Switched to performing tessellation in untransformed (object) space.
2015-05-21 09:56:25 -07:00
Takahito Tejima
743c424e9c Add high-valence evaluation path into gregory basis. 2015-05-21 09:42:26 -07:00
Takahito Tejima
e8ac41dbc8 glStencilViewer crash fix #2
this change fixes a crash when selecting catmark_hole_test1
in glStencilViewer. If there's a hole limit stencils may not
be found for given limit location, resulting invalid stencil
entries.
2015-05-21 09:05:33 -07:00
Takahito Tejima
c9150cfb23 glStencilViewer crash fix #1
use patchtables instead of patchTables (yes, quite confusing...)
patchtables may be created ondemand if patchTables isn't given
as an argument.
2015-05-21 09:03:06 -07:00
barfowl
05e9c48ea9 Raised maximum valence supported by Vtr and included new test shapes:
- changed Vtr::LocalIndex to 16-bit integer from 8-bit
    - added test shapes including valence 360 vertices
    - disabled new shapes in far/regression until improved accuracy accepted
2015-05-20 23:36:45 -07:00
George ElKoura
32e9bb7e29 Merge pull request #508 from davidgyu/dxfix
Fixed HLSL shader compile error.
2015-05-20 22:25:14 -07:00
David G Yu
1bdc69dbfc Merge pull request #506 from c64kernal/dev_patch
Remove need for friending a class in PatchTables.
2015-05-20 21:53:19 -07:00
David G. Yu
d1452a02cf Fixed HLSL shader compile error. 2015-05-20 21:48:52 -07:00
George ElKoura
b53a73f7de Removed unnecessary friendship in ProtoStencil. 2015-05-20 20:10:14 -07:00
George ElKoura
f521c9dde3 Remove need for friending a class in PatchTables.
PatchTables no longer needs to friend EndCapLegacyGregoryPatchFactory.
Instead we now make the patch table factory pass in the data that needs
to be updated directly to EndCapLegacyGregoryPatchFactory.
2015-05-20 19:44:43 -07:00
George ElKoura
a7d9d6a9b4 Merge pull request #504 from davidgyu/cleanup
Comment cleanups discovered while reviewing Far
2015-05-20 19:40:49 -07:00
David G Yu
c82b3d551d Merge pull request #502 from barfowl/patch_eval
Refactor public patch evaluation methods exposed by Far::PatchTables
2015-05-20 19:39:32 -07:00
Takahito Tejima
a1424ae163 Fix gregory patch tesslevel computation
- flipping UV
- using limit position in legacy gregory shader.
2015-05-20 18:27:32 -07:00
David G Yu
7aa6ef8113 Fixed comments and one cut-n-paste typo in Far. 2015-05-20 17:43:13 -07:00
David G Yu
11e987a7d8 Fixed the misspellings of Ignacio Castano's name. 2015-05-20 17:39:06 -07:00
barfowl
be50309752 Fixed missing qualification of IndexArray 2015-05-20 17:21:02 -07:00
Takahito Tejima
109a3f5383 osd layer: Add GLPatchTable and retire DrawContext
In osd layer, we use GLPatchTable (D3D11PatchTable) as a
device-specific representation of FarPatchTables instead of
DrawContext. GLPatchTable may be used not only for drawing
but also for GPU eval APIs (not yet supported though.
We may add CudaPatchTable etc as needed).

The legacy gregory patch drawing buffers are carved out to
the separate class, named GLLegacyGregoryPatchTable.

Also face-varying data are split into client side for now, until
we add new and more robust face-varying drawing structure
(scheduled at 3.1 release)

Tentatively replicate PatchArray structure in GLPatchTables. It will
be revised in the upcoming change.

Shifting hard-coded SRV locations of legacy gregory buffers in HLSL shaders.
2015-05-20 15:55:06 -07:00
barfowl
891772f58b Refactor public patch evalations methods exposed by Far::PatchTables:
- changes completely deprecate AddWithWeight(T, float, float, float)
    - added new EvaluateBasis() method to PatchTables
    - replaced usage of old Evaluate...<T,U>() methods with EvaluateBasis()
    - removed old Evaluate...<T,U>() methods
    - removed now unused Interpolate...<T,U>() functions in far/interpolate.h
    - moved low-level basis code from far/interpolate.* to patchBasis.*
2015-05-20 15:44:29 -07:00
David G. Yu
00ce36433f Fixed handedness flip in Gregory{Basis} shaders
There was an unnecessary double-flip in the shading calculations.
2015-05-20 14:17:31 -07:00
jcowles
d83f063d93 Break friendship between GegoryBasis and Factory 2015-05-20 13:25:19 -07:00
David G Yu
0811046c2f Merge pull request #497 from jcowles/dev-remove-pragma
Remove #pragma once
2015-05-20 12:57:21 -07:00
Takahito Tejima
8d9ae550ff Add a HLSL version of GregoryBasis patch shader.
hlslPatchGregoryBasis.hlsl is an equivalent to glslPatchGregoryBasis.
Update dxViewer to be able to switch among bspline, gregorybasis, legacy
end capping.

also fixes a bug of GLSL legacy gregory shader which had an inconsistent
resource naming with example codes.

It looks like there's still an issue of D3D11 patchParam data fetching.
we'll come back to that bug.
2015-05-20 10:49:45 -07:00
jcowles
392e5e8bed Remove #pragma once
While this may be worth revisiting, we should first quantify the benefits and
identify the compilers that support it. Ultimately, we may never use pragma
once in favor of strictly using standard C++.
2015-05-20 09:59:18 -07:00
barfowl
e3db2c94a6 Minor performance improvements to Sdc limit masks for the regular case:
- simple loop unrolling and branch reduction in Loop and Catmark limits
2015-05-19 15:49:19 -07:00
barfowl
33cbbbc4f8 Move topology queries specific to a level to new Far::topologyLevel class:
- added new class to far/topologyLevel.h
    - updated TopologyRefiner to manage set of TopologyLevels internally
    - added TopologyRefiner method to retrieve TopologyLevel
    - redefined obsolete TopologyRefiner methods in terms of TopologyLevel
2015-05-19 15:06:41 -07:00
Takahito Tejima
6421c52fae Merge pull request #489 from davidgyu/irregularRotate
Fixed varying stencils for end cap patches
2015-05-19 13:19:30 -07:00
Takahito Tejima
2f90e3799a Merge pull request #488 from jcowles/dev-size
Prefix header guards and add pragma once.
2015-05-19 13:18:18 -07:00
David G. Yu
8d33bb8dd9 Fixed varying stencils for end cap patches 2015-05-19 13:00:53 -07:00
jcowles
9d32712ec4 Prefix header guards and add pragma once. 2015-05-19 11:22:37 -07:00
Takahito Tejima
c3aa00e706 remove SupportsAdaptiveTessellation from OsdDrawContext, and example cleanups
As a preparation for retiring DrawContext, move SupportsAdaptiveTessellation
method to examples/common/glUtils, which is renamed and namespaced
from gl_common.{cpp,h} to be consistent to other files.
Same renamings applied to other example files.
2015-05-19 10:30:16 -07:00
jcowles
7b4aa33a1f Change stencils sizes from unsigned char to int. 2015-05-19 10:16:56 -07:00
David G Yu
d97d9941be Removed Interpolate{Boundary,Corner}Patch from Far
Far::GetBSplineWeights() now handles boundary and corner edges.
2015-05-18 15:05:30 -07:00
barfowl
0d7ae5c461 Refactored Far computation of Gregory patch basis functions:
- fixes normalization of (s,t) hidden in Bezier weight computation
    - includes computation of true derivatives for future reference
2015-05-15 18:52:02 -07:00
barfowl
2ec507e107 Removed more usage of alloca() dependent on maximum valence:
- replaced alloca() usage in far/gregoryBasis.cpp with StackBuffer
2015-05-15 17:20:03 -07:00
David G Yu
8716a8eebf Fixed example code use of single crease patches
Also made a couple minor changes to true up the GLSL patch shaders.
2015-05-15 11:52:41 -07:00
David G. Yu
b0dd44dd47 Fixed an alloca buffer overrun error in Far 2015-05-14 13:25:33 -07:00
David G Yu
6ade89c221 Removed an unused local var from interpolate.cpp
Fixes a build warning from clang on OS X.
2015-05-14 12:55:04 -07:00
Takahito Tejima
4a4322983f Osd drawing API refactoring.
Remove DrawRegistry from osd layer and put a simple shader caching
utility into examples/common. osd layer only provides patch shader
snippet and let client configure and compile the code. Clients also
maintain the lifetime of shader object, which is preferable for the
actual application integration.

update all examples to use the new scheme.
2015-05-13 17:35:46 -07:00
David G Yu
fb009f41b2 Removed BOUNDARY and CORNER patch types
These are now redundant since all bspline patches are encoded in
the patch tables consistently using 16 point indices with boundary
and corner edges indicated in the boundary mask of the patch params.
2015-05-13 11:31:02 -07:00
David G Yu
7b69117f02 Fixed evaluation of boundary and corner patches
My earlier change which simplified the categorization of
patch types broke evaluation for boundary and corner patches.

Previously, boundary and corner patches were always rotated
into a canoncial orientation by permuting the point indices
of the patch. This was convenient in some cases, but generally
made things unecessarily complicated, since the parameterization
of the patch had to be counter-rotated to compensate.

Now patches always remain correctly oriented with respect
to the underlying surface topology and evaluation of boundary
and corner patches is accommodated by simply adjusting the
spline weights to account for the missing/invalid patch
points along boundary and corner edges.

There is more to clean up and optimize, but this restores
correct behavior.
2015-05-12 16:13:57 -07:00
David G Yu
1c91945d10 Added stronger guards for OSD_MAX_VALENCE 2015-05-12 11:15:51 -07:00
Takahito Tejima
917974f7d1 fix typo in the include guard. 2015-05-11 18:07:26 -07:00
Takahito Tejima
b66380ee52 Refactor Osd::DrawContext
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.
2015-05-11 18:06:46 -07:00
barfowl
60c6f51592 Improvements to patch basis evaluation in far/interpolate.*:
- 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)
2015-05-11 16:18:03 -07:00
Takahito Tejima
94d6eb6491 cleanup remaining ptex specific code in osd layer
- Remove MeshPtexData bit from Osd::MeshBits. It's not used any more
- Rename ptexIndexBuffer in D3D11DrawContext to paramParamBuffer
- Remove Is/SetPtexEnabled from D3D11DrawRegistry
2015-05-11 10:59:16 -07:00
Takahito Tejima
33bfbf699b Refurbish osd layer API.
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.
2015-05-08 17:31:26 -07:00
Takahito Tejima
1a37da1c26 osd refactor: split the vertex buffer argument into src and dst
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.
2015-05-07 16:11:00 -07:00
Takahito Tejima
8fc0e5db93 Move Ptex code from osd to examples.
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)
2015-05-07 13:56:48 -07:00
Takahito Tejima
f3aec9eb31 Remove osd/vertex.h
OsdVertex was used in 2.x FarMesh as a placeholder for Hbr template parameter.
We don't need such a class any more.
2015-05-07 12:34:09 -07:00
David G Yu
8b4ef28116 Updated handling of patchParam and patchCoord
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*().
2015-05-06 13:47:33 -07:00
Takahito Tejima
efb010557d Merge pull request #461 from c64kernal/dev_warn
Satisfy compiler warnings about unused parameters.
2015-04-30 21:45:53 -07:00
barfowl
272efb6911 Minor changes to Far::TopologyRefiner:
- now declared non-copyable
    - replaced alloca() usage with StackBuffer (to allow overflow to heap)
    - overloaded Limit() to compute limit tangents (two tangents per vertex)
    - disabled face-varying influence on feature-adaptive selection
2015-04-30 19:37:53 -07:00
George ElKoura
687cc4f8d9 Return *this from operator= in vtr/stackBuffer.h 2015-04-30 19:11:51 -07:00
George ElKoura
12c421e36c Satisfy compiler warnings about unused parameters.
In vtr/stackBuffer.h, removed  unnecessary symbols for parameters to silence
compiler warnings about them not being used.
2015-04-30 18:40:44 -07:00
Takahito Tejima
dcb022e1db Fix DX-OpenCL/CUDA interop.
- 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.
2015-04-29 11:51:12 -07:00
barfowl
abce99950d Minor improvements to definition and use of Vtr::StackBuffer:
- 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
2015-04-28 17:31:43 -07:00
Takahito Tejima
82a0513326 cleanup CL/CUDA example harnesses.
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.
2015-04-28 15:46:37 -07:00
Takahito Tejima
99f1b57ba5 Merge pull request #448 from davidgyu/patcheval
Fixed gathering of patches near non-manifold topo
2015-04-27 13:34:18 -07:00
David G Yu
46b2cac54b Fixed gathering of patches near non-manifold topo
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.
2015-04-27 12:40:18 -07:00
Takahito Tejima
de0082ba95 Simplify Osd::MeshInterface.
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.
2015-04-27 11:27:05 -07:00
George ElKoura
ce0cdf1a90 Fix an out-of-bounds read.
Fixed a bad read from a std::vector.  It's normally harmless, but at least makes
debug runtimes cry.
2015-04-26 20:32:34 -07:00
barfowl
ce223949f2 Introduced StackBuffer class to replace/extend usage of alloca():
- add Vtr::StackBuffer to allocate from heap beyond local arena size
    - replaced usage of alloca() with Vtr
2015-04-26 17:04:18 -07:00
Takahito Tejima
1fab11b2b4 Merge pull request #441 from davidgyu/patch-drawing
Fixed orientation of boundary and corner patches
2015-04-24 23:00:51 -07:00
Takahito Tejima
4d0bd75067 Merge pull request #440 from asluk/dev
retain vertex 0 for lefthanded meshes
2015-04-24 22:27:36 -07:00
George ElKoura
63dd4f7f40 Fix ptex indices computations for loop.
The only method not yet implemented for loop in PtexIndices is GetAdjacency(), fix code accordingly.
2015-04-24 16:08:37 -07:00
David G Yu
f19a41105d Fixed orientation of boundary and corner patches
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.
2015-04-24 15:33:04 -07:00
barfowl
0608230c7b Completed general limit tangent masks for Catmark:
- added general formulae for both Smooth and Crease tangent masks
    - further documented expectations of tangent masks in sdc/scheme.h
2015-04-24 14:36:38 -07:00
asluk
4e22fe0f69 Fix new off-by-one error in facevarying channels for lefthanded meshes. 2015-04-24 11:42:58 -07:00
asluk
ed07ed6a8f Merge remote-tracking branch 'upstream/dev' into dev 2015-04-23 21:23:29 -07:00
Takahito Tejima
74b78b3d17 Refactor again FarPatchTableFactory.
- 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.
2015-04-23 16:58:56 -07:00
asluk
c813d4b3a9 Retain initial vertex when reversing winding order for lefthanded meshes.
Add lefthanded mesh to vtr regression suite.
2015-04-23 12:01:15 -07:00
George ElKoura
0371a3aa5f Renamed methods on Far::PtexIndices.
GetNumPtexFaces() became GetNumFaces()
GetPtexIndex() became GetFaceId()
GetPtexAdjacency() became GetAdjacency()
2015-04-21 22:23:22 -07:00
George ElKoura
bded4cb075 Small clean up to how we validate the refiner when we build a PtexIndices. 2015-04-21 22:08:26 -07:00
George ElKoura
fcc1971767 Added an informative error check when passing in a refiner with an incompatible scheme to build PtexIndices. Also fixed an assert to not check for an explicit scheme type, and use traits instead. 2015-04-21 21:06:52 -07:00
George ElKoura
1ea3ec7958 Fixing comments. 2015-04-21 17:46:55 -07:00
George ElKoura
420473b45b Experiment separating out Ptex from TopologyRefiner.
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.
2015-04-21 17:34:02 -07:00
David G Yu
7d9dcf8c03 Added a new screen-space adaptive tessellation metric which
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.
2015-04-21 14:17:29 -07:00
Takahito Tejima
43aa2500c4 Refactor far factories.
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.
2015-04-20 18:59:07 -07:00
Jeremy Cowles
2c3f519092 Merge pull request #425 from asluk/dev
Fixed off-by-1 error for lefthanded meshes in facevarying channels.
2015-04-18 21:43:27 -07:00