summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-03-23 04:06:54 +0100
committerbunnei <bunneidev@gmail.com>2018-03-23 04:06:54 +0100
commita0b1235f82b2632651cb817f8216cc9af37759a2 (patch)
tree5e04ad7b280f355a77a5c4dc813fad663e4f97a4 /src
parentLoadGLBuffer: Use bytes_per_pixel, not bits. (diff)
downloadyuzu-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')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp34
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h12
2 files changed, 44 insertions, 2 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;
}
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index 2172a9d24..14f3cdc38 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -22,6 +22,7 @@
#include "common/common_funcs.h"
#include "common/common_types.h"
#include "common/math_util.h"
+#include "video_core/gpu.h"
#include "video_core/renderer_opengl/gl_resource_manager.h"
struct CachedSurface;
@@ -115,6 +116,15 @@ struct SurfaceParams {
return GetFormatBpp(pixel_format);
}
+ static PixelFormat PixelFormatFromGPUPixelFormat(Tegra::FramebufferConfig::PixelFormat format) {
+ switch (format) {
+ case Tegra::FramebufferConfig::PixelFormat::ABGR8:
+ return PixelFormat::RGBA8;
+ default:
+ UNREACHABLE();
+ }
+ }
+
static bool CheckFormatsBlittable(PixelFormat pixel_format_a, PixelFormat pixel_format_b) {
SurfaceType a_type = GetFormatType(pixel_format_a);
SurfaceType b_type = GetFormatType(pixel_format_b);
@@ -257,7 +267,7 @@ struct CachedSurface : SurfaceParams {
std::unique_ptr<u8[]> gl_buffer;
size_t gl_buffer_size = 0;
- // Read/Write data in 3DS memory to/from gl_buffer
+ // Read/Write data in Switch memory to/from gl_buffer
void LoadGLBuffer(VAddr load_start, VAddr load_end);
void FlushGLBuffer(VAddr flush_start, VAddr flush_end);