VTK-m
2.2
|
Manages the state for transferring an ArrayHandle to opengl. More...
#include <BufferState.h>
Public Member Functions | |
BufferState (GLuint &gLHandle) | |
Construct a BufferState using an existing GLHandle. More... | |
BufferState (GLuint &gLHandle, GLenum type) | |
Construct a BufferState using an existing GLHandle and type. More... | |
BufferState () | |
~BufferState () | |
GLuint * | GetHandle () const |
get the OpenGL buffer handle More... | |
bool | HasType () const |
return if this buffer has a valid OpenGL buffer type More... | |
GLenum | GetType () const |
return what OpenGL buffer type we are bound to More... | |
void | SetType (GLenum type) |
Set what type of OpenGL buffer type we should bind as. More... | |
template<typename T > | |
void | DeduceAndSetType (T t) |
deduce the buffer type from the template value type that was passed in, and set that as our type More... | |
vtkm::Int64 | GetSize () const |
Get the size of the buffer in bytes. More... | |
void | SetSize (vtkm::Int64 size) |
vtkm::Int64 | GetCapacity () const |
Get the capacity of the buffer in bytes. More... | |
bool | ShouldRealloc (vtkm::Int64 desiredSize) const |
void | SetCapacity (vtkm::Int64 capacity) |
vtkm::interop::internal::TransferResource * | GetResource () |
void | SetResource (vtkm::interop::internal::TransferResource *resource) |
Private Member Functions | |
BufferState (const BufferState &)=delete | |
void | operator= (const BufferState &)=delete |
Private Attributes | |
GLuint * | OpenGLHandle |
GLenum | BufferType |
vtkm::Int64 | SizeOfActiveSection |
vtkm::Int64 | CapacityOfBuffer |
GLuint | DefaultGLHandle |
std::unique_ptr< vtkm::interop::internal::TransferResource > | Resource |
Manages the state for transferring an ArrayHandle to opengl.
BufferState
holds all the relevant data information for a given ArrayHandle mapping into OpenGL. Reusing the state information for all renders of an ArrayHandle will allow for the most efficient interop between backends and OpenGL ( especially for CUDA ).
The interop code in vtk-m uses a lazy buffer re-allocation.
|
inline |
Construct a BufferState using an existing GLHandle.
|
inline |
Construct a BufferState using an existing GLHandle and type.
|
inline |
|
inline |
|
privatedelete |
|
inline |
deduce the buffer type from the template value type that was passed in, and set that as our type
Will be GL_ELEMENT_ARRAY_BUFFER for vtkm::Int32, vtkm::UInt32, vtkm::Int64, vtkm::UInt64, vtkm::Id, and vtkm::IdComponent will be GL_ARRAY_BUFFER for everything else.
|
inline |
Get the capacity of the buffer in bytes.
The buffers that vtk-m allocate in OpenGL use lazy resizing. This allows vtk-m to not have to reallocate a buffer while the size stays the same or shrinks. This allows allows the cuda to OpenGL to perform significantly better as we than don't need to call cudaGraphicsGLRegisterBuffer as often
|
inline |
get the OpenGL buffer handle
|
inline |
|
inline |
Get the size of the buffer in bytes.
Get the size of the active section of the buffer This will always be <= the capacity of the buffer
|
inline |
return what OpenGL buffer type we are bound to
will return GL_INVALID_VALUE if we don't have a valid type set
|
inline |
return if this buffer has a valid OpenGL buffer type
|
privatedelete |
|
inline |
|
inline |
|
inline |
|
inline |
Set what type of OpenGL buffer type we should bind as.
|
inline |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |