yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

Implemented RGBA8_UINT

Needed by kirby
This commit is contained in:
David Marcec 2018-08-20 22:26:54 +10:00
parent 51ddb130c5
commit 23d45715dc
4 changed files with 58 additions and 45 deletions

View File

@ -55,6 +55,7 @@ u32 RenderTargetBytesPerPixel(RenderTargetFormat format) {
case RenderTargetFormat::RGBA8_UNORM: case RenderTargetFormat::RGBA8_UNORM:
case RenderTargetFormat::RGBA8_SNORM: case RenderTargetFormat::RGBA8_SNORM:
case RenderTargetFormat::RGBA8_SRGB: case RenderTargetFormat::RGBA8_SRGB:
case RenderTargetFormat::RGBA8_UINT:
case RenderTargetFormat::RGB10_A2_UNORM: case RenderTargetFormat::RGB10_A2_UNORM:
case RenderTargetFormat::BGRA8_UNORM: case RenderTargetFormat::BGRA8_UNORM:
case RenderTargetFormat::RG16_UNORM: case RenderTargetFormat::RG16_UNORM:

View File

@ -30,6 +30,7 @@ enum class RenderTargetFormat : u32 {
RGBA8_UNORM = 0xD5, RGBA8_UNORM = 0xD5,
RGBA8_SRGB = 0xD6, RGBA8_SRGB = 0xD6,
RGBA8_SNORM = 0xD7, RGBA8_SNORM = 0xD7,
RGBA8_UINT = 0xD9,
RG16_UNORM = 0xDA, RG16_UNORM = 0xDA,
RG16_SNORM = 0xDB, RG16_SNORM = 0xDB,
RG16_SINT = 0xDC, RG16_SINT = 0xDC,

View File

@ -94,6 +94,7 @@ struct FormatTuple {
static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_format_tuples = {{ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_format_tuples = {{
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, ComponentType::UNorm, false}, // ABGR8U {GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, ComponentType::UNorm, false}, // ABGR8U
{GL_RGBA8, GL_RGBA, GL_BYTE, ComponentType::SNorm, false}, // ABGR8S {GL_RGBA8, GL_RGBA, GL_BYTE, ComponentType::SNorm, false}, // ABGR8S
{GL_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, ComponentType::UInt, false}, // ABGR8UI
{GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV, ComponentType::UNorm, false}, // B5G6R5U {GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV, ComponentType::UNorm, false}, // B5G6R5U
{GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, ComponentType::UNorm, {GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, ComponentType::UNorm,
false}, // A2B10G10R10U false}, // A2B10G10R10U
@ -245,6 +246,7 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU
// clang-format off // clang-format off
MortonCopy<true, PixelFormat::ABGR8U>, MortonCopy<true, PixelFormat::ABGR8U>,
MortonCopy<true, PixelFormat::ABGR8S>, MortonCopy<true, PixelFormat::ABGR8S>,
MortonCopy<true, PixelFormat::ABGR8UI>,
MortonCopy<true, PixelFormat::B5G6R5U>, MortonCopy<true, PixelFormat::B5G6R5U>,
MortonCopy<true, PixelFormat::A2B10G10R10U>, MortonCopy<true, PixelFormat::A2B10G10R10U>,
MortonCopy<true, PixelFormat::A1B5G5R5U>, MortonCopy<true, PixelFormat::A1B5G5R5U>,
@ -299,6 +301,7 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU
// clang-format off // clang-format off
MortonCopy<false, PixelFormat::ABGR8U>, MortonCopy<false, PixelFormat::ABGR8U>,
MortonCopy<false, PixelFormat::ABGR8S>, MortonCopy<false, PixelFormat::ABGR8S>,
MortonCopy<false, PixelFormat::ABGR8UI>,
MortonCopy<false, PixelFormat::B5G6R5U>, MortonCopy<false, PixelFormat::B5G6R5U>,
MortonCopy<false, PixelFormat::A2B10G10R10U>, MortonCopy<false, PixelFormat::A2B10G10R10U>,
MortonCopy<false, PixelFormat::A1B5G5R5U>, MortonCopy<false, PixelFormat::A1B5G5R5U>,

View File

@ -25,59 +25,60 @@ struct SurfaceParams {
enum class PixelFormat { enum class PixelFormat {
ABGR8U = 0, ABGR8U = 0,
ABGR8S = 1, ABGR8S = 1,
B5G6R5U = 2, ABGR8UI = 2,
A2B10G10R10U = 3, B5G6R5U = 3,
A1B5G5R5U = 4, A2B10G10R10U = 4,
R8U = 5, A1B5G5R5U = 5,
R8UI = 6, R8U = 6,
RGBA16F = 7, R8UI = 7,
RGBA16U = 8, RGBA16F = 8,
RGBA16UI = 9, RGBA16U = 9,
R11FG11FB10F = 10, RGBA16UI = 10,
RGBA32UI = 11, R11FG11FB10F = 11,
DXT1 = 12, RGBA32UI = 12,
DXT23 = 13, DXT1 = 13,
DXT45 = 14, DXT23 = 14,
DXN1 = 15, // This is also known as BC4 DXT45 = 15,
DXN2UNORM = 16, DXN1 = 16, // This is also known as BC4
DXN2SNORM = 17, DXN2UNORM = 17,
BC7U = 18, DXN2SNORM = 18,
ASTC_2D_4X4 = 19, BC7U = 19,
G8R8U = 20, ASTC_2D_4X4 = 20,
G8R8S = 21, G8R8U = 21,
BGRA8 = 22, G8R8S = 22,
RGBA32F = 23, BGRA8 = 23,
RG32F = 24, RGBA32F = 24,
R32F = 25, RG32F = 25,
R16F = 26, R32F = 26,
R16U = 27, R16F = 27,
R16S = 28, R16U = 28,
R16UI = 29, R16S = 29,
R16I = 30, R16UI = 30,
RG16 = 31, R16I = 31,
RG16F = 32, RG16 = 32,
RG16UI = 33, RG16F = 33,
RG16I = 34, RG16UI = 34,
RG16S = 35, RG16I = 35,
RGB32F = 36, RG16S = 36,
SRGBA8 = 37, RGB32F = 37,
RG8U = 38, SRGBA8 = 38,
RG8S = 39, RG8U = 39,
RG32UI = 40, RG8S = 40,
R32UI = 41, RG32UI = 41,
R32UI = 42,
MaxColorFormat, MaxColorFormat,
// Depth formats // Depth formats
Z32F = 42, Z32F = 43,
Z16 = 43, Z16 = 44,
MaxDepthFormat, MaxDepthFormat,
// DepthStencil formats // DepthStencil formats
Z24S8 = 44, Z24S8 = 45,
S8Z24 = 45, S8Z24 = 46,
Z32FS8 = 46, Z32FS8 = 47,
MaxDepthStencilFormat, MaxDepthStencilFormat,
@ -117,6 +118,7 @@ struct SurfaceParams {
constexpr std::array<u32, MaxPixelFormat> compression_factor_table = {{ constexpr std::array<u32, MaxPixelFormat> compression_factor_table = {{
1, // ABGR8U 1, // ABGR8U
1, // ABGR8S 1, // ABGR8S
1, // ABGR8UI
1, // B5G6R5U 1, // B5G6R5U
1, // A2B10G10R10U 1, // A2B10G10R10U
1, // A1B5G5R5U 1, // A1B5G5R5U
@ -175,6 +177,7 @@ struct SurfaceParams {
constexpr std::array<u32, MaxPixelFormat> bpp_table = {{ constexpr std::array<u32, MaxPixelFormat> bpp_table = {{
32, // ABGR8U 32, // ABGR8U
32, // ABGR8S 32, // ABGR8S
32, // ABGR8UI
16, // B5G6R5U 16, // B5G6R5U
32, // A2B10G10R10U 32, // A2B10G10R10U
16, // A1B5G5R5U 16, // A1B5G5R5U
@ -257,6 +260,8 @@ struct SurfaceParams {
return PixelFormat::ABGR8U; return PixelFormat::ABGR8U;
case Tegra::RenderTargetFormat::RGBA8_SNORM: case Tegra::RenderTargetFormat::RGBA8_SNORM:
return PixelFormat::ABGR8S; return PixelFormat::ABGR8S;
case Tegra::RenderTargetFormat::RGBA8_UINT:
return PixelFormat::ABGR8UI;
case Tegra::RenderTargetFormat::BGRA8_UNORM: case Tegra::RenderTargetFormat::BGRA8_UNORM:
return PixelFormat::BGRA8; return PixelFormat::BGRA8;
case Tegra::RenderTargetFormat::RGB10_A2_UNORM: case Tegra::RenderTargetFormat::RGB10_A2_UNORM:
@ -327,6 +332,8 @@ struct SurfaceParams {
return PixelFormat::ABGR8U; return PixelFormat::ABGR8U;
case Tegra::Texture::ComponentType::SNORM: case Tegra::Texture::ComponentType::SNORM:
return PixelFormat::ABGR8S; return PixelFormat::ABGR8S;
case Tegra::Texture::ComponentType::UINT:
return PixelFormat::ABGR8UI;
} }
LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}",
static_cast<u32>(component_type)); static_cast<u32>(component_type));
@ -551,6 +558,7 @@ struct SurfaceParams {
case Tegra::RenderTargetFormat::R16_UINT: case Tegra::RenderTargetFormat::R16_UINT:
case Tegra::RenderTargetFormat::RG32_UINT: case Tegra::RenderTargetFormat::RG32_UINT:
case Tegra::RenderTargetFormat::R32_UINT: case Tegra::RenderTargetFormat::R32_UINT:
case Tegra::RenderTargetFormat::RGBA8_UINT:
return ComponentType::UInt; return ComponentType::UInt;
case Tegra::RenderTargetFormat::RG16_SINT: case Tegra::RenderTargetFormat::RG16_SINT:
case Tegra::RenderTargetFormat::R16_SINT: case Tegra::RenderTargetFormat::R16_SINT: