From b2c1672e108333bb38ae15f6c6677a0f3719896a Mon Sep 17 00:00:00 2001 From: Subv Date: Wed, 18 Apr 2018 13:51:09 -0500 Subject: [PATCH] GPU: Texture format 8 and framebuffer format 0xD5 are actually ABGR8. --- .../renderer_opengl/gl_rasterizer_cache.cpp | 6 +++--- .../renderer_opengl/gl_rasterizer_cache.h | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index a92773f11b..d54ddf6437 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -52,7 +52,7 @@ static constexpr std::array fb_format_tuples = {{ }}; static constexpr std::array 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 }}; @@ -123,13 +123,13 @@ void MortonCopy(u32 stride, u32 block_height, u32 height, u8* gl_buffer, VAddr b static constexpr std::array morton_to_gl_fns = { - MortonCopy, + MortonCopy, MortonCopy, }; static constexpr std::array gl_to_morton_fns = { - MortonCopy, + MortonCopy, // TODO(Subv): Swizzling the DXT1 format is not yet supported nullptr, }; diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 26d6c3061a..0f8f14404a 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h @@ -52,7 +52,7 @@ enum class ScaleMatch { struct SurfaceParams { enum class PixelFormat { - RGBA8 = 0, + ABGR8 = 0, DXT1 = 1, Invalid = 255, }; @@ -71,7 +71,7 @@ struct SurfaceParams { return 0; constexpr std::array bpp_table = { - 32, // RGBA8 + 32, // ABGR8 64, // DXT1 }; @@ -85,7 +85,7 @@ struct SurfaceParams { static PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format) { switch (format) { case Tegra::RenderTargetFormat::RGBA8_UNORM: - return PixelFormat::RGBA8; + return PixelFormat::ABGR8; default: NGLOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast(format)); UNREACHABLE(); @@ -95,7 +95,7 @@ struct SurfaceParams { static PixelFormat PixelFormatFromGPUPixelFormat(Tegra::FramebufferConfig::PixelFormat format) { switch (format) { case Tegra::FramebufferConfig::PixelFormat::ABGR8: - return PixelFormat::RGBA8; + return PixelFormat::ABGR8; default: NGLOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast(format)); UNREACHABLE(); @@ -106,7 +106,7 @@ struct SurfaceParams { // TODO(Subv): Properly implement this switch (format) { case Tegra::Texture::TextureFormat::A8R8G8B8: - return PixelFormat::RGBA8; + return PixelFormat::ABGR8; case Tegra::Texture::TextureFormat::DXT1: return PixelFormat::DXT1; default: @@ -118,7 +118,7 @@ struct SurfaceParams { static Tegra::Texture::TextureFormat TextureFormatFromPixelFormat(PixelFormat format) { // TODO(Subv): Properly implement this switch (format) { - case PixelFormat::RGBA8: + case PixelFormat::ABGR8: return Tegra::Texture::TextureFormat::A8R8G8B8; case PixelFormat::DXT1: return Tegra::Texture::TextureFormat::DXT1; @@ -148,7 +148,7 @@ struct SurfaceParams { } static SurfaceType GetFormatType(PixelFormat pixel_format) { - if ((unsigned int)pixel_format <= static_cast(PixelFormat::RGBA8)) { + if ((unsigned int)pixel_format <= static_cast(PixelFormat::ABGR8)) { return SurfaceType::Color; }