summaryrefslogtreecommitdiffstats
path: root/src/video_core/compatible_formats.h
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2020-06-27 00:22:29 +0200
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-06-27 00:28:11 +0200
commit1d6be9febf7b9613014ec60fc0ec42e40cc073c9 (patch)
tree66d105c6dc07957c1fd53c862bb604d0050b3e1f /src/video_core/compatible_formats.h
parentMerge pull request #4159 from ogniK5377/mem-manager-dumb-assert (diff)
downloadyuzu-1d6be9febf7b9613014ec60fc0ec42e40cc073c9.tar
yuzu-1d6be9febf7b9613014ec60fc0ec42e40cc073c9.tar.gz
yuzu-1d6be9febf7b9613014ec60fc0ec42e40cc073c9.tar.bz2
yuzu-1d6be9febf7b9613014ec60fc0ec42e40cc073c9.tar.lz
yuzu-1d6be9febf7b9613014ec60fc0ec42e40cc073c9.tar.xz
yuzu-1d6be9febf7b9613014ec60fc0ec42e40cc073c9.tar.zst
yuzu-1d6be9febf7b9613014ec60fc0ec42e40cc073c9.zip
Diffstat (limited to 'src/video_core/compatible_formats.h')
-rw-r--r--src/video_core/compatible_formats.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/video_core/compatible_formats.h b/src/video_core/compatible_formats.h
new file mode 100644
index 000000000..d1082566d
--- /dev/null
+++ b/src/video_core/compatible_formats.h
@@ -0,0 +1,32 @@
+// Copyright 2020 yuzu Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include <array>
+#include <bitset>
+#include <cstddef>
+
+#include "video_core/surface.h"
+
+namespace VideoCore::Surface {
+
+class FormatCompatibility {
+public:
+ using Table = std::array<std::bitset<MaxPixelFormat>, MaxPixelFormat>;
+
+ explicit FormatCompatibility();
+
+ bool TestView(PixelFormat format_a, PixelFormat format_b) const noexcept {
+ return view[static_cast<size_t>(format_a)][static_cast<size_t>(format_b)];
+ }
+
+ bool TestCopy(PixelFormat format_a, PixelFormat format_b) const noexcept {
+ return copy[static_cast<size_t>(format_a)][static_cast<size_t>(format_b)];
+ }
+
+private:
+ Table view;
+ Table copy;
+};
+
+} // namespace VideoCore::Surface