summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2018-07-23 16:56:52 -0400
committerGravatar bunnei2018-07-23 21:22:44 -0400
commitbcc184acfa81aee7ad33d9c82f5f4496731a1d1f (patch)
treed6025ff57f156e93aad6446df0d794ed9d0058ca /src
parentgl_rasterizer_cache: Add missing log statements. (diff)
downloadyuzu-bcc184acfa81aee7ad33d9c82f5f4496731a1d1f.tar.gz
yuzu-bcc184acfa81aee7ad33d9c82f5f4496731a1d1f.tar.xz
yuzu-bcc184acfa81aee7ad33d9c82f5f4496731a1d1f.zip
gl_rasterizer_cache: Implement RenderTargetFormat BGRA8_UNORM.
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) {
38 return 8; 38 return 8;
39 case RenderTargetFormat::RGBA8_UNORM: 39 case RenderTargetFormat::RGBA8_UNORM:
40 case RenderTargetFormat::RGB10_A2_UNORM: 40 case RenderTargetFormat::RGB10_A2_UNORM:
41 case RenderTargetFormat::BGRA8_UNORM:
41 return 4; 42 return 4;
42 default: 43 default:
43 UNIMPLEMENTED_MSG("Unimplemented render target format {}", static_cast<u32>(format)); 44 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 {
18 RGBA32_FLOAT = 0xC0, 18 RGBA32_FLOAT = 0xC0,
19 RGBA32_UINT = 0xC2, 19 RGBA32_UINT = 0xC2,
20 RGBA16_FLOAT = 0xCA, 20 RGBA16_FLOAT = 0xCA,
21 BGRA8_UNORM = 0xCF,
21 RGB10_A2_UNORM = 0xD1, 22 RGB10_A2_UNORM = 0xD1,
22 RGBA8_UNORM = 0xD5, 23 RGBA8_UNORM = 0xD5,
23 RGBA8_SRGB = 0xD6, 24 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
106 true}, // BC7U 106 true}, // BC7U
107 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4 107 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4
108 {GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // G8R8 108 {GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // G8R8
109 {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // BGRA8
109 110
110 // DepthStencil formats 111 // DepthStencil formats
111 {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, 112 {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),
197 MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT23>, 198 MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT23>,
198 MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>, 199 MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>,
199 MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>, 200 MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>,
200 MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::Z24S8>, 201 MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>,
201 MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>, 202 MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>,
202 MortonCopy<true, PixelFormat::Z16>, 203 MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>,
203}; 204};
204 205
205static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), 206static 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),
213 MortonCopy<false, PixelFormat::RGBA16F>, 214 MortonCopy<false, PixelFormat::RGBA16F>,
214 MortonCopy<false, PixelFormat::R11FG11FB10F>, 215 MortonCopy<false, PixelFormat::R11FG11FB10F>,
215 MortonCopy<false, PixelFormat::RGBA32UI>, 216 MortonCopy<false, PixelFormat::RGBA32UI>,
216 // TODO(Subv): Swizzling the DXT1/DXT23/DXT45/DXN1/BC7U formats is not yet supported 217 // TODO(Subv): Swizzling DXT1/DXT23/DXT45/DXN1/BC7U/ASTC_2D_4X4 formats is not supported
217 nullptr, 218 nullptr,
218 nullptr, 219 nullptr,
219 nullptr, 220 nullptr,
@@ -221,6 +222,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
221 nullptr, 222 nullptr,
222 nullptr, 223 nullptr,
223 MortonCopy<false, PixelFormat::G8R8>, 224 MortonCopy<false, PixelFormat::G8R8>,
225 MortonCopy<false, PixelFormat::BGRA8>,
224 MortonCopy<false, PixelFormat::Z24S8>, 226 MortonCopy<false, PixelFormat::Z24S8>,
225 MortonCopy<false, PixelFormat::S8Z24>, 227 MortonCopy<false, PixelFormat::S8Z24>,
226 MortonCopy<false, PixelFormat::Z32F>, 228 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 {
37 BC7U = 12, 37 BC7U = 12,
38 ASTC_2D_4X4 = 13, 38 ASTC_2D_4X4 = 13,
39 G8R8 = 14, 39 G8R8 = 14,
40 BGRA8 = 15,
40 41
41 MaxColorFormat, 42 MaxColorFormat,
42 43
43 // DepthStencil formats 44 // DepthStencil formats
44 Z24S8 = 15, 45 Z24S8 = 16,
45 S8Z24 = 16, 46 S8Z24 = 17,
46 Z32F = 17, 47 Z32F = 18,
47 Z16 = 18, 48 Z16 = 19,
48 49
49 MaxDepthStencilFormat, 50 MaxDepthStencilFormat,
50 51
@@ -97,6 +98,7 @@ struct SurfaceParams {
97 4, // BC7U 98 4, // BC7U
98 4, // ASTC_2D_4X4 99 4, // ASTC_2D_4X4
99 1, // G8R8 100 1, // G8R8
101 1, // BGRA8
100 1, // Z24S8 102 1, // Z24S8
101 1, // S8Z24 103 1, // S8Z24
102 1, // Z32F 104 1, // Z32F
@@ -127,6 +129,7 @@ struct SurfaceParams {
127 128, // BC7U 129 128, // BC7U
128 32, // ASTC_2D_4X4 130 32, // ASTC_2D_4X4
129 16, // G8R8 131 16, // G8R8
132 32, // BGRA8
130 32, // Z24S8 133 32, // Z24S8
131 32, // S8Z24 134 32, // S8Z24
132 32, // Z32F 135 32, // Z32F
@@ -162,6 +165,8 @@ struct SurfaceParams {
162 case Tegra::RenderTargetFormat::RGBA8_UNORM: 165 case Tegra::RenderTargetFormat::RGBA8_UNORM:
163 case Tegra::RenderTargetFormat::RGBA8_SRGB: 166 case Tegra::RenderTargetFormat::RGBA8_SRGB:
164 return PixelFormat::ABGR8; 167 return PixelFormat::ABGR8;
168 case Tegra::RenderTargetFormat::BGRA8_UNORM:
169 return PixelFormat::BGRA8;
165 case Tegra::RenderTargetFormat::RGB10_A2_UNORM: 170 case Tegra::RenderTargetFormat::RGB10_A2_UNORM:
166 return PixelFormat::A2B10G10R10; 171 return PixelFormat::A2B10G10R10;
167 case Tegra::RenderTargetFormat::RGBA16_FLOAT: 172 case Tegra::RenderTargetFormat::RGBA16_FLOAT:
@@ -248,6 +253,10 @@ struct SurfaceParams {
248 return Tegra::Texture::TextureFormat::BC7U; 253 return Tegra::Texture::TextureFormat::BC7U;
249 case PixelFormat::ASTC_2D_4X4: 254 case PixelFormat::ASTC_2D_4X4:
250 return Tegra::Texture::TextureFormat::ASTC_2D_4X4; 255 return Tegra::Texture::TextureFormat::ASTC_2D_4X4;
256 case PixelFormat::BGRA8:
257 // TODO(bunnei): This is fine for unswizzling (since we just need the right component
258 // sizes), but could be a bug if we used this function in different ways.
259 return Tegra::Texture::TextureFormat::A8R8G8B8;
251 default: 260 default:
252 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); 261 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
253 UNREACHABLE(); 262 UNREACHABLE();
@@ -286,6 +295,7 @@ struct SurfaceParams {
286 switch (format) { 295 switch (format) {
287 case Tegra::RenderTargetFormat::RGBA8_UNORM: 296 case Tegra::RenderTargetFormat::RGBA8_UNORM:
288 case Tegra::RenderTargetFormat::RGBA8_SRGB: 297 case Tegra::RenderTargetFormat::RGBA8_SRGB:
298 case Tegra::RenderTargetFormat::BGRA8_UNORM:
289 case Tegra::RenderTargetFormat::RGB10_A2_UNORM: 299 case Tegra::RenderTargetFormat::RGB10_A2_UNORM:
290 return ComponentType::UNorm; 300 return ComponentType::UNorm;
291 case Tegra::RenderTargetFormat::RGBA16_FLOAT: 301 case Tegra::RenderTargetFormat::RGBA16_FLOAT: