Debian Codegraph @

Source/Core/VideoCommon/TextureConversionShader.h

raw symbols SCIP
1 // Copyright 2008 Dolphin Emulator Project
2 // SPDX-License-Identifier: GPL-2.0-or-later
3
4 #pragma once
5
6 #include <optional>
7 #include <string>
8 #include <utility>
9
10 #include "Common/CommonTypes.h"
11
12 enum class APIType;
13 enum class TextureFormat;
14 enum class EFBCopyFormat;
15 enum class TLUTFormat;
16 enum TexelBufferFormat : u32;
17 struct EFBCopyParams;
18
19 namespace TextureConversionShaderTiled
20 {
21 u16 GetEncodedSampleCount(EFBCopyFormat format);
22
23 std::string GenerateEncodingShader(const EFBCopyParams& params, APIType api_type);
24
25 // Information required to compile and dispatch a texture decoding shader.
26 struct DecodingShaderInfo
27 {
28 TexelBufferFormat buffer_format;
29 u32 palette_size;
30 u32 group_size_x;
31 u32 group_size_y;
32 bool group_flatten;
33 const char* shader_body;
34 };
35
36 // Obtain shader information for the specified texture format.
37 // If this format does not have a shader written for it, returns nullptr.
38 const DecodingShaderInfo* GetDecodingShaderInfo(TextureFormat format);
39
40 // Determine how many thread groups should be dispatched for an image of the specified width/height.
41 // First is the number of X groups, second is the number of Y groups, Z is always one.
42 std::pair<u32, u32> GetDispatchCount(const DecodingShaderInfo* info, u32 width, u32 height);
43
44 // Returns the GLSL string containing the texture decoding shader for the specified format.
45 std::string GenerateDecodingShader(TextureFormat format, std::optional<TLUTFormat> palette_format,
46 APIType api_type);
47
48 // Returns the GLSL string containing the palette conversion shader for the specified format.
49 std::string GeneratePaletteConversionShader(TLUTFormat palette_format, APIType api_type);
50
51 } // namespace TextureConversionShaderTiled