Commit Graph

572 Commits

Author SHA1 Message Date
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
Takahito Tejima
ccb583eba0 Merge pull request #559 from davidgyu/shadingRefactor
Re-organized patch tessellation shader code
2015-05-30 09:42:29 -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
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
Jeremy Cowles
261dc17f1b OpenGL init without errors, example cleanup
The GLFW context version hint is a minimum version, not maximum version so
requesting 4.4 and then falling back to lower versions doesn't make sense.

This change sets the minimum version to 3.2 and attempts to standardize this
across all example apps.

Also print the maximum supported GL version along with the context version
at startup.
2015-05-29 22:37:12 -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
jcowles
214f86a7c0 Fix GLEW for Core profile, minor cleanup
We will need to find a solution for Ignacio's older setup, but this at least
fixes the other fallout.

 * Use glewIsSupported instead of glewGetExtension
 * Convert tabs to spaces
 * Remove GLEW static caching (they only get called once)
2015-05-29 15:56:36 -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
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
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
9cfdb6c5c1 Mac build and shader compiler error fix. 2015-05-28 10:27:23 -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
David G Yu
de286e07a6 Fixed allocation of texture buffers resources 2015-05-27 15:23:26 -07:00
David G Yu
cdf95e0477 Added a missing ';' for glViewer w/o GLEW 2015-05-26 17:48:14 -07:00
Takahito Tejima
1debcf15ff glEvalLimit: Fix an assertion failure when rand() takes RAND_MAX 2015-05-26 16:05:54 -07:00
David G Yu
96983b1a44 Merge pull request #530 from takahito-tejima/dev
Fix warning in glUtils.cpp
2015-05-26 18:56:47 -04:00
Takahito Tejima
a7abdafe2f Merge pull request #529 from davidgyu/winbuildfix
Added TBB dependencies for glEvalLimit
2015-05-26 15:33:43 -07:00
Takahito Tejima
b1ef25f026 Fix warning in glUtil.cpp 2015-05-26 15:33:05 -07:00
David G. Yu
20343f9b30 Added TBB dependencies for glEvalLimit 2015-05-26 14:45:42 -07:00
Takahito Tejima
22b5d65e46 reverting glewGetExtension with glewIsSupported until we find a better workaround. 2015-05-26 14:41:05 -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
48ee9bcaa6 glEvalLimit: Fix leaking toplogyRefiner 2015-05-26 11:22:17 -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
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
79eb6d5aeb Merge branch 'dev' into 358 2015-05-23 00:30:03 -03:00
Ignacio Lillo
0a6a47159e Merge branch 'upstream-dev' into dev 2015-05-23 00:29:39 -03:00
Ignacio Lillo
37ccad54a3 Refs #358. Refactored functions to comply with code conventions.
Also deleted bool uses_tesselation_shaders() since it was a duplicate of
bool SupportsAdaptiveTessellation().
2015-05-23 00:28:37 -03: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
403268f2aa Merge pull request #517 from jcowles/dev-fix-glsl
Fix sharpness GLSL error for OSX
2015-05-22 08:58:15 -07:00
Jeremy Cowles
9759012dec Fix sharpness GLSL error on OSX 2015-05-22 00:43:41 -07:00
jcowles
b479851502 Fix MayaPolySmooth example
Fixing some minor fallout after merging #514.
2015-05-22 00:37:25 -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
54fbbc4538 Removed last remaining occurrences of obsolete methods. 2015-05-21 21:38:10 -07:00
barfowl
5dbc1aee0d Fixed issue with exampls/farViewer 2015-05-21 20:42:29 -07:00
barfowl
fd89a1323e Fixed issue with examples/glFVarViewer 2015-05-21 20:33:02 -07:00
barfowl
6d5b29c2dc Replacing use of old Far::TopologyRefiner methods with Far::TopologyLevel 2015-05-21 19:52:25 -07:00
Ignacio Lillo
ed2e48f651 Merge branch 'upstream-dev' into dev
Conflicts:
	examples/common/d3d11Utils.h
	examples/common/glUtils.cpp
	examples/glViewer/glViewer.cpp
2015-05-21 22:47:36 -03: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
b5af25e413 Add high-valence shapes into glViewer (currently crashes) 2015-05-21 09:41:50 -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
6a0b43ab2f dxViwer/dxPtexViewer enable back-face culling
since we fixed gregory patch rotation/orientation issues.
2015-05-20 18:28:11 -07:00
barfowl
40832a0f0d Amendment to previous commit deprecating PatchTables::Evaluate methods:
- replaced Evaluate() with EvaluateBasis() in far/tutorial_6
    - commented out use of EvaluateFaceVarying() in examples/farViewer
        - face-varying patches are work in progress
2015-05-20 16:40:32 -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
David G. Yu
7ccf7c3320 Fixed build errors for dxPtexViewer w/ TBB 2015-05-20 13:31:20 -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
David G Yu
e42885a4cc Merge pull request #495 from c64kernal/dev_farviewerfix
Fixed crash in farViewer when not using Adaptive.
2015-05-19 21:57:20 -07:00
George ElKoura
a586fe1715 Fixed crash in farViewer when not using Adaptive.
Fixed a simple crash in farViewer when not using adaptive.
Also snuck in a small code clean up.
2015-05-19 20:19:54 -07:00
George ElKoura
5d89260d5b Merge branch 'dev' of https://github.com/PixarAnimationStudios/OpenSubdiv into dev_farviewer 2015-05-19 19:23:43 -07:00
George ElKoura
b781c6efd3 Removed Hbr code from farViewer.
The code in farViewer that was used to draw the Hbr representation
of meshes is now gone.  This code was mostly used as a way to compare
against the Vtr implementation.  However, we don't want this to serve
as an example for others as the Hbr code is not meant to be instructive
otherwise.
2015-05-19 19:17:50 -07:00
David G Yu
34aac7d0e6 Fixed wireframe drawing for the farViewer 2015-05-19 15:48:25 -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
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
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
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
Ignacio Lillo
a305f31a30 Merge branch 'upstream-dev' into dev
Conflicts:
	examples/glViewer/glViewer.cpp
2015-05-13 23:15:06 -03:00
Ignacio Lillo
56f1b5c765 Merge branch 'dev' of github.com:ielillo/OpenSubdiv into dev 2015-05-13 22:46:16 -03: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
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
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
Ignacio Lillo
7882ea99ee Refs #358. Extracted helper functions into gl_common.cpp.
Also fixed some shader linker errors due to a bad
version definition.
2015-05-02 23:54:26 -03: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
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
David G. Yu
421e60f8c5 A couple more DX / OpenCL changes for AMD 2015-04-30 10:01:01 -07:00
Ignacio Lillo
2239450e08 Refs #358. Refactored setGlCoreProfile .
Now it accepts the major and minor opengl version.
Refactored the windows creation flow to try different
opengl profiles before failing.
2015-04-29 23:31:34 -04: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
Ignacio Lillo
44f965b439 Merge branch 'dev_upstream' into dev 2015-04-28 23:09:33 -04:00
Ignacio Lillo
ee5fe0d3a2 Merge branch 'dev' of github.com:ielillo/OpenSubdiv into dev 2015-04-28 22:49:51 -04:00
Jeremy Cowles
917bfa0c85 Merge pull request #451 from takahito-tejima/travis
Travis CI configuration
2015-04-28 16:55:32 -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
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
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
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
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
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
David Yu
d3a554c5de Fixed glViewer shader code for OS X GL runtime. 2015-04-18 15:24:24 -07:00
David G Yu
50ee424b1c Updated vtrViewer to match recent API changes. 2015-04-18 14:59:16 -07:00
George ElKoura
6ac11ae63b Fixed a bug in the display of the dxViewer cursor
Make sure to initialize the cursor of the window class in dxViewer as required.
2015-04-18 00:45:02 -07:00
David G. Yu
acedb6c710 Fixed windows build regressions. 2015-04-17 18:28:38 -07:00
Takahito Tejima
c58e63c8d5 Refactor single crease patch to be in unfined shader. 2015-04-17 16:26:57 -07:00
Takahito Tejima
aec1f61fb0 Merge pull request #422 from davidgyu/patch-drawing
Unified adaptive patch drawing
2015-04-17 15:39:37 -07:00
David G Yu
010a31efc4 Checkpoint changes to unify adaptive patch drawing. 2015-04-17 07:42:53 -07:00