summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-07-23 22:56:52 +0200
committerbunnei <bunneidev@gmail.com>2018-07-24 03:22:44 +0200
commitbcc184acfa81aee7ad33d9c82f5f4496731a1d1f (patch)
treed6025ff57f156e93aad6446df0d794ed9d0058ca /src
parentgl_rasterizer_cache: Add missing log statements. (diff)
downloadyuzu-bcc184acfa81aee7ad33d9c82f5f4496731a1d1f.tar
yuzu-bcc184acfa81aee7ad33d9c82f5f4496731a1d1f.tar.gz
yuzu-bcc184acfa81aee7ad33d9c82f5f4496731a1d1f.tar.bz2
yuzu-bcc184acfa81aee7ad33d9c82f5f4496731a1d1f.tar.lz
yuzu-bcc184acfa81aee7ad33d9c82f5f4496731a1d1f.tar.xz
yuzu-bcc184acfa81aee7ad33d9c82f5f4496731a1d1f.tar.zst
yuzu-bcc184acfa81aee7ad33d9c82f5f4496731a1d1f.zip
Diffstat (limited to 'src')
-rw-r--r--src/video_core/gpu.cpp1
-rw-r--r--src/video_core/gpu.h1
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp10
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h18
4 files changed, 22 insertions, 8 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp
index a003bc9e3..b094d48c3 100644
--- a/src/video_core/gpu.cpp
+++ b/src/video_core/gpu.cpp
@@ -38,6 +38,7 @@ u32 RenderTargetBytesPerPixel(RenderTargetFormat format) {
return 8;
case RenderTargetFormat::RGBA8_UNORM:
case RenderTargetFormat::RGB10_A2_UNORM:
+ case RenderTargetFormat::BGRA8_UNORM:
return 4;
default:
UNIMPLEMENTED_MSG("Unimplemented render target format {}", static_cast<u32>(format));
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h
index a32148ecd..9c74cfac3 100644
--- a/src/video_core/gpu.h
+++ b/src/video_core/gpu.h
@@ -18,6 +18,7 @@ enum class RenderTargetFormat : u32 {
RGBA32_FLOAT = 0xC0,
RGBA32_UINT = 0xC2,
RGBA16_FLOAT = 0xCA,
+ BGRA8_UNORM = 0xCF,
RGB10_A2_UNORM = 0xD1,
RGBA8_UNORM = 0xD5,
RGBA8_SRGB = 0xD6,
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 28f0bc379..02bd0fa7b 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -106,6 +106,7 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
true}, // BC7U
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4
{GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // G8R8
+ {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // BGRA8
// DepthStencil formats
{GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm,
@@ -197,9 +198,9 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT23>,
MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>,
MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>,
- MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::Z24S8>,
- MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>,
- MortonCopy<true, PixelFormat::Z16>,
+ MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>,
+ MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>,
+ MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>,
};
static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
@@ -213,7 +214,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
MortonCopy<false, PixelFormat::RGBA16F>,
MortonCopy<false, PixelFormat::R11FG11FB10F>,
MortonCopy<false, PixelFormat::RGBA32UI>,
- // TODO(Subv): Swizzling the DXT1/DXT23/DXT45/DXN1/BC7U formats is not yet supported
+ // TODO(Subv): Swizzling DXT1/DXT23/DXT45/DXN1/BC7U/ASTC_2D_4X4 formats is not supported
nullptr,
nullptr,
nullptr,
@@ -221,6 +222,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
nullptr,
nullptr,
MortonCopy<false, PixelFormat::G8R8>,
+ MortonCopy<false, PixelFormat::BGRA8>,
MortonCopy<false, PixelFormat::Z24S8>,
MortonCopy<false, PixelFormat::S8Z24>,
MortonCopy<false, PixelFormat::Z32F>,
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index fbdab58be..c0f94936e 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -37,14 +37,15 @@ struct SurfaceParams {
BC7U = 12,
ASTC_2D_4X4 = 13,
G8R8 = 14,
+ BGRA8 = 15,
MaxColorFormat,
// DepthStencil formats
- Z24S8 = 15,
- S8Z24 = 16,
- Z32F = 17,
- Z16 = 18,
+ Z24S8 = 16,
+ S8Z24 = 17,
+ Z32F = 18,
+ Z16 = 19,
MaxDepthStencilFormat,
@@ -97,6 +98,7 @@ struct SurfaceParams {
4, // BC7U
4, // ASTC_2D_4X4
1, // G8R8
+ 1, // BGRA8
1, // Z24S8
1, // S8Z24
1, // Z32F
@@ -127,6 +129,7 @@ struct SurfaceParams {
128, // BC7U
32, // ASTC_2D_4X4
16, // G8R8
+ 32, // BGRA8
32, // Z24S8
32, // S8Z24
32, // Z32F
@@ -162,6 +165,8 @@ struct SurfaceParams {
case Tegra::RenderTargetFormat::RGBA8_UNORM:
case Tegra::RenderTargetFormat::RGBA8_SRGB:
return PixelFormat::ABGR8;
+ case Tegra::RenderTargetFormat::BGRA8_UNORM:
+ return PixelFormat::BGRA8;
case Tegra::RenderTargetFormat::RGB10_A2_UNORM:
return PixelFormat::A2B10G10R10;
case Tegra::RenderTargetFormat::RGBA16_FLOAT:
@@ -248,6 +253,10 @@ struct SurfaceParams {
return Tegra::Texture::TextureFormat::BC7U;
case PixelFormat::ASTC_2D_4X4:
return Tegra::Texture::TextureFormat::ASTC_2D_4X4;
+ case PixelFormat::BGRA8:
+ // TODO(bunnei): This is fine for unswizzling (since we just need the right component
+ // sizes), but could be a bug if we used this function in different ways.
+ return Tegra::Texture::TextureFormat::A8R8G8B8;
default:
LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
UNREACHABLE();
@@ -286,6 +295,7 @@ struct SurfaceParams {
switch (format) {
case Tegra::RenderTargetFormat::RGBA8_UNORM:
case Tegra::RenderTargetFormat::RGBA8_SRGB:
+ case Tegra::RenderTargetFormat::BGRA8_UNORM:
case Tegra::RenderTargetFormat::RGB10_A2_UNORM:
return ComponentType::UNorm;
case Tegra::RenderTargetFormat::RGBA16_FLOAT: