Class Context

Class Documentation

class legion::core::compute::Context

Wraps a cl_context in a neater interface.

Public Static Functions

static void init()

Initializes the OpenCL context.

Pre

initialized

static bool initialized()

Checks if the OpenCL context is initialized.

static Program createProgram(const filesystem::basic_resource &resource)

Creates a Program from a basic resource (can be file or buffer).

Return

A Program Object that supports execution

Parameters

template<class T>
static inline Buffer createBuffer(std::vector<T> &container, buffer_type type, std::string name = "")

Creates an OpenCL Native Buffer (GPU or similar) with a host buffer.

See

buffer_type

Return

a Native Buffer Object

Parameters
  • container: A container filled with any arbitrary Data, you must make sure that the alignment corresponds to the Device Buffer.

  • type: The type of Buffer you want to create can be either READ, WRITE or READ | WRITE

Parameters
  • name: (optional) The name of the Buffer, this is useful for automatically entering the buffer into a kernel

static inline Buffer createBuffer(byte *data, size_type size, buffer_type type, std::string name = "")
static inline Buffer createImage(image &img, buffer_type type, std::string name = "")
static inline Buffer createImageFromOpenGLImage(uint target, uint texture, buffer_type type, std::string name = "", uint mip_level = 0)
static inline Buffer createImageFromOpenGLBuffer(uint bufferid, buffer_type type, std::string name = "")
static inline Buffer createImageFromOpenGLRenderBuffer(uint bufferid, buffer_type type, std::string name = "")
static inline cl_device_id getDeviceId()

Returns the OpenCL device-id associated with this context.