compatible_formats.h 829 B

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright 2020 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <array>
  6. #include <bitset>
  7. #include <cstddef>
  8. #include "video_core/surface.h"
  9. namespace VideoCore::Surface {
  10. class FormatCompatibility {
  11. public:
  12. using Table = std::array<std::bitset<MaxPixelFormat>, MaxPixelFormat>;
  13. explicit FormatCompatibility();
  14. bool TestView(PixelFormat format_a, PixelFormat format_b) const noexcept {
  15. return view[static_cast<size_t>(format_a)][static_cast<size_t>(format_b)];
  16. }
  17. bool TestCopy(PixelFormat format_a, PixelFormat format_b) const noexcept {
  18. return copy[static_cast<size_t>(format_a)][static_cast<size_t>(format_b)];
  19. }
  20. private:
  21. Table view;
  22. Table copy;
  23. };
  24. } // namespace VideoCore::Surface