2015-05-24 04:55:12 +00:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2009-02-23 06:17:57 +00:00
|
|
|
|
2014-02-10 18:54:46 +00:00
|
|
|
#pragma once
|
2009-02-23 06:17:57 +00:00
|
|
|
|
2022-06-11 07:51:24 +00:00
|
|
|
#include <optional>
|
2016-11-27 08:14:58 +00:00
|
|
|
#include <string>
|
|
|
|
#include <utility>
|
|
|
|
|
2014-09-08 01:06:58 +00:00
|
|
|
#include "Common/CommonTypes.h"
|
2016-07-21 23:04:57 +00:00
|
|
|
|
|
|
|
enum class APIType;
|
2017-07-30 19:45:55 +00:00
|
|
|
enum class TextureFormat;
|
|
|
|
enum class EFBCopyFormat;
|
|
|
|
enum class TLUTFormat;
|
2019-02-15 01:59:50 +00:00
|
|
|
enum TexelBufferFormat : u32;
|
2017-07-30 19:45:55 +00:00
|
|
|
struct EFBCopyParams;
|
2009-02-23 06:17:57 +00:00
|
|
|
|
2017-11-25 10:13:22 +00:00
|
|
|
namespace TextureConversionShaderTiled
|
2009-01-11 22:25:57 +00:00
|
|
|
{
|
2017-07-30 19:45:55 +00:00
|
|
|
u16 GetEncodedSampleCount(EFBCopyFormat format);
|
2009-02-23 06:17:57 +00:00
|
|
|
|
2020-01-23 18:06:55 +00:00
|
|
|
std::string GenerateEncodingShader(const EFBCopyParams& params, APIType api_type);
|
2016-11-27 08:14:58 +00:00
|
|
|
|
|
|
|
// Information required to compile and dispatch a texture decoding shader.
|
|
|
|
struct DecodingShaderInfo
|
|
|
|
{
|
2019-02-15 01:59:50 +00:00
|
|
|
TexelBufferFormat buffer_format;
|
2016-11-27 08:14:58 +00:00
|
|
|
u32 palette_size;
|
|
|
|
u32 group_size_x;
|
|
|
|
u32 group_size_y;
|
|
|
|
bool group_flatten;
|
|
|
|
const char* shader_body;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Obtain shader information for the specified texture format.
|
|
|
|
// If this format does not have a shader written for it, returns nullptr.
|
2017-04-04 13:53:03 +00:00
|
|
|
const DecodingShaderInfo* GetDecodingShaderInfo(TextureFormat format);
|
2016-11-27 08:14:58 +00:00
|
|
|
|
|
|
|
// Determine how many thread groups should be dispatched for an image of the specified width/height.
|
|
|
|
// First is the number of X groups, second is the number of Y groups, Z is always one.
|
|
|
|
std::pair<u32, u32> GetDispatchCount(const DecodingShaderInfo* info, u32 width, u32 height);
|
|
|
|
|
|
|
|
// Returns the GLSL string containing the texture decoding shader for the specified format.
|
2022-06-11 07:51:24 +00:00
|
|
|
std::string GenerateDecodingShader(TextureFormat format, std::optional<TLUTFormat> palette_format,
|
2017-04-04 13:53:03 +00:00
|
|
|
APIType api_type);
|
2016-11-27 08:14:58 +00:00
|
|
|
|
2019-02-15 01:59:50 +00:00
|
|
|
// Returns the GLSL string containing the palette conversion shader for the specified format.
|
|
|
|
std::string GeneratePaletteConversionShader(TLUTFormat palette_format, APIType api_type);
|
|
|
|
|
2017-11-25 10:13:22 +00:00
|
|
|
} // namespace TextureConversionShaderTiled
|