From 1d6be9febf7b9613014ec60fc0ec42e40cc073c9 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Fri, 26 Jun 2020 19:22:29 -0300 Subject: video_core/compatible_formats: Table to test if two formats are legal to view or copy Add a flat table to test if it's legal to create a texture view between two formats or copy betweem them. This table is based on ARB_copy_image and ARB_texture_view. Copies are more permissive than views. --- src/video_core/compatible_formats.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/video_core/compatible_formats.h (limited to 'src/video_core/compatible_formats.h') 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 +#include +#include + +#include "video_core/surface.h" + +namespace VideoCore::Surface { + +class FormatCompatibility { +public: + using Table = std::array, MaxPixelFormat>; + + explicit FormatCompatibility(); + + bool TestView(PixelFormat format_a, PixelFormat format_b) const noexcept { + return view[static_cast(format_a)][static_cast(format_b)]; + } + + bool TestCopy(PixelFormat format_a, PixelFormat format_b) const noexcept { + return copy[static_cast(format_a)][static_cast(format_b)]; + } + +private: + Table view; + Table copy; +}; + +} // namespace VideoCore::Surface -- cgit v1.2.3