HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CE_SnippetKernelBind.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: CE_SnippetImpl.h ( CE Library, C++)
7  *
8  * COMMENTS: Implementation of snippet manipulation for OpenCL
9  */
10 
11 #ifndef __CE_SnippetKernelBind__
12 #define __CE_SnippetKernelBind__
13 
14 #include "CE_API.h"
15 #include "CE_Context.h"
16 #include "CE_Snippet.h"
17 #include <UT/UT_WorkBuffer.h>
18 #include <UT/UT_ErrorManager.h>
19 
20 namespace CE_Snippet
21 {
22  template <CE_Precision PREC, typename OP>
23  bool setKernelArgument(const Binding &binding, int p,
24  cl::Kernel &kernel, int &argidx,
26  fpreal timestep,
27  UT_ErrorManager *error,
28  UT_ErrorSeverity missingseverity,
29  const OP &op);
30 
31  /// Binds each of the bindings in turn.
32  /// OP is a callback structure that knows how to bind the various
33  /// bespoke types, with
34  /// bool operator()(const CE_Snippet::Binding &binding, int p,
35  /// cl::Kernel &kernel, int &argidx,
36  /// UT_ErrorManager *error,
37  /// CE_Precision PREC)
38  template <typename OP>
39  inline bool setKernelArguments(const UT_Array<Binding> &bindings,
40  BindingPrecision nodeprecision,
41  cl::Kernel &kernel, int &argidx,
43  fpreal timestep,
44  UT_ErrorManager *error,
45  UT_ErrorSeverity missingseverity,
46  const OP &op)
47  {
48  bool ok = true;
49  int p = 0;
50  for (auto && binding : bindings)
51  {
52  auto precision = binding.precision;
54  precision = nodeprecision;
55  switch (precision)
56  {
58  UT_ASSERT(!"This should have been handled");
59  break;
61  ok &= setKernelArgument<CE_16, OP>(binding, p, kernel, argidx, buffers, timestep, error, missingseverity, op);
62  break;
64  ok &= setKernelArgument<CE_32, OP>(binding, p, kernel, argidx, buffers, timestep, error, missingseverity, op);
65  break;
67  ok &= setKernelArgument<CE_64, OP>(binding, p, kernel, argidx, buffers, timestep, error, missingseverity, op);
68  break;
69 
70  }
71  if (!ok)
72  break;
73  p++;
74  }
75  return ok;
76  }
77 
78  /// Adds an error to the error manager for mis-binding an argument.
79  CE_API void reportSetArgError(const char *name, int argidx,
80  int pidx, const char *type,
81  const char *extra, UT_ErrorManager *error);
82 
83  template <typename TYPE>
84  inline void bindKernelArgRaw(TYPE *val, int tuplesize,
85  cl::Kernel &kernel, int &argidx,
86  const char *name, const char *type, int pidx,
87  UT_ErrorManager *error,
88  const char *extra = 0)
89  {
90  try
91  {
92  kernel.setArg( argidx, tuplesize * sizeof(TYPE), val);
93  argidx++;
94  }
95  catch (cl::Error &)
96  {
97  reportSetArgError(name, argidx, pidx, type, extra, error);
98  throw;
99  }
100  }
101  /// Binds a kernel argument of the type, incrementing the argidx
102  /// Will throw an error and add the error to the provided error manager.
103  ///{
104  inline void bindKernelArgI(cl_int val, cl::Kernel &kernel, int &argidx,
105  const char *name, int pidx, UT_ErrorManager *error,
106  const char *extra = 0)
107  { bindKernelArgRaw(&val, 1, kernel, argidx, name, "int", pidx, error, extra); }
108  inline void bindKernelArgI2(cl_int *val, cl::Kernel &kernel, int &argidx,
109  const char *name, int pidx, UT_ErrorManager *error,
110  const char *extra = 0)
111  { bindKernelArgRaw(val, 2, kernel, argidx, name, "int2", pidx, error, extra); }
112  inline void bindKernelArgF(cl_float val, cl::Kernel &kernel, int &argidx,
113  const char *name, int pidx, UT_ErrorManager *error,
114  const char *extra = 0)
115  { bindKernelArgRaw(&val, 1, kernel, argidx, name, "float", pidx, error, extra); }
116  /// NOTE: This binds float4 due to vagaries of cl!
117  inline void bindKernelArgV3(cl_float *val, cl::Kernel &kernel, int &argidx,
118  const char *name, int pidx, UT_ErrorManager *error,
119  const char *extra = 0)
120  { bindKernelArgRaw(val, 4, kernel, argidx, name, "float3", pidx, error, extra); }
121  inline void bindKernelArgV4(cl_float *val, cl::Kernel &kernel, int &argidx,
122  const char *name, int pidx, UT_ErrorManager *error,
123  const char *extra = 0)
124  { bindKernelArgRaw(val, 4, kernel, argidx, name, "float4", pidx, error, extra); }
125  inline void bindKernelArgV16(cl_float *val, cl::Kernel &kernel, int &argidx,
126  const char *name, int pidx, UT_ErrorManager *error,
127  const char *extra = 0)
128  { bindKernelArgRaw(val, 16, kernel, argidx, name, "float16", pidx, error, extra); }
129  inline void bindKernelArgB(cl::Buffer val, cl::Kernel &kernel, int &argidx,
130  const char *name, int pidx, const char *type,
131  UT_ErrorManager *error,
132  const char *extra = 0)
133  {
134  try
135  {
136  kernel.setArg( argidx, val);
137  argidx++;
138  }
139  catch (cl::Error &)
140  {
141  reportSetArgError(name, argidx, pidx, type, extra, error);
142  throw;
143  }
144  }
145 
146  ///}
147  template <CE_Precision PREC, typename OP>
148  inline bool
150  int p,
151  cl::Kernel &kernel, int &argidx,
153  fpreal timestep,
154  UT_ErrorManager *error,
155  UT_ErrorSeverity missingseverity,
156  const OP &op)
157  {
158  bool ok = true;
159  UT_String retrieveStr;
160 
161  BindingType paramtype = BindingType::INVALID;
162  CEfloatH<PREC> param_float = 0;
163  CE_Context *clcontext = CE_Context::getContext();
164  CEintH<PREC> param_int;
165  UT_Vector4D param_float4;
166  UT_Vector3D param_float3;
167  UT_Vector2D param_float2;
168  UT_String param_string;
169 
170  CEfloatH<PREC> param_fpreal_array[16];
171 
172  paramtype = binding.type;
173 
174  // set base parameter values
175  switch (paramtype)
176  {
177  // Single integer
178  case BindingType::INT:
179  param_int = binding.intval;
180  CE_Snippet::bindKernelArgRaw(&param_int, 1,
181  kernel, argidx, binding.name, "int", p, error);
182  break;
183 
184  // Single Float
185  case BindingType::FLOAT:
186  {
187  BindingTimescale timemethod;
188  param_float = binding.fval;
189  timemethod = binding.timescale;
190 
191  switch( timemethod )
192  {
193  case BindingTimescale::NONE: // None
194  break;
195  case BindingTimescale::MULT: // * Timescale
196  param_float *= timestep;
197  break;
198  case BindingTimescale::INVERT: // 1 / Timescale
199  param_float /= timestep;
200  break;
201  case BindingTimescale::POW: // e ^ timestep
202  param_float = SYSexp( param_float * timestep );
203  break;
204  default:
205  break;
206  }
207 
208  CE_Snippet::bindKernelArgRaw(&param_float, 1,
209  kernel, argidx, binding.name, "float", p, error);
210  break;
211  }
212 
213  // Float Vector 2
214  case BindingType::FLOAT2:
215  param_float2 = binding.v2val;
216  param_fpreal_array[0] = param_float2(0);
217  param_fpreal_array[1] = param_float2(1);
218 
219  CE_Snippet::bindKernelArgRaw(param_fpreal_array, 2,
220  kernel, argidx, binding.name, "float2", p, error);
221  break;
222 
223  // Float Vector 3
224  case BindingType::FLOAT3:
225  param_float3 = binding.v3val;
226  param_fpreal_array[0] = param_float3(0);
227  param_fpreal_array[1] = param_float3(1);
228  param_fpreal_array[2] = param_float3(2);
229  param_fpreal_array[3] = 0;
230 
231  CE_Snippet::bindKernelArgRaw(param_fpreal_array, 4,
232  kernel, argidx, binding.name, "float3", p, error);
233  break;
234 
235  // Float Vector 4
236  case BindingType::FLOAT4:
237  param_float4 = binding.v4val;
238  param_fpreal_array[0] = param_float4(0);
239  param_fpreal_array[1] = param_float4(1);
240  param_fpreal_array[2] = param_float4(2);
241  param_fpreal_array[3] = param_float4(3);
242  CE_Snippet::bindKernelArgRaw(param_fpreal_array, 4,
243  kernel, argidx, binding.name, "float4", p, error);
244  break;
245 
246  // Float vector 8
247  case BindingType::FLOAT8:
248  param_float4 = binding.v4val;
249  param_fpreal_array[0] = param_float4(0);
250  param_fpreal_array[1] = param_float4(1);
251  param_fpreal_array[2] = param_float4(2);
252  param_fpreal_array[3] = param_float4(3);
253  param_float4 = binding.v4bval;
254  param_fpreal_array[4+0] = param_float4(0);
255  param_fpreal_array[4+1] = param_float4(1);
256  param_fpreal_array[4+2] = param_float4(2);
257  param_fpreal_array[4+3] = param_float4(3);
258  CE_Snippet::bindKernelArgRaw(param_fpreal_array, 8,
259  kernel, argidx, binding.name, "float8", p, error);
260  break;
261 
262  // Float vector 16
264  {
265  for (int r = 0; r < 4; r++)
266  for (int c = 0; c < 4; c++)
267  param_fpreal_array[r*4+c] = binding.m4val(r, c);
268  CE_Snippet::bindKernelArgRaw(param_fpreal_array, 16,
269  kernel, argidx, binding.name, "float8", p, error);
270  break;
271  }
272 
273  case BindingType::RAMP:
274  {
275  const cl_int ramp_size = binding.rampsize;
276  const int tuplesize = binding.ramptype == BindingRampType::VECTOR ? 3 : 1;
277 
278  // load the ramp, allocate the required buffer, and populate with
279  // ramp data
280 
281  UT_Array<CEfloatH<PREC>> ramp_array;
282  ramp_array.entries(ramp_size * tuplesize);
283 
284  if (binding.ramp)
285  {
286  int writepos = 0;
287  for (int i = 0; i < ramp_size; i++)
288  {
289  float values[4];
290  fpreal pos = i / fpreal(ramp_size - 1);
291  binding.ramp->rampLookup( pos, values );
292  for (int j = 0; j < tuplesize; j++)
293  ramp_array(writepos++) = values[j];
294  }
295  }
296  else if (binding.rampdata)
297  {
298  for (int i = 0; i < ramp_array.entries(); i++)
299  ramp_array[i] = binding.rampdata[i];
300  // This array is strictly a temporary value used to perform the binding.
301  // Clear it so we don't leave a dangling pointer.
302  binding.rampdata = nullptr;
303  }
304  else
305  {
306  ramp_array.constant(0);
307  }
308 
309  const size_t ramp_data_size = ramp_size * tuplesize * sizeof( CEfloatH<PREC> );
310  cl::Buffer ramp_buffer = clcontext->allocBuffer(ramp_data_size);
311  // Blocking since we will free our array shortly.
312  clcontext->writeBuffer( ramp_buffer, ramp_data_size, ramp_array.array() );
313  buffers.append(ramp_buffer);
314 
315  CE_Snippet::bindKernelArgI(ramp_size, kernel, argidx, binding.name, p, error, "size");
316  CE_Snippet::bindKernelArgB(ramp_buffer, kernel, argidx, binding.name, p, "float *", error, "data");
317  break;
318  }
319 
323  {
324  // Ignore unbound optional volumes
325  if (!op(binding, p, kernel, argidx, error, PREC))
326  {
327  UT_WorkBuffer msg;
328  msg.sprintf("Invalid field '%s'", (const char *) binding.fieldname);
329  if (missingseverity != UT_ERROR_NONE)
330  error->addGeneric("Common", UT_ERROR_JUST_STRING, msg.buffer(), missingseverity);
331  return false;
332  }
333 
334  break;
335  }
337  {
338  // Fetch our geometry
339  BindingAttribType atype = binding.attribtype;
340  int tuplesize = binding.attribsize;
341  bool isarray = atype == BindingAttribType::FLOATARRAY || atype == BindingAttribType::INTARRAY;
342  bool optional = binding.optional;
343 
344  if (!op(binding, p, kernel, argidx, error, PREC))
345  {
346  if (!optional)
347  {
348  UT_WorkBuffer msg;
349  msg.sprintf("Invalid attribute '%s'", (const char *) binding.attribute);
350  if (missingseverity != UT_ERROR_NONE)
351  error->addGeneric("Common", UT_ERROR_JUST_STRING, msg.buffer(), missingseverity);
352  return false;
353  }
354  else
355  {
356  // Check if we are to bind a default value...
357  if (!isarray && binding.defval)
358  {
359  if (atype == BindingAttribType::INT)
360  {
361  // Single integer
362  param_int = binding.intval;
363  CE_Snippet::bindKernelArgRaw(&param_int, 1,
364  kernel, argidx, binding.name, "int", p, error);
365  }
366  else if (tuplesize == 3)
367  {
368  // Float Vector 3
369  param_float3 = binding.v3val;
370  param_fpreal_array[0] = param_float3(0);
371  param_fpreal_array[1] = param_float3(1);
372  param_fpreal_array[2] = param_float3(2);
373  param_fpreal_array[3] = 0;
374 
375  CE_Snippet::bindKernelArgRaw(param_fpreal_array, 4,
376  kernel, argidx, binding.name, "float3", p, error);
377  }
378  else if (tuplesize == 4)
379  {
380  // Float Vector 4
381  param_float4 = binding.v4val;
382  param_fpreal_array[0] = param_float4(0);
383  param_fpreal_array[1] = param_float4(1);
384  param_fpreal_array[2] = param_float4(2);
385  param_fpreal_array[3] = param_float4(3);
386  CE_Snippet::bindKernelArgRaw(param_fpreal_array, 4,
387  kernel, argidx, binding.name, "float", p, error);
388  }
389  else
390  {
391  // All other bind a single float default
392  param_float = binding.fval;
393  CE_Snippet::bindKernelArgRaw(&param_float, 1,
394  kernel, argidx, binding.name, "float", p, error);
395  }
396  }
397 
398  return true;
399  }
400  }
401 
402  break;
403  }
404 
405  case BindingType::VOLUME:
406  {
407  bool optional = binding.optional;
408 
409  // Ignore unbound optional volumes
410  if (!op(binding, p, kernel, argidx, error, PREC))
411  {
412  if (optional)
413  {
414  // Check if we are to bind a default value...
415  if (binding.defval)
416  {
417  param_float = binding.fval;
418  CE_Snippet::bindKernelArgRaw(&param_float, 1,
419  kernel, argidx, binding.name, "float", p, error);
420  }
421  return true;
422  }
423  else
424  {
425  UT_WorkBuffer msg;
426  msg.sprintf("Invalid volume '%s'", (const char *) binding.volume);
427  if (missingseverity != UT_ERROR_NONE)
428  error->addGeneric("Common", UT_ERROR_JUST_STRING, msg.buffer(), missingseverity);
429  return false;
430  }
431  }
432 
433  break;
434  }
435 
436  case BindingType::VDB:
437  {
438  bool optional = binding.optional;
439 
440  // Ignore unbound optional volumes
441  if (!op(binding, p, kernel, argidx, error, PREC))
442  {
443  if (!optional)
444  {
445  UT_WorkBuffer msg;
446  msg.sprintf("Invalid vdb '%s'", (const char *) binding.volume);
447  if (missingseverity != UT_ERROR_NONE)
448  error->addGeneric("Common", UT_ERROR_JUST_STRING, msg.buffer(), missingseverity);
449  return false;
450  }
451  else
452  {
453  // Check if we are to bind a default value...
454  if (binding.defval)
455  {
456  param_float = binding.fval;
457  CE_Snippet::bindKernelArgRaw(&param_float, 1,
458  kernel, argidx, binding.name, "float", p, error);
459  }
460  return true;
461  }
462  }
463  break;
464  }
465 
466  case BindingType::OPTION:
467  {
468  bool optional = binding.optional;
469  bool defval = binding.defval;
470  bool flttype = (binding.optiontype == BindingOptionType::FLOAT);
471  int tuplesize = binding.optionsize;
472 
473  // Ignore unbound optional volumes
474  if (!op(binding, p, kernel, argidx, error, PREC))
475  {
476  if (!optional)
477  {
478  UT_WorkBuffer msg;
479  msg.sprintf("Invalid option '%s'", (const char *) binding.optionname);
480  if (missingseverity != UT_ERROR_NONE)
481  error->addGeneric("Common", UT_ERROR_JUST_STRING, msg.buffer(), missingseverity);
482  return false;
483  }
484  else
485  {
486  // Check if we are to bind a default value...
487  if (defval)
488  {
489  if (!flttype)
490  {
491  // Integers are single value.
492  param_int = binding.intval;
493  CE_Snippet::bindKernelArgRaw(&param_int, 1,
494  kernel, argidx, binding.name, "int", p, error);
495  }
496  else if (tuplesize == 3)
497  {
498  // Float Vector 3
499  param_float3 = binding.v3val;
500  param_fpreal_array[0] = param_float3(0);
501  param_fpreal_array[1] = param_float3(1);
502  param_fpreal_array[2] = param_float3(2);
503  param_fpreal_array[3] = 0;
504 
505  CE_Snippet::bindKernelArgRaw(param_fpreal_array, 4,
506  kernel, argidx, binding.name, "float3", p, error);
507  }
508  else if (tuplesize == 4)
509  {
510  // Float Vector 4
511  param_float4 = binding.v4val;
512  param_fpreal_array[0] = param_float4(0);
513  param_fpreal_array[1] = param_float4(1);
514  param_fpreal_array[2] = param_float4(2);
515  param_fpreal_array[3] = param_float4(3);
516  CE_Snippet::bindKernelArgRaw(param_fpreal_array, 4,
517  kernel, argidx, binding.name, "float", p, error);
518  }
519  else
520  {
521  // All other bind a single float default
522  param_float = binding.fval;
523  CE_Snippet::bindKernelArgRaw(&param_float, 1,
524  kernel, argidx, binding.name, "float", p, error);
525  }
526  }
527  return true;
528  }
529  }
530  break;
531  }
532 
533  case BindingType::LAYER:
534  {
535  bool optional = binding.optional;
536  bool defval = binding.defval;
537 
538  // Ignore unbound optional volumes
539  if (!op(binding, p, kernel, argidx, error, PREC))
540  {
541  if (!optional)
542  {
543  UT_WorkBuffer msg;
544  msg.sprintf("Invalid image '%s'", (const char *) binding.name);
545  if (missingseverity != UT_ERROR_NONE)
546  error->addGeneric("Common", UT_ERROR_JUST_STRING, msg.buffer(), missingseverity);
547  return false;
548  }
549  else
550  {
551  // Check if we are to bind a default value...
552  // Currently always vec4.
553  if (defval)
554  {
555  // Bind a single float4 default
556  param_float4 = binding.v4val;
557  param_fpreal_array[0] = binding.v4val.x();
558  param_fpreal_array[1] = binding.v4val.y();
559  param_fpreal_array[2] = binding.v4val.z();
560  param_fpreal_array[3] = binding.v4val.w();
561  CE_Snippet::bindKernelArgRaw(param_fpreal_array, 4,
562  kernel, argidx, binding.name, "float4", p, error);
563  }
564  return true;
565  }
566  }
567  break;
568  }
569  default:
570  break;
571  }
572 
573  return ok;
574  }
575 
576 } /// namespace
577 
578 #endif
#define CE_API
Definition: CE_API.h:10
BindingType type
Definition: CE_Snippet.h:147
UT_StringHolder attribute
Definition: CE_Snippet.h:165
UT_StringHolder fieldname
Definition: CE_Snippet.h:154
void bindKernelArgB(cl::Buffer val, cl::Kernel &kernel, int &argidx, const char *name, int pidx, const char *type, UT_ErrorManager *error, const char *extra=0)
typename CE_PrecisionResolver< P >::host_int_type CEintH
Definition: CE_Precision.h:62
UT_Matrix4D m4val
Definition: CE_Snippet.h:180
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector4.h:493
SYS_FORCE_INLINE const char * buffer() const
CE_API void reportSetArgError(const char *name, int argidx, int pidx, const char *type, const char *extra, UT_ErrorManager *error)
Adds an error to the error manager for mis-binding an argument.
void bindKernelArgF(cl_float val, cl::Kernel &kernel, int &argidx, const char *name, int pidx, UT_ErrorManager *error, const char *extra=0)
UT_ErrorSeverity
Definition: UT_Error.h:25
T * array()
Definition: UT_Array.h:819
int32_t cl_int
Definition: cl_platform.h:260
UT_StringHolder name
Definition: CE_Snippet.h:146
typename CE_PrecisionResolver< P >::host_float_type CEfloatH
Definition: CE_Precision.h:61
UT_Vector4D v4val
Definition: CE_Snippet.h:178
void writeBuffer(const cl::Buffer &buf, size_t size, const void *p, bool blocking=true, size_t offset=0)
Write the specified number of bytes to the buffer.
UT_Vector4D v4bval
Definition: CE_Snippet.h:179
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector4.h:491
UT_StringHolder optionname
Definition: CE_Snippet.h:186
bool setKernelArguments(const UT_Array< Binding > &bindings, BindingPrecision nodeprecision, cl::Kernel &kernel, int &argidx, UT_Array< cl::Buffer > &buffers, fpreal timestep, UT_ErrorManager *error, UT_ErrorSeverity missingseverity, const OP &op)
UT_Vector2D UT_Vector3D v3val
Definition: CE_Snippet.h:177
bool setKernelArgument(const Binding &binding, int p, cl::Kernel &kernel, int &argidx, UT_Array< cl::Buffer > &buffers, fpreal timestep, UT_ErrorManager *error, UT_ErrorSeverity missingseverity, const OP &op)
}
void bindKernelArgV3(cl_float *val, cl::Kernel &kernel, int &argidx, const char *name, int pidx, UT_ErrorManager *error, const char *extra=0)
NOTE: This binds float4 due to vagaries of cl!
static CE_Context * getContext(bool gl_shared=true, bool shared_fallback=true)
BindingOptionType optiontype
Definition: CE_Snippet.h:187
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector4.h:495
const fpreal32 * rampdata
Definition: CE_Snippet.h:149
const GLuint * buffers
Definition: glcorearb.h:661
GLuint const GLchar * name
Definition: glcorearb.h:786
UT_SharedPtr< UT_Ramp > ramp
Definition: CE_Snippet.h:148
exint append()
Definition: UT_Array.h:142
int sprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
BindingRampType ramptype
Definition: CE_Snippet.h:150
GLenum GLint GLint * precision
Definition: glcorearb.h:1925
exint entries() const
Alias of size(). size() is preferred.
Definition: UT_Array.h:648
float cl_float
Definition: cl_platform.h:266
GLint j
Definition: glad.h:2733
void bindKernelArgI(cl_int val, cl::Kernel &kernel, int &argidx, const char *name, int pidx, UT_ErrorManager *error, const char *extra=0)
void bindKernelArgI2(cl_int *val, cl::Kernel &kernel, int &argidx, const char *name, int pidx, UT_ErrorManager *error, const char *extra=0)
BindingAttribType attribtype
Definition: CE_Snippet.h:167
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1602
fpreal64 fpreal
Definition: SYS_Types.h:277
constexpr SYS_FORCE_INLINE T & w() noexcept
Definition: UT_Vector4.h:497
GLuint GLfloat * val
Definition: glcorearb.h:1608
void bindKernelArgV4(cl_float *val, cl::Kernel &kernel, int &argidx, const char *name, int pidx, UT_ErrorManager *error, const char *extra=0)
A global error manager scope.
Memory buffer interface.
Definition: cl.hpp:1867
UT_Vector2D v2val
Definition: CE_Snippet.h:176
void constant(const T &v)
Quickly set the array to a single value.
void bindKernelArgV16(cl_float *val, cl::Kernel &kernel, int &argidx, const char *name, int pidx, UT_ErrorManager *error, const char *extra=0)
cl_int setArg(cl_uint index, T value)
Definition: cl.hpp:2614
Kernel interface that implements cl_kernel.
Definition: cl.hpp:2544
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
GLboolean r
Definition: glcorearb.h:1222
type
Definition: core.h:1059
void bindKernelArgRaw(TYPE *val, int tuplesize, cl::Kernel &kernel, int &argidx, const char *name, const char *type, int pidx, UT_ErrorManager *error, const char *extra=0)
cl::Buffer allocBuffer(int64 size, bool usePool=true, bool read=true, bool write=true, uint32 ogl_bind=SYS_UINT32_MAX)
UT_StringHolder volume
Definition: CE_Snippet.h:157
UT_ErrorSeverity addGeneric(const char *type, int code, const char *msg, UT_ErrorSeverity sev, const UT_SourceLocation *loc=0)
BindingTimescale timescale
Definition: CE_Snippet.h:184