ShaderProgramBinaryExtra.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright (C) 2009-2022, 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/Util/Serializer.h>
  7. namespace anki {
  8. /// Serialize/deserialize ShaderVariableBlockInfo
  9. template<typename TSerializer, typename TShaderVariableBlockInfo>
  10. void serializeShaderVariableBlockInfo(TShaderVariableBlockInfo x, TSerializer& s)
  11. {
  12. s.doValue("m_offset", offsetof(ShaderVariableBlockInfo, m_offset), x.m_offset);
  13. s.doValue("m_arraySize", offsetof(ShaderVariableBlockInfo, m_arraySize), x.m_arraySize);
  14. s.doValue("m_arrayStride", offsetof(ShaderVariableBlockInfo, m_arrayStride), x.m_arrayStride);
  15. s.doValue("m_matrixStride", offsetof(ShaderVariableBlockInfo, m_matrixStride), x.m_matrixStride);
  16. }
  17. /// Serialize ShaderVariableBlockInfo
  18. template<>
  19. class SerializeFunctor<ShaderVariableBlockInfo>
  20. {
  21. public:
  22. template<typename TSerializer>
  23. void operator()(const ShaderVariableBlockInfo& x, TSerializer& serializer)
  24. {
  25. serializeShaderVariableBlockInfo<TSerializer, const ShaderVariableBlockInfo&>(x, serializer);
  26. }
  27. };
  28. /// Deserialize ShaderVariableBlockInfo
  29. template<>
  30. class DeserializeFunctor<ShaderVariableBlockInfo>
  31. {
  32. public:
  33. template<typename TDeserializer>
  34. void operator()(ShaderVariableBlockInfo& x, TDeserializer& deserialize)
  35. {
  36. serializeShaderVariableBlockInfo<TDeserializer, ShaderVariableBlockInfo&>(x, deserialize);
  37. }
  38. };
  39. } // end namespace anki