OpenSubdiv
Loading...
Searching...
No Matches
glXFBEvaluator.h
Go to the documentation of this file.
1//
2// Copyright 2015 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_GL_XFB_EVALUATOR_H
26#define OPENSUBDIV3_OSD_GL_XFB_EVALUATOR_H
27
28#include "../version.h"
29
30#include "../osd/opengl.h"
31#include "../osd/types.h"
32#include "../osd/bufferDescriptor.h"
33
34namespace OpenSubdiv {
35namespace OPENSUBDIV_VERSION {
36
37namespace Far {
38 class PatchTable;
39 class StencilTable;
40 class LimitStencilTable;
41}
42
43namespace Osd {
44
53public:
55 Far::StencilTable const *stencilTable, void *deviceContext = NULL) {
56 (void)deviceContext; // unused
57 return new GLStencilTableTBO(stencilTable);
58 }
59
61 Far::LimitStencilTable const *limitStencilTable,
62 void *deviceContext = NULL) {
63 (void)deviceContext; // unused
64 return new GLStencilTableTBO(limitStencilTable);
65 }
66
67 explicit GLStencilTableTBO(Far::StencilTable const *stencilTable);
68 explicit GLStencilTableTBO(Far::LimitStencilTable const *limitStencilTable);
70
71 // interfaces needed for GLSLTransformFeedbackKernel
72 GLuint GetSizesTexture() const { return _sizes; }
73 GLuint GetOffsetsTexture() const { return _offsets; }
74 GLuint GetIndicesTexture() const { return _indices; }
75 GLuint GetWeightsTexture() const { return _weights; }
76 GLuint GetDuWeightsTexture() const { return _duWeights; }
77 GLuint GetDvWeightsTexture() const { return _dvWeights; }
78 GLuint GetDuuWeightsTexture() const { return _duuWeights; }
79 GLuint GetDuvWeightsTexture() const { return _duvWeights; }
80 GLuint GetDvvWeightsTexture() const { return _dvvWeights; }
81 int GetNumStencils() const { return _numStencils; }
82
83private:
84 GLuint _sizes;
85 GLuint _offsets;
86 GLuint _indices;
87 GLuint _weights;
88 GLuint _duWeights;
89 GLuint _dvWeights;
90 GLuint _duuWeights;
91 GLuint _duvWeights;
92 GLuint _dvvWeights;
93 int _numStencils;
94};
95
96// ---------------------------------------------------------------------------
97
99public:
100 typedef bool Instantiatable;
101
103 template <typename DEVICE_CONTEXT>
104 static GLXFBEvaluator *Create(BufferDescriptor const &srcDesc,
105 BufferDescriptor const &dstDesc,
106 BufferDescriptor const &duDesc,
107 BufferDescriptor const &dvDesc,
108 DEVICE_CONTEXT deviceContext) {
109 bool interleavedDerivativeBuffers = deviceContext
110 ? deviceContext->AreInterleavedDerivativeBuffers()
111 : false;
112 return Create(srcDesc, dstDesc, duDesc, dvDesc,
113 interleavedDerivativeBuffers);
114 }
115
117 static GLXFBEvaluator *Create(BufferDescriptor const &srcDesc,
118 BufferDescriptor const &dstDesc,
119 BufferDescriptor const &duDesc,
120 BufferDescriptor const &dvDesc,
121 void * deviceContext) {
122 (void)deviceContext; // not used
123 return Create(srcDesc, dstDesc, duDesc, dvDesc);
124 }
125
126 static GLXFBEvaluator * Create(BufferDescriptor const &srcDesc,
127 BufferDescriptor const &dstDesc,
128 BufferDescriptor const &duDesc,
129 BufferDescriptor const &dvDesc,
130 bool interleavedDerivativeBuffers = false) {
131 GLXFBEvaluator *instance = new GLXFBEvaluator(interleavedDerivativeBuffers);
132 if (instance->Compile(srcDesc, dstDesc, duDesc, dvDesc))
133 return instance;
134 delete instance;
135 return NULL;
136 }
137
139 template <typename DEVICE_CONTEXT>
140 static GLXFBEvaluator *Create(BufferDescriptor const &srcDesc,
141 BufferDescriptor const &dstDesc,
142 BufferDescriptor const &duDesc,
143 BufferDescriptor const &dvDesc,
144 BufferDescriptor const &duuDesc,
145 BufferDescriptor const &duvDesc,
146 BufferDescriptor const &dvvDesc,
147 DEVICE_CONTEXT deviceContext) {
148 bool interleavedDerivativeBuffers = deviceContext
149 ? deviceContext->AreInterleavedDerivativeBuffers()
150 : false;
151 return Create(srcDesc, dstDesc, duDesc, dvDesc,
152 duuDesc, duvDesc, dvvDesc,
153 interleavedDerivativeBuffers);
154 }
155
157 static GLXFBEvaluator *Create(BufferDescriptor const &srcDesc,
158 BufferDescriptor const &dstDesc,
159 BufferDescriptor const &duDesc,
160 BufferDescriptor const &dvDesc,
161 BufferDescriptor const &duuDesc,
162 BufferDescriptor const &duvDesc,
163 BufferDescriptor const &dvvDesc,
164 void * deviceContext) {
165 (void)deviceContext; // not used
166 return Create(srcDesc, dstDesc, duDesc, dvDesc,
167 duuDesc, duvDesc, dvvDesc);
168 }
169
170 static GLXFBEvaluator * Create(BufferDescriptor const &srcDesc,
171 BufferDescriptor const &dstDesc,
172 BufferDescriptor const &duDesc,
173 BufferDescriptor const &dvDesc,
174 BufferDescriptor const &duuDesc,
175 BufferDescriptor const &duvDesc,
176 BufferDescriptor const &dvvDesc,
177 bool interleavedDerivativeBuffers = false) {
178 GLXFBEvaluator *instance = new GLXFBEvaluator(interleavedDerivativeBuffers);
179 if (instance->Compile(srcDesc, dstDesc, duDesc, dvDesc,
180 duuDesc, duvDesc, dvvDesc))
181 return instance;
182 delete instance;
183 return NULL;
184 }
185
199 GLXFBEvaluator(bool interleavedDerivativeBuffers = false);
200
203
209
237 template <typename SRC_BUFFER, typename DST_BUFFER, typename STENCIL_TABLE>
238 static bool EvalStencils(
239 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
240 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
241 STENCIL_TABLE const *stencilTable,
242 GLXFBEvaluator const *instance,
243 void * deviceContext = NULL) {
244
245 if (instance) {
246 return instance->EvalStencils(srcBuffer, srcDesc,
247 dstBuffer, dstDesc,
248 stencilTable);
249 } else {
250 // Create an instance on demand (slow)
251 (void)deviceContext; // unused
252 instance = Create(srcDesc, dstDesc,
255 if (instance) {
256 bool r = instance->EvalStencils(srcBuffer, srcDesc,
257 dstBuffer, dstDesc,
258 stencilTable);
259 delete instance;
260 return r;
261 }
262 return false;
263 }
264 }
265
305 template <typename SRC_BUFFER, typename DST_BUFFER, typename STENCIL_TABLE>
306 static bool EvalStencils(
307 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
308 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
309 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
310 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
311 STENCIL_TABLE const *stencilTable,
312 GLXFBEvaluator const *instance,
313 void * deviceContext = NULL) {
314
315 if (instance) {
316 return instance->EvalStencils(srcBuffer, srcDesc,
317 dstBuffer, dstDesc,
318 duBuffer, duDesc,
319 dvBuffer, dvDesc,
320 stencilTable);
321 } else {
322 // Create an instance on demand (slow)
323 (void)deviceContext; // unused
324 instance = Create(srcDesc, dstDesc, duDesc, dvDesc);
325 if (instance) {
326 bool r = instance->EvalStencils(srcBuffer, srcDesc,
327 dstBuffer, dstDesc,
328 duBuffer, duDesc,
329 dvBuffer, dvDesc,
330 stencilTable);
331 delete instance;
332 return r;
333 }
334 return false;
335 }
336 }
337
395 template <typename SRC_BUFFER, typename DST_BUFFER, typename STENCIL_TABLE>
396 static bool EvalStencils(
397 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
398 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
399 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
400 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
401 DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc,
402 DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc,
403 DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc,
404 STENCIL_TABLE const *stencilTable,
405 GLXFBEvaluator const *instance,
406 void * deviceContext = NULL) {
407
408 if (instance) {
409 return instance->EvalStencils(srcBuffer, srcDesc,
410 dstBuffer, dstDesc,
411 duBuffer, duDesc,
412 dvBuffer, dvDesc,
413 duuBuffer, duuDesc,
414 duvBuffer, duvDesc,
415 dvvBuffer, dvvDesc,
416 stencilTable);
417 } else {
418 // Create an instance on demand (slow)
419 (void)deviceContext; // unused
420 instance = Create(srcDesc, dstDesc,
421 duDesc, dvDesc,
422 duuDesc, duvDesc, dvvDesc);
423 if (instance) {
424 bool r = instance->EvalStencils(srcBuffer, srcDesc,
425 dstBuffer, dstDesc,
426 duBuffer, duDesc,
427 dvBuffer, dvDesc,
428 duuBuffer, duuDesc,
429 duvBuffer, duvDesc,
430 dvvBuffer, dvvDesc,
431 stencilTable);
432 delete instance;
433 return r;
434 }
435 return false;
436 }
437 }
438
456 template <typename SRC_BUFFER, typename DST_BUFFER, typename STENCIL_TABLE>
458 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
459 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
460 STENCIL_TABLE const *stencilTable) const {
461
462 return EvalStencils(srcBuffer->BindVBO(), srcDesc,
463 dstBuffer->BindVBO(), dstDesc,
464 0, BufferDescriptor(),
465 0, BufferDescriptor(),
466 stencilTable->GetSizesTexture(),
467 stencilTable->GetOffsetsTexture(),
468 stencilTable->GetIndicesTexture(),
469 stencilTable->GetWeightsTexture(),
470 0,
471 0,
472 /* start = */ 0,
473 /* end = */ stencilTable->GetNumStencils());
474 }
475
505 template <typename SRC_BUFFER, typename DST_BUFFER, typename STENCIL_TABLE>
507 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
508 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
509 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
510 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
511 STENCIL_TABLE const *stencilTable) const {
512
513 return EvalStencils(srcBuffer->BindVBO(), srcDesc,
514 dstBuffer->BindVBO(), dstDesc,
515 duBuffer->BindVBO(), duDesc,
516 dvBuffer->BindVBO(), dvDesc,
517 stencilTable->GetSizesTexture(),
518 stencilTable->GetOffsetsTexture(),
519 stencilTable->GetIndicesTexture(),
520 stencilTable->GetWeightsTexture(),
521 stencilTable->GetDuWeightsTexture(),
522 stencilTable->GetDvWeightsTexture(),
523 /* start = */ 0,
524 /* end = */ stencilTable->GetNumStencils());
525 }
526
574 template <typename SRC_BUFFER, typename DST_BUFFER, typename STENCIL_TABLE>
576 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
577 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
578 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
579 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
580 DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc,
581 DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc,
582 DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc,
583 STENCIL_TABLE const *stencilTable) const {
584
585 return EvalStencils(srcBuffer->BindVBO(), srcDesc,
586 dstBuffer->BindVBO(), dstDesc,
587 duBuffer->BindVBO(), duDesc,
588 dvBuffer->BindVBO(), dvDesc,
589 duuBuffer->BindVBO(), duuDesc,
590 duvBuffer->BindVBO(), duvDesc,
591 dvvBuffer->BindVBO(), dvvDesc,
592 stencilTable->GetSizesTexture(),
593 stencilTable->GetOffsetsTexture(),
594 stencilTable->GetIndicesTexture(),
595 stencilTable->GetWeightsTexture(),
596 stencilTable->GetDuWeightsTexture(),
597 stencilTable->GetDvWeightsTexture(),
598 stencilTable->GetDuuWeightsTexture(),
599 stencilTable->GetDuvWeightsTexture(),
600 stencilTable->GetDvvWeightsTexture(),
601 /* start = */ 0,
602 /* end = */ stencilTable->GetNumStencils());
603 }
604
640 bool EvalStencils(GLuint srcBuffer, BufferDescriptor const &srcDesc,
641 GLuint dstBuffer, BufferDescriptor const &dstDesc,
642 GLuint duBuffer, BufferDescriptor const &duDesc,
643 GLuint dvBuffer, BufferDescriptor const &dvDesc,
644 GLuint sizesBuffer,
645 GLuint offsetsBuffer,
646 GLuint indicesBuffer,
647 GLuint weightsBuffer,
648 GLuint duWeightsBuffer,
649 GLuint dvWeightsBuffer,
650 int start,
651 int end) const;
652
706 bool EvalStencils(GLuint srcBuffer, BufferDescriptor const &srcDesc,
707 GLuint dstBuffer, BufferDescriptor const &dstDesc,
708 GLuint duBuffer, BufferDescriptor const &duDesc,
709 GLuint dvBuffer, BufferDescriptor const &dvDesc,
710 GLuint duuBuffer, BufferDescriptor const &duuDesc,
711 GLuint duvBuffer, BufferDescriptor const &duvDesc,
712 GLuint dvvBuffer, BufferDescriptor const &dvvDesc,
713 GLuint sizesBuffer,
714 GLuint offsetsBuffer,
715 GLuint indicesBuffer,
716 GLuint weightsBuffer,
717 GLuint duWeightsBuffer,
718 GLuint dvWeightsBuffer,
719 GLuint duuWeightsBuffer,
720 GLuint duvWeightsBuffer,
721 GLuint dvvWeightsBuffer,
722 int start,
723 int end) const;
724
730
763 template <typename SRC_BUFFER, typename DST_BUFFER,
764 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
765 static bool EvalPatches(
766 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
767 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
768 int numPatchCoords,
769 PATCHCOORD_BUFFER *patchCoords,
770 PATCH_TABLE *patchTable,
771 GLXFBEvaluator const *instance,
772 void * deviceContext = NULL) {
773
774 if (instance) {
775 return instance->EvalPatches(srcBuffer, srcDesc,
776 dstBuffer, dstDesc,
777 numPatchCoords, patchCoords,
778 patchTable);
779 } else {
780 // Create an instance on demand (slow)
781 (void)deviceContext; // unused
782 instance = Create(srcDesc, dstDesc,
785 if (instance) {
786 bool r = instance->EvalPatches(srcBuffer, srcDesc,
787 dstBuffer, dstDesc,
788 numPatchCoords, patchCoords,
789 patchTable);
790 delete instance;
791 return r;
792 }
793 return false;
794 }
795 }
796
841 template <typename SRC_BUFFER, typename DST_BUFFER,
842 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
843 static bool EvalPatches(
844 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
845 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
846 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
847 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
848 int numPatchCoords,
849 PATCHCOORD_BUFFER *patchCoords,
850 PATCH_TABLE *patchTable,
851 GLXFBEvaluator const *instance,
852 void * deviceContext = NULL) {
853
854 if (instance) {
855 return instance->EvalPatches(srcBuffer, srcDesc,
856 dstBuffer, dstDesc,
857 duBuffer, duDesc,
858 dvBuffer, dvDesc,
859 numPatchCoords, patchCoords,
860 patchTable);
861 } else {
862 // Create an instance on demand (slow)
863 (void)deviceContext; // unused
864 instance = Create(srcDesc, dstDesc, duDesc, dvDesc);
865 if (instance) {
866 bool r = instance->EvalPatches(srcBuffer, srcDesc,
867 dstBuffer, dstDesc,
868 duBuffer, duDesc,
869 dvBuffer, dvDesc,
870 numPatchCoords, patchCoords,
871 patchTable);
872 delete instance;
873 return r;
874 }
875 return false;
876 }
877 }
878
941 template <typename SRC_BUFFER, typename DST_BUFFER,
942 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
943 static bool EvalPatches(
944 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
945 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
946 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
947 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
948 DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc,
949 DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc,
950 DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc,
951 int numPatchCoords,
952 PATCHCOORD_BUFFER *patchCoords,
953 PATCH_TABLE *patchTable,
954 GLXFBEvaluator const *instance,
955 void * deviceContext = NULL) {
956
957 if (instance) {
958 return instance->EvalPatches(srcBuffer, srcDesc,
959 dstBuffer, dstDesc,
960 duBuffer, duDesc,
961 dvBuffer, dvDesc,
962 duuBuffer, duuDesc,
963 duvBuffer, duvDesc,
964 dvvBuffer, dvvDesc,
965 numPatchCoords, patchCoords,
966 patchTable);
967 } else {
968 // Create an instance on demand (slow)
969 (void)deviceContext; // unused
970 instance = Create(srcDesc, dstDesc,
971 duDesc, dvDesc,
972 duuDesc, duvDesc, dvvDesc);
973 if (instance) {
974 bool r = instance->EvalPatches(srcBuffer, srcDesc,
975 dstBuffer, dstDesc,
976 duBuffer, duDesc,
977 dvBuffer, dvDesc,
978 duuBuffer, duuDesc,
979 duvBuffer, duvDesc,
980 dvvBuffer, dvvDesc,
981 numPatchCoords, patchCoords,
982 patchTable);
983 delete instance;
984 return r;
985 }
986 return false;
987 }
988 }
989
1014 template <typename SRC_BUFFER, typename DST_BUFFER,
1015 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1017 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1018 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1019 int numPatchCoords,
1020 PATCHCOORD_BUFFER *patchCoords,
1021 PATCH_TABLE *patchTable) const {
1022
1023 return EvalPatches(srcBuffer->BindVBO(), srcDesc,
1024 dstBuffer->BindVBO(), dstDesc,
1025 0, BufferDescriptor(),
1026 0, BufferDescriptor(),
1027 numPatchCoords,
1028 patchCoords->BindVBO(),
1029 patchTable->GetPatchArrays(),
1030 patchTable->GetPatchIndexTextureBuffer(),
1031 patchTable->GetPatchParamTextureBuffer());
1032 }
1033
1068 template <typename SRC_BUFFER, typename DST_BUFFER,
1069 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1071 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1072 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1073 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
1074 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
1075 int numPatchCoords,
1076 PATCHCOORD_BUFFER *patchCoords,
1077 PATCH_TABLE *patchTable) const {
1078
1079 return EvalPatches(srcBuffer->BindVBO(), srcDesc,
1080 dstBuffer->BindVBO(), dstDesc,
1081 duBuffer->BindVBO(), duDesc,
1082 dvBuffer->BindVBO(), dvDesc,
1083 numPatchCoords,
1084 patchCoords->BindVBO(),
1085 patchTable->GetPatchArrays(),
1086 patchTable->GetPatchIndexTextureBuffer(),
1087 patchTable->GetPatchParamTextureBuffer());
1088 }
1089
1142 template <typename SRC_BUFFER, typename DST_BUFFER,
1143 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1145 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1146 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1147 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
1148 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
1149 DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc,
1150 DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc,
1151 DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc,
1152 int numPatchCoords,
1153 PATCHCOORD_BUFFER *patchCoords,
1154 PATCH_TABLE *patchTable) const {
1155
1156 return EvalPatches(srcBuffer->BindVBO(), srcDesc,
1157 dstBuffer->BindVBO(), dstDesc,
1158 duBuffer->BindVBO(), duDesc,
1159 dvBuffer->BindVBO(), dvDesc,
1160 duuBuffer->BindVBO(), duuDesc,
1161 duvBuffer->BindVBO(), duvDesc,
1162 dvvBuffer->BindVBO(), dvvDesc,
1163 numPatchCoords,
1164 patchCoords->BindVBO(),
1165 patchTable->GetPatchArrays(),
1166 patchTable->GetPatchIndexTextureBuffer(),
1167 patchTable->GetPatchParamTextureBuffer());
1168 }
1169
1170 bool EvalPatches(GLuint srcBuffer, BufferDescriptor const &srcDesc,
1171 GLuint dstBuffer, BufferDescriptor const &dstDesc,
1172 GLuint duBuffer, BufferDescriptor const &duDesc,
1173 GLuint dvBuffer, BufferDescriptor const &dvDesc,
1174 int numPatchCoords,
1175 GLuint patchCoordsBuffer,
1176 const PatchArrayVector &patchArrays,
1177 GLuint patchIndexBuffer,
1178 GLuint patchParamsBuffer) const;
1179
1180 bool EvalPatches(GLuint srcBuffer, BufferDescriptor const &srcDesc,
1181 GLuint dstBuffer, BufferDescriptor const &dstDesc,
1182 GLuint duBuffer, BufferDescriptor const &duDesc,
1183 GLuint dvBuffer, BufferDescriptor const &dvDesc,
1184 GLuint duuBuffer, BufferDescriptor const &duuDesc,
1185 GLuint duvBuffer, BufferDescriptor const &duvDesc,
1186 GLuint dvvBuffer, BufferDescriptor const &dvvDesc,
1187 int numPatchCoords,
1188 GLuint patchCoordsBuffer,
1189 const PatchArrayVector &patchArrays,
1190 GLuint patchIndexBuffer,
1191 GLuint patchParamsBuffer) const;
1192
1225 template <typename SRC_BUFFER, typename DST_BUFFER,
1226 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1228 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1229 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1230 int numPatchCoords,
1231 PATCHCOORD_BUFFER *patchCoords,
1232 PATCH_TABLE *patchTable,
1233 GLXFBEvaluator const *instance,
1234 void * deviceContext = NULL) {
1235
1236 if (instance) {
1237 return instance->EvalPatchesVarying(
1238 srcBuffer, srcDesc,
1239 dstBuffer, dstDesc,
1240 numPatchCoords, patchCoords,
1241 patchTable);
1242 } else {
1243 // Create an instance on demand (slow)
1244 (void)deviceContext; // unused
1245 instance = Create(srcDesc, dstDesc,
1248 if (instance) {
1249 bool r = instance->EvalPatchesVarying(
1250 srcBuffer, srcDesc,
1251 dstBuffer, dstDesc,
1252 numPatchCoords, patchCoords,
1253 patchTable);
1254 delete instance;
1255 return r;
1256 }
1257 return false;
1258 }
1259 }
1260
1285 template <typename SRC_BUFFER, typename DST_BUFFER,
1286 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1288 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1289 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1290 int numPatchCoords,
1291 PATCHCOORD_BUFFER *patchCoords,
1292 PATCH_TABLE *patchTable) const {
1293
1294 return EvalPatches(srcBuffer->BindVBO(), srcDesc,
1295 dstBuffer->BindVBO(), dstDesc,
1296 0, BufferDescriptor(),
1297 0, BufferDescriptor(),
1298 numPatchCoords,
1299 patchCoords->BindVBO(),
1300 patchTable->GetVaryingPatchArrays(),
1301 patchTable->GetVaryingPatchIndexTextureBuffer(),
1302 patchTable->GetPatchParamTextureBuffer());
1303 }
1304
1349 template <typename SRC_BUFFER, typename DST_BUFFER,
1350 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1352 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1353 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1354 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
1355 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
1356 int numPatchCoords,
1357 PATCHCOORD_BUFFER *patchCoords,
1358 PATCH_TABLE *patchTable,
1359 GLXFBEvaluator const *instance,
1360 void * deviceContext = NULL) {
1361
1362 if (instance) {
1363 return instance->EvalPatchesVarying(
1364 srcBuffer, srcDesc,
1365 dstBuffer, dstDesc,
1366 duBuffer, duDesc,
1367 dvBuffer, dvDesc,
1368 numPatchCoords, patchCoords,
1369 patchTable);
1370 } else {
1371 // Create an instance on demand (slow)
1372 (void)deviceContext; // unused
1373 instance = Create(srcDesc, dstDesc,
1374 duDesc, dvDesc);
1375 if (instance) {
1376 bool r = instance->EvalPatchesVarying(
1377 srcBuffer, srcDesc,
1378 dstBuffer, dstDesc,
1379 duBuffer, duDesc,
1380 dvBuffer, dvDesc,
1381 numPatchCoords, patchCoords,
1382 patchTable);
1383 delete instance;
1384 return r;
1385 }
1386 return false;
1387 }
1388 }
1389
1426 template <typename SRC_BUFFER, typename DST_BUFFER,
1427 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1429 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1430 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1431 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
1432 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
1433 int numPatchCoords,
1434 PATCHCOORD_BUFFER *patchCoords,
1435 PATCH_TABLE *patchTable) const {
1436
1437 return EvalPatches(srcBuffer->BindVBO(), srcDesc,
1438 dstBuffer->BindVBO(), dstDesc,
1439 duBuffer->BindVBO(), duDesc,
1440 dvBuffer->BindVBO(), dvDesc,
1441 numPatchCoords,
1442 patchCoords->BindVBO(),
1443 patchTable->GetVaryingPatchArrays(),
1444 patchTable->GetVaryingPatchIndexTextureBuffer(),
1445 patchTable->GetPatchParamTextureBuffer());
1446 }
1447
1510 template <typename SRC_BUFFER, typename DST_BUFFER,
1511 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1513 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1514 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1515 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
1516 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
1517 DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc,
1518 DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc,
1519 DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc,
1520 int numPatchCoords,
1521 PATCHCOORD_BUFFER *patchCoords,
1522 PATCH_TABLE *patchTable,
1523 GLXFBEvaluator const *instance,
1524 void * deviceContext = NULL) {
1525
1526 if (instance) {
1527 return instance->EvalPatchesVarying(
1528 srcBuffer, srcDesc,
1529 dstBuffer, dstDesc,
1530 duBuffer, duDesc,
1531 dvBuffer, dvDesc,
1532 duuBuffer, duuDesc,
1533 duvBuffer, duvDesc,
1534 dvvBuffer, dvvDesc,
1535 numPatchCoords, patchCoords,
1536 patchTable);
1537 } else {
1538 // Create an instance on demand (slow)
1539 (void)deviceContext; // unused
1540 instance = Create(srcDesc, dstDesc,
1541 duDesc, dvDesc,
1542 duuDesc, duvDesc, dvvDesc);
1543 if (instance) {
1544 bool r = instance->EvalPatchesVarying(
1545 srcBuffer, srcDesc,
1546 dstBuffer, dstDesc,
1547 duBuffer, duDesc,
1548 dvBuffer, dvDesc,
1549 duuBuffer, duuDesc,
1550 duvBuffer, duvDesc,
1551 dvvBuffer, dvvDesc,
1552 numPatchCoords, patchCoords,
1553 patchTable);
1554 delete instance;
1555 return r;
1556 }
1557 return false;
1558 }
1559 }
1560
1615 template <typename SRC_BUFFER, typename DST_BUFFER,
1616 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1618 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1619 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1620 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
1621 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
1622 DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc,
1623 DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc,
1624 DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc,
1625 int numPatchCoords,
1626 PATCHCOORD_BUFFER *patchCoords,
1627 PATCH_TABLE *patchTable) const {
1628
1629 return EvalPatches(srcBuffer->BindVBO(), srcDesc,
1630 dstBuffer->BindVBO(), dstDesc,
1631 duBuffer->BindVBO(), duDesc,
1632 dvBuffer->BindVBO(), dvDesc,
1633 duuBuffer->BindVBO(), duuDesc,
1634 duvBuffer->BindVBO(), duvDesc,
1635 dvvBuffer->BindVBO(), dvvDesc,
1636 numPatchCoords,
1637 patchCoords->BindVBO(),
1638 patchTable->GetVaryingPatchArrays(),
1639 patchTable->GetVaryingPatchIndexTextureBuffer(),
1640 patchTable->GetPatchParamTextureBuffer());
1641 }
1642
1677 template <typename SRC_BUFFER, typename DST_BUFFER,
1678 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1680 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1681 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1682 int numPatchCoords,
1683 PATCHCOORD_BUFFER *patchCoords,
1684 PATCH_TABLE *patchTable,
1685 int fvarChannel,
1686 GLXFBEvaluator const *instance,
1687 void * deviceContext = NULL) {
1688
1689 if (instance) {
1690 return instance->EvalPatchesFaceVarying(
1691 srcBuffer, srcDesc,
1692 dstBuffer, dstDesc,
1693 numPatchCoords, patchCoords,
1694 patchTable, fvarChannel);
1695 } else {
1696 // Create an instance on demand (slow)
1697 (void)deviceContext; // unused
1698 instance = Create(srcDesc, dstDesc,
1701 if (instance) {
1702 bool r = instance->EvalPatchesFaceVarying(
1703 srcBuffer, srcDesc,
1704 dstBuffer, dstDesc,
1705 numPatchCoords, patchCoords,
1706 patchTable, fvarChannel);
1707 delete instance;
1708 return r;
1709 }
1710 return false;
1711 }
1712 }
1713
1740 template <typename SRC_BUFFER, typename DST_BUFFER,
1741 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1743 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1744 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1745 int numPatchCoords,
1746 PATCHCOORD_BUFFER *patchCoords,
1747 PATCH_TABLE *patchTable,
1748 int fvarChannel = 0) const {
1749
1750 return EvalPatches(srcBuffer->BindVBO(), srcDesc,
1751 dstBuffer->BindVBO(), dstDesc,
1752 0, BufferDescriptor(),
1753 0, BufferDescriptor(),
1754 numPatchCoords,
1755 patchCoords->BindVBO(),
1756 patchTable->GetFVarPatchArrays(fvarChannel),
1757 patchTable->GetFVarPatchIndexTextureBuffer(fvarChannel),
1758 patchTable->GetFVarPatchParamTextureBuffer(fvarChannel));
1759 }
1760
1807 template <typename SRC_BUFFER, typename DST_BUFFER,
1808 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1810 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1811 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1812 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
1813 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
1814 int numPatchCoords,
1815 PATCHCOORD_BUFFER *patchCoords,
1816 PATCH_TABLE *patchTable,
1817 int fvarChannel,
1818 GLXFBEvaluator const *instance,
1819 void * deviceContext = NULL) {
1820
1821 if (instance) {
1822 return instance->EvalPatchesFaceVarying(
1823 srcBuffer, srcDesc,
1824 dstBuffer, dstDesc,
1825 duBuffer, duDesc,
1826 dvBuffer, dvDesc,
1827 numPatchCoords, patchCoords,
1828 patchTable, fvarChannel);
1829 } else {
1830 // Create an instance on demand (slow)
1831 (void)deviceContext; // unused
1832 instance = Create(srcDesc, dstDesc,
1833 duDesc, dvDesc);
1834 if (instance) {
1835 bool r = instance->EvalPatchesFaceVarying(
1836 srcBuffer, srcDesc,
1837 dstBuffer, dstDesc,
1838 duBuffer, duDesc,
1839 dvBuffer, dvDesc,
1840 numPatchCoords, patchCoords,
1841 patchTable, fvarChannel);
1842 delete instance;
1843 return r;
1844 }
1845 return false;
1846 }
1847 }
1848
1887 template <typename SRC_BUFFER, typename DST_BUFFER,
1888 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1890 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1891 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1892 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
1893 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
1894 int numPatchCoords,
1895 PATCHCOORD_BUFFER *patchCoords,
1896 PATCH_TABLE *patchTable,
1897 int fvarChannel = 0) const {
1898
1899 return EvalPatches(srcBuffer->BindVBO(), srcDesc,
1900 dstBuffer->BindVBO(), dstDesc,
1901 duBuffer->BindVBO(), duDesc,
1902 dvBuffer->BindVBO(), dvDesc,
1903 numPatchCoords,
1904 patchCoords->BindVBO(),
1905 patchTable->GetFVarPatchArrays(fvarChannel),
1906 patchTable->GetFVarPatchIndexTextureBuffer(fvarChannel),
1907 patchTable->GetFVarPatchParamTextureBuffer(fvarChannel));
1908 }
1909
1974 template <typename SRC_BUFFER, typename DST_BUFFER,
1975 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
1977 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
1978 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
1979 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
1980 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
1981 DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc,
1982 DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc,
1983 DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc,
1984 int numPatchCoords,
1985 PATCHCOORD_BUFFER *patchCoords,
1986 PATCH_TABLE *patchTable,
1987 int fvarChannel,
1988 GLXFBEvaluator const *instance,
1989 void * deviceContext = NULL) {
1990
1991 if (instance) {
1992 return instance->EvalPatchesFaceVarying(
1993 srcBuffer, srcDesc,
1994 dstBuffer, dstDesc,
1995 duBuffer, duDesc,
1996 dvBuffer, dvDesc,
1997 duuBuffer, duuDesc,
1998 duvBuffer, duvDesc,
1999 dvvBuffer, dvvDesc,
2000 numPatchCoords, patchCoords,
2001 patchTable, fvarChannel);
2002 } else {
2003 // Create an instance on demand (slow)
2004 (void)deviceContext; // unused
2005 instance = Create(srcDesc, dstDesc,
2006 duDesc, dvDesc,
2007 duuDesc, duvDesc, dvvDesc);
2008 if (instance) {
2009 bool r = instance->EvalPatchesFaceVarying(
2010 srcBuffer, srcDesc,
2011 dstBuffer, dstDesc,
2012 duBuffer, duDesc,
2013 dvBuffer, dvDesc,
2014 duuBuffer, duuDesc,
2015 duvBuffer, duvDesc,
2016 dvvBuffer, dvvDesc,
2017 numPatchCoords, patchCoords,
2018 patchTable, fvarChannel);
2019 delete instance;
2020 return r;
2021 }
2022 return false;
2023 }
2024 }
2025
2082 template <typename SRC_BUFFER, typename DST_BUFFER,
2083 typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
2085 SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
2086 DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
2087 DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
2088 DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
2089 DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc,
2090 DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc,
2091 DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc,
2092 int numPatchCoords,
2093 PATCHCOORD_BUFFER *patchCoords,
2094 PATCH_TABLE *patchTable,
2095 int fvarChannel = 0) const {
2096
2097 return EvalPatches(srcBuffer->BindVBO(), srcDesc,
2098 dstBuffer->BindVBO(), dstDesc,
2099 duBuffer->BindVBO(), duDesc,
2100 dvBuffer->BindVBO(), dvDesc,
2101 duuBuffer->BindVBO(), duuDesc,
2102 duvBuffer->BindVBO(), duvDesc,
2103 dvvBuffer->BindVBO(), dvvDesc,
2104 numPatchCoords,
2105 patchCoords->BindVBO(),
2106 patchTable->GetFVarPatchArrays(fvarChannel),
2107 patchTable->GetFVarPatchIndexTextureBuffer(fvarChannel),
2108 patchTable->GetFVarPatchParamTextureBuffer(fvarChannel));
2109 }
2110
2116
2119 bool Compile(BufferDescriptor const &srcDesc,
2120 BufferDescriptor const &dstDesc,
2121 BufferDescriptor const &duDesc = BufferDescriptor(),
2122 BufferDescriptor const &dvDesc = BufferDescriptor(),
2123 BufferDescriptor const &duuDesc = BufferDescriptor(),
2124 BufferDescriptor const &duvDesc = BufferDescriptor(),
2125 BufferDescriptor const &dvvDesc = BufferDescriptor());
2126
2128 static void Synchronize(void *kernel);
2129
2130private:
2131 GLuint _srcBufferTexture;
2132 GLuint _patchArraysUBO;
2133 bool _interleavedDerivativeBuffers;
2134
2135 struct _StencilKernel {
2136 _StencilKernel();
2137 ~_StencilKernel();
2138 bool Compile(BufferDescriptor const &srcDesc,
2139 BufferDescriptor const &dstDesc,
2140 BufferDescriptor const &duDesc,
2141 BufferDescriptor const &dvDesc,
2142 BufferDescriptor const &duuDesc,
2143 BufferDescriptor const &duvDesc,
2144 BufferDescriptor const &dvvDesc,
2145 bool interleavedDerivativeBuffers);
2146 GLuint program;
2147 GLint uniformSrcBufferTexture;
2148 GLint uniformSrcOffset; // src buffer offset (in elements)
2149
2150 GLint uniformSizesTexture;
2151 GLint uniformOffsetsTexture;
2152 GLint uniformIndicesTexture;
2153 GLint uniformWeightsTexture;
2154 GLint uniformDuWeightsTexture;
2155 GLint uniformDvWeightsTexture;
2156 GLint uniformDuuWeightsTexture;
2157 GLint uniformDuvWeightsTexture;
2158 GLint uniformDvvWeightsTexture;
2159 GLint uniformStart; // range
2160 GLint uniformEnd;
2161 } _stencilKernel;
2162
2163 struct _PatchKernel {
2164 _PatchKernel();
2165 ~_PatchKernel();
2166 bool Compile(BufferDescriptor const &srcDesc,
2167 BufferDescriptor const &dstDesc,
2168 BufferDescriptor const &duDesc,
2169 BufferDescriptor const &dvDesc,
2170 BufferDescriptor const &duuDesc,
2171 BufferDescriptor const &duvDesc,
2172 BufferDescriptor const &dvvDesc,
2173 bool interleavedDerivativeBuffers);
2174 GLuint program;
2175 GLint uniformSrcBufferTexture;
2176 GLint uniformSrcOffset; // src buffer offset (in elements)
2177
2178 GLint uniformPatchArraysUBOBinding;
2179 GLint uniformPatchParamTexture;
2180 GLint uniformPatchIndexTexture;
2181 } _patchKernel;
2182
2183};
2184
2185} // end namespace Osd
2186
2187} // end namespace OPENSUBDIV_VERSION
2188using namespace OPENSUBDIV_VERSION;
2189
2190} // end namespace OpenSubdiv
2191
2192
2193#endif // OPENSUBDIV3_OSD_GL_XFB_EVALUATOR_H
std::vector< PatchArray > PatchArrayVector
Definition: types.h:132
Stencil table class wrapping the template for compatibility.
Definition: stencilTable.h:273
Limit stencil table class wrapping the template for compatibility.
Definition: stencilTable.h:583
BufferDescriptor is a struct which describes buffer elements in interleaved data buffers....
static GLStencilTableTBO * Create(Far::StencilTable const *stencilTable, void *deviceContext=NULL)
GLStencilTableTBO(Far::StencilTable const *stencilTable)
GLStencilTableTBO(Far::LimitStencilTable const *limitStencilTable)
static GLStencilTableTBO * Create(Far::LimitStencilTable const *limitStencilTable, void *deviceContext=NULL)
bool EvalPatchesVarying(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable) const
Generic limit eval function. This function has a same signature as other device kernels have so that ...
static GLXFBEvaluator * Create(BufferDescriptor const &srcDesc, BufferDescriptor const &dstDesc, BufferDescriptor const &duDesc, BufferDescriptor const &dvDesc, bool interleavedDerivativeBuffers=false)
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) const
Generic stencil function.
GLXFBEvaluator(bool interleavedDerivativeBuffers=false)
Constructor.
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) const
Generic stencil function.
bool EvalPatches(GLuint srcBuffer, BufferDescriptor const &srcDesc, GLuint dstBuffer, BufferDescriptor const &dstDesc, GLuint duBuffer, BufferDescriptor const &duDesc, GLuint dvBuffer, BufferDescriptor const &dvDesc, GLuint duuBuffer, BufferDescriptor const &duuDesc, GLuint duvBuffer, BufferDescriptor const &duvDesc, GLuint dvvBuffer, BufferDescriptor const &dvvDesc, int numPatchCoords, GLuint patchCoordsBuffer, const PatchArrayVector &patchArrays, GLuint patchIndexBuffer, GLuint patchParamsBuffer) const
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, GLXFBEvaluator const *instance, void *deviceContext=NULL)
Generic static stencil function. This function has a same signature as other device kernels have so t...
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) const
Generic limit eval function with derivatives. This function has a same signature as other device kern...
static GLXFBEvaluator * Create(BufferDescriptor const &srcDesc, BufferDescriptor const &dstDesc, BufferDescriptor const &duDesc, BufferDescriptor const &dvDesc, BufferDescriptor const &duuDesc, BufferDescriptor const &duvDesc, BufferDescriptor const &dvvDesc, bool interleavedDerivativeBuffers=false)
static GLXFBEvaluator * Create(BufferDescriptor const &srcDesc, BufferDescriptor const &dstDesc, BufferDescriptor const &duDesc, BufferDescriptor const &dvDesc, void *deviceContext)
Specialization to allow creation without a device context.
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, GLXFBEvaluator const *instance, void *deviceContext=NULL)
Generic static stencil function. This function has a same signature as other device kernels have so t...
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, GLXFBEvaluator const *instance, void *deviceContext=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
bool EvalStencils(GLuint srcBuffer, BufferDescriptor const &srcDesc, GLuint dstBuffer, BufferDescriptor const &dstDesc, GLuint duBuffer, BufferDescriptor const &duDesc, GLuint dvBuffer, BufferDescriptor const &dvDesc, GLuint duuBuffer, BufferDescriptor const &duuDesc, GLuint duvBuffer, BufferDescriptor const &duvDesc, GLuint dvvBuffer, BufferDescriptor const &dvvDesc, GLuint sizesBuffer, GLuint offsetsBuffer, GLuint indicesBuffer, GLuint weightsBuffer, GLuint duWeightsBuffer, GLuint dvWeightsBuffer, GLuint duuWeightsBuffer, GLuint duvWeightsBuffer, GLuint dvvWeightsBuffer, int start, int end) const
Dispatch the GLSL XFB kernel on on GPU asynchronously returns false if the kernel hasn't been compile...
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, GLXFBEvaluator const *instance, void *deviceContext=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
static GLXFBEvaluator * Create(BufferDescriptor const &srcDesc, BufferDescriptor const &dstDesc, BufferDescriptor const &duDesc, BufferDescriptor const &dvDesc, BufferDescriptor const &duuDesc, BufferDescriptor const &duvDesc, BufferDescriptor const &dvvDesc, DEVICE_CONTEXT deviceContext)
Generic creator template.
static GLXFBEvaluator * Create(BufferDescriptor const &srcDesc, BufferDescriptor const &dstDesc, BufferDescriptor const &duDesc, BufferDescriptor const &dvDesc, DEVICE_CONTEXT deviceContext)
Generic creator template.
static void Synchronize(void *kernel)
Wait the dispatched kernel finishes.
static bool EvalPatchesVarying(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, GLXFBEvaluator const *instance, void *deviceContext=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
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) const
Generic limit eval function. This function has a same signature as other device kernels have so that ...
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=0) const
Generic limit eval function. This function has a same signature as other device kernels have so that ...
static bool EvalPatches(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, GLXFBEvaluator const *instance, void *deviceContext=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
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, GLXFBEvaluator const *instance, void *deviceContext=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
bool EvalPatches(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable) const
Generic limit eval function. This function has a same signature as other device kernels have so that ...
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, GLXFBEvaluator const *instance, void *deviceContext=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
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) const
Generic limit eval function with derivatives. This function has a same signature as other device kern...
bool EvalStencils(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, STENCIL_TABLE const *stencilTable) const
Generic stencil function.
bool EvalPatches(GLuint srcBuffer, BufferDescriptor const &srcDesc, GLuint dstBuffer, BufferDescriptor const &dstDesc, GLuint duBuffer, BufferDescriptor const &duDesc, GLuint dvBuffer, BufferDescriptor const &dvDesc, int numPatchCoords, GLuint patchCoordsBuffer, const PatchArrayVector &patchArrays, GLuint patchIndexBuffer, GLuint patchParamsBuffer) const
static GLXFBEvaluator * Create(BufferDescriptor const &srcDesc, BufferDescriptor const &dstDesc, BufferDescriptor const &duDesc, BufferDescriptor const &dvDesc, BufferDescriptor const &duuDesc, BufferDescriptor const &duvDesc, BufferDescriptor const &dvvDesc, void *deviceContext)
Specialization to allow creation without a device context.
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=0) const
Generic limit eval function. This function has a same signature as other device kernels have so that ...
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, GLXFBEvaluator const *instance, void *deviceContext=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
bool EvalStencils(GLuint srcBuffer, BufferDescriptor const &srcDesc, GLuint dstBuffer, BufferDescriptor const &dstDesc, GLuint duBuffer, BufferDescriptor const &duDesc, GLuint dvBuffer, BufferDescriptor const &dvDesc, GLuint sizesBuffer, GLuint offsetsBuffer, GLuint indicesBuffer, GLuint weightsBuffer, GLuint duWeightsBuffer, GLuint dvWeightsBuffer, int start, int end) const
Dispatch the GLSL XFB kernel on on GPU asynchronously returns false if the kernel hasn't been compile...
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, GLXFBEvaluator const *instance, void *deviceContext=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
static bool EvalStencils(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, STENCIL_TABLE const *stencilTable, GLXFBEvaluator const *instance, void *deviceContext=NULL)
Generic static stencil function. This function has a same signature as other device kernels have so t...
~GLXFBEvaluator()
Destructor. note that the GL context must be made current.
bool Compile(BufferDescriptor const &srcDesc, BufferDescriptor const &dstDesc, BufferDescriptor const &duDesc=BufferDescriptor(), BufferDescriptor const &dvDesc=BufferDescriptor(), BufferDescriptor const &duuDesc=BufferDescriptor(), BufferDescriptor const &duvDesc=BufferDescriptor(), BufferDescriptor const &dvvDesc=BufferDescriptor())
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) const
Generic limit eval function. This function has a same signature as other device kernels have so that ...
bool EvalPatchesFaceVarying(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, int fvarChannel=0) const
Generic limit eval function. This function has a same signature as other device kernels have so that ...
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, GLXFBEvaluator const *instance, void *deviceContext=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...