HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CE_Snippet Namespace Reference

Classes

struct  Binding
 

Enumerations

enum  RunOver {
  RunOver::ATTRIBUTE = 0, RunOver::VOLUME, RunOver::WORKSETS, RunOver::FIELDS,
  RunOver::VDB, RunOver::LAYER
}
 
enum  BindingType {
  BindingType::INVALID = -1, BindingType::INT, BindingType::INTARRAY, BindingType::FLOAT,
  BindingType::FLOAT2, BindingType::FLOAT3, BindingType::FLOAT4, BindingType::FLOAT8,
  BindingType::FLOAT16, BindingType::FIELD_S, BindingType::FIELD_V, BindingType::FIELD_M,
  BindingType::RAMP, BindingType::ATTRIBUTE, BindingType::VOLUME, BindingType::VDB,
  BindingType::OPTION, BindingType::LAYER, BindingType::NUM_TYPES
}
 
enum  BindingAttribClass { BindingAttribClass::DETAIL, BindingAttribClass::PRIMITIVE, BindingAttribClass::POINT, BindingAttribClass::VERTEX }
 
enum  BindingAttribType { BindingAttribType::FLOAT, BindingAttribType::INT, BindingAttribType::FLOATARRAY, BindingAttribType::INTARRAY }
 
enum  BindingVDBType { BindingVDBType::ANY, BindingVDBType::FLOAT, BindingVDBType::VECTOR }
 
enum  BindingPrecision { BindingPrecision::NODE, BindingPrecision::_16, BindingPrecision::_32, BindingPrecision::_64 }
 
enum  BindingTimescale { BindingTimescale::NONE, BindingTimescale::MULT, BindingTimescale::INVERT, BindingTimescale::POW }
 
enum  BindingRampType { BindingRampType::FLOAT, BindingRampType::VECTOR }
 
enum  BindingLayerType {
  BindingLayerType::INT, BindingLayerType::FLOAT, BindingLayerType::FLOAT2, BindingLayerType::FLOAT3,
  BindingLayerType::FLOAT4, BindingLayerType::FLOATN
}
 
enum  BindingLayerBorder {
  BindingLayerBorder::INPUT, BindingLayerBorder::CONSTANT, BindingLayerBorder::CLAMP, BindingLayerBorder::MIRROR,
  BindingLayerBorder::WRAP
}
 
enum  BindingOptionType { BindingOptionType::FLOAT, BindingOptionType::INT }
 

Functions

CE_API const char * bindingTypeToString (BindingType type)
 
CE_API const char * bindingAttribClassToString (BindingAttribClass type)
 
CE_API const char * bindingAttribTypeToString (BindingAttribType type)
 
CE_API const char * bindingVDBTypeToString (BindingVDBType type)
 
CE_API const char * bindingPrecisionToString (BindingPrecision type)
 
CE_API const char * bindingTimescaleToString (BindingTimescale type)
 
CE_API const char * bindingRampTypeToString (BindingRampType type)
 
CE_API const char * bindingLayerTypeToString (BindingLayerType type)
 
CE_API const char * bindingLayerBorderToString (BindingLayerBorder type)
 
CE_API const char * bindingOptionTypeToString (BindingOptionType type)
 
CE_API UT_StringHolder protectAts (UT_StringHolder code)
 
CE_API UT_StringHolder findIncludeFile (const char *path, bool searchcwd, UT_ErrorManager *error)
 
CE_API UT_StringHolder loadImport (const char *path, bool searchcwd, UT_ErrorManager *error)
 Loads an import, searching the include path to locate it. More...
 
CE_API UT_StringHolder expandImportDirectives (UT_StringHolder code, UT_ErrorManager *error)
 Expands all #import directives. More...
 
CE_API UT_StringHolder extractBindings (UT_StringHolder code, UT_Array< Binding > &bindings, UT_ErrorManager *error)
 
CE_API UT_StringHolder generateAtCode (UT_StringHolder code, RunOver runover, UT_Options *opt, UT_StringMap< UT_StringHolder > *globals, UT_StringMap< UT_StringHolder > *missing_globals, const UT_Array< Binding > &bindings, const char *kernelsig, const char *writebacksig, UT_ErrorManager *error)
 
CE_API UT_StringHolder restoreAts (UT_StringHolder code)
 Restore protected to be @ again. More...
 
CE_API bool parseType (const UT_StringRef &attribtypename, BindingAttribType &attribtype, BindingPrecision &precision, int &tuplesize)
 
CE_API UT_StringHolder computeSyntax (const char *code)
 
CE_API void buildArgumentSign (const Binding &binding, int p, int maxparam, UT_WorkBuffer &sign, UT_StringHolder &firstwriteable, bool &firstwriteable_forced, BindingVDBType &firstvdbtype, bool prefixbound, RunOver runover, bool fieldsarealigned, UT_WorkBuffer &paraminitcode)
 Append into sign the argument signature for a binding. More...
 
CE_API void buildKernelRunOverArguments (UT_WorkBuffer &signature, RunOver runover, bool singleworkgroup, bool filedsarealigned, bool prefixbound)
 
CE_API void addKernelArgument (UT_WorkBuffer &signature, const char *type, const char *name, bool prefixbound)
 
CE_API void buildKernelRunOverCode (UT_WorkBuffer &signature, RunOver runover, BindingVDBType firstvdbtype, bool singleworkgroup, bool fieldsarealigned, bool firstname_forced, bool prefixbound, UT_StringRef firstname)
 Append into sign the code to start the provided runover mode. More...
 
template<CE_Precision PREC, typename OP >
bool setKernelArgument (const CE_Snippet::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)
 } More...
 
template<typename OP >
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)
 
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. More...
 
template<typename TYPE >
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)
 
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)
 
void bindKernelArgF (cl_float val, cl::Kernel &kernel, int &argidx, const char *name, int pidx, UT_ErrorManager *error, const char *extra=0)
 
void bindKernelArgV2 (cl_float *val, cl::Kernel &kernel, int &argidx, const char *name, int pidx, UT_ErrorManager *error, const char *extra=0)
 
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! More...
 
void bindKernelArgV4 (cl_float *val, cl::Kernel &kernel, int &argidx, const char *name, int pidx, UT_ErrorManager *error, const char *extra=0)
 
void bindKernelArgV16 (cl_float *val, cl::Kernel &kernel, int &argidx, const char *name, int pidx, UT_ErrorManager *error, const char *extra=0)
 
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)
 

Enumeration Type Documentation

Enumerator
DETAIL 
PRIMITIVE 
POINT 
VERTEX 

Definition at line 66 of file CE_Snippet.h.

Enumerator
FLOAT 
INT 
FLOATARRAY 
INTARRAY 

Definition at line 75 of file CE_Snippet.h.

Enumerator
INPUT 
CONSTANT 
CLAMP 
MIRROR 
WRAP 

Definition at line 128 of file CE_Snippet.h.

Enumerator
INT 
FLOAT 
FLOAT2 
FLOAT3 
FLOAT4 
FLOATN 

Definition at line 117 of file CE_Snippet.h.

Enumerator
FLOAT 
INT 

Definition at line 138 of file CE_Snippet.h.

Enumerator
NODE 
_16 
_32 
_64 

Definition at line 92 of file CE_Snippet.h.

Enumerator
FLOAT 
VECTOR 

Definition at line 110 of file CE_Snippet.h.

Enumerator
NONE 
MULT 
INVERT 
POW 

Definition at line 101 of file CE_Snippet.h.

Enumerator
INVALID 
INT 
INTARRAY 
FLOAT 
FLOAT2 
FLOAT3 
FLOAT4 
FLOAT8 
FLOAT16 
FIELD_S 
FIELD_V 
FIELD_M 
RAMP 
ATTRIBUTE 
VOLUME 
VDB 
OPTION 
LAYER 
NUM_TYPES 

Definition at line 42 of file CE_Snippet.h.

Enumerator
ANY 
FLOAT 
VECTOR 

Definition at line 84 of file CE_Snippet.h.

enum CE_Snippet::RunOver
strong
Enumerator
ATTRIBUTE 
VOLUME 
WORKSETS 
FIELDS 
VDB 
LAYER 

Definition at line 32 of file CE_Snippet.h.

Function Documentation

CE_API void CE_Snippet::addKernelArgument ( UT_WorkBuffer signature,
const char *  type,
const char *  name,
bool  prefixbound 
)
CE_API const char* CE_Snippet::bindingAttribClassToString ( BindingAttribClass  type)
CE_API const char* CE_Snippet::bindingAttribTypeToString ( BindingAttribType  type)
CE_API const char* CE_Snippet::bindingLayerBorderToString ( BindingLayerBorder  type)
CE_API const char* CE_Snippet::bindingLayerTypeToString ( BindingLayerType  type)
CE_API const char* CE_Snippet::bindingOptionTypeToString ( BindingOptionType  type)
CE_API const char* CE_Snippet::bindingPrecisionToString ( BindingPrecision  type)
CE_API const char* CE_Snippet::bindingRampTypeToString ( BindingRampType  type)
CE_API const char* CE_Snippet::bindingTimescaleToString ( BindingTimescale  type)
CE_API const char* CE_Snippet::bindingTypeToString ( BindingType  type)
CE_API const char* CE_Snippet::bindingVDBTypeToString ( BindingVDBType  type)
void CE_Snippet::bindKernelArgB ( cl::Buffer  val,
cl::Kernel kernel,
int argidx,
const char *  name,
int  pidx,
const char *  type,
UT_ErrorManager error,
const char *  extra = 0 
)
inline

Definition at line 133 of file CE_SnippetKernelBind.h.

void CE_Snippet::bindKernelArgF ( cl_float  val,
cl::Kernel kernel,
int argidx,
const char *  name,
int  pidx,
UT_ErrorManager error,
const char *  extra = 0 
)
inline

Definition at line 112 of file CE_SnippetKernelBind.h.

void CE_Snippet::bindKernelArgI ( cl_int  val,
cl::Kernel kernel,
int argidx,
const char *  name,
int  pidx,
UT_ErrorManager error,
const char *  extra = 0 
)
inline

Binds a kernel argument of the type, incrementing the argidx Will throw an error and add the error to the provided error manager. {

Definition at line 104 of file CE_SnippetKernelBind.h.

void CE_Snippet::bindKernelArgI2 ( cl_int val,
cl::Kernel kernel,
int argidx,
const char *  name,
int  pidx,
UT_ErrorManager error,
const char *  extra = 0 
)
inline

Definition at line 108 of file CE_SnippetKernelBind.h.

template<typename TYPE >
void CE_Snippet::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 
)
inline

Definition at line 84 of file CE_SnippetKernelBind.h.

void CE_Snippet::bindKernelArgV16 ( cl_float val,
cl::Kernel kernel,
int argidx,
const char *  name,
int  pidx,
UT_ErrorManager error,
const char *  extra = 0 
)
inline

Definition at line 129 of file CE_SnippetKernelBind.h.

void CE_Snippet::bindKernelArgV2 ( cl_float val,
cl::Kernel kernel,
int argidx,
const char *  name,
int  pidx,
UT_ErrorManager error,
const char *  extra = 0 
)
inline

Definition at line 116 of file CE_SnippetKernelBind.h.

void CE_Snippet::bindKernelArgV3 ( cl_float val,
cl::Kernel kernel,
int argidx,
const char *  name,
int  pidx,
UT_ErrorManager error,
const char *  extra = 0 
)
inline

NOTE: This binds float4 due to vagaries of cl!

Definition at line 121 of file CE_SnippetKernelBind.h.

void CE_Snippet::bindKernelArgV4 ( cl_float val,
cl::Kernel kernel,
int argidx,
const char *  name,
int  pidx,
UT_ErrorManager error,
const char *  extra = 0 
)
inline

Definition at line 125 of file CE_SnippetKernelBind.h.

CE_API void CE_Snippet::buildArgumentSign ( const Binding &  binding,
int  p,
int  maxparam,
UT_WorkBuffer sign,
UT_StringHolder firstwriteable,
bool &  firstwriteable_forced,
BindingVDBType &  firstvdbtype,
bool  prefixbound,
RunOver  runover,
bool  fieldsarealigned,
UT_WorkBuffer paraminitcode 
)

Append into sign the argument signature for a binding.

CE_API void CE_Snippet::buildKernelRunOverArguments ( UT_WorkBuffer signature,
RunOver  runover,
bool  singleworkgroup,
bool  filedsarealigned,
bool  prefixbound 
)

Append into signature the arguments required for the runover mode.

CE_API void CE_Snippet::buildKernelRunOverCode ( UT_WorkBuffer signature,
RunOver  runover,
BindingVDBType  firstvdbtype,
bool  singleworkgroup,
bool  fieldsarealigned,
bool  firstname_forced,
bool  prefixbound,
UT_StringRef  firstname 
)

Append into sign the code to start the provided runover mode.

CE_API UT_StringHolder CE_Snippet::computeSyntax ( const char *  code)

Return a syntax string that is byte-for-byte with code describing the state at that point.

CE_API UT_StringHolder CE_Snippet::expandImportDirectives ( UT_StringHolder  code,
UT_ErrorManager error 
)

Expands all #import directives.

CE_API UT_StringHolder CE_Snippet::extractBindings ( UT_StringHolder  code,
UT_Array< Binding > &  bindings,
UT_ErrorManager error 
)

Process all commands appending to the provided Bindings array. Returns the code with the elided

CE_API UT_StringHolder CE_Snippet::findIncludeFile ( const char *  path,
bool  searchcwd,
UT_ErrorManager error 
)

Expands a path into the matching include file on the search path

CE_API UT_StringHolder CE_Snippet::generateAtCode ( UT_StringHolder  code,
RunOver  runover,
UT_Options opt,
UT_StringMap< UT_StringHolder > *  globals,
UT_StringMap< UT_StringHolder > *  missing_globals,
const UT_Array< Binding > &  bindings,
const char *  kernelsig,
const char *  writebacksig,
UT_ErrorManager error 
)

Returns the kernel code transformed by the bindings, ie, all @ commands turned into accessors and the appropriate prequel code generated. Globals generate := _bound_VAL

CE_API UT_StringHolder CE_Snippet::loadImport ( const char *  path,
bool  searchcwd,
UT_ErrorManager error 
)

Loads an import, searching the include path to locate it.

CE_API bool CE_Snippet::parseType ( const UT_StringRef attribtypename,
BindingAttribType &  attribtype,
BindingPrecision &  precision,
int tuplesize 
)

Given an opencl decorated typename break it into type, precision, and size. TYPE#[] TYPE: half, float, double, fpreal, short, int, long exint #: missing means scalar, ? means -1. [] optional to flag array.

CE_API UT_StringHolder CE_Snippet::protectAts ( UT_StringHolder  code)

Protect that shouldn't be parsed because they are in comments or in quotes with ATSAFESTRING

CE_API void CE_Snippet::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.

CE_API UT_StringHolder CE_Snippet::restoreAts ( UT_StringHolder  code)

Restore protected to be @ again.

template<CE_Precision PREC, typename OP >
bool CE_Snippet::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 
)
inline

}

Definition at line 153 of file CE_SnippetKernelBind.h.

template<typename OP >
bool CE_Snippet::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 
)
inline

Binds each of the bindings in turn. OP is a callback structure that knows how to bind the various bespoke types, with bool operator()(const CE_Snippet::Binding &binding, int p, cl::Kernel &kernel, int &argidx, UT_ErrorManager *error, CE_Precision PREC)

Definition at line 39 of file CE_SnippetKernelBind.h.