GPU: Texture format 8 and framebuffer format 0xD5 are actually ABGR8.

This commit is contained in:
Subv 2018-04-18 13:51:09 -05:00
parent d3f9ea90e7
commit b2c1672e10
2 changed files with 10 additions and 10 deletions

View File

@ -52,7 +52,7 @@ static constexpr std::array<FormatTuple, 1> fb_format_tuples = {{
}}; }};
static constexpr std::array<FormatTuple, 2> tex_format_tuples = {{ static constexpr std::array<FormatTuple, 2> tex_format_tuples = {{
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, false, 1}, // RGBA8 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, false, 1}, // ABGR8
{GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, true, 16}, // DXT1 {GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, true, 16}, // DXT1
}}; }};
@ -123,13 +123,13 @@ void MortonCopy(u32 stride, u32 block_height, u32 height, u8* gl_buffer, VAddr b
static constexpr std::array<void (*)(u32, u32, u32, u8*, VAddr, VAddr, VAddr), 2> morton_to_gl_fns = static constexpr std::array<void (*)(u32, u32, u32, u8*, VAddr, VAddr, VAddr), 2> morton_to_gl_fns =
{ {
MortonCopy<true, PixelFormat::RGBA8>, MortonCopy<true, PixelFormat::ABGR8>,
MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT1>,
}; };
static constexpr std::array<void (*)(u32, u32, u32, u8*, VAddr, VAddr, VAddr), 2> gl_to_morton_fns = static constexpr std::array<void (*)(u32, u32, u32, u8*, VAddr, VAddr, VAddr), 2> gl_to_morton_fns =
{ {
MortonCopy<false, PixelFormat::RGBA8>, MortonCopy<false, PixelFormat::ABGR8>,
// TODO(Subv): Swizzling the DXT1 format is not yet supported // TODO(Subv): Swizzling the DXT1 format is not yet supported
nullptr, nullptr,
}; };

View File

@ -52,7 +52,7 @@ enum class ScaleMatch {
struct SurfaceParams { struct SurfaceParams {
enum class PixelFormat { enum class PixelFormat {
RGBA8 = 0, ABGR8 = 0,
DXT1 = 1, DXT1 = 1,
Invalid = 255, Invalid = 255,
}; };
@ -71,7 +71,7 @@ struct SurfaceParams {
return 0; return 0;
constexpr std::array<unsigned int, 2> bpp_table = { constexpr std::array<unsigned int, 2> bpp_table = {
32, // RGBA8 32, // ABGR8
64, // DXT1 64, // DXT1
}; };
@ -85,7 +85,7 @@ struct SurfaceParams {
static PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format) { static PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format) {
switch (format) { switch (format) {
case Tegra::RenderTargetFormat::RGBA8_UNORM: case Tegra::RenderTargetFormat::RGBA8_UNORM:
return PixelFormat::RGBA8; return PixelFormat::ABGR8;
default: default:
NGLOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); NGLOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
UNREACHABLE(); UNREACHABLE();
@ -95,7 +95,7 @@ struct SurfaceParams {
static PixelFormat PixelFormatFromGPUPixelFormat(Tegra::FramebufferConfig::PixelFormat format) { static PixelFormat PixelFormatFromGPUPixelFormat(Tegra::FramebufferConfig::PixelFormat format) {
switch (format) { switch (format) {
case Tegra::FramebufferConfig::PixelFormat::ABGR8: case Tegra::FramebufferConfig::PixelFormat::ABGR8:
return PixelFormat::RGBA8; return PixelFormat::ABGR8;
default: default:
NGLOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); NGLOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
UNREACHABLE(); UNREACHABLE();
@ -106,7 +106,7 @@ struct SurfaceParams {
// TODO(Subv): Properly implement this // TODO(Subv): Properly implement this
switch (format) { switch (format) {
case Tegra::Texture::TextureFormat::A8R8G8B8: case Tegra::Texture::TextureFormat::A8R8G8B8:
return PixelFormat::RGBA8; return PixelFormat::ABGR8;
case Tegra::Texture::TextureFormat::DXT1: case Tegra::Texture::TextureFormat::DXT1:
return PixelFormat::DXT1; return PixelFormat::DXT1;
default: default:
@ -118,7 +118,7 @@ struct SurfaceParams {
static Tegra::Texture::TextureFormat TextureFormatFromPixelFormat(PixelFormat format) { static Tegra::Texture::TextureFormat TextureFormatFromPixelFormat(PixelFormat format) {
// TODO(Subv): Properly implement this // TODO(Subv): Properly implement this
switch (format) { switch (format) {
case PixelFormat::RGBA8: case PixelFormat::ABGR8:
return Tegra::Texture::TextureFormat::A8R8G8B8; return Tegra::Texture::TextureFormat::A8R8G8B8;
case PixelFormat::DXT1: case PixelFormat::DXT1:
return Tegra::Texture::TextureFormat::DXT1; return Tegra::Texture::TextureFormat::DXT1;
@ -148,7 +148,7 @@ struct SurfaceParams {
} }
static SurfaceType GetFormatType(PixelFormat pixel_format) { static SurfaceType GetFormatType(PixelFormat pixel_format) {
if ((unsigned int)pixel_format <= static_cast<unsigned int>(PixelFormat::RGBA8)) { if ((unsigned int)pixel_format <= static_cast<unsigned int>(PixelFormat::ABGR8)) {
return SurfaceType::Color; return SurfaceType::Color;
} }