opensubdiv/osd/mtlComputeEvaluator.h Source File

mtlComputeEvaluator.h
Go to the documentation of this file.
1 //
2 // Copyright 2013 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24
25 #ifndef OPENSUBDIV3_OSD_MTL_COMPUTE_EVALUATOR_H
26 #define OPENSUBDIV3_OSD_MTL_COMPUTE_EVALUATOR_H
27
28 #include "../version.h"
29 #include "../osd/types.h"
30 #include "../osd/bufferDescriptor.h"
31 #include "../osd/mtlCommon.h"
32
33 @protocol MTLDevice;
34 @protocol MTLBuffer;
35 @protocol MTLLibrary;
36 @protocol MTLComputePipelineState;
37
38 namespace OpenSubdiv
39 {
40 namespace OPENSUBDIV_VERSION
41 {
42 namespace Far
43 {
44 class StencilTable;
45 class PatchTable;
46 class LimitStencilTable;
47 }
48
49 namespace Osd
50 {
51 class MTLStencilTable
52 {
53 public:
54 template<typename STENCIL_TABLE, typename DEVICE_CONTEXT>
55 static MTLStencilTable* Create(STENCIL_TABLE* stencilTable,
56 DEVICE_CONTEXT context)
57 {
58 return new MTLStencilTable(stencilTable, context);
59 }
60
61
62 MTLStencilTable(Far::StencilTable const* stencilTable, MTLContext* context);
63 MTLStencilTable(Far::LimitStencilTable const* stencilTable, MTLContext* context);
64 ~MTLStencilTable();
65
66
67 id<MTLBuffer> GetSizesBuffer() const { return _sizesBuffer; }
68 id<MTLBuffer> GetOffsetsBuffer() const { return _offsetsBuffer; }
69 id<MTLBuffer> GetIndicesBuffer() const { return _indicesBuffer; }
70 id<MTLBuffer> GetWeightsBuffer() const { return _weightsBuffer; }
71 id<MTLBuffer> GetDuWeightsBuffer() const { return _duWeightsBuffer; }
72 id<MTLBuffer> GetDvWeightsBuffer() const { return _dvWeightsBuffer; }
73 id<MTLBuffer> GetDuuWeightsBuffer() const { return _duuWeightsBuffer; }
74 id<MTLBuffer> GetDuvWeightsBuffer() const { return _duvWeightsBuffer; }
75 id<MTLBuffer> GetDvvWeightsBuffer() const { return _dvvWeightsBuffer; }
76
77 int GetNumStencils() const { return _numStencils; }
78
79 private:
80 id<MTLBuffer> _sizesBuffer;
81 id<MTLBuffer> _offsetsBuffer;
82 id<MTLBuffer> _indicesBuffer;
83 id<MTLBuffer> _weightsBuffer;
84 id<MTLBuffer> _duWeightsBuffer;
85 id<MTLBuffer> _dvWeightsBuffer;
86 id<MTLBuffer> _duuWeightsBuffer;
87 id<MTLBuffer> _duvWeightsBuffer;
88 id<MTLBuffer> _dvvWeightsBuffer;
89
90 int _numStencils;
91 };
92
93 class MTLComputeEvaluator
94 {
95 public:
96 typedef bool Instantiatable;
97
98 static MTLComputeEvaluator * Create(BufferDescriptor const &srcDesc,
99 BufferDescriptor const &dstDesc,
100 BufferDescriptor const &duDesc,
101 BufferDescriptor const &dvDesc,
102 MTLContext* context);
103
104 static MTLComputeEvaluator * Create(BufferDescriptor const &srcDesc,
105 BufferDescriptor const &dstDesc,
106 BufferDescriptor const &duDesc,
107 BufferDescriptor const &dvDesc,
108 BufferDescriptor const &duuDesc,
109 BufferDescriptor const &duvDesc,
110 BufferDescriptor const &dvvDesc,
111 MTLContext* context);
112
113 MTLComputeEvaluator();
114 ~MTLComputeEvaluator();
115
121
150 template <typename SRC_BUFFER, typename DST_BUFFER, typename STENCIL_TABLE>
151 static bool EvalStencils(
152 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
153 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
154 STENCIL_TABLE const *stencilTable,
155 MTLComputeEvaluator const *instance,
156 MTLContext* context)
157 {
158 if (instance)
159 {
160 return instance->EvalStencils(srcBuffer, srcDesc,
161 dstBuffer, dstDesc,
162 stencilTable,
163 context);
164 }
165 else
166 {
167 // Create an instance on demand (slow)
168 instance = Create(srcDesc, dstDesc,
169 BufferDescriptor(),
170 BufferDescriptor(),
171 context);
172 if (instance)
173 {
174 bool r = instance->EvalStencils(srcBuffer, srcDesc,
175 dstBuffer, dstDesc,
176 stencilTable,
177 context);
178 delete instance;
179 return r;
180 }
181 return false;
182 }
183 }
184
225 template <typename SRC_BUFFER, typename DST_BUFFER, typename STENCIL_TABLE>
226 static bool EvalStencils(
227 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
228 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
229 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
230 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
231 STENCIL_TABLE const *stencilTable,
232 MTLComputeEvaluator const *instance,
233 MTLContext* context) {
234
235 if (instance) {
236 return instance->EvalStencils(srcBuffer, srcDesc,
237 dstBuffer, dstDesc,
238 duBuffer, duDesc,
239 dvBuffer, dvDesc,
240 stencilTable,
241 context);
242 } else {
243 // Create an instance on demand (slow)
244 instance = Create(srcDesc, dstDesc, duDesc, dvDesc, context);
245 if (instance) {
246 bool r = instance->EvalStencils(srcBuffer, srcDesc,
247 dstBuffer, dstDesc,
248 duBuffer, duDesc,
249 dvBuffer, dvDesc,
250 stencilTable,
251 context);
252 delete instance;
253 return r;
254 }
255 return false;
256 }
257 }
258
317 template <typename SRC_BUFFER, typename DST_BUFFER, typename STENCIL_TABLE>
318 static bool EvalStencils(
319 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
320 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
321 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
322 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
323 DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc,
324 DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc,
325 DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc,
326 STENCIL_TABLE const *stencilTable,
327 MTLComputeEvaluator const *instance,
328 MTLContext* context) {
329
330 if (instance) {
331 return instance->EvalStencils(srcBuffer, srcDesc,
332 dstBuffer, dstDesc,
333 duBuffer, duDesc,
334 dvBuffer, dvDesc,
335 duuBuffer, duuDesc,
336 duvBuffer, duvDesc,
337 dvvBuffer, dvvDesc,
338 stencilTable,
339 context);
340 } else {
341 // Create an instance on demand (slow)
342 instance = Create(srcDesc, dstDesc, duDesc, dvDesc,
343 duuDesc, duvDesc, dvvDesc, context);
344 if (instance) {
345 bool r = instance->EvalStencils(srcBuffer, srcDesc,
346 dstBuffer, dstDesc,
347 duBuffer, duDesc,
348 dvBuffer, dvDesc,
349 duuBuffer, duuDesc,
350 duvBuffer, duvDesc,
351 dvvBuffer, dvvDesc,
352 stencilTable,
353 context);
354 delete instance;
355 return r;
356 }
357 return false;
358 }
359 }
360
381 template <typename SRC_BUFFER, typename DST_BUFFER, typename STENCIL_TABLE>
382 bool EvalStencils(
383 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
384 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
385 STENCIL_TABLE const *stencilTable,
386 MTLContext* context) const
387 {
388 return EvalStencils(srcBuffer->BindMTLBuffer(context), srcDesc,
389 dstBuffer->BindMTLBuffer(context), dstDesc,
390 0, BufferDescriptor(),
391 0, BufferDescriptor(),
392 stencilTable->GetSizesBuffer(),
393 stencilTable->GetOffsetsBuffer(),
394 stencilTable->GetIndicesBuffer(),
395 stencilTable->GetWeightsBuffer(),
396 0,
397 0,
398 /* start = */ 0,
399 /* end = */ stencilTable->GetNumStencils(),
400 context);
401 }
402
435 template <typename SRC_BUFFER, typename DST_BUFFER, typename STENCIL_TABLE>
436 bool EvalStencils(
437 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
438 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
439 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
440 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
441 STENCIL_TABLE const *stencilTable,
442 MTLContext* context) const
443 {
444 return EvalStencils(srcBuffer->BindMTLBuffer(context), srcDesc,
445 dstBuffer->BindMTLBuffer(context), dstDesc,
446 duBuffer->BindMTLBuffer(context), duDesc,
447 dvBuffer->BindMTLBuffer(context), dvDesc,
448 stencilTable->GetSizesBuffer(),
449 stencilTable->GetOffsetsBuffer(),
450 stencilTable->GetIndicesBuffer(),
451 stencilTable->GetWeightsBuffer(),
452 stencilTable->GetDuWeightsBuffer(),
453 stencilTable->GetDvWeightsBuffer(),
454 /* start = */ 0,
455 /* end = */ stencilTable->GetNumStencils(),
456 context);
457 }
458
509 template <typename SRC_BUFFER, typename DST_BUFFER, typename STENCIL_TABLE>
510 bool EvalStencils(
511 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
512 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
513 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
514 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
515 DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc,
516 DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc,
517 DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc,
518 STENCIL_TABLE const *stencilTable,
519 MTLContext* context) const
520 {
521 return EvalStencils(srcBuffer->BindMTLBuffer(context), srcDesc,
522 dstBuffer->BindMTLBuffer(context), dstDesc,
523 duBuffer->BindMTLBuffer(context), duDesc,
524 dvBuffer->BindMTLBuffer(context), dvDesc,
525 duuBuffer->BindMTLBuffer(context), duuDesc,
526 duvBuffer->BindMTLBuffer(context), duvDesc,
527 dvvBuffer->BindMTLBuffer(context), dvvDesc,
528 stencilTable->GetSizesBuffer(),
529 stencilTable->GetOffsetsBuffer(),
530 stencilTable->GetIndicesBuffer(),
531 stencilTable->GetWeightsBuffer(),
532 stencilTable->GetDuWeightsBuffer(),
533 stencilTable->GetDvWeightsBuffer(),
534 stencilTable->GetDuuWeightsBuffer(),
535 stencilTable->GetDuvWeightsBuffer(),
536 stencilTable->GetDvvWeightsBuffer(),
537 /* start = */ 0,
538 /* end = */ stencilTable->GetNumStencils(),
539 context);
540 }
541
580 bool EvalStencils(id<MTLBuffer> srcBuffer, BufferDescriptor const &srcDesc,
581 id<MTLBuffer> dstBuffer, BufferDescriptor const &dstDesc,
582 id<MTLBuffer> duBuffer, BufferDescriptor const &duDesc,
583 id<MTLBuffer> dvBuffer, BufferDescriptor const &dvDesc,
584 id<MTLBuffer> sizesBuffer,
585 id<MTLBuffer> offsetsBuffer,
586 id<MTLBuffer> indicesBuffer,
587 id<MTLBuffer> weightsBuffer,
588 id<MTLBuffer> duWeightsBuffer,
589 id<MTLBuffer> dvWeightsBuffer,
590 int start,
591 int end,
592 MTLContext* context) const;
593
650 bool EvalStencils(id<MTLBuffer> srcBuffer, BufferDescriptor const &srcDesc,
651 id<MTLBuffer> dstBuffer, BufferDescriptor const &dstDesc,
652 id<MTLBuffer> duBuffer, BufferDescriptor const &duDesc,
653 id<MTLBuffer> dvBuffer, BufferDescriptor const &dvDesc,
654 id<MTLBuffer> duuBuffer, BufferDescriptor const &duuDesc,
655 id<MTLBuffer> duvBuffer, BufferDescriptor const &duvDesc,
656 id<MTLBuffer> dvvBuffer, BufferDescriptor const &dvvDesc,
657 id<MTLBuffer> sizesBuffer,
658 id<MTLBuffer> offsetsBuffer,
659 id<MTLBuffer> indicesBuffer,
660 id<MTLBuffer> weightsBuffer,
661 id<MTLBuffer> duWeightsBuffer,
662 id<MTLBuffer> dvWeightsBuffer,
663 id<MTLBuffer> duuWeightsBuffer,
664 id<MTLBuffer> duvWeightsBuffer,
665 id<MTLBuffer> dvvWeightsBuffer,
666 int start,
667 int end,
668 MTLContext* context) const;
669
675
709 template <typename SRC_BUFFER, typename DST_BUFFER,
710 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
711 static bool EvalPatches(
712 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
713 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
714 int numPatchCoords,
715 PATCHCOORD_BUFFER *patchCoords,
716 PATCH_TABLE *patchTable,
717 MTLComputeEvaluator const *instance,
718 MTLContext* context) {
719
720 if (instance) {
721 return instance->EvalPatches(srcBuffer, srcDesc,
722 dstBuffer, dstDesc,
723 numPatchCoords, patchCoords,
724 patchTable,
725 context);
726 } else {
727 // Create an instance on demand (slow)
728 instance = Create(srcDesc, dstDesc,
729 BufferDescriptor(),
730 BufferDescriptor(),
731 context);
732 if (instance) {
733 bool r = instance->EvalPatches(srcBuffer, srcDesc,
734 dstBuffer, dstDesc,
735 numPatchCoords, patchCoords,
736 patchTable,
737 context);
738 delete instance;
739 return r;
740 }
741 return false;
742 }
743 }
744
790 template <typename SRC_BUFFER, typename DST_BUFFER,
791 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
792 static bool EvalPatches(
793 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
794 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
795 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
796 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
797 int numPatchCoords,
798 PATCHCOORD_BUFFER *patchCoords,
799 PATCH_TABLE *patchTable,
800 MTLComputeEvaluator* instance,
801 MTLContext* context) {
802
803 if (instance) {
804 return instance->EvalPatches(srcBuffer, srcDesc,
805 dstBuffer, dstDesc,
806 duBuffer, duDesc,
807 dvBuffer, dvDesc,
808 numPatchCoords, patchCoords,
809 patchTable,
810 context);
811 } else {
812 // Create an instance on demand (slow)
813 instance = Create(srcDesc, dstDesc,
814 duDesc, dvDesc, context);
815 if (instance) {
816 bool r = instance->EvalPatches(srcBuffer, srcDesc,
817 dstBuffer, dstDesc,
818 duBuffer, duDesc,
819 dvBuffer, dvDesc,
820 numPatchCoords, patchCoords,
821 patchTable,
822 context);
823 delete instance;
824 return r;
825 }
826 return false;
827 }
828 }
829
893 template <typename SRC_BUFFER, typename DST_BUFFER,
894 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
895 static bool EvalPatches(
896 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
897 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
898 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
899 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
900 DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc,
901 DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc,
902 DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc,
903 int numPatchCoords,
904 PATCHCOORD_BUFFER *patchCoords,
905 PATCH_TABLE *patchTable,
906 MTLComputeEvaluator* instance,
907 MTLContext* context) {
908
909 if (instance) {
910 return instance->EvalPatches(srcBuffer, srcDesc,
911 dstBuffer, dstDesc,
912 duBuffer, duDesc,
913 dvBuffer, dvDesc,
914 duuBuffer, duuDesc,
915 duvBuffer, duvDesc,
916 dvvBuffer, dvvDesc,
917 numPatchCoords, patchCoords,
918 patchTable,
919 context);
920 } else {
921 // Create an instance on demand (slow)
922 instance = Create(srcDesc, dstDesc,
923 duDesc, dvDesc,
924 duuDesc, duvDesc, dvvDesc, context);
925 if (instance) {
926 bool r = instance->EvalPatches(srcBuffer, srcDesc,
927 dstBuffer, dstDesc,
928 duBuffer, duDesc,
929 dvBuffer, dvDesc,
930 duuBuffer, duuDesc,
931 duvBuffer, duvDesc,
932 dvvBuffer, dvvDesc,
933 numPatchCoords, patchCoords,
934 patchTable,
935 context);
936 delete instance;
937 return r;
938 }
939 return false;
940 }
941 }
942
970 template <typename SRC_BUFFER, typename DST_BUFFER,
971 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
972 bool EvalPatches(
973 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
974 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
975 int numPatchCoords,
976 PATCHCOORD_BUFFER *patchCoords,
977 PATCH_TABLE *patchTable,
978 MTLContext* context) const {
979
980 return EvalPatches(srcBuffer->BindMTLBuffer(context), srcDesc,
981 dstBuffer->BindMTLBuffer(context), dstDesc,
982 0, BufferDescriptor(),
983 0, BufferDescriptor(),
984 numPatchCoords,
985 patchCoords->BindMTLBuffer(context),
986 patchTable->GetPatchArrays(),
987 patchTable->GetPatchIndexBuffer(),
988 patchTable->GetPatchParamBuffer(),
989 context);
990 }
991
1029 template <typename SRC_BUFFER, typename DST_BUFFER,
1030 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1031 bool EvalPatches(
1032 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1033 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1034 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
1035 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
1036 int numPatchCoords,
1037 PATCHCOORD_BUFFER *patchCoords,
1038 PATCH_TABLE *patchTable,
1039 MTLContext* context) const {
1040
1041 return EvalPatches(srcBuffer->BindMTLBuffer(context), srcDesc,
1042 dstBuffer->BindMTLBuffer(context), dstDesc,
1043 duBuffer->BindMTLBuffer(context), duDesc,
1044 dvBuffer->BindMTLBuffer(context), dvDesc,
1045 numPatchCoords,
1046 patchCoords->BindMTLBuffer(context),
1047 patchTable->GetPatchArrays(),
1048 patchTable->GetPatchIndexBuffer(),
1049 patchTable->GetPatchParamBuffer(),
1050 context);
1051 }
1052
1108 template <typename SRC_BUFFER, typename DST_BUFFER,
1109 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1110 bool EvalPatches(
1111 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1112 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1113 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
1114 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
1115 DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc,
1116 DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc,
1117 DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc,
1118 int numPatchCoords,
1119 PATCHCOORD_BUFFER *patchCoords,
1120 PATCH_TABLE *patchTable,
1121 MTLContext* context) const {
1122
1123 return EvalPatches(srcBuffer->BindMTLBuffer(context), srcDesc,
1124 dstBuffer->BindMTLBuffer(context), dstDesc,
1125 duBuffer->BindMTLBuffer(context), duDesc,
1126 dvBuffer->BindMTLBuffer(context), dvDesc,
1127 duuBuffer->BindMTLBuffer(context), duuDesc,
1128 duvBuffer->BindMTLBuffer(context), duvDesc,
1129 dvvBuffer->BindMTLBuffer(context), dvvDesc,
1130 numPatchCoords,
1131 patchCoords->BindMTLBuffer(context),
1132 patchTable->GetPatchArrays(),
1133 patchTable->GetPatchIndexBuffer(),
1134 patchTable->GetPatchParamBuffer(),
1135 context);
1136 }
1137
1138 bool EvalPatches(id<MTLBuffer> srcBuffer, BufferDescriptor const &srcDesc,
1139 id<MTLBuffer> dstBuffer, BufferDescriptor const &dstDesc,
1140 id<MTLBuffer> duBuffer, BufferDescriptor const &duDesc,
1141 id<MTLBuffer> dvBuffer, BufferDescriptor const &dvDesc,
1142 int numPatchCoords,
1143 id<MTLBuffer> patchCoordsBuffer,
1144 const PatchArrayVector &patchArrays,
1145 id<MTLBuffer> patchIndexBuffer,
1146 id<MTLBuffer> patchParamsBuffer,
1147 MTLContext* context) const;
1148
1149 bool EvalPatches(id<MTLBuffer> srcBuffer, BufferDescriptor const &srcDesc,
1150 id<MTLBuffer> dstBuffer, BufferDescriptor const &dstDesc,
1151 id<MTLBuffer> duBuffer, BufferDescriptor const &duDesc,
1152 id<MTLBuffer> dvBuffer, BufferDescriptor const &dvDesc,
1153 id<MTLBuffer> duuBuffer, BufferDescriptor const &duuDesc,
1154 id<MTLBuffer> duvBuffer, BufferDescriptor const &duvDesc,
1155 id<MTLBuffer> dvvBuffer, BufferDescriptor const &dvvDesc,
1156 int numPatchCoords,
1157 id<MTLBuffer> patchCoordsBuffer,
1158 const PatchArrayVector &patchArrays,
1159 id<MTLBuffer> patchIndexBuffer,
1160 id<MTLBuffer> patchParamsBuffer,
1161 MTLContext* context) const;
1162
1196 template <typename SRC_BUFFER, typename DST_BUFFER,
1197 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1198 static bool EvalPatchesVarying(
1199 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1200 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1201 int numPatchCoords,
1202 PATCHCOORD_BUFFER *patchCoords,
1203 PATCH_TABLE *patchTable,
1204 MTLComputeEvaluator const *instance,
1205 MTLContext* deviceContext) {
1206
1207 if (instance) {
1208 return instance->EvalPatchesVarying(
1209 srcBuffer, srcDesc,
1210 dstBuffer, dstDesc,
1211 numPatchCoords, patchCoords,
1212 patchTable,
1213 deviceContext);
1214 } else {
1215 // Create an instance on demand (slow)
1216 instance = Create(srcDesc, dstDesc,
1217 BufferDescriptor(),
1218 BufferDescriptor(),
1219 deviceContext);
1220 if (instance) {
1221 bool r = instance->EvalPatchesVarying(
1222 srcBuffer, srcDesc,
1223 dstBuffer, dstDesc,
1224 numPatchCoords, patchCoords,
1225 patchTable,
1226 deviceContext);
1227 delete instance;
1228 return r;
1229 }
1230 return false;
1231 }
1232 }
1233
1261 template <typename SRC_BUFFER, typename DST_BUFFER,
1262 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1263 bool EvalPatchesVarying(
1264 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1265 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1266 int numPatchCoords,
1267 PATCHCOORD_BUFFER *patchCoords,
1268 PATCH_TABLE *patchTable,
1269 MTLContext* deviceContext) const {
1270
1271 return EvalPatches(srcBuffer->BindMTLBuffer(deviceContext), srcDesc,
1272 dstBuffer->BindMTLBuffer(deviceContext), dstDesc,
1273 0, BufferDescriptor(),
1274 0, BufferDescriptor(),
1275 numPatchCoords,
1276 patchCoords->BindMTLBuffer(deviceContext),
1277 patchTable->GetVaryingPatchArrays(),
1278 patchTable->GetVaryingPatchIndexBuffer(),
1279 patchTable->GetPatchParamBuffer(),
1280 deviceContext
1281 );
1282 }
1283
1329 template <typename SRC_BUFFER, typename DST_BUFFER,
1330 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1331 static bool EvalPatchesVarying(
1332 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1333 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1334 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
1335 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
1336 int numPatchCoords,
1337 PATCHCOORD_BUFFER *patchCoords,
1338 PATCH_TABLE *patchTable,
1339 MTLComputeEvaluator const *instance,
1340 MTLContext* deviceContext) {
1341
1342 if (instance) {
1343 return instance->EvalPatchesVarying(
1344 srcBuffer, srcDesc,
1345 dstBuffer, dstDesc,
1346 duBuffer, duDesc,
1347 dvBuffer, dvDesc,
1348 numPatchCoords, patchCoords,
1349 patchTable,
1350 deviceContext);
1351 } else {
1352 // Create an instance on demand (slow)
1353 instance = Create(srcDesc, dstDesc,
1354 duDesc, dvDesc,
1355 deviceContext);
1356 if (instance) {
1357 bool r = instance->EvalPatchesVarying(
1358 srcBuffer, srcDesc,
1359 dstBuffer, dstDesc,
1360 duBuffer, duDesc,
1361 dvBuffer, dvDesc,
1362 numPatchCoords, patchCoords,
1363 patchTable,
1364 deviceContext);
1365 delete instance;
1366 return r;
1367 }
1368 return false;
1369 }
1370 }
1371
1411 template <typename SRC_BUFFER, typename DST_BUFFER,
1412 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1413 bool EvalPatchesVarying(
1414 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1415 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1416 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
1417 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
1418 int numPatchCoords,
1419 PATCHCOORD_BUFFER *patchCoords,
1420 PATCH_TABLE *patchTable,
1421 MTLContext* deviceContext) const {
1422
1423 return EvalPatches(srcBuffer->BindMTLBuffer(deviceContext), srcDesc,
1424 dstBuffer->BindMTLBuffer(deviceContext), dstDesc,
1425 duBuffer->BindMTLBuffer(deviceContext), duDesc,
1426 dvBuffer->BindMTLBuffer(deviceContext), dvDesc,
1427 numPatchCoords,
1428 patchCoords->BindMTLBuffer(deviceContext),
1429 patchTable->GetVaryingPatchArrays(),
1430 patchTable->GetVaryingPatchIndexBuffer(),
1431 patchTable->GetPatchParamBuffer(),
1432 deviceContext
1433 );
1434 }
1435
1436
1500 template <typename SRC_BUFFER, typename DST_BUFFER,
1501 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1502 static bool EvalPatchesVarying(
1503 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1504 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1505 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
1506 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
1507 DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc,
1508 DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc,
1509 DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc,
1510 int numPatchCoords,
1511 PATCHCOORD_BUFFER *patchCoords,
1512 PATCH_TABLE *patchTable,
1513 MTLComputeEvaluator const *instance,
1514 MTLContext* deviceContext) {
1515
1516 if (instance) {
1517 return instance->EvalPatchesVarying(
1518 srcBuffer, srcDesc,
1519 dstBuffer, dstDesc,
1520 duBuffer, duDesc,
1521 dvBuffer, dvDesc,
1522 duuBuffer, duuDesc,
1523 duvBuffer, duvDesc,
1524 dvvBuffer, dvvDesc,
1525 numPatchCoords, patchCoords,
1526 patchTable,
1527 deviceContext);
1528 } else {
1529 // Create an instance on demand (slow)
1530 instance = Create(srcDesc, dstDesc,
1531 duDesc, dvDesc,
1532 duuDesc, duvDesc, dvvDesc,
1533 deviceContext);
1534 if (instance) {
1535 bool r = instance->EvalPatchesVarying(
1536 srcBuffer, srcDesc,
1537 dstBuffer, dstDesc,
1538 duBuffer, duDesc,
1539 dvBuffer, dvDesc,
1540 duuBuffer, duuDesc,
1541 duvBuffer, duvDesc,
1542 dvvBuffer, dvvDesc,
1543 numPatchCoords, patchCoords,
1544 patchTable,
1545 deviceContext);
1546 delete instance;
1547 return r;
1548 }
1549 return false;
1550 }
1551 }
1552
1610 template <typename SRC_BUFFER, typename DST_BUFFER,
1611 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1612 bool EvalPatchesVarying(
1613 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1614 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1615 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
1616 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
1617 DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc,
1618 DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc,
1619 DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc,
1620 int numPatchCoords,
1621 PATCHCOORD_BUFFER *patchCoords,
1622 PATCH_TABLE *patchTable,
1623 MTLContext* deviceContext) const {
1624
1625 return EvalPatches(srcBuffer->BindMTLBuffer(deviceContext), srcDesc,
1626 dstBuffer->BindMTLBuffer(deviceContext), dstDesc,
1627 duBuffer->BindMTLBuffer(deviceContext), duDesc,
1628 dvBuffer->BindMTLBuffer(deviceContext), dvDesc,
1629 duuBuffer->BindMTLBuffer(deviceContext), duuDesc,
1630 duvBuffer->BindMTLBuffer(deviceContext), duvDesc,
1631 dvvBuffer->BindMTLBuffer(deviceContext), dvvDesc,
1632 numPatchCoords,
1633 patchCoords->BindMTLBuffer(deviceContext),
1634 patchTable->GetVaryingPatchArrays(),
1635 patchTable->GetVaryingPatchIndexBuffer(),
1636 patchTable->GetPatchParamBuffer(),
1637 deviceContext
1638 );
1639 }
1640
1676 template <typename SRC_BUFFER, typename DST_BUFFER,
1677 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1678 static bool EvalPatchesFaceVarying(
1679 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1680 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1681 int numPatchCoords,
1682 PATCHCOORD_BUFFER *patchCoords,
1683 PATCH_TABLE *patchTable,
1684 int fvarChannel,
1685 MTLComputeEvaluator const *instance,
1686 MTLContext* deviceContext) {
1687
1688 if (instance) {
1689 return instance->EvalPatchesFaceVarying(
1690 srcBuffer, srcDesc,
1691 dstBuffer, dstDesc,
1692 numPatchCoords, patchCoords,
1693 patchTable,
1694 fvarChannel,
1695 deviceContext);
1696 } else {
1697 // Create an instance on demand (slow)
1698 instance = Create(srcDesc, dstDesc,
1699 BufferDescriptor(),
1700 BufferDescriptor(),
1701 deviceContext);
1702 if (instance) {
1703 bool r = instance->EvalPatchesFaceVarying(
1704 srcBuffer, srcDesc,
1705 dstBuffer, dstDesc,
1706 numPatchCoords, patchCoords,
1707 patchTable,
1708 fvarChannel,
1709 deviceContext);
1710 delete instance;
1711 return r;
1712 }
1713 return false;
1714 }
1715 }
1716
1746 template <typename SRC_BUFFER, typename DST_BUFFER,
1747 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1748 bool EvalPatchesFaceVarying(
1749 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1750 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1751 int numPatchCoords,
1752 PATCHCOORD_BUFFER *patchCoords,
1753 PATCH_TABLE *patchTable,
1754 int fvarChannel,
1755 MTLContext* deviceContext) const {
1756
1757 return EvalPatches(srcBuffer->BindMTLBuffer(deviceContext), srcDesc,
1758 dstBuffer->BindMTLBuffer(deviceContext), dstDesc,
1759 0, BufferDescriptor(),
1760 0, BufferDescriptor(),
1761 numPatchCoords,
1762 patchCoords->BindMTLBuffer(deviceContext),
1763 patchTable->GetFVarPatchArrays(fvarChannel),
1764 patchTable->GetFVarPatchIndexBuffer(fvarChannel),
1765 patchTable->GetFVarPatchParamBuffer(fvarChannel),
1766 deviceContext
1767 );
1768 }
1769
1817 template <typename SRC_BUFFER, typename DST_BUFFER,
1818 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1819 static bool EvalPatchesFaceVarying(
1820 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1821 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1822 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
1823 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
1824 int numPatchCoords,
1825 PATCHCOORD_BUFFER *patchCoords,
1826 PATCH_TABLE *patchTable,
1827 int fvarChannel,
1828 MTLComputeEvaluator const *instance,
1829 MTLContext* deviceContext) {
1830
1831 if (instance) {
1832 return instance->EvalPatchesFaceVarying(
1833 srcBuffer, srcDesc,
1834 dstBuffer, dstDesc,
1835 duBuffer, duDesc,
1836 dvBuffer, dvDesc,
1837 numPatchCoords, patchCoords,
1838 patchTable,
1839 fvarChannel,
1840 deviceContext);
1841 } else {
1842 // Create an instance on demand (slow)
1843 instance = Create(srcDesc, dstDesc,
1844 duDesc, dvDesc,
1845 deviceContext);
1846 if (instance) {
1847 bool r = instance->EvalPatchesFaceVarying(
1848 srcBuffer, srcDesc,
1849 dstBuffer, dstDesc,
1850 duBuffer, duDesc,
1851 dvBuffer, dvDesc,
1852 numPatchCoords, patchCoords,
1853 patchTable,
1854 fvarChannel,
1855 deviceContext);
1856 delete instance;
1857 return r;
1858 }
1859 return false;
1860 }
1861 }
1862
1904 template <typename SRC_BUFFER, typename DST_BUFFER,
1905 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1906 bool EvalPatchesFaceVarying(
1907 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1908 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1909 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
1910 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
1911 int numPatchCoords,
1912 PATCHCOORD_BUFFER *patchCoords,
1913 PATCH_TABLE *patchTable,
1914 int fvarChannel,
1915 MTLContext* deviceContext) const {
1916
1917 return EvalPatches(srcBuffer->BindMTLBuffer(deviceContext), srcDesc,
1918 dstBuffer->BindMTLBuffer(deviceContext), dstDesc,
1919 duBuffer->BindMTLBuffer(deviceContext), duDesc,
1920 dvBuffer->BindMTLBuffer(deviceContext), dvDesc,
1921 numPatchCoords,
1922 patchCoords->BindMTLBuffer(deviceContext),
1923 patchTable->GetFVarPatchArrays(fvarChannel),
1924 patchTable->GetFVarPatchIndexBuffer(fvarChannel),
1925 patchTable->GetFVarPatchParamBuffer(fvarChannel),
1926 deviceContext
1927 );
1928 }
1929
1995 template <typename SRC_BUFFER, typename DST_BUFFER,
1996 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1997 static bool EvalPatchesFaceVarying(
1998 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1999 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
2000 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
2001 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
2002 DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc,
2003 DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc,
2004 DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc,
2005 int numPatchCoords,
2006 PATCHCOORD_BUFFER *patchCoords,
2007 PATCH_TABLE *patchTable,
2008 int fvarChannel,
2009 MTLComputeEvaluator const *instance,
2010 MTLContext* deviceContext) {
2011
2012 if (instance) {
2013 return instance->EvalPatchesFaceVarying(
2014 srcBuffer, srcDesc,
2015 dstBuffer, dstDesc,
2016 duBuffer, duDesc,
2017 dvBuffer, dvDesc,
2018 duuBuffer, duuDesc,
2019 duvBuffer, duvDesc,
2020 dvvBuffer, dvvDesc,
2021 numPatchCoords, patchCoords,
2022 patchTable,
2023 fvarChannel,
2024 deviceContext);
2025 } else {
2026 // Create an instance on demand (slow)
2027 instance = Create(srcDesc, dstDesc,
2028 duDesc, dvDesc,
2029 duuDesc, duvDesc, dvvDesc,
2030 deviceContext);
2031 if (instance) {
2032 bool r = instance->EvalPatchesFaceVarying(
2033 srcBuffer, srcDesc,
2034 dstBuffer, dstDesc,
2035 duBuffer, duDesc,
2036 dvBuffer, dvDesc,
2037 duuBuffer, duuDesc,
2038 duvBuffer, duvDesc,
2039 dvvBuffer, dvvDesc,
2040 numPatchCoords, patchCoords,
2041 patchTable,
2042 fvarChannel,
2043 deviceContext);
2044 delete instance;
2045 return r;
2046 }
2047 return false;
2048 }
2049 }
2050
2110 template <typename SRC_BUFFER, typename DST_BUFFER,
2111 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
2112 bool EvalPatchesFaceVarying(
2113 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
2114 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
2115 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
2116 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
2117 DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc,
2118 DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc,
2119 DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc,
2120 int numPatchCoords,
2121 PATCHCOORD_BUFFER *patchCoords,
2122 PATCH_TABLE *patchTable,
2123 int fvarChannel,
2124 MTLContext* deviceContext) const {
2125
2126 return EvalPatches(srcBuffer->BindMTLBuffer(deviceContext), srcDesc,
2127 dstBuffer->BindMTLBuffer(deviceContext), dstDesc,
2128 duBuffer->BindMTLBuffer(deviceContext), duDesc,
2129 dvBuffer->BindMTLBuffer(deviceContext), dvDesc,
2130 duuBuffer->BindMTLBuffer(deviceContext), duuDesc,
2131 duvBuffer->BindMTLBuffer(deviceContext), duvDesc,
2132 dvvBuffer->BindMTLBuffer(deviceContext), dvvDesc,
2133 numPatchCoords,
2134 patchCoords->BindMTLBuffer(deviceContext),
2135 patchTable->GetFVarPatchArrays(fvarChannel),
2136 patchTable->GetFVarPatchIndexBuffer(fvarChannel),
2137 patchTable->GetFVarPatchParamBuffer(fvarChannel),
2138 fvarChannel,
2139 deviceContext
2140 );
2141 }
2142
2144 bool Compile(BufferDescriptor const &srcDesc,
2145 BufferDescriptor const &dstDesc,
2146 BufferDescriptor const &duDesc,
2147 BufferDescriptor const &dvDesc,
2148 BufferDescriptor const &duuDesc,
2149 BufferDescriptor const &duvDesc,
2150 BufferDescriptor const &dvvDesc,
2151 MTLContext* context);
2152
2154 static void Synchronize(MTLContext* context);
2155
2156 private:
2157
2158 id<MTLLibrary> _computeLibrary;
2159 id<MTLComputePipelineState> _evalStencils;
2160 id<MTLComputePipelineState> _evalPatches;
2161 id<MTLBuffer> _parameterBuffer;
2162
2163 int _workGroupSize;
2164 };
2165 } //end namespace Osd
2166 } //end namespace OPENSUBDIV_VERSION
2167 using namespace OPENSUBDIV_VERSION;
2168 } //end namespace OpenSubdiv
2169 #endif // OPENSUBDIV3_OSD_MTL_COMPUTE_EVALUATOR_H
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator::EvalPatchesVarying
bool EvalPatchesVarying(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, DST_BUFFER *duBuffer, BufferDescriptor const &duDesc, DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc, DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc, DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc, DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, MTLContext *deviceContext) const
Generic limit eval function. This function has a same signature as other device kernels have so that ...
Definition: mtlComputeEvaluator.h:1612
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator::EvalPatchesFaceVarying
bool EvalPatchesFaceVarying(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, int fvarChannel, MTLContext *deviceContext) const
Generic limit eval function. This function has a same signature as other device kernels have so that ...
Definition: mtlComputeEvaluator.h:1748
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator::EvalPatchesVarying
static bool EvalPatchesVarying(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, DST_BUFFER *duBuffer, BufferDescriptor const &duDesc, DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc, DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc, DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc, DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, MTLComputeEvaluator const *instance, MTLContext *deviceContext)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
Definition: mtlComputeEvaluator.h:1502
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator::EvalPatchesFaceVarying
bool EvalPatchesFaceVarying(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, DST_BUFFER *duBuffer, BufferDescriptor const &duDesc, DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc, DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc, DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc, DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, int fvarChannel, MTLContext *deviceContext) const
Generic limit eval function. This function has a same signature as other device kernels have so that ...
Definition: mtlComputeEvaluator.h:2112
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLStencilTable::GetDvWeightsBuffer
id< MTLBuffer > GetDvWeightsBuffer() const
Definition: mtlComputeEvaluator.h:72
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator::EvalStencils
bool EvalStencils(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, STENCIL_TABLE const *stencilTable, MTLContext *context) const
Generic stencil function.
Definition: mtlComputeEvaluator.h:382
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator::EvalPatches
bool EvalPatches(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, DST_BUFFER *duBuffer, BufferDescriptor const &duDesc, DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc, DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc, DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc, DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, MTLContext *context) const
Generic limit eval function with derivatives. This function has a same signature as other device kern...
Definition: mtlComputeEvaluator.h:1110
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator::EvalStencils
static bool EvalStencils(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, STENCIL_TABLE const *stencilTable, MTLComputeEvaluator const *instance, MTLContext *context)
Generic static stencil function. This function has a same signature as other device kernels have so t...
Definition: mtlComputeEvaluator.h:151
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLStencilTable::GetDuvWeightsBuffer
id< MTLBuffer > GetDuvWeightsBuffer() const
Definition: mtlComputeEvaluator.h:74
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator::EvalPatchesFaceVarying
bool EvalPatchesFaceVarying(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, DST_BUFFER *duBuffer, BufferDescriptor const &duDesc, DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, int fvarChannel, MTLContext *deviceContext) const
Generic limit eval function. This function has a same signature as other device kernels have so that ...
Definition: mtlComputeEvaluator.h:1906
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator::EvalPatchesVarying
bool EvalPatchesVarying(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, DST_BUFFER *duBuffer, BufferDescriptor const &duDesc, DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, MTLContext *deviceContext) const
Generic limit eval function. This function has a same signature as other device kernels have so that ...
Definition: mtlComputeEvaluator.h:1413
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator::EvalPatches
static bool EvalPatches(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, MTLComputeEvaluator const *instance, MTLContext *context)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
Definition: mtlComputeEvaluator.h:711
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLStencilTable
Definition: mtlComputeEvaluator.h:51
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLStencilTable::GetDuuWeightsBuffer
id< MTLBuffer > GetDuuWeightsBuffer() const
Definition: mtlComputeEvaluator.h:73
OpenSubdiv::OPENSUBDIV_VERSION::Osd::PatchArrayVector
std::vector< PatchArray > PatchArrayVector
Definition: types.h:98
OpenSubdiv
Definition: error.h:30
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator::EvalPatches
bool EvalPatches(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, DST_BUFFER *duBuffer, BufferDescriptor const &duDesc, DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, MTLContext *context) const
Generic limit eval function with derivatives. This function has a same signature as other device kern...
Definition: mtlComputeEvaluator.h:1031
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator::EvalPatchesFaceVarying
static bool EvalPatchesFaceVarying(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, DST_BUFFER *duBuffer, BufferDescriptor const &duDesc, DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, int fvarChannel, MTLComputeEvaluator const *instance, MTLContext *deviceContext)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
Definition: mtlComputeEvaluator.h:1819
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator::EvalStencils
static bool EvalStencils(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, DST_BUFFER *duBuffer, BufferDescriptor const &duDesc, DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc, STENCIL_TABLE const *stencilTable, MTLComputeEvaluator const *instance, MTLContext *context)
Generic static stencil function. This function has a same signature as other device kernels have so t...
Definition: mtlComputeEvaluator.h:226
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLStencilTable::Create
static MTLStencilTable * Create(STENCIL_TABLE *stencilTable, DEVICE_CONTEXT context)
Definition: mtlComputeEvaluator.h:55
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator::EvalStencils
static bool EvalStencils(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, DST_BUFFER *duBuffer, BufferDescriptor const &duDesc, DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc, DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc, DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc, DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc, STENCIL_TABLE const *stencilTable, MTLComputeEvaluator const *instance, MTLContext *context)
Generic static stencil function. This function has a same signature as other device kernels have so t...
Definition: mtlComputeEvaluator.h:318
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator::EvalStencils
bool EvalStencils(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, DST_BUFFER *duBuffer, BufferDescriptor const &duDesc, DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc, STENCIL_TABLE const *stencilTable, MTLContext *context) const
Generic stencil function.
Definition: mtlComputeEvaluator.h:436
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator::EvalPatchesFaceVarying
static bool EvalPatchesFaceVarying(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, DST_BUFFER *duBuffer, BufferDescriptor const &duDesc, DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc, DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc, DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc, DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, int fvarChannel, MTLComputeEvaluator const *instance, MTLContext *deviceContext)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
Definition: mtlComputeEvaluator.h:1997
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLStencilTable::GetDuWeightsBuffer
id< MTLBuffer > GetDuWeightsBuffer() const
Definition: mtlComputeEvaluator.h:71
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLStencilTable::GetIndicesBuffer
id< MTLBuffer > GetIndicesBuffer() const
Definition: mtlComputeEvaluator.h:69
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator::EvalPatchesVarying
static bool EvalPatchesVarying(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, MTLComputeEvaluator const *instance, MTLContext *deviceContext)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
Definition: mtlComputeEvaluator.h:1198
OpenSubdiv::OPENSUBDIV_VERSION::Osd::BufferDescriptor
BufferDescriptor is a struct which describes buffer elements in interleaved data buffers. Almost all Osd Evaluator APIs take BufferDescriptors along with device-specific buffer objects.
Definition: bufferDescriptor.h:61
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLContext
Definition: mtlCommon.h:41
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator::EvalPatches
static bool EvalPatches(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, DST_BUFFER *duBuffer, BufferDescriptor const &duDesc, DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc, DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc, DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc, DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, MTLComputeEvaluator *instance, MTLContext *context)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
Definition: mtlComputeEvaluator.h:895
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTable
Table of subdivision stencils.
Definition: stencilTable.h:125
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator::Instantiatable
bool Instantiatable
Definition: mtlComputeEvaluator.h:96
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLStencilTable::GetWeightsBuffer
id< MTLBuffer > GetWeightsBuffer() const
Definition: mtlComputeEvaluator.h:70
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator
Definition: mtlComputeEvaluator.h:93
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLStencilTable::GetDvvWeightsBuffer
id< MTLBuffer > GetDvvWeightsBuffer() const
Definition: mtlComputeEvaluator.h:75
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTable
Table of limit subdivision stencils.
Definition: stencilTable.h:333
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator::EvalPatches
bool EvalPatches(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, MTLContext *context) const
Generic limit eval function. This function has a same signature as other device kernels have so that ...
Definition: mtlComputeEvaluator.h:972
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator::EvalPatchesVarying
static bool EvalPatchesVarying(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, DST_BUFFER *duBuffer, BufferDescriptor const &duDesc, DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, MTLComputeEvaluator const *instance, MTLContext *deviceContext)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
Definition: mtlComputeEvaluator.h:1331
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator::EvalPatchesFaceVarying
static bool EvalPatchesFaceVarying(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, int fvarChannel, MTLComputeEvaluator const *instance, MTLContext *deviceContext)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
Definition: mtlComputeEvaluator.h:1678
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator::EvalPatches
static bool EvalPatches(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, DST_BUFFER *duBuffer, BufferDescriptor const &duDesc, DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, MTLComputeEvaluator *instance, MTLContext *context)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
Definition: mtlComputeEvaluator.h:792
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLStencilTable::GetSizesBuffer
id< MTLBuffer > GetSizesBuffer() const
Definition: mtlComputeEvaluator.h:67
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator::EvalStencils
bool EvalStencils(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, DST_BUFFER *duBuffer, BufferDescriptor const &duDesc, DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc, DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc, DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc, DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc, STENCIL_TABLE const *stencilTable, MTLContext *context) const
Generic stencil function.
Definition: mtlComputeEvaluator.h:510
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLComputeEvaluator::EvalPatchesVarying
bool EvalPatchesVarying(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, MTLContext *deviceContext) const
Generic limit eval function. This function has a same signature as other device kernels have so that ...
Definition: mtlComputeEvaluator.h:1263
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLStencilTable::GetOffsetsBuffer
id< MTLBuffer > GetOffsetsBuffer() const
Definition: mtlComputeEvaluator.h:68
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLStencilTable::GetNumStencils
int GetNumStencils() const
Definition: mtlComputeEvaluator.h:77