Class BufferGPU<T extends Buffer>
java.lang.Object
cz.fidentis.analyst.opencl.memory.BufferGPU<T>
- Type Parameters:
T
- Any type to be stored in buffer
- All Implemented Interfaces:
CLResources
- Direct Known Subclasses:
IntegerBuffer
,RayIntersectionBuffer
,WriteBufferGPU
Buffer in GPU memory. Read-Only on host side.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionBufferGPU
(com.jogamp.opencl.CLContext clContext) Creates Buffer in specified OpenCl Context with default element size set to 1protected
BufferGPU
(com.jogamp.opencl.CLContext clContext, int elementSize) Creates Buffer in specified OpenCl Context with given element size -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
allocateBuffer
(int desiredSize) Allocate the buffer to fit the elementsabstract com.jogamp.opencl.CLBuffer
<T> get()
Get underlying CLBuffercom.jogamp.opencl.CLContext
Get current OpenCL contextint
getCount()
int
Some elements take multiple values to be continuously stored in buffer.protected com.jogamp.opencl.CLCommandQueue
getQueue()
Get current OpenCL queueint
getSize()
void
resize
(int elementCount) Creating new buffer and releasing the old one is costly.protected abstract void
resizeSubBuffer
(int desiredSize) Creating new SubBuffer of the main buffer to operate with smaller amount of memoryabstract void
rewind()
Rewinds the bufferMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface cz.fidentis.analyst.opencl.memory.CLResources
release
-
Constructor Details
-
BufferGPU
public BufferGPU(com.jogamp.opencl.CLContext clContext) Creates Buffer in specified OpenCl Context with default element size set to 1- Parameters:
clContext
- OpenCl Context
-
BufferGPU
protected BufferGPU(com.jogamp.opencl.CLContext clContext, int elementSize) Creates Buffer in specified OpenCl Context with given element size- Parameters:
clContext
- OpenCl ContextelementSize
- element size
-
-
Method Details
-
getElementSize
public int getElementSize()Some elements take multiple values to be continuously stored in buffer.- Returns:
- Size of 1 element loaded in buffer.
-
getCount
public int getCount()- Returns:
- Count of the elements loaded inside. Do not confuse with the actual size of allocated memory
-
getSize
public int getSize()- Returns:
- Memory size of the buffer. Do not confuse with current element count
-
getClContext
public com.jogamp.opencl.CLContext getClContext()Get current OpenCL context- Returns:
- OpenCL context
-
resize
public void resize(int elementCount) Creating new buffer and releasing the old one is costly. Reuse them if they are already big enough.- Parameters:
elementCount
- element count to fit in
-
get
Get underlying CLBuffer- Returns:
- CLBuffer
-
rewind
public abstract void rewind()Rewinds the buffer -
allocateBuffer
protected abstract void allocateBuffer(int desiredSize) Allocate the buffer to fit the elements- Parameters:
desiredSize
- desired size of the buffer
-
resizeSubBuffer
protected abstract void resizeSubBuffer(int desiredSize) Creating new SubBuffer of the main buffer to operate with smaller amount of memory- Parameters:
desiredSize
- desired size of the buffer
-
getQueue
protected com.jogamp.opencl.CLCommandQueue getQueue()Get current OpenCL queue- Returns:
- OpenCL queue
-