diff options
-rw-r--r-- | src/gallium/state_trackers/clover/core/module.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/gallium/state_trackers/clover/core/module.cpp b/src/gallium/state_trackers/clover/core/module.cpp index 3e3ad99e450..41de7344203 100644 --- a/src/gallium/state_trackers/clover/core/module.cpp +++ b/src/gallium/state_trackers/clover/core/module.cpp @@ -69,7 +69,9 @@ namespace { /// (De)serialize a vector. template<typename T> - struct _serializer<compat::vector<T>> { + struct _serializer<compat::vector<T>, + typename std::enable_if< + !std::is_scalar<T>::value>::type> { static void proc(compat::ostream &os, const compat::vector<T> &v) { _proc<uint32_t>(os, v.size()); @@ -87,6 +89,25 @@ namespace { } }; + template<typename T> + struct _serializer<compat::vector<T>, + typename std::enable_if< + std::is_scalar<T>::value>::type> { + static void + proc(compat::ostream &os, const compat::vector<T> &v) { + _proc<uint32_t>(os, v.size()); + os.write(reinterpret_cast<const char *>(v.begin()), + v.size() * sizeof(T)); + } + + static void + proc(compat::istream &is, compat::vector<T> &v) { + v.reserve(_proc<uint32_t>(is)); + is.read(reinterpret_cast<char *>(v.begin()), + v.size() * sizeof(T)); + } + }; + /// (De)serialize a module::section. template<> struct _serializer<module::section> { |