1 /* SPDX-FileCopyrightText: 2015 Pixar
3 * SPDX-License-Identifier: Apache-2.0 */
5 #ifndef OPENSUBDIV_GL_COMPUTE_EVALUATOR_H_
6 #define OPENSUBDIV_GL_COMPUTE_EVALUATOR_H_
8 #include <opensubdiv/osd/bufferDescriptor.h>
9 #include <opensubdiv/osd/opengl.h>
10 #include <opensubdiv/osd/types.h>
11 #include <opensubdiv/version.h>
13 namespace OpenSubdiv::OPENSUBDIV_VERSION::Far
{
14 class LimitStencilTable
;
16 } // namespace OpenSubdiv::OPENSUBDIV_VERSION::Far
17 // namespace OPENSUBDIV_VERSION
19 namespace blender::opensubdiv
{
21 /// \brief GL stencil table (Shader Storage buffer)
23 /// This class is a GLSL SSBO representation of OpenSubdiv::Far::StencilTable.
25 /// GLSLComputeKernel consumes this table to apply stencils
27 class GLStencilTableSSBO
{
29 static GLStencilTableSSBO
*Create(OpenSubdiv::Far::StencilTable
const *stencilTable
,
30 void *deviceContext
= nullptr)
32 (void)deviceContext
; // unused
33 return new GLStencilTableSSBO(stencilTable
);
35 static GLStencilTableSSBO
*Create(OpenSubdiv::Far::LimitStencilTable
const *limitStencilTable
,
36 void *deviceContext
= nullptr)
38 (void)deviceContext
; // unused
39 return new GLStencilTableSSBO(limitStencilTable
);
42 explicit GLStencilTableSSBO(OpenSubdiv::Far::StencilTable
const *stencilTable
);
43 explicit GLStencilTableSSBO(OpenSubdiv::Far::LimitStencilTable
const *limitStencilTable
);
44 ~GLStencilTableSSBO();
46 // interfaces needed for GLSLComputeKernel
47 GLuint
GetSizesBuffer() const
51 GLuint
GetOffsetsBuffer() const
55 GLuint
GetIndicesBuffer() const
59 GLuint
GetWeightsBuffer() const
63 GLuint
GetDuWeightsBuffer() const
67 GLuint
GetDvWeightsBuffer() const
71 GLuint
GetDuuWeightsBuffer() const
75 GLuint
GetDuvWeightsBuffer() const
79 GLuint
GetDvvWeightsBuffer() const
83 int GetNumStencils() const
101 // ---------------------------------------------------------------------------
103 class GLComputeEvaluator
{
105 using Instantiatable
= bool;
106 static GLComputeEvaluator
*Create(OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
107 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
108 OpenSubdiv::Osd::BufferDescriptor
const &duDesc
,
109 OpenSubdiv::Osd::BufferDescriptor
const &dvDesc
,
110 void *deviceContext
= nullptr)
112 return Create(srcDesc
,
116 OpenSubdiv::Osd::BufferDescriptor(),
117 OpenSubdiv::Osd::BufferDescriptor(),
118 OpenSubdiv::Osd::BufferDescriptor(),
122 static GLComputeEvaluator
*Create(OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
123 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
124 OpenSubdiv::Osd::BufferDescriptor
const &duDesc
,
125 OpenSubdiv::Osd::BufferDescriptor
const &dvDesc
,
126 OpenSubdiv::Osd::BufferDescriptor
const &duuDesc
,
127 OpenSubdiv::Osd::BufferDescriptor
const &duvDesc
,
128 OpenSubdiv::Osd::BufferDescriptor
const &dvvDesc
,
129 void *deviceContext
= nullptr)
131 (void)deviceContext
; // not used
132 GLComputeEvaluator
*instance
= new GLComputeEvaluator();
133 if (instance
->Compile(srcDesc
, dstDesc
, duDesc
, dvDesc
, duuDesc
, duvDesc
, dvvDesc
)) {
141 GLComputeEvaluator();
143 /// Destructor. note that the GL context must be made current.
144 ~GLComputeEvaluator();
146 /// ----------------------------------------------------------------------
148 /// Stencil evaluations with StencilTable
150 /// ----------------------------------------------------------------------
152 /// \brief Generic static stencil function. This function has a same
153 /// signature as other device kernels have so that it can be called
154 /// transparently from OsdMesh template interface.
156 /// @param srcBuffer Input primvar buffer.
157 /// must have BindVBO() method returning a GL
158 /// buffer object of source data
160 /// @param srcDesc vertex buffer descriptor for the input buffer
162 /// @param dstBuffer Output primvar buffer
163 /// must have BindVBO() method returning a GL
164 /// buffer object of destination data
166 /// @param dstDesc vertex buffer descriptor for the output buffer
168 /// @param stencilTable stencil table to be applied. The table must have
171 /// @param instance cached compiled instance. Clients are supposed to
172 /// pre-compile an instance of this class and provide
173 /// to this function. If it's null the kernel still
174 /// compute by instantiating on-demand kernel although
175 /// it may cause a performance problem.
177 /// @param deviceContext not used in the GLSL kernel
179 template<typename SRC_BUFFER
, typename DST_BUFFER
, typename STENCIL_TABLE
>
180 static bool EvalStencils(SRC_BUFFER
*srcBuffer
,
181 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
182 DST_BUFFER
*dstBuffer
,
183 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
184 STENCIL_TABLE
const *stencilTable
,
185 GLComputeEvaluator
const *instance
,
186 void *deviceContext
= nullptr)
190 return instance
->EvalStencils(srcBuffer
, srcDesc
, dstBuffer
, dstDesc
, stencilTable
);
193 // Create an instance on demand (slow)
194 (void)deviceContext
; // unused
195 instance
= Create(srcDesc
,
197 OpenSubdiv::Osd::BufferDescriptor(),
198 OpenSubdiv::Osd::BufferDescriptor());
200 bool r
= instance
->EvalStencils(srcBuffer
, srcDesc
, dstBuffer
, dstDesc
, stencilTable
);
207 /// \brief Generic static stencil function. This function has a same
208 /// signature as other device kernels have so that it can be called
209 /// transparently from OsdMesh template interface.
211 /// @param srcBuffer Input primvar buffer.
212 /// must have BindVBO() method returning a GL
213 /// buffer object of source data
215 /// @param srcDesc vertex buffer descriptor for the input buffer
217 /// @param dstBuffer Output primvar buffer
218 /// must have BindVBO() method returning a GL
219 /// buffer object of destination data
221 /// @param dstDesc vertex buffer descriptor for the dstBuffer
223 /// @param duBuffer Output buffer derivative wrt u
224 /// must have BindVBO() method returning a GL
225 /// buffer object of destination data
227 /// @param duDesc vertex buffer descriptor for the duBuffer
229 /// @param dvBuffer Output buffer derivative wrt v
230 /// must have BindVBO() method returning a GL
231 /// buffer object of destination data
233 /// @param dvDesc vertex buffer descriptor for the dvBuffer
235 /// @param stencilTable stencil table to be applied. The table must have
238 /// @param instance cached compiled instance. Clients are supposed to
239 /// pre-compile an instance of this class and provide
240 /// to this function. If it's null the kernel still
241 /// compute by instantiating on-demand kernel although
242 /// it may cause a performance problem.
244 /// @param deviceContext not used in the GLSL kernel
246 template<typename SRC_BUFFER
, typename DST_BUFFER
, typename STENCIL_TABLE
>
247 static bool EvalStencils(SRC_BUFFER
*srcBuffer
,
248 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
249 DST_BUFFER
*dstBuffer
,
250 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
251 DST_BUFFER
*duBuffer
,
252 OpenSubdiv::Osd::BufferDescriptor
const &duDesc
,
253 DST_BUFFER
*dvBuffer
,
254 OpenSubdiv::Osd::BufferDescriptor
const &dvDesc
,
255 STENCIL_TABLE
const *stencilTable
,
256 GLComputeEvaluator
const *instance
,
257 void *deviceContext
= nullptr)
261 return instance
->EvalStencils(srcBuffer
,
272 // Create an instance on demand (slow)
273 (void)deviceContext
; // unused
274 instance
= Create(srcDesc
, dstDesc
, duDesc
, dvDesc
);
276 bool r
= instance
->EvalStencils(srcBuffer
,
291 /// \brief Generic static stencil function. This function has a same
292 /// signature as other device kernels have so that it can be called
293 /// transparently from OsdMesh template interface.
295 /// @param srcBuffer Input primvar buffer.
296 /// must have BindVBO() method returning a GL
297 /// buffer object of source data
299 /// @param srcDesc vertex buffer descriptor for the input buffer
301 /// @param dstBuffer Output primvar buffer
302 /// must have BindVBO() method returning a GL
303 /// buffer object of destination data
305 /// @param dstDesc vertex buffer descriptor for the dstBuffer
307 /// @param duBuffer Output buffer derivative wrt u
308 /// must have BindVBO() method returning a GL
309 /// buffer object of destination data
311 /// @param duDesc vertex buffer descriptor for the duBuffer
313 /// @param dvBuffer Output buffer derivative wrt v
314 /// must have BindVBO() method returning a GL
315 /// buffer object of destination data
317 /// @param dvDesc vertex buffer descriptor for the dvBuffer
319 /// @param duuBuffer Output buffer 2nd derivative wrt u
320 /// must have BindVBO() method returning a GL
321 /// buffer object of destination data
323 /// @param duuDesc vertex buffer descriptor for the duuBuffer
325 /// @param duvBuffer Output buffer 2nd derivative wrt u and v
326 /// must have BindVBO() method returning a GL
327 /// buffer object of destination data
329 /// @param duvDesc vertex buffer descriptor for the duvBuffer
331 /// @param dvvBuffer Output buffer 2nd derivative wrt v
332 /// must have BindVBO() method returning a GL
333 /// buffer object of destination data
335 /// @param dvvDesc vertex buffer descriptor for the dvvBuffer
337 /// @param stencilTable stencil table to be applied. The table must have
340 /// @param instance cached compiled instance. Clients are supposed to
341 /// pre-compile an instance of this class and provide
342 /// to this function. If it's null the kernel still
343 /// compute by instantiating on-demand kernel although
344 /// it may cause a performance problem.
346 /// @param deviceContext not used in the GLSL kernel
348 template<typename SRC_BUFFER
, typename DST_BUFFER
, typename STENCIL_TABLE
>
349 static bool EvalStencils(SRC_BUFFER
*srcBuffer
,
350 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
351 DST_BUFFER
*dstBuffer
,
352 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
353 DST_BUFFER
*duBuffer
,
354 OpenSubdiv::Osd::BufferDescriptor
const &duDesc
,
355 DST_BUFFER
*dvBuffer
,
356 OpenSubdiv::Osd::BufferDescriptor
const &dvDesc
,
357 DST_BUFFER
*duuBuffer
,
358 OpenSubdiv::Osd::BufferDescriptor
const &duuDesc
,
359 DST_BUFFER
*duvBuffer
,
360 OpenSubdiv::Osd::BufferDescriptor
const &duvDesc
,
361 DST_BUFFER
*dvvBuffer
,
362 OpenSubdiv::Osd::BufferDescriptor
const &dvvDesc
,
363 STENCIL_TABLE
const *stencilTable
,
364 GLComputeEvaluator
const *instance
,
365 void *deviceContext
= nullptr)
369 return instance
->EvalStencils(srcBuffer
,
386 // Create an instance on demand (slow)
387 (void)deviceContext
; // unused
388 instance
= Create(srcDesc
, dstDesc
, duDesc
, dvDesc
, duuDesc
, duvDesc
, dvvDesc
);
390 bool r
= instance
->EvalStencils(srcBuffer
,
411 /// \brief Generic stencil function.
413 /// @param srcBuffer Input primvar buffer.
414 /// must have BindVBO() method returning a GL
415 /// buffer object of source data
417 /// @param srcDesc vertex buffer descriptor for the input buffer
419 /// @param dstBuffer Output primvar buffer
420 /// must have BindVBO() method returning a GL
421 /// buffer object of destination data
423 /// @param dstDesc vertex buffer descriptor for the output buffer
425 /// @param stencilTable stencil table to be applied. The table must have
428 template<typename SRC_BUFFER
, typename DST_BUFFER
, typename STENCIL_TABLE
>
429 bool EvalStencils(SRC_BUFFER
*srcBuffer
,
430 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
431 DST_BUFFER
*dstBuffer
,
432 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
433 STENCIL_TABLE
const *stencilTable
) const
435 return EvalStencils(srcBuffer
->BindVBO(),
437 dstBuffer
->BindVBO(),
440 OpenSubdiv::Osd::BufferDescriptor(),
442 OpenSubdiv::Osd::BufferDescriptor(),
443 stencilTable
->GetSizesBuffer(),
444 stencilTable
->GetOffsetsBuffer(),
445 stencilTable
->GetIndicesBuffer(),
446 stencilTable
->GetWeightsBuffer(),
450 /* end = */ stencilTable
->GetNumStencils());
453 /// \brief Generic stencil function.
455 /// @param srcBuffer Input primvar buffer.
456 /// must have BindVBO() method returning a GL
457 /// buffer object of source data
459 /// @param srcDesc vertex buffer descriptor for the input buffer
461 /// @param dstBuffer Output primvar buffer
462 /// must have BindVBO() method returning a GL
463 /// buffer object of destination data
465 /// @param dstDesc vertex buffer descriptor for the dstBuffer
467 /// @param duBuffer Output buffer derivative wrt u
468 /// must have BindVBO() method returning a GL
469 /// buffer object of destination data
471 /// @param duDesc vertex buffer descriptor for the duBuffer
473 /// @param dvBuffer Output buffer derivative wrt v
474 /// must have BindVBO() method returning a GL
475 /// buffer object of destination data
477 /// @param dvDesc vertex buffer descriptor for the dvBuffer
479 /// @param stencilTable stencil table to be applied. The table must have
482 template<typename SRC_BUFFER
, typename DST_BUFFER
, typename STENCIL_TABLE
>
483 bool EvalStencils(SRC_BUFFER
*srcBuffer
,
484 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
485 DST_BUFFER
*dstBuffer
,
486 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
487 DST_BUFFER
*duBuffer
,
488 OpenSubdiv::Osd::BufferDescriptor
const &duDesc
,
489 DST_BUFFER
*dvBuffer
,
490 OpenSubdiv::Osd::BufferDescriptor
const &dvDesc
,
491 STENCIL_TABLE
const *stencilTable
) const
493 return EvalStencils(srcBuffer
->BindVBO(),
495 dstBuffer
->BindVBO(),
501 stencilTable
->GetSizesBuffer(),
502 stencilTable
->GetOffsetsBuffer(),
503 stencilTable
->GetIndicesBuffer(),
504 stencilTable
->GetWeightsBuffer(),
505 stencilTable
->GetDuWeightsBuffer(),
506 stencilTable
->GetDvWeightsBuffer(),
508 /* end = */ stencilTable
->GetNumStencils());
511 /// \brief Generic stencil function.
513 /// @param srcBuffer Input primvar buffer.
514 /// must have BindVBO() method returning a GL
515 /// buffer object of source data
517 /// @param srcDesc vertex buffer descriptor for the input buffer
519 /// @param dstBuffer Output primvar buffer
520 /// must have BindVBO() method returning a GL
521 /// buffer object of destination data
523 /// @param dstDesc vertex buffer descriptor for the dstBuffer
525 /// @param duBuffer Output buffer derivative wrt u
526 /// must have BindVBO() method returning a GL
527 /// buffer object of destination data
529 /// @param duDesc vertex buffer descriptor for the duBuffer
531 /// @param dvBuffer Output buffer derivative wrt v
532 /// must have BindVBO() method returning a GL
533 /// buffer object of destination data
535 /// @param dvDesc vertex buffer descriptor for the dvBuffer
537 /// @param duuBuffer Output buffer 2nd derivative wrt u
538 /// must have BindVBO() method returning a GL
539 /// buffer object of destination data
541 /// @param duuDesc vertex buffer descriptor for the duuBuffer
543 /// @param duvBuffer Output buffer 2nd derivative wrt u and v
544 /// must have BindVBO() method returning a GL
545 /// buffer object of destination data
547 /// @param duvDesc vertex buffer descriptor for the duvBuffer
549 /// @param dvvBuffer Output buffer 2nd derivative wrt v
550 /// must have BindVBO() method returning a GL
551 /// buffer object of destination data
553 /// @param dvvDesc vertex buffer descriptor for the dvvBuffer
555 /// @param stencilTable stencil table to be applied. The table must have
558 template<typename SRC_BUFFER
, typename DST_BUFFER
, typename STENCIL_TABLE
>
559 bool EvalStencils(SRC_BUFFER
*srcBuffer
,
560 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
561 DST_BUFFER
*dstBuffer
,
562 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
563 DST_BUFFER
*duBuffer
,
564 OpenSubdiv::Osd::BufferDescriptor
const &duDesc
,
565 DST_BUFFER
*dvBuffer
,
566 OpenSubdiv::Osd::BufferDescriptor
const &dvDesc
,
567 DST_BUFFER
*duuBuffer
,
568 OpenSubdiv::Osd::BufferDescriptor
const &duuDesc
,
569 DST_BUFFER
*duvBuffer
,
570 OpenSubdiv::Osd::BufferDescriptor
const &duvDesc
,
571 DST_BUFFER
*dvvBuffer
,
572 OpenSubdiv::Osd::BufferDescriptor
const &dvvDesc
,
573 STENCIL_TABLE
const *stencilTable
) const
575 return EvalStencils(srcBuffer
->BindVBO(),
577 dstBuffer
->BindVBO(),
583 duuBuffer
->BindVBO(),
585 duvBuffer
->BindVBO(),
587 dvvBuffer
->BindVBO(),
589 stencilTable
->GetSizesBuffer(),
590 stencilTable
->GetOffsetsBuffer(),
591 stencilTable
->GetIndicesBuffer(),
592 stencilTable
->GetWeightsBuffer(),
593 stencilTable
->GetDuWeightsBuffer(),
594 stencilTable
->GetDvWeightsBuffer(),
595 stencilTable
->GetDuuWeightsBuffer(),
596 stencilTable
->GetDuvWeightsBuffer(),
597 stencilTable
->GetDvvWeightsBuffer(),
599 /* end = */ stencilTable
->GetNumStencils());
602 /// \brief Dispatch the GLSL compute kernel on GPU asynchronously
603 /// returns false if the kernel hasn't been compiled yet.
605 /// @param srcBuffer GL buffer of input primvar source data
607 /// @param srcDesc vertex buffer descriptor for the srcBuffer
609 /// @param dstBuffer GL buffer of output primvar destination data
611 /// @param dstDesc vertex buffer descriptor for the dstBuffer
613 /// @param duBuffer GL buffer of output derivative wrt u
615 /// @param duDesc vertex buffer descriptor for the duBuffer
617 /// @param dvBuffer GL buffer of output derivative wrt v
619 /// @param dvDesc vertex buffer descriptor for the dvBuffer
621 /// @param sizesBuffer GL buffer of the sizes in the stencil table
623 /// @param offsetsBuffer GL buffer of the offsets in the stencil table
625 /// @param indicesBuffer GL buffer of the indices in the stencil table
627 /// @param weightsBuffer GL buffer of the weights in the stencil table
629 /// @param duWeightsBuffer GL buffer of the du weights in the stencil table
631 /// @param dvWeightsBuffer GL buffer of the dv weights in the stencil table
633 /// @param start start index of stencil table
635 /// @param end end index of stencil table
637 bool EvalStencils(GLuint srcBuffer
,
638 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
640 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
642 OpenSubdiv::Osd::BufferDescriptor
const &duDesc
,
644 OpenSubdiv::Osd::BufferDescriptor
const &dvDesc
,
646 GLuint offsetsBuffer
,
647 GLuint indicesBuffer
,
648 GLuint weightsBuffer
,
649 GLuint duWeightsBuffer
,
650 GLuint dvWeightsBuffer
,
654 /// \brief Dispatch the GLSL compute kernel on GPU asynchronously
655 /// returns false if the kernel hasn't been compiled yet.
657 /// @param srcBuffer GL buffer of input primvar source data
659 /// @param srcDesc vertex buffer descriptor for the srcBuffer
661 /// @param dstBuffer GL buffer of output primvar destination data
663 /// @param dstDesc vertex buffer descriptor for the dstBuffer
665 /// @param duBuffer GL buffer of output derivative wrt u
667 /// @param duDesc vertex buffer descriptor for the duBuffer
669 /// @param dvBuffer GL buffer of output derivative wrt v
671 /// @param dvDesc vertex buffer descriptor for the dvBuffer
673 /// @param duuBuffer GL buffer of output 2nd derivative wrt u
675 /// @param duuDesc vertex buffer descriptor for the duuBuffer
677 /// @param duvBuffer GL buffer of output 2nd derivative wrt u and v
679 /// @param duvDesc vertex buffer descriptor for the duvBuffer
681 /// @param dvvBuffer GL buffer of output 2nd derivative wrt v
683 /// @param dvvDesc vertex buffer descriptor for the dvvBuffer
685 /// @param sizesBuffer GL buffer of the sizes in the stencil table
687 /// @param offsetsBuffer GL buffer of the offsets in the stencil table
689 /// @param indicesBuffer GL buffer of the indices in the stencil table
691 /// @param weightsBuffer GL buffer of the weights in the stencil table
693 /// @param duWeightsBuffer GL buffer of the du weights in the stencil table
695 /// @param dvWeightsBuffer GL buffer of the dv weights in the stencil table
697 /// @param duuWeightsBuffer GL buffer of the duu weights in the stencil table
699 /// @param duvWeightsBuffer GL buffer of the duv weights in the stencil table
701 /// @param dvvWeightsBuffer GL buffer of the dvv weights in the stencil table
703 /// @param start start index of stencil table
705 /// @param end end index of stencil table
707 bool EvalStencils(GLuint srcBuffer
,
708 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
710 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
712 OpenSubdiv::Osd::BufferDescriptor
const &duDesc
,
714 OpenSubdiv::Osd::BufferDescriptor
const &dvDesc
,
716 OpenSubdiv::Osd::BufferDescriptor
const &duuDesc
,
718 OpenSubdiv::Osd::BufferDescriptor
const &duvDesc
,
720 OpenSubdiv::Osd::BufferDescriptor
const &dvvDesc
,
722 GLuint offsetsBuffer
,
723 GLuint indicesBuffer
,
724 GLuint weightsBuffer
,
725 GLuint duWeightsBuffer
,
726 GLuint dvWeightsBuffer
,
727 GLuint duuWeightsBuffer
,
728 GLuint duvWeightsBuffer
,
729 GLuint dvvWeightsBuffer
,
733 /// ----------------------------------------------------------------------
735 /// Limit evaluations with PatchTable
737 /// ----------------------------------------------------------------------
739 /// \brief Generic limit eval function. This function has a same
740 /// signature as other device kernels have so that it can be called
743 /// @param srcBuffer Input primvar buffer.
744 /// must have BindVBO() method returning a GL
745 /// buffer object of source data
747 /// @param srcDesc vertex buffer descriptor for the input buffer
749 /// @param dstBuffer Output primvar buffer
750 /// must have BindVBO() method returning a GL
751 /// buffer object of destination data
753 /// @param dstDesc vertex buffer descriptor for the output buffer
755 /// @param numPatchCoords number of patchCoords.
757 /// @param patchCoords array of locations to be evaluated.
758 /// must have BindVBO() method returning an
759 /// array of PatchCoord struct in VBO.
761 /// @param patchTable GLPatchTable or equivalent
763 /// @param instance cached compiled instance. Clients are supposed to
764 /// pre-compile an instance of this class and provide
765 /// to this function. If it's null the kernel still
766 /// compute by instantiating on-demand kernel although
767 /// it may cause a performance problem.
769 /// @param deviceContext not used in the GLXFB evaluator
771 template<typename SRC_BUFFER
,
773 typename PATCHCOORD_BUFFER
,
774 typename PATCH_TABLE
>
775 static bool EvalPatches(SRC_BUFFER
*srcBuffer
,
776 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
777 DST_BUFFER
*dstBuffer
,
778 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
780 PATCHCOORD_BUFFER
*patchCoords
,
781 PATCH_TABLE
*patchTable
,
782 GLComputeEvaluator
const *instance
,
783 void *deviceContext
= nullptr)
787 return instance
->EvalPatches(
788 srcBuffer
, srcDesc
, dstBuffer
, dstDesc
, numPatchCoords
, patchCoords
, patchTable
);
790 // Create an instance on demand (slow)
791 (void)deviceContext
; // unused
792 instance
= Create(srcDesc
,
794 OpenSubdiv::Osd::BufferDescriptor(),
795 OpenSubdiv::Osd::BufferDescriptor());
797 bool r
= instance
->EvalPatches(
798 srcBuffer
, srcDesc
, dstBuffer
, dstDesc
, numPatchCoords
, patchCoords
, patchTable
);
805 /// \brief Generic limit eval function. This function has a same
806 /// signature as other device kernels have so that it can be called
809 /// @param srcBuffer Input primvar buffer.
810 /// must have BindVBO() method returning a GL
811 /// buffer object of source data
813 /// @param srcDesc vertex buffer descriptor for the input buffer
815 /// @param dstBuffer Output primvar buffer
816 /// must have BindVBO() method returning a GL
817 /// buffer object of destination data
819 /// @param dstDesc vertex buffer descriptor for the output buffer
821 /// @param duBuffer Output buffer derivative wrt u
822 /// must have BindVBO() method returning a GL
823 /// buffer object of destination data
825 /// @param duDesc vertex buffer descriptor for the duBuffer
827 /// @param dvBuffer Output buffer derivative wrt v
828 /// must have BindVBO() method returning a GL
829 /// buffer object of destination data
831 /// @param dvDesc vertex buffer descriptor for the dvBuffer
833 /// @param numPatchCoords number of patchCoords.
835 /// @param patchCoords array of locations to be evaluated.
836 /// must have BindVBO() method returning an
837 /// array of PatchCoord struct in VBO.
839 /// @param patchTable GLPatchTable or equivalent
841 /// @param instance cached compiled instance. Clients are supposed to
842 /// pre-compile an instance of this class and provide
843 /// to this function. If it's null the kernel still
844 /// compute by instantiating on-demand kernel although
845 /// it may cause a performance problem.
847 /// @param deviceContext not used in the GLXFB evaluator
849 template<typename SRC_BUFFER
,
851 typename PATCHCOORD_BUFFER
,
852 typename PATCH_TABLE
>
853 static bool EvalPatches(SRC_BUFFER
*srcBuffer
,
854 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
855 DST_BUFFER
*dstBuffer
,
856 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
857 DST_BUFFER
*duBuffer
,
858 OpenSubdiv::Osd::BufferDescriptor
const &duDesc
,
859 DST_BUFFER
*dvBuffer
,
860 OpenSubdiv::Osd::BufferDescriptor
const &dvDesc
,
862 PATCHCOORD_BUFFER
*patchCoords
,
863 PATCH_TABLE
*patchTable
,
864 GLComputeEvaluator
const *instance
,
865 void *deviceContext
= nullptr)
868 return instance
->EvalPatches(srcBuffer
,
881 // Create an instance on demand (slow)
882 (void)deviceContext
; // unused
883 instance
= Create(srcDesc
, dstDesc
, duDesc
, dvDesc
);
885 bool r
= instance
->EvalPatches(srcBuffer
,
902 /// \brief Generic limit eval function. This function has a same
903 /// signature as other device kernels have so that it can be called
906 /// @param srcBuffer Input primvar buffer.
907 /// must have BindVBO() method returning a GL
908 /// buffer object of source data
910 /// @param srcDesc vertex buffer descriptor for the input buffer
912 /// @param dstBuffer Output primvar buffer
913 /// must have BindVBO() method returning a GL
914 /// buffer object of destination data
916 /// @param dstDesc vertex buffer descriptor for the output buffer
918 /// @param duBuffer Output buffer derivative wrt u
919 /// must have BindVBO() method returning a GL
920 /// buffer object of destination data
922 /// @param duDesc vertex buffer descriptor for the duBuffer
924 /// @param dvBuffer Output buffer derivative wrt v
925 /// must have BindVBO() method returning a GL
926 /// buffer object of destination data
928 /// @param dvDesc vertex buffer descriptor for the dvBuffer
930 /// @param duuBuffer Output buffer 2nd derivative wrt u
931 /// must have BindVBO() method returning a GL
932 /// buffer object of destination data
934 /// @param duuDesc vertex buffer descriptor for the duuBuffer
936 /// @param duvBuffer Output buffer 2nd derivative wrt u and v
937 /// must have BindVBO() method returning a GL
938 /// buffer object of destination data
940 /// @param duvDesc vertex buffer descriptor for the duvBuffer
942 /// @param dvvBuffer Output buffer 2nd derivative wrt v
943 /// must have BindVBO() method returning a GL
944 /// buffer object of destination data
946 /// @param dvvDesc vertex buffer descriptor for the dvvBuffer
948 /// @param numPatchCoords number of patchCoords.
950 /// @param patchCoords array of locations to be evaluated.
951 /// must have BindVBO() method returning an
952 /// array of PatchCoord struct in VBO.
954 /// @param patchTable GLPatchTable or equivalent
956 /// @param instance cached compiled instance. Clients are supposed to
957 /// pre-compile an instance of this class and provide
958 /// to this function. If it's null the kernel still
959 /// compute by instantiating on-demand kernel although
960 /// it may cause a performance problem.
962 /// @param deviceContext not used in the GLXFB evaluator
964 template<typename SRC_BUFFER
,
966 typename PATCHCOORD_BUFFER
,
967 typename PATCH_TABLE
>
968 static bool EvalPatches(SRC_BUFFER
*srcBuffer
,
969 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
970 DST_BUFFER
*dstBuffer
,
971 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
972 DST_BUFFER
*duBuffer
,
973 OpenSubdiv::Osd::BufferDescriptor
const &duDesc
,
974 DST_BUFFER
*dvBuffer
,
975 OpenSubdiv::Osd::BufferDescriptor
const &dvDesc
,
976 DST_BUFFER
*duuBuffer
,
977 OpenSubdiv::Osd::BufferDescriptor
const &duuDesc
,
978 DST_BUFFER
*duvBuffer
,
979 OpenSubdiv::Osd::BufferDescriptor
const &duvDesc
,
980 DST_BUFFER
*dvvBuffer
,
981 OpenSubdiv::Osd::BufferDescriptor
const &dvvDesc
,
983 PATCHCOORD_BUFFER
*patchCoords
,
984 PATCH_TABLE
*patchTable
,
985 GLComputeEvaluator
const *instance
,
986 void *deviceContext
= nullptr)
989 return instance
->EvalPatches(srcBuffer
,
1008 // Create an instance on demand (slow)
1009 (void)deviceContext
; // unused
1010 instance
= Create(srcDesc
, dstDesc
, duDesc
, dvDesc
, duuDesc
, duvDesc
, dvvDesc
);
1012 bool r
= instance
->EvalPatches(srcBuffer
,
1035 /// \brief Generic limit eval function. This function has a same
1036 /// signature as other device kernels have so that it can be called
1037 /// in the same way.
1039 /// @param srcBuffer Input primvar buffer.
1040 /// must have BindVBO() method returning a GL
1041 /// buffer object of source data
1043 /// @param srcDesc vertex buffer descriptor for the input buffer
1045 /// @param dstBuffer Output primvar buffer
1046 /// must have BindVBO() method returning a GL
1047 /// buffer object of destination data
1049 /// @param dstDesc vertex buffer descriptor for the output buffer
1051 /// @param numPatchCoords number of patchCoords.
1053 /// @param patchCoords array of locations to be evaluated.
1054 /// must have BindVBO() method returning an
1055 /// array of PatchCoord struct in VBO.
1057 /// @param patchTable GLPatchTable or equivalent
1059 template<typename SRC_BUFFER
,
1060 typename DST_BUFFER
,
1061 typename PATCHCOORD_BUFFER
,
1062 typename PATCH_TABLE
>
1063 bool EvalPatches(SRC_BUFFER
*srcBuffer
,
1064 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
1065 DST_BUFFER
*dstBuffer
,
1066 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
1068 PATCHCOORD_BUFFER
*patchCoords
,
1069 PATCH_TABLE
*patchTable
) const
1072 return EvalPatches(srcBuffer
->BindVBO(),
1074 dstBuffer
->BindVBO(),
1077 OpenSubdiv::Osd::BufferDescriptor(),
1079 OpenSubdiv::Osd::BufferDescriptor(),
1081 patchCoords
->BindVBO(),
1082 patchTable
->GetPatchArrays(),
1083 patchTable
->GetPatchIndexBuffer(),
1084 patchTable
->GetPatchParamBuffer());
1087 /// \brief Generic limit eval function with derivatives. This function has
1088 /// a same signature as other device kernels have so that it can be
1089 /// called in the same way.
1091 /// @param srcBuffer Input primvar buffer.
1092 /// must have BindVBO() method returning a GL
1093 /// buffer object of source data
1095 /// @param srcDesc vertex buffer descriptor for the input buffer
1097 /// @param dstBuffer Output primvar buffer
1098 /// must have BindVBO() method returning a GL
1099 /// buffer object of destination data
1101 /// @param dstDesc vertex buffer descriptor for the output buffer
1103 /// @param duBuffer Output buffer derivative wrt u
1104 /// must have BindVBO() method returning a GL
1105 /// buffer object of destination data
1107 /// @param duDesc vertex buffer descriptor for the duBuffer
1109 /// @param dvBuffer Output buffer derivative wrt v
1110 /// must have BindVBO() method returning a GL
1111 /// buffer object of destination data
1113 /// @param dvDesc vertex buffer descriptor for the dvBuffer
1115 /// @param numPatchCoords number of patchCoords.
1117 /// @param patchCoords array of locations to be evaluated.
1119 /// @param patchTable GLPatchTable or equivalent
1121 template<typename SRC_BUFFER
,
1122 typename DST_BUFFER
,
1123 typename PATCHCOORD_BUFFER
,
1124 typename PATCH_TABLE
>
1125 bool EvalPatches(SRC_BUFFER
*srcBuffer
,
1126 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
1127 DST_BUFFER
*dstBuffer
,
1128 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
1129 DST_BUFFER
*duBuffer
,
1130 OpenSubdiv::Osd::BufferDescriptor
const &duDesc
,
1131 DST_BUFFER
*dvBuffer
,
1132 OpenSubdiv::Osd::BufferDescriptor
const &dvDesc
,
1134 PATCHCOORD_BUFFER
*patchCoords
,
1135 PATCH_TABLE
*patchTable
) const
1138 return EvalPatches(srcBuffer
->BindVBO(),
1140 dstBuffer
->BindVBO(),
1142 duBuffer
->BindVBO(),
1144 dvBuffer
->BindVBO(),
1147 patchCoords
->BindVBO(),
1148 patchTable
->GetPatchArrays(),
1149 patchTable
->GetPatchIndexBuffer(),
1150 patchTable
->GetPatchParamBuffer());
1153 /// \brief Generic limit eval function with derivatives. This function has
1154 /// a same signature as other device kernels have so that it can be
1155 /// called in the same way.
1157 /// @param srcBuffer Input primvar buffer.
1158 /// must have BindVBO() method returning a GL
1159 /// buffer object of source data
1161 /// @param srcDesc vertex buffer descriptor for the input buffer
1163 /// @param dstBuffer Output primvar buffer
1164 /// must have BindVBO() method returning a GL
1165 /// buffer object of destination data
1167 /// @param dstDesc vertex buffer descriptor for the output buffer
1169 /// @param duBuffer Output buffer derivative wrt u
1170 /// must have BindVBO() method returning a GL
1171 /// buffer object of destination data
1173 /// @param duDesc vertex buffer descriptor for the duBuffer
1175 /// @param dvBuffer Output buffer derivative wrt v
1176 /// must have BindVBO() method returning a GL
1177 /// buffer object of destination data
1179 /// @param dvDesc vertex buffer descriptor for the dvBuffer
1181 /// @param duuBuffer Output buffer 2nd derivative wrt u
1182 /// must have BindVBO() method returning a GL
1183 /// buffer object of destination data
1185 /// @param duuDesc vertex buffer descriptor for the duuBuffer
1187 /// @param duvBuffer Output buffer 2nd derivative wrt u and v
1188 /// must have BindVBO() method returning a GL
1189 /// buffer object of destination data
1191 /// @param duvDesc vertex buffer descriptor for the duvBuffer
1193 /// @param dvvBuffer Output buffer 2nd derivative wrt v
1194 /// must have BindVBO() method returning a GL
1195 /// buffer object of destination data
1197 /// @param dvvDesc vertex buffer descriptor for the dvvBuffer
1199 /// @param numPatchCoords number of patchCoords.
1201 /// @param patchCoords array of locations to be evaluated.
1203 /// @param patchTable GLPatchTable or equivalent
1205 template<typename SRC_BUFFER
,
1206 typename DST_BUFFER
,
1207 typename PATCHCOORD_BUFFER
,
1208 typename PATCH_TABLE
>
1209 bool EvalPatches(SRC_BUFFER
*srcBuffer
,
1210 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
1211 DST_BUFFER
*dstBuffer
,
1212 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
1213 DST_BUFFER
*duBuffer
,
1214 OpenSubdiv::Osd::BufferDescriptor
const &duDesc
,
1215 DST_BUFFER
*dvBuffer
,
1216 OpenSubdiv::Osd::BufferDescriptor
const &dvDesc
,
1217 DST_BUFFER
*duuBuffer
,
1218 OpenSubdiv::Osd::BufferDescriptor
const &duuDesc
,
1219 DST_BUFFER
*duvBuffer
,
1220 OpenSubdiv::Osd::BufferDescriptor
const &duvDesc
,
1221 DST_BUFFER
*dvvBuffer
,
1222 OpenSubdiv::Osd::BufferDescriptor
const &dvvDesc
,
1224 PATCHCOORD_BUFFER
*patchCoords
,
1225 PATCH_TABLE
*patchTable
) const
1228 return EvalPatches(srcBuffer
->BindVBO(),
1230 dstBuffer
->BindVBO(),
1232 duBuffer
->BindVBO(),
1234 dvBuffer
->BindVBO(),
1236 duuBuffer
->BindVBO(),
1238 duvBuffer
->BindVBO(),
1240 dvvBuffer
->BindVBO(),
1243 patchCoords
->BindVBO(),
1244 patchTable
->GetPatchArrays(),
1245 patchTable
->GetPatchIndexBuffer(),
1246 patchTable
->GetPatchParamBuffer());
1249 bool EvalPatches(GLuint srcBuffer
,
1250 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
1252 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
1254 OpenSubdiv::Osd::BufferDescriptor
const &duDesc
,
1256 OpenSubdiv::Osd::BufferDescriptor
const &dvDesc
,
1258 GLuint patchCoordsBuffer
,
1259 const OpenSubdiv::Osd::PatchArrayVector
&patchArrays
,
1260 GLuint patchIndexBuffer
,
1261 GLuint patchParamsBuffer
) const;
1263 bool EvalPatches(GLuint srcBuffer
,
1264 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
1266 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
1268 OpenSubdiv::Osd::BufferDescriptor
const &duDesc
,
1270 OpenSubdiv::Osd::BufferDescriptor
const &dvDesc
,
1272 OpenSubdiv::Osd::BufferDescriptor
const &duuDesc
,
1274 OpenSubdiv::Osd::BufferDescriptor
const &duvDesc
,
1276 OpenSubdiv::Osd::BufferDescriptor
const &dvvDesc
,
1278 GLuint patchCoordsBuffer
,
1279 const OpenSubdiv::Osd::PatchArrayVector
&patchArrays
,
1280 GLuint patchIndexBuffer
,
1281 GLuint patchParamsBuffer
) const;
1283 /// \brief Generic limit eval function. This function has a same
1284 /// signature as other device kernels have so that it can be called
1285 /// in the same way.
1287 /// @param srcBuffer Input primvar buffer.
1288 /// must have BindVBO() method returning a GL
1289 /// buffer object of source data
1291 /// @param srcDesc vertex buffer descriptor for the input buffer
1293 /// @param dstBuffer Output primvar buffer
1294 /// must have BindVBO() method returning a GL
1295 /// buffer object of destination data
1297 /// @param dstDesc vertex buffer descriptor for the output buffer
1299 /// @param numPatchCoords number of patchCoords.
1301 /// @param patchCoords array of locations to be evaluated.
1302 /// must have BindVBO() method returning an
1303 /// array of PatchCoord struct in VBO.
1305 /// @param patchTable GLPatchTable or equivalent
1307 /// @param instance cached compiled instance. Clients are supposed to
1308 /// pre-compile an instance of this class and provide
1309 /// to this function. If it's null the kernel still
1310 /// compute by instantiating on-demand kernel although
1311 /// it may cause a performance problem.
1313 /// @param deviceContext not used in the GLXFB evaluator
1315 template<typename SRC_BUFFER
,
1316 typename DST_BUFFER
,
1317 typename PATCHCOORD_BUFFER
,
1318 typename PATCH_TABLE
>
1319 static bool EvalPatchesVarying(SRC_BUFFER
*srcBuffer
,
1320 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
1321 DST_BUFFER
*dstBuffer
,
1322 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
1324 PATCHCOORD_BUFFER
*patchCoords
,
1325 PATCH_TABLE
*patchTable
,
1326 GLComputeEvaluator
const *instance
,
1327 void *deviceContext
= nullptr)
1330 return instance
->EvalPatchesVarying(
1331 srcBuffer
, srcDesc
, dstBuffer
, dstDesc
, numPatchCoords
, patchCoords
, patchTable
);
1334 // Create an instance on demand (slow)
1335 (void)deviceContext
; // unused
1336 instance
= Create(srcDesc
,
1338 OpenSubdiv::Osd::BufferDescriptor(),
1339 OpenSubdiv::Osd::BufferDescriptor());
1341 bool r
= instance
->EvalPatchesVarying(
1342 srcBuffer
, srcDesc
, dstBuffer
, dstDesc
, numPatchCoords
, patchCoords
, patchTable
);
1349 /// \brief Generic limit eval function. This function has a same
1350 /// signature as other device kernels have so that it can be called
1351 /// in the same way.
1353 /// @param srcBuffer Input primvar buffer.
1354 /// must have BindVBO() method returning a GL
1355 /// buffer object of source data
1357 /// @param srcDesc vertex buffer descriptor for the input buffer
1359 /// @param dstBuffer Output primvar buffer
1360 /// must have BindVBO() method returning a GL
1361 /// buffer object of destination data
1363 /// @param dstDesc vertex buffer descriptor for the output buffer
1365 /// @param numPatchCoords number of patchCoords.
1367 /// @param patchCoords array of locations to be evaluated.
1368 /// must have BindVBO() method returning an
1369 /// array of PatchCoord struct in VBO.
1371 /// @param patchTable GLPatchTable or equivalent
1373 template<typename SRC_BUFFER
,
1374 typename DST_BUFFER
,
1375 typename PATCHCOORD_BUFFER
,
1376 typename PATCH_TABLE
>
1377 bool EvalPatchesVarying(SRC_BUFFER
*srcBuffer
,
1378 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
1379 DST_BUFFER
*dstBuffer
,
1380 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
1382 PATCHCOORD_BUFFER
*patchCoords
,
1383 PATCH_TABLE
*patchTable
) const
1386 return EvalPatches(srcBuffer
->BindVBO(),
1388 dstBuffer
->BindVBO(),
1391 OpenSubdiv::Osd::BufferDescriptor(),
1393 OpenSubdiv::Osd::BufferDescriptor(),
1395 patchCoords
->BindVBO(),
1396 patchTable
->GetVaryingPatchArrays(),
1397 patchTable
->GetVaryingPatchIndexBuffer(),
1398 patchTable
->GetPatchParamBuffer());
1401 /// \brief Generic limit eval function. This function has a same
1402 /// signature as other device kernels have so that it can be called
1403 /// in the same way.
1405 /// @param srcBuffer Input primvar buffer.
1406 /// must have BindVBO() method returning a GL
1407 /// buffer object of source data
1409 /// @param srcDesc vertex buffer descriptor for the input buffer
1411 /// @param dstBuffer Output primvar buffer
1412 /// must have BindVBO() method returning a GL
1413 /// buffer object of destination data
1415 /// @param dstDesc vertex buffer descriptor for the output buffer
1417 /// @param duBuffer Output buffer derivative wrt u
1418 /// must have BindVBO() method returning a GL
1419 /// buffer object of destination data
1421 /// @param duDesc vertex buffer descriptor for the duBuffer
1423 /// @param dvBuffer Output buffer derivative wrt v
1424 /// must have BindVBO() method returning a GL
1425 /// buffer object of destination data
1427 /// @param dvDesc vertex buffer descriptor for the dvBuffer
1429 /// @param numPatchCoords number of patchCoords.
1431 /// @param patchCoords array of locations to be evaluated.
1432 /// must have BindVBO() method returning an
1433 /// array of PatchCoord struct in VBO.
1435 /// @param patchTable GLPatchTable or equivalent
1437 /// @param instance cached compiled instance. Clients are supposed to
1438 /// pre-compile an instance of this class and provide
1439 /// to this function. If it's null the kernel still
1440 /// compute by instantiating on-demand kernel although
1441 /// it may cause a performance problem.
1443 /// @param deviceContext not used in the GLXFB evaluator
1445 template<typename SRC_BUFFER
,
1446 typename DST_BUFFER
,
1447 typename PATCHCOORD_BUFFER
,
1448 typename PATCH_TABLE
>
1449 static bool EvalPatchesVarying(SRC_BUFFER
*srcBuffer
,
1450 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
1451 DST_BUFFER
*dstBuffer
,
1452 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
1453 DST_BUFFER
*duBuffer
,
1454 OpenSubdiv::Osd::BufferDescriptor
const &duDesc
,
1455 DST_BUFFER
*dvBuffer
,
1456 OpenSubdiv::Osd::BufferDescriptor
const &dvDesc
,
1458 PATCHCOORD_BUFFER
*patchCoords
,
1459 PATCH_TABLE
*patchTable
,
1460 GLComputeEvaluator
const *instance
,
1461 void *deviceContext
= nullptr)
1464 return instance
->EvalPatchesVarying(srcBuffer
,
1477 // Create an instance on demand (slow)
1478 (void)deviceContext
; // unused
1479 instance
= Create(srcDesc
, dstDesc
, duDesc
, dvDesc
);
1481 bool r
= instance
->EvalPatchesVarying(srcBuffer
,
1498 /// \brief Generic limit eval function. This function has a same
1499 /// signature as other device kernels have so that it can be called
1500 /// in the same way.
1502 /// @param srcBuffer Input primvar buffer.
1503 /// must have BindVBO() method returning a GL
1504 /// buffer object of source data
1506 /// @param srcDesc vertex buffer descriptor for the input buffer
1508 /// @param dstBuffer Output primvar buffer
1509 /// must have BindVBO() method returning a GL
1510 /// buffer object of destination data
1512 /// @param dstDesc vertex buffer descriptor for the output buffer
1514 /// @param duBuffer Output buffer derivative wrt u
1515 /// must have BindVBO() method returning a GL
1516 /// buffer object of destination data
1518 /// @param duDesc vertex buffer descriptor for the duBuffer
1520 /// @param dvBuffer Output buffer derivative wrt v
1521 /// must have BindVBO() method returning a GL
1522 /// buffer object of destination data
1524 /// @param dvDesc vertex buffer descriptor for the dvBuffer
1526 /// @param numPatchCoords number of patchCoords.
1528 /// @param patchCoords array of locations to be evaluated.
1529 /// must have BindVBO() method returning an
1530 /// array of PatchCoord struct in VBO.
1532 /// @param patchTable GLPatchTable or equivalent
1534 template<typename SRC_BUFFER
,
1535 typename DST_BUFFER
,
1536 typename PATCHCOORD_BUFFER
,
1537 typename PATCH_TABLE
>
1538 bool EvalPatchesVarying(SRC_BUFFER
*srcBuffer
,
1539 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
1540 DST_BUFFER
*dstBuffer
,
1541 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
1542 DST_BUFFER
*duBuffer
,
1543 OpenSubdiv::Osd::BufferDescriptor
const &duDesc
,
1544 DST_BUFFER
*dvBuffer
,
1545 OpenSubdiv::Osd::BufferDescriptor
const &dvDesc
,
1547 PATCHCOORD_BUFFER
*patchCoords
,
1548 PATCH_TABLE
*patchTable
) const
1551 return EvalPatches(srcBuffer
->BindVBO(),
1553 dstBuffer
->BindVBO(),
1555 duBuffer
->BindVBO(),
1557 dvBuffer
->BindVBO(),
1560 patchCoords
->BindVBO(),
1561 patchTable
->GetVaryingPatchArrays(),
1562 patchTable
->GetVaryingPatchIndexBuffer(),
1563 patchTable
->GetPatchParamBuffer());
1566 /// \brief Generic limit eval function. This function has a same
1567 /// signature as other device kernels have so that it can be called
1568 /// in the same way.
1570 /// @param srcBuffer Input primvar buffer.
1571 /// must have BindVBO() method returning a GL
1572 /// buffer object of source data
1574 /// @param srcDesc vertex buffer descriptor for the input buffer
1576 /// @param dstBuffer Output primvar buffer
1577 /// must have BindVBO() method returning a GL
1578 /// buffer object of destination data
1580 /// @param dstDesc vertex buffer descriptor for the output buffer
1582 /// @param duBuffer Output buffer derivative wrt u
1583 /// must have BindVBO() method returning a GL
1584 /// buffer object of destination data
1586 /// @param duDesc vertex buffer descriptor for the duBuffer
1588 /// @param dvBuffer Output buffer derivative wrt v
1589 /// must have BindVBO() method returning a GL
1590 /// buffer object of destination data
1592 /// @param dvDesc vertex buffer descriptor for the dvBuffer
1594 /// @param duuBuffer Output buffer 2nd derivative wrt u
1595 /// must have BindVBO() method returning a GL
1596 /// buffer object of destination data
1598 /// @param duuDesc vertex buffer descriptor for the duuBuffer
1600 /// @param duvBuffer Output buffer 2nd derivative wrt u and v
1601 /// must have BindVBO() method returning a GL
1602 /// buffer object of destination data
1604 /// @param duvDesc vertex buffer descriptor for the duvBuffer
1606 /// @param dvvBuffer Output buffer 2nd derivative wrt v
1607 /// must have BindVBO() method returning a GL
1608 /// buffer object of destination data
1610 /// @param dvvDesc vertex buffer descriptor for the dvvBuffer
1612 /// @param numPatchCoords number of patchCoords.
1614 /// @param patchCoords array of locations to be evaluated.
1615 /// must have BindVBO() method returning an
1616 /// array of PatchCoord struct in VBO.
1618 /// @param patchTable GLPatchTable or equivalent
1620 /// @param instance cached compiled instance. Clients are supposed to
1621 /// pre-compile an instance of this class and provide
1622 /// to this function. If it's null the kernel still
1623 /// compute by instantiating on-demand kernel although
1624 /// it may cause a performance problem.
1626 /// @param deviceContext not used in the GLXFB evaluator
1628 template<typename SRC_BUFFER
,
1629 typename DST_BUFFER
,
1630 typename PATCHCOORD_BUFFER
,
1631 typename PATCH_TABLE
>
1632 static bool EvalPatchesVarying(SRC_BUFFER
*srcBuffer
,
1633 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
1634 DST_BUFFER
*dstBuffer
,
1635 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
1636 DST_BUFFER
*duBuffer
,
1637 OpenSubdiv::Osd::BufferDescriptor
const &duDesc
,
1638 DST_BUFFER
*dvBuffer
,
1639 OpenSubdiv::Osd::BufferDescriptor
const &dvDesc
,
1640 DST_BUFFER
*duuBuffer
,
1641 OpenSubdiv::Osd::BufferDescriptor
const &duuDesc
,
1642 DST_BUFFER
*duvBuffer
,
1643 OpenSubdiv::Osd::BufferDescriptor
const &duvDesc
,
1644 DST_BUFFER
*dvvBuffer
,
1645 OpenSubdiv::Osd::BufferDescriptor
const &dvvDesc
,
1647 PATCHCOORD_BUFFER
*patchCoords
,
1648 PATCH_TABLE
*patchTable
,
1649 GLComputeEvaluator
const *instance
,
1650 void *deviceContext
= nullptr)
1653 return instance
->EvalPatchesVarying(srcBuffer
,
1672 // Create an instance on demand (slow)
1673 (void)deviceContext
; // unused
1674 instance
= Create(srcDesc
, dstDesc
, duDesc
, dvDesc
, duuDesc
, duvDesc
, dvvDesc
);
1676 bool r
= instance
->EvalPatchesVarying(srcBuffer
,
1699 /// \brief Generic limit eval function. This function has a same
1700 /// signature as other device kernels have so that it can be called
1701 /// in the same way.
1703 /// @param srcBuffer Input primvar buffer.
1704 /// must have BindVBO() method returning a GL
1705 /// buffer object of source data
1707 /// @param srcDesc vertex buffer descriptor for the input buffer
1709 /// @param dstBuffer Output primvar buffer
1710 /// must have BindVBO() method returning a GL
1711 /// buffer object of destination data
1713 /// @param dstDesc vertex buffer descriptor for the output buffer
1715 /// @param duBuffer Output buffer derivative wrt u
1716 /// must have BindVBO() method returning a GL
1717 /// buffer object of destination data
1719 /// @param duDesc vertex buffer descriptor for the duBuffer
1721 /// @param dvBuffer Output buffer derivative wrt v
1722 /// must have BindVBO() method returning a GL
1723 /// buffer object of destination data
1725 /// @param dvDesc vertex buffer descriptor for the dvBuffer
1727 /// @param duuBuffer Output buffer 2nd derivative wrt u
1728 /// must have BindVBO() method returning a GL
1729 /// buffer object of destination data
1731 /// @param duuDesc vertex buffer descriptor for the duuBuffer
1733 /// @param duvBuffer Output buffer 2nd derivative wrt u and v
1734 /// must have BindVBO() method returning a GL
1735 /// buffer object of destination data
1737 /// @param duvDesc vertex buffer descriptor for the duvBuffer
1739 /// @param dvvBuffer Output buffer 2nd derivative wrt v
1740 /// must have BindVBO() method returning a GL
1741 /// buffer object of destination data
1743 /// @param dvvDesc vertex buffer descriptor for the dvvBuffer
1745 /// @param numPatchCoords number of patchCoords.
1747 /// @param patchCoords array of locations to be evaluated.
1748 /// must have BindVBO() method returning an
1749 /// array of PatchCoord struct in VBO.
1751 /// @param patchTable GLPatchTable or equivalent
1753 template<typename SRC_BUFFER
,
1754 typename DST_BUFFER
,
1755 typename PATCHCOORD_BUFFER
,
1756 typename PATCH_TABLE
>
1757 bool EvalPatchesVarying(SRC_BUFFER
*srcBuffer
,
1758 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
1759 DST_BUFFER
*dstBuffer
,
1760 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
1761 DST_BUFFER
*duBuffer
,
1762 OpenSubdiv::Osd::BufferDescriptor
const &duDesc
,
1763 DST_BUFFER
*dvBuffer
,
1764 OpenSubdiv::Osd::BufferDescriptor
const &dvDesc
,
1765 DST_BUFFER
*duuBuffer
,
1766 OpenSubdiv::Osd::BufferDescriptor
const &duuDesc
,
1767 DST_BUFFER
*duvBuffer
,
1768 OpenSubdiv::Osd::BufferDescriptor
const &duvDesc
,
1769 DST_BUFFER
*dvvBuffer
,
1770 OpenSubdiv::Osd::BufferDescriptor
const &dvvDesc
,
1772 PATCHCOORD_BUFFER
*patchCoords
,
1773 PATCH_TABLE
*patchTable
) const
1776 return EvalPatches(srcBuffer
->BindVBO(),
1778 dstBuffer
->BindVBO(),
1780 duBuffer
->BindVBO(),
1782 dvBuffer
->BindVBO(),
1784 duuBuffer
->BindVBO(),
1786 duvBuffer
->BindVBO(),
1788 dvvBuffer
->BindVBO(),
1791 patchCoords
->BindVBO(),
1792 patchTable
->GetVaryingPatchArrays(),
1793 patchTable
->GetVaryingPatchIndexBuffer(),
1794 patchTable
->GetPatchParamBuffer());
1797 /// \brief Generic limit eval function. This function has a same
1798 /// signature as other device kernels have so that it can be called
1799 /// in the same way.
1801 /// @param srcBuffer Input primvar buffer.
1802 /// must have BindVBO() method returning a GL
1803 /// buffer object of source data
1805 /// @param srcDesc vertex buffer descriptor for the input buffer
1807 /// @param dstBuffer Output primvar buffer
1808 /// must have BindVBO() method returning a GL
1809 /// buffer object of destination data
1811 /// @param dstDesc vertex buffer descriptor for the output buffer
1813 /// @param numPatchCoords number of patchCoords.
1815 /// @param patchCoords array of locations to be evaluated.
1816 /// must have BindVBO() method returning an
1817 /// array of PatchCoord struct in VBO.
1819 /// @param patchTable GLPatchTable or equivalent
1821 /// @param fvarChannel face-varying channel
1823 /// @param instance cached compiled instance. Clients are supposed to
1824 /// pre-compile an instance of this class and provide
1825 /// to this function. If it's null the kernel still
1826 /// compute by instantiating on-demand kernel although
1827 /// it may cause a performance problem.
1829 /// @param deviceContext not used in the GLXFB evaluator
1831 template<typename SRC_BUFFER
,
1832 typename DST_BUFFER
,
1833 typename PATCHCOORD_BUFFER
,
1834 typename PATCH_TABLE
>
1835 static bool EvalPatchesFaceVarying(SRC_BUFFER
*srcBuffer
,
1836 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
1837 DST_BUFFER
*dstBuffer
,
1838 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
1840 PATCHCOORD_BUFFER
*patchCoords
,
1841 PATCH_TABLE
*patchTable
,
1843 GLComputeEvaluator
const *instance
,
1844 void *deviceContext
= nullptr)
1847 return instance
->EvalPatchesFaceVarying(srcBuffer
,
1857 // Create an instance on demand (slow)
1858 (void)deviceContext
; // unused
1859 instance
= Create(srcDesc
,
1861 OpenSubdiv::Osd::BufferDescriptor(),
1862 OpenSubdiv::Osd::BufferDescriptor());
1864 bool r
= instance
->EvalPatchesFaceVarying(srcBuffer
,
1878 /// \brief Generic limit eval function. This function has a same
1879 /// signature as other device kernels have so that it can be called
1880 /// in the same way.
1882 /// @param srcBuffer Input primvar buffer.
1883 /// must have BindVBO() method returning a GL
1884 /// buffer object of source data
1886 /// @param srcDesc vertex buffer descriptor for the input buffer
1888 /// @param dstBuffer Output primvar buffer
1889 /// must have BindVBO() method returning a GL
1890 /// buffer object of destination data
1892 /// @param dstDesc vertex buffer descriptor for the output buffer
1894 /// @param numPatchCoords number of patchCoords.
1896 /// @param patchCoords array of locations to be evaluated.
1897 /// must have BindVBO() method returning an
1898 /// array of PatchCoord struct in VBO.
1900 /// @param patchTable GLPatchTable or equivalent
1902 /// @param fvarChannel face-varying channel
1904 template<typename SRC_BUFFER
,
1905 typename DST_BUFFER
,
1906 typename PATCHCOORD_BUFFER
,
1907 typename PATCH_TABLE
>
1908 bool EvalPatchesFaceVarying(SRC_BUFFER
*srcBuffer
,
1909 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
1910 DST_BUFFER
*dstBuffer
,
1911 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
1913 PATCHCOORD_BUFFER
*patchCoords
,
1914 PATCH_TABLE
*patchTable
,
1915 int fvarChannel
= 0) const
1918 return EvalPatches(srcBuffer
->BindVBO(),
1920 dstBuffer
->BindVBO(),
1923 OpenSubdiv::Osd::BufferDescriptor(),
1925 OpenSubdiv::Osd::BufferDescriptor(),
1927 patchCoords
->BindVBO(),
1928 patchTable
->GetFVarPatchArrays(fvarChannel
),
1929 patchTable
->GetFVarPatchIndexBuffer(fvarChannel
),
1930 patchTable
->GetFVarPatchParamBuffer(fvarChannel
));
1933 /// \brief Generic limit eval function. This function has a same
1934 /// signature as other device kernels have so that it can be called
1935 /// in the same way.
1937 /// @param srcBuffer Input primvar buffer.
1938 /// must have BindVBO() method returning a GL
1939 /// buffer object of source data
1941 /// @param srcDesc vertex buffer descriptor for the input buffer
1943 /// @param dstBuffer Output primvar buffer
1944 /// must have BindVBO() method returning a GL
1945 /// buffer object of destination data
1947 /// @param dstDesc vertex buffer descriptor for the output buffer
1949 /// @param duBuffer Output buffer derivative wrt u
1950 /// must have BindVBO() method returning a GL
1951 /// buffer object of destination data
1953 /// @param duDesc vertex buffer descriptor for the duBuffer
1955 /// @param dvBuffer Output buffer derivative wrt v
1956 /// must have BindVBO() method returning a GL
1957 /// buffer object of destination data
1959 /// @param dvDesc vertex buffer descriptor for the dvBuffer
1961 /// @param numPatchCoords number of patchCoords.
1963 /// @param patchCoords array of locations to be evaluated.
1964 /// must have BindVBO() method returning an
1965 /// array of PatchCoord struct in VBO.
1967 /// @param patchTable GLPatchTable or equivalent
1969 /// @param fvarChannel face-varying channel
1971 /// @param instance cached compiled instance. Clients are supposed to
1972 /// pre-compile an instance of this class and provide
1973 /// to this function. If it's null the kernel still
1974 /// compute by instantiating on-demand kernel although
1975 /// it may cause a performance problem.
1977 /// @param deviceContext not used in the GLXFB evaluator
1979 template<typename SRC_BUFFER
,
1980 typename DST_BUFFER
,
1981 typename PATCHCOORD_BUFFER
,
1982 typename PATCH_TABLE
>
1983 static bool EvalPatchesFaceVarying(SRC_BUFFER
*srcBuffer
,
1984 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
1985 DST_BUFFER
*dstBuffer
,
1986 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
1987 DST_BUFFER
*duBuffer
,
1988 OpenSubdiv::Osd::BufferDescriptor
const &duDesc
,
1989 DST_BUFFER
*dvBuffer
,
1990 OpenSubdiv::Osd::BufferDescriptor
const &dvDesc
,
1992 PATCHCOORD_BUFFER
*patchCoords
,
1993 PATCH_TABLE
*patchTable
,
1995 GLComputeEvaluator
const *instance
,
1996 void *deviceContext
= nullptr)
1999 return instance
->EvalPatchesFaceVarying(srcBuffer
,
2013 // Create an instance on demand (slow)
2014 (void)deviceContext
; // unused
2015 instance
= Create(srcDesc
, dstDesc
, duDesc
, dvDesc
);
2017 bool r
= instance
->EvalPatchesFaceVarying(srcBuffer
,
2035 /// \brief Generic limit eval function. This function has a same
2036 /// signature as other device kernels have so that it can be called
2037 /// in the same way.
2039 /// @param srcBuffer Input primvar buffer.
2040 /// must have BindVBO() method returning a GL
2041 /// buffer object of source data
2043 /// @param srcDesc vertex buffer descriptor for the input buffer
2045 /// @param dstBuffer Output primvar buffer
2046 /// must have BindVBO() method returning a GL
2047 /// buffer object of destination data
2049 /// @param dstDesc vertex buffer descriptor for the output buffer
2051 /// @param duBuffer Output buffer derivative wrt u
2052 /// must have BindVBO() method returning a GL
2053 /// object of destination data
2055 /// @param duDesc vertex buffer descriptor for the duBuffer
2057 /// @param dvBuffer Output buffer derivative wrt v
2058 /// must have BindVBO() method returning a GL
2059 /// buffer object of destination data
2061 /// @param dvDesc vertex buffer descriptor for the dvBuffer
2063 /// @param numPatchCoords number of patchCoords.
2065 /// @param patchCoords array of locations to be evaluated.
2066 /// must have BindVBO() method returning an
2067 /// array of PatchCoord struct in VBO.
2069 /// @param patchTable GLPatchTable or equivalent
2071 /// @param fvarChannel face-varying channel
2073 template<typename SRC_BUFFER
,
2074 typename DST_BUFFER
,
2075 typename PATCHCOORD_BUFFER
,
2076 typename PATCH_TABLE
>
2077 bool EvalPatchesFaceVarying(SRC_BUFFER
*srcBuffer
,
2078 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
2079 DST_BUFFER
*dstBuffer
,
2080 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
2081 DST_BUFFER
*duBuffer
,
2082 OpenSubdiv::Osd::BufferDescriptor
const &duDesc
,
2083 DST_BUFFER
*dvBuffer
,
2084 OpenSubdiv::Osd::BufferDescriptor
const &dvDesc
,
2086 PATCHCOORD_BUFFER
*patchCoords
,
2087 PATCH_TABLE
*patchTable
,
2088 int fvarChannel
= 0) const
2091 return EvalPatches(srcBuffer
->BindVBO(),
2093 dstBuffer
->BindVBO(),
2095 duBuffer
->BindVBO(),
2097 dvBuffer
->BindVBO(),
2100 patchCoords
->BindVBO(),
2101 patchTable
->GetFVarPatchArrays(fvarChannel
),
2102 patchTable
->GetFVarPatchIndexBuffer(fvarChannel
),
2103 patchTable
->GetFVarPatchParamBuffer(fvarChannel
));
2106 /// \brief Generic limit eval function. This function has a same
2107 /// signature as other device kernels have so that it can be called
2108 /// in the same way.
2110 /// @param srcBuffer Input primvar buffer.
2111 /// must have BindVBO() method returning a GL
2112 /// buffer object of source data
2114 /// @param srcDesc vertex buffer descriptor for the input buffer
2116 /// @param dstBuffer Output primvar buffer
2117 /// must have BindVBO() method returning a GL
2118 /// buffer object of destination data
2120 /// @param dstDesc vertex buffer descriptor for the output buffer
2122 /// @param duBuffer Output buffer derivative wrt u
2123 /// must have BindVBO() method returning a GL
2124 /// buffer object of destination data
2126 /// @param duDesc vertex buffer descriptor for the duBuffer
2128 /// @param dvBuffer Output buffer derivative wrt v
2129 /// must have BindVBO() method returning a GL
2130 /// buffer object of destination data
2132 /// @param dvDesc vertex buffer descriptor for the dvBuffer
2134 /// @param duuBuffer Output buffer 2nd derivative wrt u
2135 /// must have BindVBO() method returning a GL
2136 /// buffer object of destination data
2138 /// @param duuDesc vertex buffer descriptor for the duuBuffer
2140 /// @param duvBuffer Output buffer 2nd derivative wrt u and v
2141 /// must have BindVBO() method returning a GL
2142 /// buffer object of destination data
2144 /// @param duvDesc vertex buffer descriptor for the duvBuffer
2146 /// @param dvvBuffer Output buffer 2nd derivative wrt v
2147 /// must have BindVBO() method returning a GL
2148 /// buffer object of destination data
2150 /// @param dvvDesc vertex buffer descriptor for the dvvBuffer
2152 /// @param numPatchCoords number of patchCoords.
2154 /// @param patchCoords array of locations to be evaluated.
2155 /// must have BindVBO() method returning an
2156 /// array of PatchCoord struct in VBO.
2158 /// @param patchTable GLPatchTable or equivalent
2160 /// @param fvarChannel face-varying channel
2162 /// @param instance cached compiled instance. Clients are supposed to
2163 /// pre-compile an instance of this class and provide
2164 /// to this function. If it's null the kernel still
2165 /// compute by instantiating on-demand kernel although
2166 /// it may cause a performance problem.
2168 /// @param deviceContext not used in the GLXFB evaluator
2170 template<typename SRC_BUFFER
,
2171 typename DST_BUFFER
,
2172 typename PATCHCOORD_BUFFER
,
2173 typename PATCH_TABLE
>
2174 static bool EvalPatchesFaceVarying(SRC_BUFFER
*srcBuffer
,
2175 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
2176 DST_BUFFER
*dstBuffer
,
2177 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
2178 DST_BUFFER
*duBuffer
,
2179 OpenSubdiv::Osd::BufferDescriptor
const &duDesc
,
2180 DST_BUFFER
*dvBuffer
,
2181 OpenSubdiv::Osd::BufferDescriptor
const &dvDesc
,
2182 DST_BUFFER
*duuBuffer
,
2183 OpenSubdiv::Osd::BufferDescriptor
const &duuDesc
,
2184 DST_BUFFER
*duvBuffer
,
2185 OpenSubdiv::Osd::BufferDescriptor
const &duvDesc
,
2186 DST_BUFFER
*dvvBuffer
,
2187 OpenSubdiv::Osd::BufferDescriptor
const &dvvDesc
,
2189 PATCHCOORD_BUFFER
*patchCoords
,
2190 PATCH_TABLE
*patchTable
,
2192 GLComputeEvaluator
const *instance
,
2193 void *deviceContext
= nullptr)
2196 return instance
->EvalPatchesFaceVarying(srcBuffer
,
2216 // Create an instance on demand (slow)
2217 (void)deviceContext
; // unused
2218 instance
= Create(srcDesc
, dstDesc
, duDesc
, dvDesc
, duuDesc
, duvDesc
, dvvDesc
);
2220 bool r
= instance
->EvalPatchesFaceVarying(srcBuffer
,
2244 /// \brief Generic limit eval function. This function has a same
2245 /// signature as other device kernels have so that it can be called
2246 /// in the same way.
2248 /// @param srcBuffer Input primvar buffer.
2249 /// must have BindVBO() method returning a GL
2250 /// buffer object of source data
2252 /// @param srcDesc vertex buffer descriptor for the input buffer
2254 /// @param dstBuffer Output primvar buffer
2255 /// must have BindVBO() method returning a GL
2256 /// buffer object of destination data
2258 /// @param dstDesc vertex buffer descriptor for the output buffer
2260 /// @param duBuffer Output buffer derivative wrt u
2261 /// must have BindVBO() method returning a GL
2262 /// buffer object of destination data
2264 /// @param duDesc vertex buffer descriptor for the duBuffer
2266 /// @param dvBuffer Output buffer derivative wrt v
2267 /// must have BindVBO() method returning a GL
2268 /// buffer object of destination data
2270 /// @param dvDesc vertex buffer descriptor for the dvBuffer
2272 /// @param duuBuffer Output buffer 2nd derivative wrt u
2273 /// must have BindVBO() method returning a GL
2274 /// buffer object of destination data
2276 /// @param duuDesc vertex buffer descriptor for the duuBuffer
2278 /// @param duvBuffer Output buffer 2nd derivative wrt u and v
2279 /// must have BindVBO() method returning a GL
2280 /// buffer object of destination data
2282 /// @param duvDesc vertex buffer descriptor for the duvBuffer
2284 /// @param dvvBuffer Output buffer 2nd derivative wrt v
2285 /// must have BindVBO() method returning a GL
2286 /// buffer object of destination data
2288 /// @param dvvDesc vertex buffer descriptor for the dvvBuffer
2290 /// @param numPatchCoords number of patchCoords.
2292 /// @param patchCoords array of locations to be evaluated.
2293 /// must have BindVBO() method returning an
2294 /// array of PatchCoord struct in VBO.
2296 /// @param patchTable GLPatchTable or equivalent
2298 /// @param fvarChannel face-varying channel
2300 template<typename SRC_BUFFER
,
2301 typename DST_BUFFER
,
2302 typename PATCHCOORD_BUFFER
,
2303 typename PATCH_TABLE
>
2304 bool EvalPatchesFaceVarying(SRC_BUFFER
*srcBuffer
,
2305 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
2306 DST_BUFFER
*dstBuffer
,
2307 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
2308 DST_BUFFER
*duBuffer
,
2309 OpenSubdiv::Osd::BufferDescriptor
const &duDesc
,
2310 DST_BUFFER
*dvBuffer
,
2311 OpenSubdiv::Osd::BufferDescriptor
const &dvDesc
,
2312 DST_BUFFER
*duuBuffer
,
2313 OpenSubdiv::Osd::BufferDescriptor
const &duuDesc
,
2314 DST_BUFFER
*duvBuffer
,
2315 OpenSubdiv::Osd::BufferDescriptor
const &duvDesc
,
2316 DST_BUFFER
*dvvBuffer
,
2317 OpenSubdiv::Osd::BufferDescriptor
const &dvvDesc
,
2319 PATCHCOORD_BUFFER
*patchCoords
,
2320 PATCH_TABLE
*patchTable
,
2321 int fvarChannel
= 0) const
2324 return EvalPatches(srcBuffer
->BindVBO(),
2326 dstBuffer
->BindVBO(),
2328 duBuffer
->BindVBO(),
2330 dvBuffer
->BindVBO(),
2332 duuBuffer
->BindVBO(),
2334 duvBuffer
->BindVBO(),
2336 dvvBuffer
->BindVBO(),
2339 patchCoords
->BindVBO(),
2340 patchTable
->GetFVarPatchArrays(fvarChannel
),
2341 patchTable
->GetFVarPatchIndexBuffer(fvarChannel
),
2342 patchTable
->GetFVarPatchParamBuffer(fvarChannel
));
2345 /// ----------------------------------------------------------------------
2349 /// ----------------------------------------------------------------------
2351 /// Configure GLSL kernel. A valid GL context must be made current before
2352 /// calling this function. Returns false if it fails to compile the kernel.
2354 OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
2355 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
2356 OpenSubdiv::Osd::BufferDescriptor
const &duDesc
= OpenSubdiv::Osd::BufferDescriptor(),
2357 OpenSubdiv::Osd::BufferDescriptor
const &dvDesc
= OpenSubdiv::Osd::BufferDescriptor(),
2358 OpenSubdiv::Osd::BufferDescriptor
const &duuDesc
= OpenSubdiv::Osd::BufferDescriptor(),
2359 OpenSubdiv::Osd::BufferDescriptor
const &duvDesc
= OpenSubdiv::Osd::BufferDescriptor(),
2360 OpenSubdiv::Osd::BufferDescriptor
const &dvvDesc
= OpenSubdiv::Osd::BufferDescriptor());
2362 /// Wait the dispatched kernel finishes.
2363 static void Synchronize(void *deviceContext
);
2366 struct _StencilKernel
{
2369 bool Compile(OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
2370 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
2371 OpenSubdiv::Osd::BufferDescriptor
const &duDesc
,
2372 OpenSubdiv::Osd::BufferDescriptor
const &dvDesc
,
2373 OpenSubdiv::Osd::BufferDescriptor
const &duuDesc
,
2374 OpenSubdiv::Osd::BufferDescriptor
const &duvDesc
,
2375 OpenSubdiv::Osd::BufferDescriptor
const &dvvDesc
,
2378 GLuint uniformStart
;
2380 GLuint uniformSrcOffset
;
2381 GLuint uniformDstOffset
;
2382 GLuint uniformDuDesc
;
2383 GLuint uniformDvDesc
;
2384 GLuint uniformDuuDesc
;
2385 GLuint uniformDuvDesc
;
2386 GLuint uniformDvvDesc
;
2389 struct _PatchKernel
{
2392 bool Compile(OpenSubdiv::Osd::BufferDescriptor
const &srcDesc
,
2393 OpenSubdiv::Osd::BufferDescriptor
const &dstDesc
,
2394 OpenSubdiv::Osd::BufferDescriptor
const &duDesc
,
2395 OpenSubdiv::Osd::BufferDescriptor
const &dvDesc
,
2396 OpenSubdiv::Osd::BufferDescriptor
const &duuDesc
,
2397 OpenSubdiv::Osd::BufferDescriptor
const &duvDesc
,
2398 OpenSubdiv::Osd::BufferDescriptor
const &dvvDesc
,
2401 GLuint uniformSrcOffset
;
2402 GLuint uniformDstOffset
;
2403 GLuint uniformPatchArray
;
2404 GLuint uniformDuDesc
;
2405 GLuint uniformDvDesc
;
2406 GLuint uniformDuuDesc
;
2407 GLuint uniformDuvDesc
;
2408 GLuint uniformDvvDesc
;
2412 GLuint _patchArraysSSBO
;
2414 int GetDispatchSize(int count
) const;
2416 void DispatchCompute(int totalDispatchSize
) const;
2419 } // namespace blender::opensubdiv
2421 #endif // OPENSUBDIV_GL_COMPUTE_EVALUATOR_H_