Commit Graph

31 Commits

Author SHA1 Message Date
David G Yu
ff34c514f5 Improved patch basis eval for Osd to match Far
This updates the patch basis evaluation functions in Osd
to match recent changes to far/patchBasis.

This also exposes a common facility for dealing with PatchCoord,
PatchArray, and PatchParam. These are exposed as global functions
operating on struct data, since C++ style class methods are not
supported by all of the Osd shader and kernel execution envirionments.

Changes:
    - Merged far/patchBasis.cpp to osd/patchBasisCommon{,Types,Eval}.h
    - Exposed PatchCoord, PatchArray, and PatchParam to Osd kernels
    - exposed OsdEvaluatePatchBasis and OsdEvaluatePatchBasisNormalized
    - Updated CPU, TBB, Omp, CUDA, OpenCL, GLSL, HLSL, and Metal evaluators
    - Updated glFVarViewer
2018-11-15 17:11:50 -08:00
barry
d6572ab226 Updated Osd evaluators to deal with changes to PatchParam boundary:
- updated evaluators to extract the extended 5-bit mask from PatchParam
2018-09-27 20:13:01 -07:00
David G Yu
fe38ad8cda Added missing Osd Evaluator methods for deriv eval
Now that Far::LimitStencilTable and Far::PatchTable
support evaluation of 1st and 2nd derivatives the
Osd Evaluator API for evaluating stencils and patches
has been updated to match.
2017-01-27 17:14:18 -08:00
David G. Yu
236afb2c06 Osd Varying and FaceVarying Patch Evaluation
Implemented EvalPatchesVarying and EvalPatchesFaceVarying
methods for Osd::*Evaluator classes, i.e. cpu, omp, tbb,
GLXFB, GLSLCompute, OpenCL, and CUDA.

Also, the GPU Kernel implementations have been updated to use
the common patchBasis implementation instead of re-implementing
methods to compute patch basis weights locally.
2016-09-29 09:56:15 -07:00
David G. Yu
3e3695652f iso-646 fix for CUDA / CL / TBB 2016-06-25 14:23:55 -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
749bbf4271 Fix OpenCL and CUDA EvalPatches kernels. 2015-05-26 11:13:30 -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
jcowles
7b4aa33a1f Change stencils sizes from unsigned char to int. 2015-05-19 10:16:56 -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
manuelk
e538261f7d Fix Cuda compile warning in osd/cudaKernel.cu 2014-09-12 10:43:18 -07:00
Julien Demouth
29b2d033e3 Introduces a kernel for NUM_ELEMENTS=4. It's faster and not buggy,
anymore.
2014-09-12 10:22:30 -07:00
Julien Demouth
cf0fe60ab4 Add a first pass of optimization in CUDA kernels
Conflicts:
	opensubdiv/osd/cudaKernel.cu
2014-09-12 10:21:46 -07:00
manuelk
c399655dcc Landing 3.0.0.alpha
Sync'ing the 'dev' branch with the 'feature_3.0dev' branch at commit 68c6d11fc36761ae1a5e6cdc3457be16f2e9704a

The branch 'feature_3.0dev' is now locked and preserved for historical purposes.
2014-09-05 15:07:46 -07:00
Manuel Kraemer
df719eb9ed Revert "added memcpyasync and streams to cuda backend"
This reverts commit 84212cd725.
2014-08-02 12:40:08 -07:00
Frost
84212cd725 added memcpyasync and streams to cuda backend 2014-07-24 10:18:09 -04:00
Sergey Sharybin
1ebf2449dd Fix mismatch in declaration and usage of OsdCudaComputeRestrictedVertexA
Unused argument `pass` was defined in the CUDA kernel and it was never
passed to this function from the C++ code. This argument is also wasn't
used by the function itself.
2014-07-03 16:54:15 +06:00
Nathan Litke
b7a763853c Added the CATMARK_RESTRICTED_VERT_VERTEX_A, CATMARK_RESTRICTED_VERT_VERTEX_B1, and CATMARK_RESTRICTED_VERT_VERTEX_B2 kernels which compute vertices resulting from the refinement of a smooth or (fully) sharp vertex.
* CATMARK_RESTRICTED_VERT_VERTEX_A handles k_Crease and k_Corner rules
* CATMARK_RESTRICTED_VERT_VERTEX_B1 handles regular k_Smooth and k_Dart rules
* CATMARK_RESTRICTED_VERT_VERTEX_B2 handles irregular k_Smooth and k_Dart rules
2014-06-23 15:59:43 -07:00
Nathan Litke
634187f6c5 Fixed a bug in the CUDA kernel. 2014-06-23 14:49:10 -07:00
Nathan Litke
0af14f8ac6 Added the CATMARK_RESTRICTED_EDGE_VERTEX kernel which computes vertices resulting from the refinement of a smooth or (fully) sharp edge. 2014-05-30 17:44:25 -07:00
Nathan Litke
b769f4f60d Implemented CATMARK_QUAD_FACE_VERTEX and CATMARK_TRI_QUAD_FACE_VERTEX kernels for CUDA, GLSL Transform Feedback, and GLSL Compute platforms. 2014-05-28 17:21:37 -07:00
Takahito Tejima
ee061291b7 Interleaved buffer support in OsdCompute. Removed OsdVertexDescriptor and replaced with OsdVertexBufferDescriptor.
All kernels take offset/length/stride to apply subdivision partially in each vertex elements.

Also the offset can be used for client-based VBO aggregation, without modifying index buffers.
This is useful for topology sharing, in conjunction with glDrawElementsBaseVertex etc.
However, gregory patch shader fetches vertex buffer via texture buffer, which index should also
be offsetted too. Although gl_BaseVertexARB extension should be able to do that job, it's a
relatively new extension. So we use OsdBaseVertex() call to mitigate the compatibility
issue as clients can provide it in their way at least for the time being.
2014-05-09 15:44:52 -07:00
manuelk
3ae50d1c50 Amending Apache license language & file headers.
New text:

     Copyright 2013 Pixar

     Licensed under the Apache License, Version 2.0 (the "Apache License")
     with the following modification; you may not use this file except in
     compliance with the Apache License and the following modification to it:
     Section 6. Trademarks. is deleted and replaced with:

     6. Trademarks. This License does not grant permission to use the trade
        names, trademarks, service marks, or product names of the Licensor
        and its affiliates, except as required to comply with Section 4(c) of
        the License and to reproduce the content of the NOTICE file.

     You may obtain a copy of the Apache License at

         http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the Apache License with the above modification is
     distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     KIND, either express or implied. See the Apache License for the specific
     language governing permissions and limitations under the Apache License.
2013-09-26 12:04:57 -07:00
Takahito Tejima
51a45b598d Updating EULA 2013-07-18 14:19:50 -07:00
Takahito Tejima
11b644a06e Fix a indexing bug in hierarchical edit kernel of Cuda, GLSLcompute and GLSLTransformFeedback
Closes #183
2013-06-26 16:10:26 -07:00
Takahito Tejima
8efecb0fca Batching stuffs: generalized kernel batches, table/dispatcher refactoring, multiMeshFactory, drawContext, etc.
2 client APIs are changed.
- VertexBuffer::UpdateData() takes start vertex offset
- ComputeController::Refine() takes FarKernelBatchVector

Also, ComputeContext no longer holds farmesh.
Client can free farmesh after OsdComputeContext is created.
(but still need FarKernelBatchVector to apply subdivision kernels)
2013-03-07 17:50:15 -08:00
manuelk
a1552cfe82 Siggrpah 2012 - rolling over all of prepro work into beta 1.1 2012-08-03 19:51:27 -07:00
Takahito Tejima
6cae48665d add bilinear computation for cuda kernel (not yet for CL, GLSL kernels) 2012-06-11 18:09:23 -07:00
Manuel Kraemer
fe5e1fd9a1 including the correct version file so namespaces work 2012-06-11 17:02:27 -07:00
Manuel Kraemer
fb709d9fa6 adding CUDA kernels 2012-06-09 14:22:57 -07:00