11 #ifndef __CE_Context__
12 #define __CE_Context__
40 virtual
void rebindOGLBuffer(
uint buf_obj ) = 0;
41 virtual
void unbindOGLBuffer() = 0;
42 virtual
bool isBinded() = 0;
51 virtual ~CE_Context();
61 static CE_Context *getContext(
bool gl_shared =
true,
62 bool shared_fallback =
true);
64 static bool isGLSharingPossible();
87 void get1DRanges(
const cl::Kernel &k,
size_t items,
91 size_t getMaxWorkgroupSize(
const cl::Kernel &k);
94 std::vector<size_t> getMaxWorkItemSizes();
100 static size_t roundUpGroupSize(
size_t gsize);
109 cl::Program loadProgram(
const char *progname,
const char *options = NULL,
110 bool recompile =
false);
111 cl::Program compileProgram(
const char *progtext,
const char *options = NULL,
112 bool recompile =
false);
120 const char *options = NULL)
121 {
return loadKernel(loadProgram(progname, options), kernelname); }
129 static bool isInitialized(
bool gl_shared=
false);
143 void finish(
bool sweepPool=
true);
170 void unregisterDelayedOGLBindBuffer(
uint32 id);
174 void clearMemoryPool();
199 static void reportError(
const cl::Error &err);
200 static void outputErrorMessage(
const char *errMsg);
202 static void outputWarningMessage(
const char *errMsg);
204 static void initMainSharedGLContext(
int devicetype,
void* context,
void* display );
205 static bool useHalfNormalDelayedBindBuffer();
226 static int getDefaultDevice(
230 static bool isEnvironmentOverride();
243 cl::Program *doCompileProgram(
const char *progtext,
const char *options);
249 void releasePinnedBuffer();
289 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
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()
void read(T &in, bool &v)
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
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()
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.
void write(T &out, bool v)
Program interface that implements cl_program.
bool hasOutOfMemoryFailureHappened() const
cl::Buffer myPinnedBuffer
UT_StringMap< cl::Program * > myProgramTable