ShaderProgramBinaryExtra.h 1.5 KB

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