Commit Graph

1475 Commits

Author SHA1 Message Date
David G Yu
4500f9a679 Merge pull request #487 from takahito-tejima/examples2
remove SupportsAdaptiveTessellation from OsdDrawContext (and example cleanups)
2015-05-19 10:57:57 -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
Takahito Tejima
de358d7f82 Merge pull request #486 from jcowles/dev-size
Change stencils sizes from unsigned char to int.
2015-05-19 10:29:57 -07:00
jcowles
7b4aa33a1f Change stencils sizes from unsigned char to int. 2015-05-19 10:16:56 -07:00
Jeremy Cowles
d28a5c01c9 Merge pull request #485 from c64kernal/dev_vtrviewer
Renamed vtrViewer to farViewer.
2015-05-19 09:17:07 -07:00
George ElKoura
a79dbcc074 Renamed vtrViewer to farViewer.
The name change is motivated by the desire to reflect that Vtr is
private API and its functionality is exposed publically through Far.
2015-05-18 19:46:22 -07:00
Takahito Tejima
05bbc3bb27 Merge pull request #483 from davidgyu/interpolate
Removed Interpolate{Boundary,Corner}Patch from Far
2015-05-18 18:06:12 -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
David G Yu
4ac2fb9909 Merge pull request #482 from barfowl/test
Refactored Far computation of Gregory patch basis functions:
2015-05-16 13:29:50 -07:00
David G Yu
3d7bf8a2a6 Merge pull request #480 from takahito-tejima/refactor
update glShareTopology example.
2015-05-16 13:24:50 -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
David G Yu
e378927035 Merge pull request #481 from barfowl/test
Removed more usage of alloca() dependent on maximum valence:
2015-05-15 18:02:23 -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
Takahito Tejima
948895369d update glShareTopology example.
This examples is rewritten as a more comprehensive example
of Far and Osd APIs to generate batched index buffer and
vertex buffer, as well as sharing same topology and stencil
table among multiple objects.

Also this change includes an experimental code path of using
glMultiDrawElementsIndirect. It's currently incomplete due to
the missing interface of osd tessellation shader.
2015-05-15 16:26:17 -07:00
Takahito Tejima
ffc7678e1c Merge pull request #479 from davidgyu/evalfix1
Fixed example code use of single crease patches
2015-05-15 15:45:04 -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
Takahito Tejima
c11041f93d Merge pull request #477 from davidgyu/winbuildfix
Fixed an alloca buffer overrun error in Far
2015-05-14 18:24:41 -07:00
David G. Yu
b0dd44dd47 Fixed an alloca buffer overrun error in Far 2015-05-14 13:25:33 -07:00
Takahito Tejima
2fdd410b4b Merge pull request #475 from davidgyu/winbuildfix
Changed default draw modes for dxViewer
2015-05-14 13:21:08 -07:00
Takahito Tejima
0bf78b5431 Merge pull request #476 from davidgyu/macbuildfix
Removed an unused local var from interpolate.cpp
2015-05-14 13:20:50 -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
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
David G Yu
c5b7224b77 Merge pull request #474 from takahito-tejima/refactor2
Osd drawing API refactoring.
2015-05-14 10:05:35 -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
Takahito Tejima
a0e3b59ae5 Merge pull request #471 from davidgyu/evalfix1
Removed BOUNDARY and CORNER patch types
2015-05-13 13:12:11 -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
d77d627180 Merge pull request #470 from davidgyu/evalfix1
Fixed evaluation of boundary and corner patches
2015-05-13 09:18:25 -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
Takahito Tejima
4f372fa695 Merge pull request #469 from davidgyu/macbuildfix
Added stronger guards for OSD_MAX_VALENCE
2015-05-12 11:42:47 -07:00
David G Yu
1c91945d10 Added stronger guards for OSD_MAX_VALENCE 2015-05-12 11:15:51 -07:00
David G Yu
7c28326d1a Merge pull request #468 from takahito-tejima/refactor
Refactor Osd::DrawContext
2015-05-12 10:30:27 -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
David G Yu
0a43750fc1 Merge pull request #467 from takahito-tejima/refactor
cleanup remaining ptex specific code in osd layer
2015-05-11 14:31:00 -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
David G Yu
41df98c9cc Merge pull request #466 from takahito-tejima/refactor
Refurbish osd layer API.
2015-05-11 10:18:20 -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
David G Yu
2aead56868 Merge pull request #465 from takahito-tejima/refactor
osd refactor: split the vertex buffer argument into src and dst
2015-05-08 10:30:27 -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
David G Yu
70ea3124ee Merge pull request #464 from takahito-tejima/refactor
Remove osd/vertex.h, osd/*ptex* classes
2015-05-07 14:23:01 -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
Takahito Tejima
2159f2c7c3 Merge pull request #463 from davidgyu/shadercleanup1
Updated handling of patchParam and patchCoord
2015-05-07 11:48:51 -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
Takahito Tejima
a04af8958f Merge pull request #460 from c64kernal/dev_clewfix
Fixed build breakage for CLEW.
2015-04-30 21:37:04 -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