diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/gpu.cpp | 12 | ||||
| -rw-r--r-- | src/video_core/gpu.h | 5 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.cpp | 17 |
3 files changed, 11 insertions, 23 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 1622332a4..3006d8059 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -17,18 +17,6 @@ | |||
| 17 | 17 | ||
| 18 | namespace Tegra { | 18 | namespace Tegra { |
| 19 | 19 | ||
| 20 | u32 FramebufferConfig::BytesPerPixel(PixelFormat format) { | ||
| 21 | switch (format) { | ||
| 22 | case PixelFormat::ABGR8: | ||
| 23 | case PixelFormat::BGRA8: | ||
| 24 | return 4; | ||
| 25 | default: | ||
| 26 | return 4; | ||
| 27 | } | ||
| 28 | |||
| 29 | UNREACHABLE(); | ||
| 30 | } | ||
| 31 | |||
| 32 | GPU::GPU(Core::System& system, VideoCore::RendererBase& renderer, bool is_async) | 20 | GPU::GPU(Core::System& system, VideoCore::RendererBase& renderer, bool is_async) |
| 33 | : system{system}, renderer{renderer}, is_async{is_async} { | 21 | : system{system}, renderer{renderer}, is_async{is_async} { |
| 34 | auto& rasterizer{renderer.Rasterizer()}; | 22 | auto& rasterizer{renderer.Rasterizer()}; |
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index 168a88692..dea9dfef0 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h | |||
| @@ -94,11 +94,6 @@ struct FramebufferConfig { | |||
| 94 | BGRA8 = 5, | 94 | BGRA8 = 5, |
| 95 | }; | 95 | }; |
| 96 | 96 | ||
| 97 | /** | ||
| 98 | * Returns the number of bytes per pixel. | ||
| 99 | */ | ||
| 100 | static u32 BytesPerPixel(PixelFormat format); | ||
| 101 | |||
| 102 | VAddr address; | 97 | VAddr address; |
| 103 | u32 offset; | 98 | u32 offset; |
| 104 | u32 width; | 99 | u32 width; |
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index aa923d1d0..f26adc388 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp | |||
| @@ -147,7 +147,9 @@ void RendererOpenGL::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) { | |||
| 147 | * Loads framebuffer from emulated memory into the active OpenGL texture. | 147 | * Loads framebuffer from emulated memory into the active OpenGL texture. |
| 148 | */ | 148 | */ |
| 149 | void RendererOpenGL::LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuffer) { | 149 | void RendererOpenGL::LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuffer) { |
| 150 | const u32 bytes_per_pixel{Tegra::FramebufferConfig::BytesPerPixel(framebuffer.pixel_format)}; | 150 | const auto pixel_format{ |
| 151 | VideoCore::Surface::PixelFormatFromGPUPixelFormat(framebuffer.pixel_format)}; | ||
| 152 | const u32 bytes_per_pixel{VideoCore::Surface::GetBytesPerPixel(pixel_format)}; | ||
| 151 | const u64 size_in_bytes{framebuffer.stride * framebuffer.height * bytes_per_pixel}; | 153 | const u64 size_in_bytes{framebuffer.stride * framebuffer.height * bytes_per_pixel}; |
| 152 | const VAddr framebuffer_addr{framebuffer.address + framebuffer.offset}; | 154 | const VAddr framebuffer_addr{framebuffer.address + framebuffer.offset}; |
| 153 | 155 | ||
| @@ -274,22 +276,25 @@ void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture, | |||
| 274 | texture.height = framebuffer.height; | 276 | texture.height = framebuffer.height; |
| 275 | texture.pixel_format = framebuffer.pixel_format; | 277 | texture.pixel_format = framebuffer.pixel_format; |
| 276 | 278 | ||
| 279 | const auto pixel_format{ | ||
| 280 | VideoCore::Surface::PixelFormatFromGPUPixelFormat(framebuffer.pixel_format)}; | ||
| 281 | const u32 bytes_per_pixel{VideoCore::Surface::GetBytesPerPixel(pixel_format)}; | ||
| 282 | gl_framebuffer_data.resize(texture.width * texture.height * bytes_per_pixel); | ||
| 283 | |||
| 277 | GLint internal_format; | 284 | GLint internal_format; |
| 278 | switch (framebuffer.pixel_format) { | 285 | switch (framebuffer.pixel_format) { |
| 279 | case Tegra::FramebufferConfig::PixelFormat::ABGR8: | 286 | case Tegra::FramebufferConfig::PixelFormat::ABGR8: |
| 280 | internal_format = GL_RGBA8; | 287 | internal_format = GL_RGBA8; |
| 281 | texture.gl_format = GL_RGBA; | 288 | texture.gl_format = GL_RGBA; |
| 282 | texture.gl_type = GL_UNSIGNED_INT_8_8_8_8_REV; | 289 | texture.gl_type = GL_UNSIGNED_INT_8_8_8_8_REV; |
| 283 | gl_framebuffer_data.resize(texture.width * texture.height * 4); | 290 | |
| 284 | break; | 291 | break; |
| 285 | default: | 292 | default: |
| 286 | internal_format = GL_RGBA8; | 293 | internal_format = GL_RGBA8; |
| 287 | texture.gl_format = GL_RGBA; | 294 | texture.gl_format = GL_RGBA; |
| 288 | texture.gl_type = GL_UNSIGNED_INT_8_8_8_8_REV; | 295 | texture.gl_type = GL_UNSIGNED_INT_8_8_8_8_REV; |
| 289 | gl_framebuffer_data.resize(texture.width * texture.height * 4); | 296 | UNIMPLEMENTED_MSG("Unknown framebuffer pixel format: {}", |
| 290 | LOG_CRITICAL(Render_OpenGL, "Unknown framebuffer pixel format: {}", | 297 | static_cast<u32>(framebuffer.pixel_format)); |
| 291 | static_cast<u32>(framebuffer.pixel_format)); | ||
| 292 | UNREACHABLE(); | ||
| 293 | } | 298 | } |
| 294 | 299 | ||
| 295 | texture.resource.Release(); | 300 | texture.resource.Release(); |