Commit Graph

1448 Commits

Author SHA1 Message Date
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
George ElKoura
46569132cf Fixed build breakage for CLEW. 2015-04-30 18:28:48 -07:00
David G Yu
f95099a808 Merge pull request #459 from takahito-tejima/dev
glImaging: Fix out-of-bound access when creating varying buffer.
2015-04-30 15:04:28 -07:00
David G Yu
4a602a18fb Merge pull request #457 from takahito-tejima/refactor
remove libpng dependency and use stb_image_write instead
2015-04-30 14:06:10 -07:00
David G Yu
5087e37592 Merge pull request #458 from takahito-tejima/examples
update example glShareTopology to use gregory basis patch.
2015-04-30 14:04:31 -07:00
takahito-tejima
3761570714 glPtexViewer: remove -lz option from mac build 2015-04-30 13:17:04 -07:00
Takahito Tejima
b77aaf499e glImaging: Fix out-of-bound access when creating varying buffer. 2015-04-30 12:44:11 -07:00
Takahito Tejima
cb9a93b598 update example glShareTopology to use gregory basis patch. 2015-04-30 11:05:23 -07:00
Takahito Tejima
b3da5d3fab remove libpng and use stb_image_write instead 2015-04-30 11:04:16 -07:00
Takahito Tejima
b0188bf217 Merge pull request #456 from davidgyu/dxfix
A couple more DX / OpenCL changes for AMD
2015-04-30 11:02:49 -07:00
David G Yu
c2e2651b80 Merge pull request #455 from takahito-tejima/bugfix
Fix glPtexViewer backfacing bug: initialize handedness flag in Shape
2015-04-30 10:02:40 -07:00
David G. Yu
421e60f8c5 A couple more DX / OpenCL changes for AMD 2015-04-30 10:01:01 -07:00
Takahito Tejima
ac41c3d5ba Fix glPtexViewer backfacing bug: initialize handedness flag in Shape 2015-04-30 09:05:51 -07:00
David G Yu
0d0f6210ac Merge pull request #454 from takahito-tejima/dev
Fix DX-OpenCL/CUDA interop.
2015-04-29 23:11:16 -07:00
Takahito Tejima
9316852e69 use OPENSUBDIV_HAS_DX11SDK
replace OPENSUBDIV_HAS_DX of the previous change with
OPENSUBDIV_HAS_DX11SDK since we already have that.
2015-04-29 17:06:42 -07:00
takahito-tejima
04009e8a80 fix mac build. 2015-04-29 14:14:41 -07:00
Takahito Tejima
bfe0be5226 CMakeLists: remove unnecessary lines 2015-04-29 14:00:52 -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
George ElKoura
766ed5b316 Merge pull request #453 from takahito-tejima/travis
Add some comments into .travis.yml
2015-04-28 18:40:26 -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
8233e9d258 Add some comments into .travis.yml
(also triggerring the first test build)
2015-04-28 17:31:04 -07:00
Jeremy Cowles
917bfa0c85 Merge pull request #451 from takahito-tejima/travis
Travis CI configuration
2015-04-28 16:55:32 -07:00
David G Yu
5d7147c358 Merge pull request #452 from takahito-tejima/dev
cleanup CL/CUDA example harnesses.
2015-04-28 16:18:17 -07:00
Takahito Tejima
dc137283dd removing unnecessary cuda includes from examples. 2015-04-28 16:13:48 -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
2a543ee9a8 Travis CI configuration
add NO_GLTESTS option to cmake.
2015-04-28 14:44:07 -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
6b884ec1ae Merge pull request #447 from takahito-tejima/refactor
Simplify Osd::MeshInterface.
2015-04-27 13:22:17 -07:00