CUDA buffer object managment class More...
#include <Inventor/devices/SoCudaBufferObject.h>
Public Member Functions | |
SoCudaBufferObject () | |
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 (SoCudaBufferObject *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 (SoCudaBufferObject *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 (SoCudaBufferObject *bufferObject) |
virtual void | unmap (SoCpuBufferObject *bufferObject) |
virtual void | unmap (SoGLBufferObject *bufferObject) |
virtual void * | getLocation () |
virtual SoBufferObject * | createInstance () const |
virtual void | clearInstance () |
This class provides management functions for CUDA memory buffers.
SoCudaBufferObject::SoCudaBufferObject | ( | ) |
Default constructor.
The SoCudaContext used for this buffer is the one active when the constructor is called.
virtual void SoCudaBufferObject::clearInstance | ( | ) | [virtual] |
Free the memory allocated by the buffer object.
Implements SoBufferObject.
virtual SoBufferObject* SoCudaBufferObject::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 void* SoCudaBufferObject::getLocation | ( | ) | [virtual] |
Returns a CUDA pointer for this buffer object.
Be careful, the returned pointer is only valid in a CUDA device function.
virtual void SoCudaBufferObject::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 SoCudaBufferObject::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 SoCudaBufferObject::map | ( | SoCudaBufferObject * | targetBufferObject, | |
AccessMode | accessMode, | |||
size_t | startPosition = 0 , |
|||
size_t | mappingSize = SO_BUFFER_SIZE_ALL | |||
) | [virtual] |
Map the buffer object to a CUDA 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 SoCudaBufferObject::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 CUDA 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 CUDA context.
targetBufferObject | The target buffer object which receives the mapping from the CUDA 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 SoCudaBufferObject::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 SoCudaBufferObject::memcpy | ( | SoCudaBufferObject * | sourceBufferObject, | |
size_t | destOffset = 0 , |
|||
size_t | sourceOffset = 0 , |
|||
size_t | copySize = SO_BUFFER_SIZE_ALL | |||
) | [virtual] |
Copy data from a CUDA buffer into this CUDA buffer.
This function is a specialized function for speed-up.
See the regular memcpy function for more information
Implements SoBufferObject.
virtual void SoCudaBufferObject::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 CUDA buffer.
This function is a specialized function for speed-up.
See the regular memcpy function for more information
Implements SoBufferObject.
virtual void SoCudaBufferObject::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 CUDA 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 SoCudaBufferObject::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 SoCudaBufferObject::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 SoCudaBufferObject::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 SoCudaBufferObject::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 SoCudaBufferObject::unmap | ( | SoCudaBufferObject * | bufferObject | ) | [virtual] |
Unmap the specified CUDA 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 SoCudaBufferObject::unmap | ( | SoBufferObject * | bufferObject | ) | [virtual] |
Unmap the specified buffer object.