11 #ifndef __CE_Context__
12 #define __CE_Context__
42 virtual
void rebindOGLBuffer(
uint buf_obj ) = 0;
43 virtual
void unbindOGLBuffer() = 0;
44 virtual
bool isBinded() = 0;
74 const cl_image_desc *desc,
81 #ifndef CL_UUID_SIZE_KHR
82 #define CL_UUID_SIZE_KHR 16
101 static CE_Context *getContext(
bool gl_shared =
true,
102 bool shared_fallback =
true);
104 static bool isGLSharingPossible();
127 void get1DRanges(
const cl::Kernel &k,
size_t items,
131 size_t getMaxWorkgroupSize(
const cl::Kernel &k);
134 std::vector<size_t> getMaxWorkItemSizes();
140 static size_t roundUpGroupSize(
size_t gsize);
149 cl::Program loadProgram(
const char *progname,
const char *options = NULL,
150 bool recompile =
false);
151 cl::Program compileProgram(
const char *progtext,
const char *options = NULL,
152 bool recompile =
false);
160 const char *options = NULL)
161 {
return loadKernel(loadProgram(progname, options), kernelname); }
169 static bool isInitialized(
bool gl_shared=
false);
183 void finish(
bool sweepPool=
true);
210 void unregisterDelayedOGLBindBuffer(
uint32 id);
226 bool supportsExternalMemory();
239 const cl_image_desc& image_desc,
240 bool read =
true,
bool write =
true);
243 void clearMemoryPool();
268 static void reportError(
const cl::Error &err);
269 static void outputErrorMessage(
const char *errMsg);
271 static void outputWarningMessage(
const char *errMsg);
273 static void initMainSharedGLContext(
int devicetype,
void* context,
void* display );
274 static bool useHalfNormalDelayedBindBuffer();
295 static int getDefaultDevice(
299 static bool isEnvironmentOverride();
313 size_t getAddressableMemory()
const;
323 void registerMemFreeFunc(FreeFunc
func);
327 return myMemFreeFuncs;
331 void reportUsage(std::ostream &os)
const;
334 cl::Program *doCompileProgram(
const char *progtext,
const char *options,
341 void releasePinnedBuffer();
387 const std::vector<cl::Event>* events,
struct _cl_device_id * cl_device_id
bool has3DImageWriteSupport() const
Returns true if the OpenCL device supports writing to 3D image objects.
GLenum GLuint GLenum GLsizei const GLchar * buf
cl::Device getDevice() const
Returns the OpenCL Device object.
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
bool myOutOfMemoryFailure
UT_StringHolder platformVendor
cl::Kernel loadKernel(const char *progname, const UT_StringRef &kernelname, const char *options=NULL)
bool mySupports3DImageWrites
ceTraceCtx getTraceContext() const
CE_API cl_int ce_enqueueKernel(const cl::CommandQueue &queue, const cl::Kernel &kernel, const cl::NDRange &offset, const cl::NDRange &global, const cl::NDRange &local, const std::vector< cl::Event > *events, cl::Event *event)
**But if you need a result
virtual ~CE_DelayedOGLBindBuffer()
cl::CommandQueue getQueue() const
Event interface for cl_event.
bool isValid() const
Returns whether the CE_Context has been successfully initialized.
UT_Map< uint32, CE_DelayedOGLBindBuffer * > myDelayedOGLBindBuffers
cl_bitfield cl_device_type
cl::CommandQueue myDeviceQueue
GLint GLint GLsizei GLint GLenum format
CE_MemoryPool * myMemPool
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the queue
static void * theGLDisplay
void setOutOfMemoryFailure(bool hasfailed=true)
CommandQueue interface for cl_command_queue.
static void * theGLContext
cl_int getInfo(Func f, cl_uint name, T *param)
CE_DelayedOGLBindBuffer()
UT_Array< FreeFunc > myMemFreeFuncs
const UT_Array< FreeFunc > & getMemFreeFuncs() const
Returns the list of registered memory freeing functions.
Base class interface for all images.
void(* CE_ErrorCB)(const char *errmsg, UT_ErrorSeverity severity, void *data)
Kernel interface that implements cl_kernel.
cl::Context getCLContext() const
Returns the underlying cl::Context object.
static int theGLDeviceType
UT_Map< const _cl_program *, UT_Array< KernelInfo > * > myKernelTable
Device interface for cl_device_id.
bool hasDoubleSupport() const
Returns true if the OpenCL device supports double precision.
Program interface that implements cl_program.
bool hasOutOfMemoryFailureHappened() const
cl::Buffer myPinnedBuffer
UT_StringMap< cl::Program * > myProgramTable