summaryrefslogtreecommitdiff
path: root/src/video_core
diff options
context:
space:
mode:
authorGravatar bunnei2018-03-23 14:58:27 -0400
committerGravatar bunnei2018-03-23 14:58:27 -0400
commitec4e1a3685d458147ac76f4cf53ea86632d0debd (patch)
tree0bdc8e13b56ae88459055360f02b13e943dd6199 /src/video_core
parentrenderer_opengl: Use accelerated framebuffer load with LoadFBToScreenInfo. (diff)
downloadyuzu-ec4e1a3685d458147ac76f4cf53ea86632d0debd.tar.gz
yuzu-ec4e1a3685d458147ac76f4cf53ea86632d0debd.tar.xz
yuzu-ec4e1a3685d458147ac76f4cf53ea86632d0debd.zip
renderer_opengl: Better handling of framebuffer transform flags.
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/gpu.h5
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp18
2 files changed, 20 insertions, 3 deletions
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h
index f3c5e366a..206b3e05e 100644
--- a/src/video_core/gpu.h
+++ b/src/video_core/gpu.h
@@ -8,6 +8,7 @@
8#include <unordered_map> 8#include <unordered_map>
9#include <vector> 9#include <vector>
10#include "common/common_types.h" 10#include "common/common_types.h"
11#include "core/hle/service/nvflinger/buffer_queue.h"
11#include "video_core/memory_manager.h" 12#include "video_core/memory_manager.h"
12 13
13namespace Tegra { 14namespace Tegra {
@@ -38,7 +39,9 @@ struct FramebufferConfig {
38 u32 height; 39 u32 height;
39 u32 stride; 40 u32 stride;
40 PixelFormat pixel_format; 41 PixelFormat pixel_format;
41 bool flip_vertical; 42
43 using TransformFlags = Service::NVFlinger::BufferQueue::BufferTransformFlags;
44 TransformFlags transform_flags;
42}; 45};
43 46
44namespace Engines { 47namespace Engines {
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index 047389fee..ef63cbcf0 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -141,6 +141,9 @@ void RendererOpenGL::LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuf
141 const u32 size_in_bytes{framebuffer.stride * framebuffer.height * bpp}; 141 const u32 size_in_bytes{framebuffer.stride * framebuffer.height * bpp};
142 const VAddr framebuffer_addr{framebuffer.address}; 142 const VAddr framebuffer_addr{framebuffer.address};
143 143
144 // Framebuffer orientation handling
145 framebuffer_transform_flags = framebuffer.transform_flags;
146
144 // Ensure no bad interactions with GL_UNPACK_ALIGNMENT, which by default 147 // Ensure no bad interactions with GL_UNPACK_ALIGNMENT, which by default
145 // only allows rows to have a memory alignement of 4. 148 // only allows rows to have a memory alignement of 4.
146 ASSERT(framebuffer.stride % 4 == 0); 149 ASSERT(framebuffer.stride % 4 == 0);
@@ -292,8 +295,19 @@ void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture,
292void RendererOpenGL::DrawSingleScreen(const ScreenInfo& screen_info, float x, float y, float w, 295void RendererOpenGL::DrawSingleScreen(const ScreenInfo& screen_info, float x, float y, float w,
293 float h) { 296 float h) {
294 const auto& texcoords = screen_info.display_texcoords; 297 const auto& texcoords = screen_info.display_texcoords;
295 const auto& left = framebuffer_flip_vertical ? texcoords.right : texcoords.left; 298 auto left = texcoords.left;
296 const auto& right = framebuffer_flip_vertical ? texcoords.left : texcoords.right; 299 auto right = texcoords.right;
300 if (framebuffer_transform_flags != Tegra::FramebufferConfig::TransformFlags::Unset)
301 if (framebuffer_transform_flags == Tegra::FramebufferConfig::TransformFlags::FlipV) {
302 // Flip the framebuffer vertically
303 left = texcoords.right;
304 right = texcoords.left;
305 } else {
306 // Other transformations are unsupported
307 LOG_CRITICAL(HW_GPU, "unsupported framebuffer_transform_flags=%d",
308 framebuffer_transform_flags);
309 UNIMPLEMENTED();
310 }
297 311
298 std::array<ScreenRectVertex, 4> vertices = {{ 312 std::array<ScreenRectVertex, 4> vertices = {{
299 ScreenRectVertex(x, y, texcoords.top, right), 313 ScreenRectVertex(x, y, texcoords.top, right),