18 #ifndef ION_GFX_SHADERINPUT_H_
19 #define ION_GFX_SHADERINPUT_H_
23 #include "base/integral_types.h"
29 class ShaderInputRegistry;
49 template <
typename ValueHolderType,
typename ValueEnumType>
59 bool IsValid()
const {
return registry_ != NULL; }
86 return value_.template Get<T>();
94 return value_.template GetValueAt<T>(i);
100 return value_.GetCount();
105 template <
typename T>
bool Is()
const {
106 return value_.template Is<T>();
112 return value_.template IsArrayOf<T>();
119 if (value_.template IsAssignableTo<T>()) {
132 if (value_.template ElementsAssignableTo<T>()) {
134 value_.SetValueAt(i, value);
154 index_in_registry_(0),
169 template <
typename T>
171 size_t index_in_registry,
size_t array_index,
ValueType type,
173 registry_ = ®istry;
174 registry_id_ = registry_id;
175 index_in_registry_ = index_in_registry;
176 array_index_ = array_index;
188 template <
typename T>
190 size_t index_in_registry,
size_t array_index,
ValueType type,
191 const T* values,
size_t count,
193 registry_ = ®istry;
194 registry_id_ = registry_id;
195 index_in_registry_ = index_in_registry;
196 array_index_ = array_index;
198 value_.template InitArray<T>(allocator, count);
200 for (
size_t i = 0; i < count; ++i)
201 value_.SetValueAt(i, values[i]);
208 return value_.GetArrayAllocator();
214 size_t index_in_registry_;
217 ValueHolderType value_;
229 #endif // ION_GFX_SHADERINPUT_H_
UniformType
The UniformType enum defines all supported uniform shader argument types.