diff options
author | bunnei <bunneidev@gmail.com> | 2018-03-23 04:06:54 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2018-03-23 04:06:54 +0100 |
commit | a0b1235f82b2632651cb817f8216cc9af37759a2 (patch) | |
tree | 5e04ad7b280f355a77a5c4dc813fad663e4f97a4 /src/video_core/renderer_opengl/gl_rasterizer.cpp | |
parent | LoadGLBuffer: Use bytes_per_pixel, not bits. (diff) | |
download | yuzu-a0b1235f82b2632651cb817f8216cc9af37759a2.tar yuzu-a0b1235f82b2632651cb817f8216cc9af37759a2.tar.gz yuzu-a0b1235f82b2632651cb817f8216cc9af37759a2.tar.bz2 yuzu-a0b1235f82b2632651cb817f8216cc9af37759a2.tar.lz yuzu-a0b1235f82b2632651cb817f8216cc9af37759a2.tar.xz yuzu-a0b1235f82b2632651cb817f8216cc9af37759a2.tar.zst yuzu-a0b1235f82b2632651cb817f8216cc9af37759a2.zip |
Diffstat (limited to 'src/video_core/renderer_opengl/gl_rasterizer.cpp')
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 20e192ec9..b51614c25 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -229,7 +229,39 @@ bool RasterizerOpenGL::AccelerateFill(const void* config) { bool RasterizerOpenGL::AccelerateDisplay(const Tegra::FramebufferConfig& framebuffer, VAddr framebuffer_addr, u32 pixel_stride, ScreenInfo& screen_info) { - ASSERT_MSG(false, "Unimplemented"); + if (framebuffer_addr == 0) { + return false; + } + MICROPROFILE_SCOPE(OpenGL_CacheManagement); + + SurfaceParams src_params; + src_params.addr = framebuffer_addr; + src_params.width = std::min(framebuffer.width, pixel_stride); + src_params.height = framebuffer.height; + src_params.stride = pixel_stride; + src_params.is_tiled = false; + src_params.pixel_format = + SurfaceParams::PixelFormatFromGPUPixelFormat(framebuffer.pixel_format); + src_params.UpdateParams(); + + MathUtil::Rectangle<u32> src_rect; + Surface src_surface; + std::tie(src_surface, src_rect) = + res_cache.GetSurfaceSubRect(src_params, ScaleMatch::Ignore, true); + + if (src_surface == nullptr) { + return false; + } + + u32 scaled_width = src_surface->GetScaledWidth(); + u32 scaled_height = src_surface->GetScaledHeight(); + + screen_info.display_texcoords = MathUtil::Rectangle<float>( + (float)src_rect.bottom / (float)scaled_height, (float)src_rect.left / (float)scaled_width, + (float)src_rect.top / (float)scaled_height, (float)src_rect.right / (float)scaled_width); + + screen_info.display_texture = src_surface->texture.handle; + return true; } |