Viskores  1.0
BufferTypePicker.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 #ifndef viskores_interop_internal_BufferTypePicker_h
19 #define viskores_interop_internal_BufferTypePicker_h
20 
21 #include <viskores/TypeTraits.h>
22 #include <viskores/Types.h>
24 
25 namespace viskores
26 {
27 namespace interop
28 {
29 namespace internal
30 {
31 
32 namespace detail
33 {
34 
35 template <typename NumericTag, typename DimensionalityTag>
36 static inline VISKORES_CONT GLenum BufferTypePickerImpl(NumericTag, DimensionalityTag)
37 {
38  return GL_ARRAY_BUFFER;
39 }
40 
42 static inline GLenum BufferTypePickerImpl(viskores::TypeTraitsIntegerTag,
44 {
45  return GL_ELEMENT_ARRAY_BUFFER;
46 }
47 
48 } //namespace detail
49 
50 static inline VISKORES_CONT GLenum BufferTypePicker(viskores::Int32)
51 {
52  return GL_ELEMENT_ARRAY_BUFFER;
53 }
54 
55 static inline VISKORES_CONT GLenum BufferTypePicker(viskores::UInt32)
56 {
57  return GL_ELEMENT_ARRAY_BUFFER;
58 }
59 
60 static inline VISKORES_CONT GLenum BufferTypePicker(viskores::Int64)
61 {
62  return GL_ELEMENT_ARRAY_BUFFER;
63 }
64 
65 static inline VISKORES_CONT GLenum BufferTypePicker(viskores::UInt64)
66 {
67  return GL_ELEMENT_ARRAY_BUFFER;
68 }
69 
74 template <typename T>
75 static inline VISKORES_CONT GLenum BufferTypePicker(T)
76 {
77  using Traits = viskores::TypeTraits<T>;
78  return detail::BufferTypePickerImpl(typename Traits::NumericTag(),
79  typename Traits::DimensionalityTag());
80 }
81 }
82 }
83 } //namespace viskores::interop::internal
84 
85 #endif //viskores_interop_internal_BufferTypePicker_h
Types.h
OpenGLHeaders.h
viskores::Int64
signed long long Int64
Base type to use for 64-bit signed integer numbers.
Definition: Types.h:212
viskores::TypeTraitsScalarTag
Tag used to identify 0 dimensional types (scalars).
Definition: TypeTraits.h:52
TypeTraits.h
viskores::TypeTraits
The TypeTraits class provides helpful compile-time information about the basic types used in Viskores...
Definition: TypeTraits.h:69
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::UInt64
unsigned long long UInt64
Base type to use for 64-bit signed integer numbers.
Definition: Types.h:215
viskores::Int32
int32_t Int32
Base type to use for 32-bit signed integer numbers.
Definition: Types.h:189
viskores::UInt32
uint32_t UInt32
Base type to use for 32-bit unsigned integer numbers.
Definition: Types.h:193
viskores::TypeTraitsIntegerTag
Tag used to identify types that store integer numbers.
Definition: TypeTraits.h:44