Implement RGB565 Framebuffer format
This commit is contained in:
@@ -18,6 +18,8 @@ u32 FramebufferConfig::BytesPerPixel(PixelFormat format) {
|
|||||||
case PixelFormat::ABGR8:
|
case PixelFormat::ABGR8:
|
||||||
case PixelFormat::BGRA8:
|
case PixelFormat::BGRA8:
|
||||||
return 4;
|
return 4;
|
||||||
|
case PixelFormat::RGB565:
|
||||||
|
return 2;
|
||||||
default:
|
default:
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ class DebugContext;
|
|||||||
struct FramebufferConfig {
|
struct FramebufferConfig {
|
||||||
enum class PixelFormat : u32 {
|
enum class PixelFormat : u32 {
|
||||||
ABGR8 = 1,
|
ABGR8 = 1,
|
||||||
|
RGB565 = 4,
|
||||||
BGRA8 = 5,
|
BGRA8 = 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -324,6 +324,7 @@ static constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex
|
|||||||
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_8X5
|
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_8X5
|
||||||
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_5X4
|
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_5X4
|
||||||
{GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // BGRA8
|
{GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // BGRA8
|
||||||
|
{GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, ComponentType::UNorm, false}, // RGB565U
|
||||||
// Compressed sRGB formats
|
// Compressed sRGB formats
|
||||||
{GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm,
|
{GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm,
|
||||||
true}, // DXT1_SRGB
|
true}, // DXT1_SRGB
|
||||||
|
|||||||
@@ -410,6 +410,8 @@ PixelFormat PixelFormatFromGPUPixelFormat(Tegra::FramebufferConfig::PixelFormat
|
|||||||
return PixelFormat::ABGR8U;
|
return PixelFormat::ABGR8U;
|
||||||
case Tegra::FramebufferConfig::PixelFormat::BGRA8:
|
case Tegra::FramebufferConfig::PixelFormat::BGRA8:
|
||||||
return PixelFormat::BGRA8;
|
return PixelFormat::BGRA8;
|
||||||
|
case Tegra::FramebufferConfig::PixelFormat::RGB565:
|
||||||
|
return PixelFormat::RGB565U;
|
||||||
default:
|
default:
|
||||||
LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
|
LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
|||||||
@@ -62,31 +62,32 @@ enum class PixelFormat {
|
|||||||
ASTC_2D_8X5 = 44,
|
ASTC_2D_8X5 = 44,
|
||||||
ASTC_2D_5X4 = 45,
|
ASTC_2D_5X4 = 45,
|
||||||
BGRA8_SRGB = 46,
|
BGRA8_SRGB = 46,
|
||||||
DXT1_SRGB = 47,
|
RGB565U = 47,
|
||||||
DXT23_SRGB = 48,
|
DXT1_SRGB = 48,
|
||||||
DXT45_SRGB = 49,
|
DXT23_SRGB = 49,
|
||||||
BC7U_SRGB = 50,
|
DXT45_SRGB = 50,
|
||||||
ASTC_2D_4X4_SRGB = 51,
|
BC7U_SRGB = 51,
|
||||||
ASTC_2D_8X8_SRGB = 52,
|
ASTC_2D_4X4_SRGB = 52,
|
||||||
ASTC_2D_8X5_SRGB = 53,
|
ASTC_2D_8X8_SRGB = 53,
|
||||||
ASTC_2D_5X4_SRGB = 54,
|
ASTC_2D_8X5_SRGB = 54,
|
||||||
ASTC_2D_5X5 = 55,
|
ASTC_2D_5X4_SRGB = 55,
|
||||||
ASTC_2D_5X5_SRGB = 56,
|
ASTC_2D_5X5 = 56,
|
||||||
ASTC_2D_10X8 = 57,
|
ASTC_2D_5X5_SRGB = 57,
|
||||||
ASTC_2D_10X8_SRGB = 58,
|
ASTC_2D_10X8 = 58,
|
||||||
|
ASTC_2D_10X8_SRGB = 59,
|
||||||
|
|
||||||
MaxColorFormat,
|
MaxColorFormat,
|
||||||
|
|
||||||
// Depth formats
|
// Depth formats
|
||||||
Z32F = 59,
|
Z32F = 60,
|
||||||
Z16 = 60,
|
Z16 = 61,
|
||||||
|
|
||||||
MaxDepthFormat,
|
MaxDepthFormat,
|
||||||
|
|
||||||
// DepthStencil formats
|
// DepthStencil formats
|
||||||
Z24S8 = 61,
|
Z24S8 = 62,
|
||||||
S8Z24 = 62,
|
S8Z24 = 63,
|
||||||
Z32FS8 = 63,
|
Z32FS8 = 64,
|
||||||
|
|
||||||
MaxDepthStencilFormat,
|
MaxDepthStencilFormat,
|
||||||
|
|
||||||
@@ -171,6 +172,7 @@ constexpr std::array<u32, MaxPixelFormat> compression_factor_table = {{
|
|||||||
4, // ASTC_2D_8X5
|
4, // ASTC_2D_8X5
|
||||||
4, // ASTC_2D_5X4
|
4, // ASTC_2D_5X4
|
||||||
1, // BGRA8_SRGB
|
1, // BGRA8_SRGB
|
||||||
|
1, // RGB565U
|
||||||
4, // DXT1_SRGB
|
4, // DXT1_SRGB
|
||||||
4, // DXT23_SRGB
|
4, // DXT23_SRGB
|
||||||
4, // DXT45_SRGB
|
4, // DXT45_SRGB
|
||||||
@@ -252,6 +254,7 @@ constexpr std::array<u32, MaxPixelFormat> block_width_table = {{
|
|||||||
8, // ASTC_2D_8X5
|
8, // ASTC_2D_8X5
|
||||||
5, // ASTC_2D_5X4
|
5, // ASTC_2D_5X4
|
||||||
1, // BGRA8_SRGB
|
1, // BGRA8_SRGB
|
||||||
|
1, // RGB565U
|
||||||
4, // DXT1_SRGB
|
4, // DXT1_SRGB
|
||||||
4, // DXT23_SRGB
|
4, // DXT23_SRGB
|
||||||
4, // DXT45_SRGB
|
4, // DXT45_SRGB
|
||||||
@@ -327,6 +330,7 @@ constexpr std::array<u32, MaxPixelFormat> block_height_table = {{
|
|||||||
5, // ASTC_2D_8X5
|
5, // ASTC_2D_8X5
|
||||||
4, // ASTC_2D_5X4
|
4, // ASTC_2D_5X4
|
||||||
1, // BGRA8_SRGB
|
1, // BGRA8_SRGB
|
||||||
|
1, // RGB565U
|
||||||
4, // DXT1_SRGB
|
4, // DXT1_SRGB
|
||||||
4, // DXT23_SRGB
|
4, // DXT23_SRGB
|
||||||
4, // DXT45_SRGB
|
4, // DXT45_SRGB
|
||||||
@@ -402,6 +406,7 @@ constexpr std::array<u32, MaxPixelFormat> bpp_table = {{
|
|||||||
128, // ASTC_2D_8X5
|
128, // ASTC_2D_8X5
|
||||||
128, // ASTC_2D_5X4
|
128, // ASTC_2D_5X4
|
||||||
32, // BGRA8_SRGB
|
32, // BGRA8_SRGB
|
||||||
|
16, // RGB565U
|
||||||
64, // DXT1_SRGB
|
64, // DXT1_SRGB
|
||||||
128, // DXT23_SRGB
|
128, // DXT23_SRGB
|
||||||
128, // DXT45_SRGB
|
128, // DXT45_SRGB
|
||||||
|
|||||||
Reference in New Issue
Block a user