Commit Graph

96 Commits

Author SHA1 Message Date
David G Yu
e0c14ddbef Fixed examples link dependency on GLFW
Split the examples/common objects into graphics API dependent object
libraries (following the pattern used for cemmon Ptex dependencies)
so that DX11 and Metal examples are no longer forced to link with GLFW.
2020-02-12 14:25:14 -08:00
barry
b80a414361 Updated examples with new shapes for boundary interpolation "none":
- added catmark_edgenone and loop_triangle_edgenone to shape lists
2020-01-14 14:27:51 -08:00
barry
936aff0b8a Moved ArgOptions from examples/common to regression/common:
- updated CMakeLists to account for the moved files
    - updated references to argOptions.h in all examples
    - added method to ArgOptions to populate vector<ShapeDesc>
    - minor changes to ViewerArgUtils to use forward references
2019-12-14 12:06:55 -08:00
George ElKoura
92341f7c1e Prefix OpenSubdiv CMake macros
This fixes issue #1157 by adding "osd" as a prefix to public macros.
2019-08-17 16:44:30 -07:00
George ElKoura
3c4081aac3
Merge pull request #1126 from davidgyu/examples_shaders
Minor improvements to examples for Loop
2019-06-17 21:11:02 -07:00
David G Yu
ed3fa312e5 Removed obsolete LOOP define from example shaders
Removed the use of the LOOP preprocessor symbol from
the remaining example shader code. The shader code is now
configured according to the types of the resulting patches
without depending on the subdivision scheme of the mesh
topology.
2019-06-17 17:59:15 -07:00
David G Yu
62195753a9 Updated default options for examples
Changed several default options in the example viewers to the
preferred settings for improved shape fidelity and to improve
consistency between the different viewers:
 - enabled smooth corner, and inf sharp patch options by default
 - disabled screenspace tess and fractional tess by default
 - changed the default approximation to Gregory in the mtlViewer
2019-06-17 17:33:40 -07:00
barry
4a198ace66 Added new Loop tetrahedron shape to main example viewers:
- added to the main geometry viewers: glViewer, dxViewer, mtlViewer
    - added to glFVarViewer for viewing face-varying UVs
2019-06-14 15:24:00 -07:00
barry
cf9573cdc5 Updated shape lists for example viewers:
- included shapes added in recent pull requests
    - removed old shapes made redundant by recent additions
    - ordered Catmark and Loop sets for consistency
2019-06-04 19:14:38 -07:00
David G Yu
944f98a9ea Updated dxViewer for Loop patches
Along with other changes to improve consistency with the glViewer
2019-04-26 11:08:01 -07:00
barry
b7470bb26f Moved definition of struct ShapeDesc into same header file as Shape:
- added definition to regression/common/shape_utils.h
    - removed examples/common/shapeDesc.h and all references to it
    - removed local definitions of ShapeDesc from examples, regressions, etc.
    - overloaded Shape::parseObj() with ShapeDesc
    - updated examples to use Shape::parseObj(ShapeDesc const&);
    - removed axis argument to Shape::ParseObj() and ObjAnim::Create()
2019-04-23 12:05:14 -07:00
barry
48a557abeb Replaced -axis with -yup in common args and examples:
- replaced -axis with -yup in examples/common/argOptions
    - updated clients of ArgOptions: glViewer, glFVarViewer, dxViewer
    - updated documentation for common arguments and usage of examples
2019-04-16 18:59:24 -07:00
George ElKoura
d02cad1e65 Use the new common ArgOptions in dxViewer 2019-04-09 21:06:06 -07:00
barry
949dc1dd0d Pruned the overly long list of shapes in example viewers:
- removed redundant, trivial or otherwise poor shapes from viewer lists
    - copied init_shapes.h to glViewer, dxViewer and mtlViewer for consistency
2019-03-22 16:55:30 -07:00
barry
20dcd24b9d Updated all example source for consistent inclusion of header files:
- prepend the opensubdiv directory to all library headers included
    - removed the opensubdiv directory from all declared include paths
2019-01-31 10:49:02 -08:00
barry
c424594625 Major step towards consistent use of include paths in source files:
- changed the main OPENSUBDIV_INCLUDE_DIR to exclude ./opensubdiv
    - updated CMakeLists.txt files in non-examples to use only this path
    - updated CMakeLists.txt files in examples to append ./opensubdiv to path
    - updated source in regression/common to use #include <opensubdiv/...>
    - updated source in examples/common to use #include <opensubdiv/...>
    - deferred source in examples to be updated on a case-by-case basis
2018-10-09 10:51:31 -07:00
David G Yu
917fc36dde HLSL patch shader changes for degenerate normals
Updated HLSL patch shaders to resolve degenerate normals.
This fix was ported from the GLSL patch shader source.

Also, added missing inf sharp test cases to dxViewer.
2017-11-21 18:01:57 -08:00
Mike Erwin
bd3113e7e3 spelling phase 4 -- examples, tutorials, regression tests
Read all comments and made corrections to files that aren't part of
OpenSubdiv itself but are packaged with it.

Commandline output of glPtexViewer is affected. Otherwise no functional
changes.
2017-01-24 22:48:48 -08:00
David G. Yu
c9a3bb4d87 Updated glViewer and dxViewer for InfSharp patches
Both of these have been updated to expose toggles
to enable refinement and creation of infinitely
sharp patches.
2016-09-30 11:00:31 -07:00
David G. Yu
42f5090290 Updated glFVarViewer and glEvalLimit examples
These have both been updated to test the refinement
and evaluation of face-varying patch data.
2016-09-29 10:00:19 -07:00
David G Yu
781b060bd8 Merge pull request #812 from c64kernal/dev_dxv
Fix unsigned/signed compare in dxViewer
2016-06-26 10:49:20 -07:00
George ElKoura
507e655a10 Fix unsigned/signed compare. 2016-06-25 21:55:51 -07:00
David G. Yu
1ba1e07ad1 iso-646 fix for ptex / examples / tutorials 2016-06-25 14:27:53 -07:00
Thomas Thomassen
b1e1ff31b4 Clean up DX, example and tutorials. 2016-06-25 10:30:50 +02:00
George ElKoura
923d60ca74 Use cmake's folder feature on platforms that support it.
We now make use of folders where they are supported.  In particular, on Visual Studio, this produces much nicer solutions to navigate.
2016-06-09 17:04:26 -07:00
David G. Yu
dcc4b61bf7 Re-enabled fractional tessellation in viewers 2015-10-23 15:26:46 -07:00
David G Yu
282c462097 Disabled Fractional Spacing toggles from viewers
Fractional tessellation is not currently supported by the core
tessellation shaders. This will be fixed in a future release.
2015-08-03 12:51:59 -07:00
Takahito Tejima
376e9dd3eb glViewer,dxViewer: disable catmark_pole360 2015-07-30 15:53:08 -07:00
Takahito Tejima
5c01e709f9 example fix: remove unnecessary debugging feature. 2015-06-03 17:40:36 -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
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
Takahito Tejima
7394bf5f51 Examples cleanup: factor out control mesh drawing.
- add GLControlMeshDisplay and D3D11ControlMeshDisplay into
  examples/common
- delete all drawCageEdges/drawCageVertices from viewers and
  use ControlMeshDisplay class
2015-05-31 15:08:37 -07:00
David G. Yu
bd6d9b4ea9 Sync'd screen-space single-crease patch fix to DX 2015-05-31 08:18:18 -07:00
George ElKoura
5a51f31104 Remove mention of vtr from tests and examples.
- Renamed common/vtr_utils to common/far_utils.
- Renamed all mentions of Vtr in the sources of tests and examples.
2015-05-30 22:10:07 -07:00
George ElKoura
8dc8bcdace Fix build breakage due to recent examples/common refactor.
- Make sure to declare usage of the include files if GLFW is found
- When GLFW is found and is compiled into examples/common, we need to
  unfortunately link it into dxViewer.  Hopefully we can refactor common
  so that this won't be necessary in the future.
2015-05-30 02:34:29 -07:00
Takahito Tejima
89dcea57c2 Fix CMakeLists: make project-relative include path overridable
All examples, regression tests and tutorials directly looked into
opensubdiv source directory to grab the header files. This is somewhat
convenient during development but they can mistakenly access private
header files.

With this change, when OPENSUBDIV_INCLUDE_DIR is given to cmake,
it will be used as an include search path to build examples etc.
Otherwise it follows the same behavior as before.

Also replaces include references to the files in regression dir
to be relative, and cleanups some copy-paste patterns.
2015-05-28 17:32:33 -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
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
barfowl
6d5b29c2dc Replacing use of old Far::TopologyRefiner methods with Far::TopologyLevel 2015-05-21 19:52:25 -07:00
Takahito Tejima
6a0b43ab2f dxViwer/dxPtexViewer enable back-face culling
since we fixed gregory patch rotation/orientation issues.
2015-05-20 18:28:11 -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
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
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
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
984aedf842 Changed default draw modes for dxViewer
This restores the previous defaults and works around an
apparent runtime error on some platforms which is triggered
in the legacy gregory patch drawing code when patch culling
is disabled.
2015-05-14 12:48:36 -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
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
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