ShaderProgramBinaryExtra.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright (C) 2009-2021, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #include <AnKi/ShaderCompiler/Common.h>
  6. #include <AnKi/Gr/Utils/Functions.h>
  7. #include <AnKi/Util/Serializer.h>
  8. namespace anki {
  9. /// Serialize/deserialize ShaderVariableBlockInfo
  10. template<typename TSerializer, typename TShaderVariableBlockInfo>
  11. void serializeShaderVariableBlockInfo(TShaderVariableBlockInfo x, TSerializer& s)
  12. {
  13. s.doValue("m_offset", offsetof(ShaderVariableBlockInfo, m_offset), x.m_offset);
  14. s.doValue("m_arraySize", offsetof(ShaderVariableBlockInfo, m_arraySize), x.m_arraySize);
  15. s.doValue("m_arrayStride", offsetof(ShaderVariableBlockInfo, m_arrayStride), x.m_arrayStride);
  16. s.doValue("m_matrixStride", offsetof(ShaderVariableBlockInfo, m_matrixStride), x.m_matrixStride);
  17. }
  18. /// Serialize ShaderVariableBlockInfo
  19. template<>
  20. class SerializeFunctor<ShaderVariableBlockInfo>
  21. {
  22. public:
  23. template<typename TSerializer>
  24. void operator()(const ShaderVariableBlockInfo& x, TSerializer& serializer)
  25. {
  26. serializeShaderVariableBlockInfo<TSerializer, const ShaderVariableBlockInfo&>(x, serializer);
  27. }
  28. };
  29. /// Deserialize ShaderVariableBlockInfo
  30. template<>
  31. class DeserializeFunctor<ShaderVariableBlockInfo>
  32. {
  33. public:
  34. template<typename TDeserializer>
  35. void operator()(ShaderVariableBlockInfo& x, TDeserializer& deserialize)
  36. {
  37. serializeShaderVariableBlockInfo<TDeserializer, ShaderVariableBlockInfo&>(x, deserialize);
  38. }
  39. };
  40. } // end namespace anki