mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-19 18:45:43 +00:00
Update TransferToOpenGL to use ArrayHandle::CopyInto.
Now that ArrayHandle has CopyInto we can simplify the code inside the OpenGL transfer of non basic array handles.
This commit is contained in:
parent
0416506715
commit
763691a7b3
@ -52,16 +52,9 @@ void CopyFromHandle(
|
||||
static_cast<GLsizeiptr>(sizeof(ValueType)) *
|
||||
static_cast<GLsizeiptr>(numberOfValues);
|
||||
|
||||
//Copy the data from its specialized Storage container to a basic storage
|
||||
vtkm::cont::ArrayHandle<ValueType, vtkm::cont::StorageTagBasic> tmpHandle;
|
||||
vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapterTag>::Copy(handle, tmpHandle);
|
||||
|
||||
//Synchronize the arrays to ensure the most current data is available in the
|
||||
//control environment
|
||||
tmpHandle.SyncControlArray();
|
||||
|
||||
//Note that the temporary ArrayHandle is no longer valid after this call
|
||||
ValueType* temporaryStorage = tmpHandle.Internals->ControlArray.StealArray();
|
||||
//Copy the data from its specialized Storage container to a basic heap alloc
|
||||
ValueType* temporaryStorage = new ValueType[numberOfValues];
|
||||
handle.CopyInto(temporaryStorage, DeviceAdapterTag());
|
||||
|
||||
//Determine if we need to reallocate the buffer
|
||||
state.SetSize(size);
|
||||
@ -89,7 +82,7 @@ void CopyFromHandle(
|
||||
{
|
||||
//Specialization given that we are use an C allocated array storage tag
|
||||
//that allows us to directly hook into the data. We pull the data
|
||||
//back to the control enviornment using PerpareForInput and give an iterator
|
||||
//back to the control environment using PerpareForInput and give an iterator
|
||||
//from the portal to OpenGL to upload to the rendering system
|
||||
//This also works because we know that this class isn't used for cuda interop,
|
||||
//instead we are specialized
|
||||
|
Loading…
Reference in New Issue
Block a user