VTK-m  2.2
BufferTypePicker.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 #ifndef vtk_m_interop_internal_BufferTypePicker_h
11 #define vtk_m_interop_internal_BufferTypePicker_h
12 
13 #include <vtkm/TypeTraits.h>
14 #include <vtkm/Types.h>
16 
17 namespace vtkm
18 {
19 namespace interop
20 {
21 namespace internal
22 {
23 
24 namespace detail
25 {
26 
27 template <typename NumericTag, typename DimensionalityTag>
28 static inline VTKM_CONT GLenum BufferTypePickerImpl(NumericTag, DimensionalityTag)
29 {
30  return GL_ARRAY_BUFFER;
31 }
32 
34 static inline GLenum BufferTypePickerImpl(vtkm::TypeTraitsIntegerTag, vtkm::TypeTraitsScalarTag)
35 {
36  return GL_ELEMENT_ARRAY_BUFFER;
37 }
38 
39 } //namespace detail
40 
41 static inline VTKM_CONT GLenum BufferTypePicker(vtkm::Int32)
42 {
43  return GL_ELEMENT_ARRAY_BUFFER;
44 }
45 
46 static inline VTKM_CONT GLenum BufferTypePicker(vtkm::UInt32)
47 {
48  return GL_ELEMENT_ARRAY_BUFFER;
49 }
50 
51 static inline VTKM_CONT GLenum BufferTypePicker(vtkm::Int64)
52 {
53  return GL_ELEMENT_ARRAY_BUFFER;
54 }
55 
56 static inline VTKM_CONT GLenum BufferTypePicker(vtkm::UInt64)
57 {
58  return GL_ELEMENT_ARRAY_BUFFER;
59 }
60 
65 template <typename T>
66 static inline VTKM_CONT GLenum BufferTypePicker(T)
67 {
68  using Traits = vtkm::TypeTraits<T>;
69  return detail::BufferTypePickerImpl(typename Traits::NumericTag(),
70  typename Traits::DimensionalityTag());
71 }
72 }
73 }
74 } //namespace vtkm::interop::internal
75 
76 #endif //vtk_m_interop_internal_BufferTypePicker_h
vtkm::TypeTraitsIntegerTag
Tag used to identify types that store integer numbers.
Definition: TypeTraits.h:36
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::TypeTraits
The TypeTraits class provides helpful compile-time information about the basic types used in VTKm (an...
Definition: TypeTraits.h:61
Types.h
OpenGLHeaders.h
TypeTraits.h
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::Int64
signed long long Int64
Base type to use for 64-bit signed integer numbers.
Definition: Types.h:204
vtkm::TypeTraitsScalarTag
Tag used to identify 0 dimensional types (scalars).
Definition: TypeTraits.h:44
vtkm::UInt32
uint32_t UInt32
Base type to use for 32-bit unsigned integer numbers.
Definition: Types.h:185
vtkm::UInt64
unsigned long long UInt64
Base type to use for 64-bit signed integer numbers.
Definition: Types.h:207
vtkm::Int32
int32_t Int32
Base type to use for 32-bit signed integer numbers.
Definition: Types.h:181