Rename the opengl folder / namespace to interop.

To clarify what functionality the classes inside provide.
This commit is contained in:
Robert Maynard 2016-04-13 15:52:15 -04:00
parent bb60abb1af
commit 1ec3bc0e7a
24 changed files with 101 additions and 101 deletions

@ -29,7 +29,7 @@
#include <vtkm/Math.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/Timer.h>
#include <vtkm/opengl/TransferToOpenGL.h>
#include <vtkm/interop/TransferToOpenGL.h>
#include <vtkm/worklet/DispatcherMapField.h>
#include <vtkm/worklet/WorkletMapField.h>
@ -58,8 +58,8 @@ struct HelloVTKMInterop
GLuint ProgramId;
GLuint VAOId;
vtkm::opengl::BufferState VBOState;
vtkm::opengl::BufferState ColorState;
vtkm::interop::BufferState VBOState;
vtkm::interop::BufferState ColorState;
vtkm::cont::Timer<DeviceAdapter> Timer;
@ -166,8 +166,8 @@ struct HelloVTKMInterop
GenerateSurfaceWorklet worklet( t );
DispatcherType(worklet).Invoke( this->InHandle, this->OutCoords, this->OutColors );
vtkm::opengl::TransferToOpenGL( this->OutCoords, this->VBOState, DeviceAdapter() );
vtkm::opengl::TransferToOpenGL( this->OutColors, this->ColorState, DeviceAdapter() );
vtkm::interop::TransferToOpenGL( this->OutCoords, this->VBOState, DeviceAdapter() );
vtkm::interop::TransferToOpenGL( this->OutColors, this->ColorState, DeviceAdapter() );
this->render();
if(t > 10)

@ -52,7 +52,7 @@ add_subdirectory(testing)
add_subdirectory(internal)
if(VTKm_ENABLE_OPENGL_INTEROP)
add_subdirectory(opengl)
add_subdirectory(interop)
endif(VTKm_ENABLE_OPENGL_INTEROP)
#-----------------------------------------------------------------------------

@ -74,10 +74,10 @@ VTKM_THIRDPARTY_POST_INCLUDE
* change. This should not be used for projects using VTKm. Instead it servers
* are a reference for the developers of VTKm.
*
* \namespace vtkm::opengl
* \namespace vtkm::interop
* \brief Utility opengl interop functions
*
* vtkm::opengl defines the publicly accessible API for interoperability between
* vtkm::interop defines the publicly accessible API for interoperability between
* vtkm and opengl.
*
* \namespace vtkm::testing

@ -17,19 +17,19 @@
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#ifndef vtk_m_opengl_BufferState_h
#define vtk_m_opengl_BufferState_h
#ifndef vtk_m_interop_BufferState_h
#define vtk_m_interop_BufferState_h
//gl headers needs to be buffer anything to do with buffer's
#include <vtkm/opengl/internal/OpenGLHeaders.h>
#include <vtkm/opengl/internal/BufferTypePicker.h>
#include <vtkm/interop/internal/OpenGLHeaders.h>
#include <vtkm/interop/internal/BufferTypePicker.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/smart_ptr/scoped_ptr.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
namespace vtkm{
namespace opengl{
namespace interop{
namespace internal
@ -125,7 +125,7 @@ public:
/// will be GL_ARRAY_BUFFER for everything else.
template<typename T>
void DeduceAndSetType(T t)
{ this->BufferType = vtkm::opengl::internal::BufferTypePicker(t); }
{ this->BufferType = vtkm::interop::internal::BufferTypePicker(t); }
/// \brief Get the size of the buffer in bytes
///
@ -162,11 +162,11 @@ public:
void SetCapacity(vtkm::Int64 capacity) { this->CapacityOfBuffer = capacity; }
//Note: This call should only be used internally by vtk-m
vtkm::opengl::internal::TransferResource* GetResource()
vtkm::interop::internal::TransferResource* GetResource()
{ return this->Resource.get(); }
//Note: This call should only be used internally by vtk-m
void SetResource( vtkm::opengl::internal::TransferResource* resource)
void SetResource( vtkm::interop::internal::TransferResource* resource)
{ this->Resource.reset(resource); }
@ -180,9 +180,9 @@ private:
vtkm::Int64 SizeOfActiveSection; //must be Int64 as size can be over 2billion
vtkm::Int64 CapacityOfBuffer; //must be Int64 as size can be over 2billion
GLuint DefaultGLHandle;
boost::scoped_ptr<vtkm::opengl::internal::TransferResource> Resource;
boost::scoped_ptr<vtkm::interop::internal::TransferResource> Resource;
};
}}
#endif //vtk_m_opengl_BufferState_h
#endif //vtk_m_interop_BufferState_h

@ -17,15 +17,15 @@
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#ifndef vtk_m_opengl_TransferToOpenGL_h
#define vtk_m_opengl_TransferToOpenGL_h
#ifndef vtk_m_interop_TransferToOpenGL_h
#define vtk_m_interop_TransferToOpenGL_h
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/opengl/BufferState.h>
#include <vtkm/opengl/internal/TransferToOpenGL.h>
#include <vtkm/interop/BufferState.h>
#include <vtkm/interop/internal/TransferToOpenGL.h>
namespace vtkm{
namespace opengl{
namespace interop{
/// \brief Manages transferring an ArrayHandle to opengl .
@ -47,10 +47,10 @@ void TransferToOpenGL(vtkm::cont::ArrayHandle<ValueType, StorageTag> handle,
BufferState& state,
DeviceAdapterTag)
{
vtkm::opengl::internal::TransferToOpenGL<ValueType, DeviceAdapterTag> toGL(state);
vtkm::interop::internal::TransferToOpenGL<ValueType, DeviceAdapterTag> toGL(state);
return toGL.Transfer(handle);
}
}}
#endif //vtk_m_opengl_TransferToOpenGL_h
#endif //vtk_m_interop_TransferToOpenGL_h

@ -17,8 +17,8 @@
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#ifndef vtk_m_cuda_opengl_SetOpenGLDevice_h
#define vtk_m_cuda_opengl_SetOpenGLDevice_h
#ifndef vtk_m_cuda_interop_SetOpenGLDevice_h
#define vtk_m_cuda_interop_SetOpenGLDevice_h
#include <cuda.h>
#include <cuda_gl_interop.h>
@ -26,7 +26,7 @@
#include <vtkm/cont/ErrorExecution.h>
namespace vtkm{
namespace opengl{
namespace interop{
namespace cuda{
static void SetCudaGLDevice(int id)
@ -52,4 +52,4 @@ static void SetCudaGLDevice(int id)
}
} //namespace
#endif //vtk_m_cuda_opengl_SetOpenGLDevice_h
#endif //vtk_m_cuda_interop_SetOpenGLDevice_h

@ -17,8 +17,8 @@
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#ifndef vtkm_opengl_cuda_internal_TransferToOpenGL_h
#define vtkm_opengl_cuda_internal_TransferToOpenGL_h
#ifndef vtkm_interop_cuda_internal_TransferToOpenGL_h
#define vtkm_interop_cuda_internal_TransferToOpenGL_h
#include <vtkm/cont/ErrorExecution.h>
#include <vtkm/cont/ErrorControlBadAllocation.h>
@ -26,7 +26,7 @@
#include <vtkm/cont/cuda/internal/DeviceAdapterTagCuda.h>
#include <vtkm/cont/cuda/internal/MakeThrustIterator.h>
#include <vtkm/opengl/internal/TransferToOpenGL.h>
#include <vtkm/interop/internal/TransferToOpenGL.h>
// Disable warnings we check vtkm for but Thrust does not.
VTKM_THIRDPARTY_PRE_INCLUDE
@ -36,7 +36,7 @@ VTKM_THIRDPARTY_PRE_INCLUDE
VTKM_THIRDPARTY_POST_INCLUDE
namespace vtkm {
namespace opengl {
namespace interop {
namespace internal {
/// \brief cuda backend and opengl interop resource management
@ -44,11 +44,11 @@ namespace internal {
/// \c TransferResource manages cuda resource binding for a given buffer
///
///
class CudaTransferResource : public vtkm::opengl::internal::TransferResource
class CudaTransferResource : public vtkm::interop::internal::TransferResource
{
public:
CudaTransferResource():
vtkm::opengl::internal::TransferResource()
vtkm::interop::internal::TransferResource()
{
this->Registered = false;
}
@ -146,12 +146,12 @@ public:
this->State.DeduceAndSetType( ValueType() );
}
this->Resource = dynamic_cast<vtkm::opengl::internal::CudaTransferResource*>
this->Resource = dynamic_cast<vtkm::interop::internal::CudaTransferResource*>
(state.GetResource());
if( !this->Resource )
{
vtkm::opengl::internal::CudaTransferResource* cudaResource =
new vtkm::opengl::internal::CudaTransferResource();
vtkm::interop::internal::CudaTransferResource* cudaResource =
new vtkm::interop::internal::CudaTransferResource();
//reset the resource to be a cuda resource
this->State.SetResource( cudaResource );
@ -219,15 +219,15 @@ public:
}
private:
vtkm::opengl::BufferState& State;
vtkm::opengl::internal::CudaTransferResource* Resource;
vtkm::interop::BufferState& State;
vtkm::interop::internal::CudaTransferResource* Resource;
};
}
}
} //namespace vtkm::opengl::cuda::internal
} //namespace vtkm::interop::cuda::internal
#endif

@ -25,12 +25,12 @@
#include <vtkm/cont/cuda/DeviceAdapterCuda.h>
#include <vtkm/cont/cuda/internal/testing/Testing.h>
#include <vtkm/opengl/testing/TestingOpenGLInterop.h>
#include <vtkm/interop/testing/TestingOpenGLInterop.h>
int UnitTestTransferToOpenGLCuda(int, char *[])
{
int result = 1;
result = vtkm::opengl::testing::TestingOpenGLInterop
result = vtkm::interop::testing::TestingOpenGLInterop
<vtkm::cont::cuda::DeviceAdapterTagCuda >::Run();
return vtkm::cont::cuda::internal::Testing::CheckCudaBeforeExit(result);
}

@ -17,14 +17,14 @@
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#ifndef vtk_m_opengl_internal_BufferTypePicker_h
#define vtk_m_opengl_internal_BufferTypePicker_h
#ifndef vtk_m_interop_internal_BufferTypePicker_h
#define vtk_m_interop_internal_BufferTypePicker_h
#include <vtkm/Types.h>
#include <vtkm/opengl/internal/OpenGLHeaders.h>
#include <vtkm/interop/internal/OpenGLHeaders.h>
namespace vtkm {
namespace opengl {
namespace interop {
namespace internal {
/// helper function that guesses what OpenGL buffer type is the best default
@ -53,6 +53,6 @@ VTKM_CONT_EXPORT GLenum BufferTypePicker( T )
}
}
} //namespace vtkm::opengl::internal
} //namespace vtkm::interop::internal
#endif //vtk_m_opengl_internal_BufferTypePicker_h
#endif //vtk_m_interop_internal_BufferTypePicker_h

@ -17,8 +17,8 @@
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#ifndef vtk_m_opengl_internal_OpenGLHeaders_h
#define vtk_m_opengl_internal_OpenGLHeaders_h
#ifndef vtk_m_interop_internal_OpenGLHeaders_h
#define vtk_m_interop_internal_OpenGLHeaders_h
#include <vtkm/internal/ExportMacros.h>
@ -38,4 +38,4 @@
#endif //vtk_m_opengl_internal_OpenGLHeaders_h
#endif //vtk_m_interop_internal_OpenGLHeaders_h

@ -17,19 +17,19 @@
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#ifndef vtk_m_opengl_internal_TransferToOpenGL_h
#define vtk_m_opengl_internal_TransferToOpenGL_h
#ifndef vtk_m_interop_internal_TransferToOpenGL_h
#define vtk_m_interop_internal_TransferToOpenGL_h
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/StorageBasic.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/opengl/internal/OpenGLHeaders.h>
#include <vtkm/opengl/BufferState.h>
#include <vtkm/interop/internal/OpenGLHeaders.h>
#include <vtkm/interop/BufferState.h>
namespace vtkm {
namespace opengl {
namespace interop {
namespace internal {
namespace detail
@ -39,7 +39,7 @@ template<class ValueType, class StorageTag, class DeviceAdapterTag>
VTKM_CONT_EXPORT
void CopyFromHandle(
vtkm::cont::ArrayHandle<ValueType, StorageTag>& handle,
vtkm::opengl::BufferState& state,
vtkm::interop::BufferState& state,
DeviceAdapterTag)
{
//Generic implementation that will work no matter what. We copy the data
@ -86,7 +86,7 @@ template<class ValueType, class DeviceAdapterTag>
VTKM_CONT_EXPORT
void CopyFromHandle(
vtkm::cont::ArrayHandle<ValueType, vtkm::cont::StorageTagBasic>& handle,
vtkm::opengl::BufferState& state,
vtkm::interop::BufferState& state,
DeviceAdapterTag)
{
//Specialization given that we are use an C allocated array storage tag
@ -168,20 +168,20 @@ public:
detail::CopyFromHandle(handle, this->State, DeviceAdapterTag());
}
private:
vtkm::opengl::BufferState& State;
vtkm::interop::BufferState& State;
};
}
}
} //namespace vtkm::opengl::internal
} //namespace vtkm::interop::internal
//-----------------------------------------------------------------------------
// These includes are intentionally placed here after the declaration of the
// TransferToOpenGL class, so that people get the correct device adapter
/// specializations if they exist.
#if VTKM_DEVICE_ADAPTER == VTKM_DEVICE_ADAPTER_CUDA
#include <vtkm/opengl/cuda/internal/TransferToOpenGL.h>
#include <vtkm/interop/cuda/internal/TransferToOpenGL.h>
#endif
#endif //vtk_m_opengl_internal_TransferToOpenGL_h
#endif //vtk_m_interop_internal_TransferToOpenGL_h

@ -17,7 +17,7 @@
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#include <vtkm/opengl/internal/BufferTypePicker.h>
#include <vtkm/interop/internal/BufferTypePicker.h>
#include <vtkm/cont/testing/Testing.h>
namespace
@ -29,22 +29,22 @@ void TestBufferTypePicker()
typedef unsigned int vtkmUint;
typedef vtkm::FloatDefault T;
type = vtkm::opengl::internal::BufferTypePicker(vtkm::Id());
type = vtkm::interop::internal::BufferTypePicker(vtkm::Id());
VTKM_TEST_ASSERT(type == GL_ELEMENT_ARRAY_BUFFER, "Bad OpenGL Buffer Type");
type = vtkm::opengl::internal::BufferTypePicker(int());
type = vtkm::interop::internal::BufferTypePicker(int());
VTKM_TEST_ASSERT(type == GL_ELEMENT_ARRAY_BUFFER, "Bad OpenGL Buffer Type");
type = vtkm::opengl::internal::BufferTypePicker(vtkmUint());
type = vtkm::interop::internal::BufferTypePicker(vtkmUint());
VTKM_TEST_ASSERT(type == GL_ELEMENT_ARRAY_BUFFER, "Bad OpenGL Buffer Type");
type = vtkm::opengl::internal::BufferTypePicker(vtkm::Vec<T,4>());
type = vtkm::interop::internal::BufferTypePicker(vtkm::Vec<T,4>());
VTKM_TEST_ASSERT(type == GL_ARRAY_BUFFER, "Bad OpenGL Buffer Type");
type = vtkm::opengl::internal::BufferTypePicker(vtkm::Vec<T,3>());
type = vtkm::interop::internal::BufferTypePicker(vtkm::Vec<T,3>());
VTKM_TEST_ASSERT(type == GL_ARRAY_BUFFER, "Bad OpenGL Buffer Type");
type = vtkm::opengl::internal::BufferTypePicker(vtkm::FloatDefault());
type = vtkm::interop::internal::BufferTypePicker(vtkm::FloatDefault());
VTKM_TEST_ASSERT(type == GL_ARRAY_BUFFER, "Bad OpenGL Buffer Type");
type = vtkm::opengl::internal::BufferTypePicker(float());
type = vtkm::interop::internal::BufferTypePicker(float());
VTKM_TEST_ASSERT(type == GL_ARRAY_BUFFER, "Bad OpenGL Buffer Type");
type = vtkm::opengl::internal::BufferTypePicker(double());
type = vtkm::interop::internal::BufferTypePicker(double());
VTKM_TEST_ASSERT(type == GL_ARRAY_BUFFER, "Bad OpenGL Buffer Type");
}
}

@ -17,7 +17,7 @@
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#include <vtkm/opengl/internal/OpenGLHeaders.h>
#include <vtkm/interop/internal/OpenGLHeaders.h>
#include <vtkm/cont/testing/Testing.h>
namespace {

@ -17,16 +17,16 @@
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#ifndef vtk_m_opengl_testing_TestingOpenGLInterop_h
#define vtk_m_opengl_testing_TestingOpenGLInterop_h
#ifndef vtk_m_interop_testing_TestingOpenGLInterop_h
#define vtk_m_interop_testing_TestingOpenGLInterop_h
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/ArrayHandleConstant.h>
#include <vtkm/worklet/DispatcherMapField.h>
#include <vtkm/worklet/Magnitude.h>
#include <vtkm/opengl/testing/TestingWindow.h>
#include <vtkm/opengl/TransferToOpenGL.h>
#include <vtkm/interop/testing/TestingWindow.h>
#include <vtkm/interop/TransferToOpenGL.h>
#include <vtkm/cont/testing/Testing.h>
// #include <vtkm/cont/testing/TestingGridGenerator.h>
@ -37,7 +37,7 @@
namespace vtkm {
namespace opengl {
namespace interop {
namespace testing {
/// This class has a single static member, Run, that tests the templated
@ -75,8 +75,8 @@ private:
{
try
{
vtkm::opengl::BufferState state(handle);
vtkm::opengl::TransferToOpenGL(array, state, DeviceAdapterTag());
vtkm::interop::BufferState state(handle);
vtkm::interop::TransferToOpenGL(array, state, DeviceAdapterTag());
}
catch (vtkm::cont::ErrorControlBadAllocation error)
{
@ -98,8 +98,8 @@ private:
{
try
{
vtkm::opengl::BufferState state(handle, type);
vtkm::opengl::TransferToOpenGL(array, state, DeviceAdapterTag());
vtkm::interop::BufferState state(handle, type);
vtkm::interop::TransferToOpenGL(array, state, DeviceAdapterTag());
}
catch (vtkm::cont::ErrorControlBadAllocation error)
{
@ -124,7 +124,7 @@ private:
std::vector<T> CopyGLBuffer(GLuint& handle, T t)
{
//get the type we used for this buffer.
GLenum type = vtkm::opengl::internal::BufferTypePicker(t);
GLenum type = vtkm::interop::internal::BufferTypePicker(t);
//bind the buffer to the guessed buffer type, this way
//we can call CopyGLBuffer no matter what it the active buffer
@ -179,7 +179,7 @@ private:
temp.ReleaseResources();
temp = FillArray(tempData,Size*2);
GLenum type = vtkm::opengl::internal::BufferTypePicker(t);
GLenum type = vtkm::interop::internal::BufferTypePicker(t);
SafelyTransferArray(temp,GLHandle,type);
is_buffer = glIsBuffer(GLHandle);
VTKM_TEST_ASSERT(is_buffer==true,
@ -282,7 +282,7 @@ public:
VTKM_CONT_EXPORT static int Run()
{
//create a valid openGL context that we can test transfer of data
vtkm::opengl::testing::TestingWindow window;
vtkm::interop::testing::TestingWindow window;
window.Init("Testing Window", 300, 300);
//verify that we can transfer basic arrays and constant value arrays to opengl
@ -303,4 +303,4 @@ public:
} } }
#endif //vtk_m_opengl_testing_TestingOpenGLInterop_h
#endif //vtk_m_interop_testing_TestingOpenGLInterop_h

@ -17,11 +17,11 @@
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#ifndef vtk_m_opengl_testing_TestingWindow_h
#define vtk_m_opengl_testing_TestingWindow_h
#ifndef vtk_m_interop_testing_TestingWindow_h
#define vtk_m_interop_testing_TestingWindow_h
#include <vtkm/internal/ExportMacros.h>
#include <vtkm/opengl/testing/WindowBase.h>
#include <vtkm/interop/testing/WindowBase.h>
#if defined(VTKM_GCC) && defined(VTKM_POSIX) && !defined(__APPLE__)
//
@ -77,7 +77,7 @@ static int vtkm_force_linking_to_pthread_to_fix_nvidia_libgl_bug()
namespace vtkm{
namespace opengl{
namespace interop{
namespace testing{
/// \brief Basic Render Window that only makes sure opengl has a valid context
@ -86,7 +86,7 @@ namespace testing{
/// has no ability to interact with opengl other than to close down the window
///
///
class TestingWindow : public vtkm::opengl::testing::WindowBase<TestingWindow>
class TestingWindow : public vtkm::interop::testing::WindowBase<TestingWindow>
{
public:
VTKM_CONT_EXPORT TestingWindow(){};
@ -136,4 +136,4 @@ public:
}
}
}
#endif //vtk_m_opengl_testing_TestingWindow_h
#endif //vtk_m_interop_testing_TestingWindow_h

@ -21,10 +21,10 @@
//This sets up testing with the default device adapter and array container
#include <vtkm/cont/DeviceAdapterSerial.h>
#include <vtkm/opengl/testing/TestingOpenGLInterop.h>
#include <vtkm/interop/testing/TestingOpenGLInterop.h>
int UnitTestTransferToOpenGL(int, char *[])
{
return vtkm::opengl::testing::TestingOpenGLInterop<
return vtkm::interop::testing::TestingOpenGLInterop<
vtkm::cont::DeviceAdapterTagSerial >::Run();
}

@ -17,8 +17,8 @@
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#ifndef vtkm_m_opengl_testing_WindowBase_h
#define vtkm_m_opengl_testing_WindowBase_h
#ifndef vtkm_m_interop_testing_WindowBase_h
#define vtkm_m_interop_testing_WindowBase_h
//constructs a valid openGL context so that we can verify
//that vtkm to open gl bindings work
@ -32,7 +32,7 @@
// OpenGL Graphics includes
//glew needs to go before glut
#include <vtkm/opengl/internal/OpenGLHeaders.h>
#include <vtkm/interop/internal/OpenGLHeaders.h>
#if defined (__APPLE__)
# include <GLUT/glut.h>
#else
@ -43,14 +43,14 @@
#ifdef VTKM_CUDA
# include <vtkm/cont/cuda/ChooseCudaDevice.h>
# include <vtkm/opengl/cuda/SetOpenGLDevice.h>
# include <vtkm/interop/cuda/SetOpenGLDevice.h>
#endif
#include <iostream>
namespace vtkm{
namespace opengl{
namespace interop{
namespace testing{
namespace internal
@ -101,7 +101,7 @@ public:
#ifdef VTKM_CUDA
int id = vtkm::cont::cuda::FindFastestDeviceId();
vtkm::opengl::cuda::SetCudaGLDevice(id);
vtkm::interop::cuda::SetCudaGLDevice(id);
#endif
//attach all the glut call backs
@ -168,4 +168,4 @@ public:
# pragma GCC diagnostic pop
#endif
#endif //vtkm_m_opengl_testing_WindowBase_h
#endif //vtkm_m_interop_testing_WindowBase_h