2015-05-24 06:55:12 +02:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-18 01:08:10 +02:00
|
|
|
// Licensed under GPLv2+
|
2013-04-17 23:09:55 -04:00
|
|
|
// Refer to the license.txt file included.
|
2009-02-23 06:17:57 +00:00
|
|
|
|
2014-02-10 13:54:46 -05:00
|
|
|
#pragma once
|
2009-02-23 06:17:57 +00:00
|
|
|
|
2016-11-27 18:14:58 +10:00
|
|
|
#include <string>
|
|
|
|
#include <utility>
|
|
|
|
|
2014-09-07 20:06:58 -05:00
|
|
|
#include "Common/CommonTypes.h"
|
2016-07-21 19:04:57 -04:00
|
|
|
|
|
|
|
enum class APIType;
|
2017-07-30 12:45:55 -07:00
|
|
|
enum class TextureFormat;
|
|
|
|
enum class EFBCopyFormat;
|
|
|
|
enum class TLUTFormat;
|
|
|
|
struct EFBCopyParams;
|
2009-02-23 06:17:57 +00:00
|
|
|
|
2017-11-25 11:13:22 +01:00
|
|
|
namespace TextureConversionShaderTiled
|
2009-02-23 06:17:57 +00:00
|
|
|
{
|
2017-07-30 12:45:55 -07:00
|
|
|
u16 GetEncodedSampleCount(EFBCopyFormat format);
|
2009-02-23 06:17:57 +00:00
|
|
|
|
2017-07-30 12:45:55 -07:00
|
|
|
const char* GenerateEncodingShader(const EFBCopyParams& params, APIType ApiType);
|
2016-11-27 18:14:58 +10:00
|
|
|
|
|
|
|
// View format of the input data to the texture decoding shader.
|
|
|
|
enum BufferFormat
|
|
|
|
{
|
|
|
|
BUFFER_FORMAT_R8_UINT,
|
|
|
|
BUFFER_FORMAT_R16_UINT,
|
|
|
|
BUFFER_FORMAT_R32G32_UINT,
|
2017-08-08 00:09:25 -05:00
|
|
|
BUFFER_FORMAT_RGBA8_UINT,
|
2016-11-27 18:14:58 +10:00
|
|
|
BUFFER_FORMAT_COUNT
|
|
|
|
};
|
|
|
|
|
|
|
|
// Information required to compile and dispatch a texture decoding shader.
|
|
|
|
struct DecodingShaderInfo
|
|
|
|
{
|
|
|
|
BufferFormat buffer_format;
|
|
|
|
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 23:53:03 +10:00
|
|
|
const DecodingShaderInfo* GetDecodingShaderInfo(TextureFormat format);
|
2016-11-27 18:14:58 +10:00
|
|
|
|
|
|
|
// Determine how many bytes there are in each element of the texel buffer.
|
|
|
|
// Needed for alignment and stride calculations.
|
|
|
|
u32 GetBytesPerBufferElement(BufferFormat buffer_format);
|
|
|
|
|
|
|
|
// 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.
|
2017-07-30 12:45:55 -07:00
|
|
|
std::string GenerateDecodingShader(TextureFormat format, TLUTFormat palette_format,
|
2017-04-04 23:53:03 +10:00
|
|
|
APIType api_type);
|
2016-11-27 18:14:58 +10:00
|
|
|
|
2017-11-25 11:13:22 +01:00
|
|
|
} // namespace TextureConversionShaderTiled
|