vtkDataTransferHelper Class Reference

#include <vtkDataTransferHelper.h>

Inheritance diagram for vtkDataTransferHelper:

Inheritance graph
[legend]
Collaboration diagram for vtkDataTransferHelper:

Collaboration graph
[legend]

List of all members.


Detailed Description

is a helper class that aids in transferring data between CPU memory and GPU memory.

vtkDataTransferHelper is a helper class that aids in transferring data between the CPU memory and the GPU memory. The data in GPU memory is stored as textures which that in CPU memory is stored as vtkDataArray. vtkDataTransferHelper provides API to transfer only a sub-extent of CPU structured data to/from the GPU.

See also:
vtkPixelBufferObject vtkTextureObject vtkOpenGLExtensionManager

Definition at line 43 of file vtkDataTransferHelper.h.


Public Types

typedef vtkObject Superclass

Public Member Functions

virtual const char * GetClassName ()
virtual int IsA (const char *type)
void PrintSelf (ostream &os, vtkIndent indent)
bool GetExtentIsValid (int *extent)
bool GetCPUExtentIsValid ()
bool GetGPUExtentIsValid ()
bool GetTextureExtentIsValid ()
bool Download ()
bool GetShaderSupportsTextureInt ()
void SetShaderSupportsTextureInt (bool value)
void SetContext (vtkRenderWindow *context)
vtkRenderWindowGetContext ()
virtual void SetCPUExtent (int, int, int, int, int, int)
virtual void SetCPUExtent (int[6])
virtual int * GetCPUExtent ()
virtual void GetCPUExtent (int &, int &, int &, int &, int &, int &)
virtual void GetCPUExtent (int[6])
virtual void SetGPUExtent (int, int, int, int, int, int)
virtual void SetGPUExtent (int[6])
virtual int * GetGPUExtent ()
virtual void GetGPUExtent (int &, int &, int &, int &, int &, int &)
virtual void GetGPUExtent (int[6])
virtual void SetTextureExtent (int, int, int, int, int, int)
virtual void SetTextureExtent (int[6])
virtual int * GetTextureExtent ()
virtual void GetTextureExtent (int &, int &, int &, int &, int &, int &)
virtual void GetTextureExtent (int[6])
virtual void SetMinTextureDimension (int)
virtual int GetMinTextureDimension ()
virtual vtkDataArrayGetArray ()
void SetArray (vtkDataArray *array)
virtual vtkTextureObjectGetTexture ()
void SetTexture (vtkTextureObject *texture)
bool Upload (int components=0, int *componentList=NULL)
bool DownloadAsync1 ()
bool DownloadAsync2 ()

Static Public Member Functions

static vtkDataTransferHelperNew ()
static int IsTypeOf (const char *type)
static vtkDataTransferHelperSafeDownCast (vtkObject *o)
static bool IsSupported (vtkRenderWindow *renWin)

Protected Member Functions

 vtkDataTransferHelper ()
 ~vtkDataTransferHelper ()
bool LoadRequiredExtensions (vtkOpenGLExtensionManager *)
vtkPixelBufferObjectGetPBO ()

Protected Attributes

int CPUExtent [6]
int GPUExtent [6]
int TextureExtent [6]
vtkWeakPointer< vtkRenderWindowContext
vtkTextureObjectTexture
vtkDataArrayArray
bool ShaderSupportsTextureInt
int MinTextureDimension
vtkSmartPointer
< vtkPixelBufferObject
AsyncDownloadPBO
vtkSmartPointer
< vtkPixelBufferObject
PBO

Member Typedef Documentation

Reimplemented from vtkObject.

Definition at line 47 of file vtkDataTransferHelper.h.


Constructor & Destructor Documentation

vtkDataTransferHelper::vtkDataTransferHelper (  )  [protected]

vtkDataTransferHelper::~vtkDataTransferHelper (  )  [protected]


Member Function Documentation

static vtkDataTransferHelper* vtkDataTransferHelper::New (  )  [static]

Create an object with Debug turned off, modified time initialized to zero, and reference counting on.

Reimplemented from vtkObject.

virtual const char* vtkDataTransferHelper::GetClassName (  )  [virtual]

Reimplemented from vtkObject.

static int vtkDataTransferHelper::IsTypeOf ( const char *  name  )  [static]

Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkObject.

virtual int vtkDataTransferHelper::IsA ( const char *  name  )  [virtual]

Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkObject.

static vtkDataTransferHelper* vtkDataTransferHelper::SafeDownCast ( vtkObject o  )  [static]

Reimplemented from vtkObject.

void vtkDataTransferHelper::PrintSelf ( ostream &  os,
vtkIndent  indent 
) [virtual]

Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkObject.

void vtkDataTransferHelper::SetContext ( vtkRenderWindow context  ) 

Get/Set the context. Context must be a vtkOpenGLRenderWindow. This does not increase the reference count of the context to avoid reference loops. SetContext() may raise an error is the OpenGL context does not support the required OpenGL extensions.

vtkRenderWindow* vtkDataTransferHelper::GetContext (  ) 

Get/Set the context. Context must be a vtkOpenGLRenderWindow. This does not increase the reference count of the context to avoid reference loops. SetContext() may raise an error is the OpenGL context does not support the required OpenGL extensions.

virtual void vtkDataTransferHelper::SetCPUExtent ( int  ,
int  ,
int  ,
int  ,
int  ,
int   
) [virtual]

Set the CPU data extent. The extent matches the vtkDataArray size. If the vtkDataArray comes from an vtkImageData and it is part of the point data, it is usually the vtkImageData extent. It can be on cell data too, but in this case it does not match the vtkImageData extent. If the vtkDataArray comes from a vtkDataSet, just set it to a one-dimenstional extent equal to the number of tuples. Initial value is (0,0,0,0,0,0), a valid one tuple array.

virtual void vtkDataTransferHelper::SetCPUExtent ( int  [6]  )  [virtual]

Set the CPU data extent. The extent matches the vtkDataArray size. If the vtkDataArray comes from an vtkImageData and it is part of the point data, it is usually the vtkImageData extent. It can be on cell data too, but in this case it does not match the vtkImageData extent. If the vtkDataArray comes from a vtkDataSet, just set it to a one-dimenstional extent equal to the number of tuples. Initial value is (0,0,0,0,0,0), a valid one tuple array.

virtual int* vtkDataTransferHelper::GetCPUExtent (  )  [virtual]

Set the CPU data extent. The extent matches the vtkDataArray size. If the vtkDataArray comes from an vtkImageData and it is part of the point data, it is usually the vtkImageData extent. It can be on cell data too, but in this case it does not match the vtkImageData extent. If the vtkDataArray comes from a vtkDataSet, just set it to a one-dimenstional extent equal to the number of tuples. Initial value is (0,0,0,0,0,0), a valid one tuple array.

virtual void vtkDataTransferHelper::GetCPUExtent ( int &  ,
int &  ,
int &  ,
int &  ,
int &  ,
int &   
) [virtual]

Set the CPU data extent. The extent matches the vtkDataArray size. If the vtkDataArray comes from an vtkImageData and it is part of the point data, it is usually the vtkImageData extent. It can be on cell data too, but in this case it does not match the vtkImageData extent. If the vtkDataArray comes from a vtkDataSet, just set it to a one-dimenstional extent equal to the number of tuples. Initial value is (0,0,0,0,0,0), a valid one tuple array.

virtual void vtkDataTransferHelper::GetCPUExtent ( int  [6]  )  [virtual]

Set the CPU data extent. The extent matches the vtkDataArray size. If the vtkDataArray comes from an vtkImageData and it is part of the point data, it is usually the vtkImageData extent. It can be on cell data too, but in this case it does not match the vtkImageData extent. If the vtkDataArray comes from a vtkDataSet, just set it to a one-dimenstional extent equal to the number of tuples. Initial value is (0,0,0,0,0,0), a valid one tuple array.

virtual void vtkDataTransferHelper::SetGPUExtent ( int  ,
int  ,
int  ,
int  ,
int  ,
int   
) [virtual]

Set the GPU data extent. This is the sub-extent to copy from or to the GPU. This extent matches the size of the data to transfer. GPUExtent and TextureExtent don't have to match (GPUExtent can be 1D whereas TextureExtent is 2D) but the number of elements have to match. Initial value is (0,0,0,0,0,0), a valid one tuple array.

virtual void vtkDataTransferHelper::SetGPUExtent ( int  [6]  )  [virtual]

Set the GPU data extent. This is the sub-extent to copy from or to the GPU. This extent matches the size of the data to transfer. GPUExtent and TextureExtent don't have to match (GPUExtent can be 1D whereas TextureExtent is 2D) but the number of elements have to match. Initial value is (0,0,0,0,0,0), a valid one tuple array.

virtual int* vtkDataTransferHelper::GetGPUExtent (  )  [virtual]

Set the GPU data extent. This is the sub-extent to copy from or to the GPU. This extent matches the size of the data to transfer. GPUExtent and TextureExtent don't have to match (GPUExtent can be 1D whereas TextureExtent is 2D) but the number of elements have to match. Initial value is (0,0,0,0,0,0), a valid one tuple array.

virtual void vtkDataTransferHelper::GetGPUExtent ( int &  ,
int &  ,
int &  ,
int &  ,
int &  ,
int &   
) [virtual]

Set the GPU data extent. This is the sub-extent to copy from or to the GPU. This extent matches the size of the data to transfer. GPUExtent and TextureExtent don't have to match (GPUExtent can be 1D whereas TextureExtent is 2D) but the number of elements have to match. Initial value is (0,0,0,0,0,0), a valid one tuple array.

virtual void vtkDataTransferHelper::GetGPUExtent ( int  [6]  )  [virtual]

Set the GPU data extent. This is the sub-extent to copy from or to the GPU. This extent matches the size of the data to transfer. GPUExtent and TextureExtent don't have to match (GPUExtent can be 1D whereas TextureExtent is 2D) but the number of elements have to match. Initial value is (0,0,0,0,0,0), a valid one tuple array.

virtual void vtkDataTransferHelper::SetTextureExtent ( int  ,
int  ,
int  ,
int  ,
int  ,
int   
) [virtual]

Set the texture data extent. This is the extent of the texture image that will receive the data. This extent matches the size of the data to transfer. If it is set to an invalid extent, GPUExtent is used. See more comment on GPUExtent. Initial value is an invalid extent.

virtual void vtkDataTransferHelper::SetTextureExtent ( int  [6]  )  [virtual]

Set the texture data extent. This is the extent of the texture image that will receive the data. This extent matches the size of the data to transfer. If it is set to an invalid extent, GPUExtent is used. See more comment on GPUExtent. Initial value is an invalid extent.

virtual int* vtkDataTransferHelper::GetTextureExtent (  )  [virtual]

Set the texture data extent. This is the extent of the texture image that will receive the data. This extent matches the size of the data to transfer. If it is set to an invalid extent, GPUExtent is used. See more comment on GPUExtent. Initial value is an invalid extent.

virtual void vtkDataTransferHelper::GetTextureExtent ( int &  ,
int &  ,
int &  ,
int &  ,
int &  ,
int &   
) [virtual]

Set the texture data extent. This is the extent of the texture image that will receive the data. This extent matches the size of the data to transfer. If it is set to an invalid extent, GPUExtent is used. See more comment on GPUExtent. Initial value is an invalid extent.

virtual void vtkDataTransferHelper::GetTextureExtent ( int  [6]  )  [virtual]

Set the texture data extent. This is the extent of the texture image that will receive the data. This extent matches the size of the data to transfer. If it is set to an invalid extent, GPUExtent is used. See more comment on GPUExtent. Initial value is an invalid extent.

bool vtkDataTransferHelper::GetExtentIsValid ( int *  extent  ) 

Tells if the given extent (6 int) is valid. True if min extent<=max extent.

Precondition:
extent_exists: extent!=0

bool vtkDataTransferHelper::GetCPUExtentIsValid (  ) 

Tells if CPUExtent is valid. True if min extent<=max extent.

bool vtkDataTransferHelper::GetGPUExtentIsValid (  ) 

Tells if GPUExtent is valid. True if min extent<=max extent.

bool vtkDataTransferHelper::GetTextureExtentIsValid (  ) 

Tells if TextureExtent is valid. True if min extent<=max extent.

virtual void vtkDataTransferHelper::SetMinTextureDimension ( int   )  [virtual]

Define the minimal dimension of the texture regardless of the dimensions of the TextureExtent. Initial value is 1. A texture extent can have a given dimension 0D (one value), 1D, 2D or 3D. By default 0D and 1D are translated into a 1D texture, 2D is translated into a 2D texture, 3D is translated into a 3D texture. To make life easier when writting GLSL code and use only one type of sampler (ex: sampler2d), the default behavior can be changed by forcing a type of texture with this ivar. 1: default behavior. Initial value. 2: force 0D and 1D to be in a 2D texture 3: force 0D, 1D and 2D texture to be in a 3D texture.

virtual int vtkDataTransferHelper::GetMinTextureDimension (  )  [virtual]

Define the minimal dimension of the texture regardless of the dimensions of the TextureExtent. Initial value is 1. A texture extent can have a given dimension 0D (one value), 1D, 2D or 3D. By default 0D and 1D are translated into a 1D texture, 2D is translated into a 2D texture, 3D is translated into a 3D texture. To make life easier when writting GLSL code and use only one type of sampler (ex: sampler2d), the default behavior can be changed by forcing a type of texture with this ivar. 1: default behavior. Initial value. 2: force 0D and 1D to be in a 2D texture 3: force 0D, 1D and 2D texture to be in a 3D texture.

virtual vtkDataArray* vtkDataTransferHelper::GetArray (  )  [virtual]

Get/Set the CPU data buffer. Initial value is 0.

void vtkDataTransferHelper::SetArray ( vtkDataArray array  ) 

Get/Set the CPU data buffer. Initial value is 0.

virtual vtkTextureObject* vtkDataTransferHelper::GetTexture (  )  [virtual]

Get/Set the GPU data buffer. Initial value is 0.

void vtkDataTransferHelper::SetTexture ( vtkTextureObject texture  ) 

Get/Set the GPU data buffer. Initial value is 0.

bool vtkDataTransferHelper::Upload ( int  components = 0,
int *  componentList = NULL 
)

Old comment. Upload Extent from CPU data buffer to GPU. The WholeExtent must match the Array size. New comment. Upload GPUExtent from CPU vtkDataArray to GPU texture. It is possible to send a subset of the components or to specify and order of components or both. If components=0, componentList is ignored and all components are passed, a texture cannot have more than 4 components.

Precondition:
array_exists: array!=0

array_not_empty: array->GetNumberOfTuples()>0

valid_cpu_extent: this->GetCPUExtentIsValid()

valid_cpu_extent_size: (CPUExtent[1]-CPUExtent[0]+1)*(CPUExtent[3]-CPUExtent[2]+1)*(CPUExten t[5]-CPUExtent[4]+1)==array->GetNumberOfTuples()

valid_gpu_extent: this->GetGPUExtentIsValid()

gpu_extent_in_cpu_extent: CPUExtent[0]<=GPUExtent[0] && GPUExtent[1]<=CPUExtent[1] && CPUExtent[2]<=GPUExtent[2] && GPUExtent[3]<=CPUExtent[3] && CPUExtent[4]<=GPUExtent[4] && GPUExtent[5]<=CPUExtent[5]

gpu_texture_size: !this->GetTextureExtentIsValid() || (GPUExtent[1]-GPUExtent[0]+1)*(GPUExtent[3]-GPUExtent[2]+1)*(GPUExten t[5]-GPUExtent[4]+1)==(TextureExtent[1]-TextureExtent[0]+1)*(TextureE xtent[3]-TextureExtent[2]+1)*(TextureExtent[5]-TextureExtent[4]+1)

texture_can_exist_or_not: texture==0 || texture!=0

valid_components: (components==0 && componentList==0 && array->GetNumberOfComponents()<=4) || (components>=1 && components<=array->GetNumberOfComponents() && components<=4 && componentList!=0)

bool vtkDataTransferHelper::Download (  ) 

old comment: Downlad Extent from GPU data buffer to CPU. GPU data size must exactly match Extent. CPU data buffer will be resized to match WholeExtent in which only the Extent will be filled with the GPU data. new comment: Download GPUExtent from GPU texture to CPU vtkDataArray. If Array is not provided, it will be created with the size of CPUExtent. But only the tuples covered by GPUExtent will be download. In this case, if GPUExtent does not cover all GPUExtent, some of the vtkDataArray will be uninitialized. Reminder: A=>B <=> !A||B

Precondition:
texture_exists: texture!=0

array_not_empty: array==0 || array->GetNumberOfTuples()>0

valid_cpu_extent: this->GetCPUExtentIsValid()

valid_cpu_extent_size: array==0 || (CPUExtent[1]-CPUExtent[0]+1)*(CPUExtent[3]-CPUExtent[2]+1)*(CPUExten t[5]-CPUExtent[4]+1)==array->GetNumberOfTuples()

valid_gpu_extent: this->GetGPUExtentIsValid()

gpu_extent_in_cpu_extent: CPUExtent[0]<=GPUExtent[0] && GPUExtent[1]<=CPUExtent[1] && CPUExtent[2]<=GPUExtent[2] && GPUExtent[3]<=CPUExtent[3] && CPUExtent[4]<=GPUExtent[4] && GPUExtent[5]<=CPUExtent[5]

gpu_texture_size: !this->GetTextureExtentIsValid() || (GPUExtent[1]-GPUExtent[0]+1)*(GPUExtent[3]-GPUExtent[2]+1)*(GPUExten t[5]-GPUExtent[4]+1)==(TextureExtent[1]-TextureExtent[0]+1)*(TextureE xtent[3]-TextureExtent[2]+1)*(TextureExtent[5]-TextureExtent[4]+1)

valid_components: array==0 || array->GetNumberOfComponents()<=4

components_match: array==0 || (texture->GetComponents()==array->GetNumberOfComponents())

bool vtkDataTransferHelper::DownloadAsync1 (  ) 

Splits the download in two operations * Asynchronously download from texture memory to PBO (DownloadAsync1()). * Copy from pbo to user array (DownloadAsync2()).

bool vtkDataTransferHelper::DownloadAsync2 (  ) 

Splits the download in two operations * Asynchronously download from texture memory to PBO (DownloadAsync1()). * Copy from pbo to user array (DownloadAsync2()).

bool vtkDataTransferHelper::GetShaderSupportsTextureInt (  ) 

void vtkDataTransferHelper::SetShaderSupportsTextureInt ( bool  value  ) 

static bool vtkDataTransferHelper::IsSupported ( vtkRenderWindow renWin  )  [static]

Returns if the context supports the required extensions.

bool vtkDataTransferHelper::LoadRequiredExtensions ( vtkOpenGLExtensionManager  )  [protected]

Load all necessary extensions.

vtkPixelBufferObject* vtkDataTransferHelper::GetPBO (  )  [protected]


Member Data Documentation

Definition at line 208 of file vtkDataTransferHelper.h.

Definition at line 209 of file vtkDataTransferHelper.h.

Definition at line 210 of file vtkDataTransferHelper.h.

Definition at line 212 of file vtkDataTransferHelper.h.

Definition at line 213 of file vtkDataTransferHelper.h.

Definition at line 214 of file vtkDataTransferHelper.h.

Definition at line 215 of file vtkDataTransferHelper.h.

Definition at line 216 of file vtkDataTransferHelper.h.

Definition at line 218 of file vtkDataTransferHelper.h.

Definition at line 223 of file vtkDataTransferHelper.h.


The documentation for this class was generated from the following file:

Generated on Mon Sep 27 18:21:45 2010 for VTK by  doxygen 1.5.6