3
0

ShaderOutputContract.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <Atom/RPI.Reflect/Shader/ShaderOutputContract.h>
  9. #include <AzCore/Utils/TypeHash.h>
  10. #include <AzCore/Serialization/SerializeContext.h>
  11. namespace AZ
  12. {
  13. namespace RPI
  14. {
  15. void ShaderOutputContract::Reflect(ReflectContext* context)
  16. {
  17. if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
  18. {
  19. serializeContext->Class<ShaderOutputContract>()
  20. ->Version(0)
  21. ->Field("m_requiredColorAttachments", &ShaderOutputContract::m_requiredColorAttachments)
  22. ;
  23. serializeContext->Class<ColorAttachmentInfo>()
  24. ->Version(0)
  25. ->Field("m_componentCount", &ColorAttachmentInfo::m_componentCount)
  26. ;
  27. }
  28. }
  29. HashValue64 ShaderOutputContract::GetHash() const
  30. {
  31. HashValue64 hash = HashValue64{ 0 };
  32. for (const ColorAttachmentInfo& info : m_requiredColorAttachments)
  33. {
  34. hash = TypeHash64(info.m_componentCount, hash);
  35. }
  36. return hash;
  37. }
  38. } // namespace RPI
  39. } // namespace AZ