OpenCL buffer object managment class More...
#include <Inventor/devices/SoOpenCLBufferObject.h>
Public Member Functions | |
SoOpenCLBufferObject () | |
virtual bool | setSize (size_t size) |
virtual void | memcpy (SoBufferObject *sourceBufferObject, size_t destOffset=0, size_t sourceOffset=0, size_t copySize=SO_BUFFER_SIZE_ALL) |
virtual void | memcpy (SoCpuBufferObject *sourceBufferObject, size_t destOffset=0, size_t sourceOffset=0, size_t copySize=SO_BUFFER_SIZE_ALL) |
virtual void | memcpy (SoOpenCLBufferObject *sourceBufferObject, size_t destOffset=0, size_t sourceOffset=0, size_t copySize=SO_BUFFER_SIZE_ALL) |
virtual void | memcpy (SoGLBufferObject *sourceBufferObject, size_t destOffset=0, size_t sourceOffset=0, size_t copySize=SO_BUFFER_SIZE_ALL) |
virtual void | memset (void *value, size_t valueSize=1, size_t offset=0, size_t count=SO_BUFFER_SIZE_ALL) |
virtual void | map (SoBufferObject *targetBufferObject, AccessMode accessMode, size_t startPosition=0, size_t mappingSize=SO_BUFFER_SIZE_ALL) |
virtual void | map (SoOpenCLBufferObject *targetBufferObject, AccessMode accessMode, size_t startPosition=0, size_t mappingSize=SO_BUFFER_SIZE_ALL) |
virtual void | map (SoCpuBufferObject *targetBufferObject, AccessMode accessMode, size_t startPosition=0, size_t mappingSize=SO_BUFFER_SIZE_ALL) |
virtual void | map (SoGLBufferObject *targetBufferObject, AccessMode accessMode, size_t startPosition=0, size_t mappingSize=SO_BUFFER_SIZE_ALL) |
virtual void | unmap (SoBufferObject *bufferObject) |
virtual void | unmap (SoOpenCLBufferObject *bufferObject) |
virtual void | unmap (SoCpuBufferObject *bufferObject) |
virtual void | unmap (SoGLBufferObject *bufferObject) |
virtual cl_mem | getLocation () |
virtual SoBufferObject * | createInstance () const |
virtual void | clearInstance () |
This class provides management functions for OpenCL memory buffers.
SoOpenCLBufferObject::SoOpenCLBufferObject | ( | ) |
Default constructor.
The SoOpenCLContext used for this buffer is the one active when the constructor is called.
virtual void SoOpenCLBufferObject::clearInstance | ( | ) | [virtual] |
Free the memory allocated by the buffer object.
Implements SoBufferObject.
virtual SoBufferObject* SoOpenCLBufferObject::createInstance | ( | ) | const [virtual] |
Creates a new buffer with the same properties as the current one.
The new instance will have the same context or device properties, but no memory is allocated.
Implements SoBufferObject.
virtual cl_mem SoOpenCLBufferObject::getLocation | ( | ) | [virtual] |
Returns a OpenCL pointer for this buffer object.
Be careful, the returned pointer is only valid in a OpenCL device function.
virtual void SoOpenCLBufferObject::map | ( | SoGLBufferObject * | targetBufferObject, | |
AccessMode | accessMode, | |||
size_t | startPosition = 0 , |
|||
size_t | mappingSize = SO_BUFFER_SIZE_ALL | |||
) | [virtual] |
Map the buffer object to a GL buffer object.
It is defined just to speed up the call when the type of the object is known.
See the general map function for more information.
virtual void SoOpenCLBufferObject::map | ( | SoCpuBufferObject * | targetBufferObject, | |
AccessMode | accessMode, | |||
size_t | startPosition = 0 , |
|||
size_t | mappingSize = SO_BUFFER_SIZE_ALL | |||
) | [virtual] |
Map the buffer object to a CPU buffer object.
It is defined just to speed up the call when the type of the object is known.
See the general map function for more information.
Implements SoBufferObject.
virtual void SoOpenCLBufferObject::map | ( | SoOpenCLBufferObject * | targetBufferObject, | |
AccessMode | accessMode, | |||
size_t | startPosition = 0 , |
|||
size_t | mappingSize = SO_BUFFER_SIZE_ALL | |||
) | [virtual] |
Map the buffer object to a OpenCL buffer object.
It is defined just to speed up the call when the type of the object is known.
See the general map function for more information.
Implements SoBufferObject.
virtual void SoOpenCLBufferObject::map | ( | SoBufferObject * | targetBufferObject, | |
AccessMode | accessMode, | |||
size_t | startPosition = 0 , |
|||
size_t | mappingSize = SO_BUFFER_SIZE_ALL | |||
) | [virtual] |
Map the buffer object to any buffer object.
It can be called from any context, the function binds the correct context when it's called!
If the target buffer is another OpenCL buffer object, the map function copies the data according to the context. It does a copy of the source buffer in a temp buffer if the two buffers don't use the same OpenCL context.
targetBufferObject | The target buffer object which receives the mapping from the OpenCL buffer. | |
accessMode | The access mode used for the mapping. | |
startPosition | Offset in source buffer to map from. | |
mappingSize | Number of bytes to map, if SO_BUFFER_SIZE_ALL then the whole buffer is mapped. |
virtual void SoOpenCLBufferObject::memcpy | ( | SoGLBufferObject * | sourceBufferObject, | |
size_t | destOffset = 0 , |
|||
size_t | sourceOffset = 0 , |
|||
size_t | copySize = SO_BUFFER_SIZE_ALL | |||
) | [virtual] |
Copy data from the specified GL buffer object into this buffer object.
This is an optimized implementation. See the general memcpy method for more information.
virtual void SoOpenCLBufferObject::memcpy | ( | SoOpenCLBufferObject * | sourceBufferObject, | |
size_t | destOffset = 0 , |
|||
size_t | sourceOffset = 0 , |
|||
size_t | copySize = SO_BUFFER_SIZE_ALL | |||
) | [virtual] |
Copy data from a OpenCL buffer into this OpenCL buffer.
This function is a specialized function for speed-up.
See the regular memcpy function for more information
Implements SoBufferObject.
virtual void SoOpenCLBufferObject::memcpy | ( | SoCpuBufferObject * | sourceBufferObject, | |
size_t | destOffset = 0 , |
|||
size_t | sourceOffset = 0 , |
|||
size_t | copySize = SO_BUFFER_SIZE_ALL | |||
) | [virtual] |
Copy data from a CPU buffer into the OpenCL buffer.
This function is a specialized function for speed-up.
See the regular memcpy function for more information
Implements SoBufferObject.
virtual void SoOpenCLBufferObject::memcpy | ( | SoBufferObject * | sourceBufferObject, | |
size_t | destOffset = 0 , |
|||
size_t | sourceOffset = 0 , |
|||
size_t | copySize = SO_BUFFER_SIZE_ALL | |||
) | [virtual] |
Copy data from any SoBufferObject into the OpenCL memory.
sourceBufferObject | The source buffer object which contains the data to copy. | |
destOffset | The starting offset in the source buffer. | |
sourceOffset | The starting offset in the source buffer. | |
copySize | The size in bytes of the chunk of data to copy. |
virtual void SoOpenCLBufferObject::memset | ( | void * | value, | |
size_t | valueSize = 1 , |
|||
size_t | offset = 0 , |
|||
size_t | count = SO_BUFFER_SIZE_ALL | |||
) | [virtual] |
This function sets the contents of (or a portion of) this buffer object to the specified value. The valueSize parameter provides a way to do a memset with float, short, byte, etc values. The number of bytes set in this buffer object is exactly valueSize*count. The first byte changed in this buffer is given by the offset argument.
value | is a pointer to the value to set in the buffer. | |
valueSize | The size in bytes of the value. Default is 1 byte. | |
offset | The offset in bytes (where to start setting values). Default is 0. | |
count | The number of values to set. Default is number of bytes in buffer. |
EXAMPLE
unsigned char memset_value = 0; buffer->memset( &memset_value );
Implements SoBufferObject.
virtual bool SoOpenCLBufferObject::setSize | ( | size_t | size | ) | [virtual] |
Sets the size in bytes of the buffer.
size | The new buffer size in bytes. |
Reimplemented from SoBufferObject.
virtual void SoOpenCLBufferObject::unmap | ( | SoGLBufferObject * | bufferObject | ) | [virtual] |
Unmap the specified GL buffer object.
It is defined just to speed up the call when the type of the object is known.
See the general unmap function for more information.
virtual void SoOpenCLBufferObject::unmap | ( | SoCpuBufferObject * | bufferObject | ) | [virtual] |
Unmap the specified CPU buffer object.
It is defined just to speed up the call when the type of the object is known.
See the general unmap function for more information.
Implements SoBufferObject.
virtual void SoOpenCLBufferObject::unmap | ( | SoOpenCLBufferObject * | bufferObject | ) | [virtual] |
Unmap the specified OpenCL buffer object.
It is defined just to speed up the call when the type of the object is known.
See the general unmap function for more information.
Implements SoBufferObject.
virtual void SoOpenCLBufferObject::unmap | ( | SoBufferObject * | bufferObject | ) | [virtual] |
Unmap the specified buffer object.