summaryrefslogtreecommitdiffstats
path: root/src/video_core/compatible_formats.h
blob: 51766349b0d8fb4035da59ce1d684125b1891ae3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright 2020 yuzu Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.

#pragma once

#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