Class MeshTriangleBuffer
java.lang.Object
cz.fidentis.analyst.opencl.memory.BufferGPU<FloatBuffer>
cz.fidentis.analyst.opencl.memory.WriteBufferGPU<MeshTriangle>
cz.fidentis.analyst.opencl.memory.impl.MeshTriangleBuffer
- All Implemented Interfaces:
CLResources
Class providing readable conversion of
MeshTriangle
data to reside in OpenCL buffers
Each triangle is represented by 3 points and 3 vectors.
Each point and vector are copied to separate buffers, so the whole triangle is stored under one index.
For ex. To get 5th triangle on GPU --> we need to collect the components under index 5-
Constructor Summary
ConstructorsConstructorDescriptionMeshTriangleBuffer
(com.jogamp.opencl.CLContext clContext) Initializes buffer of size according to element count -
Method Summary
Modifier and TypeMethodDescriptionprotected void
allocateBuffer
(int elementCount) Allocate the buffer to fit the elementscom.jogamp.opencl.CLBuffer
<FloatBuffer> get()
Get underlying CLBufferGets data, that are currently copied to GPUvoid
putAll
(List<MeshTriangle> triangles) Populated buffer with desired elements.void
release()
Explicitly releases GPU resources held by this objectprotected void
resizeSubBuffer
(int elementCount) Creating new SubBuffer of the main buffer to operate with smaller amount of memoryvoid
rewind()
Rewinds the buffervoid
Copies contents to GPUMethods inherited from class cz.fidentis.analyst.opencl.memory.BufferGPU
getClContext, getCount, getElementSize, getQueue, getSize, resize
-
Constructor Details
-
MeshTriangleBuffer
public MeshTriangleBuffer(com.jogamp.opencl.CLContext clContext) Initializes buffer of size according to element count- Parameters:
clContext
-CLContext
of the buffer
-
-
Method Details
-
release
public void release()Description copied from interface:CLResources
Explicitly releases GPU resources held by this object -
writeToGPU
public void writeToGPU()Description copied from class:WriteBufferGPU
Copies contents to GPU- Specified by:
writeToGPU
in classWriteBufferGPU<MeshTriangle>
-
get
Description copied from class:BufferGPU
Get underlying CLBuffer- Specified by:
get
in classBufferGPU<FloatBuffer>
- Returns:
- CLBuffer
-
rewind
public void rewind()Description copied from class:BufferGPU
Rewinds the buffer- Specified by:
rewind
in classBufferGPU<FloatBuffer>
-
putAll
Description copied from class:WriteBufferGPU
Populated buffer with desired elements. Overwrites previous data and resizes itself, if needed. Is asynchronous! Make sure to call finish() method before use- Specified by:
putAll
in classWriteBufferGPU<MeshTriangle>
-
getOriginalData
Description copied from class:WriteBufferGPU
Gets data, that are currently copied to GPU- Specified by:
getOriginalData
in classWriteBufferGPU<MeshTriangle>
- Returns:
- data
-
allocateBuffer
protected void allocateBuffer(int elementCount) Description copied from class:BufferGPU
Allocate the buffer to fit the elements- Specified by:
allocateBuffer
in classBufferGPU<FloatBuffer>
- Parameters:
elementCount
- desired size of the buffer
-
resizeSubBuffer
protected void resizeSubBuffer(int elementCount) Description copied from class:BufferGPU
Creating new SubBuffer of the main buffer to operate with smaller amount of memory- Specified by:
resizeSubBuffer
in classBufferGPU<FloatBuffer>
- Parameters:
elementCount
- desired size of the buffer
-