Debian Codegraph @

Source/Core/VideoCommon/TextureConverterShaderGen.h

raw symbols SCIP
1 // Copyright 2017 Dolphin Emulator Project
2 // SPDX-License-Identifier: GPL-2.0-or-later
3
4 #pragma once
5
6 #include <fmt/format.h>
7 #include <string>
8
9 #include "Common/CommonTypes.h"
10
11 #include "VideoCommon/ShaderGenCommon.h"
12 #include "VideoCommon/TextureDecoder.h"
13
14 enum class APIType;
15
16 namespace TextureConversionShaderGen
17 {
18 #pragma pack(1)
19 struct UidData
20 {
21 u32 NumValues() const { return sizeof(UidData); }
22 EFBCopyFormat dst_format;
23
24 u32 efb_has_alpha : 1;
25 u32 is_depth_copy : 1;
26 u32 is_intensity : 1;
27 u32 scale_by_half : 1;
28 u32 all_copy_filter_coefs_needed : 1;
29 u32 copy_filter_can_overflow : 1;
30 u32 apply_gamma : 1;
31 };
32 #pragma pack()
33
34 using TCShaderUid = ShaderUid<UidData>;
35
36 ShaderCode GenerateVertexShader(APIType api_type);
37 ShaderCode GeneratePixelShader(APIType api_type, const UidData* uid_data);
38
39 TCShaderUid GetShaderUid(EFBCopyFormat dst_format, bool is_depth_copy, bool is_intensity,
40 bool scale_by_half, float gamma_rcp,
41 const std::array<u32, 3>& filter_coefficients);
42
43 } // namespace TextureConversionShaderGen
44
45 template <>
46 struct fmt::formatter<TextureConversionShaderGen::UidData>
47 {
48 constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); }
49 template <typename FormatContext>
50 auto format(const TextureConversionShaderGen::UidData& uid, FormatContext& ctx) const
51 {
52 std::string dst_format;
53 if (uid.dst_format == EFBCopyFormat::XFB)
54 dst_format = "XFB";
55 else
56 dst_format = fmt::to_string(uid.dst_format);
57 return fmt::format_to(ctx.out(),
58 "dst_format: {}, efb_has_alpha: {}, is_depth_copy: {}, is_intensity: {}, "
59 "scale_by_half: {}, all_copy_filter_coefs_needed: {}, "
60 "copy_filter_can_overflow: {}, apply_gamma: {}",
61 dst_format, uid.efb_has_alpha, uid.is_depth_copy, uid.is_intensity,
62 uid.scale_by_half, uid.all_copy_filter_coefs_needed,
63 uid.copy_filter_can_overflow, uid.apply_gamma);
64 }
65 };