diff options
author | Liam <byteslice@airmail.cc> | 2024-01-19 02:47:50 +0100 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2024-01-31 17:27:21 +0100 |
commit | 10cf0585180bcf2eab38ebf65dc593fecc4ddf92 (patch) | |
tree | c0c7680fd2a17b32b0baab91b31f3c25c597ccfd /src/video_core/renderer_opengl/present/layer.h | |
parent | renderer_vulkan: implement layer stack composition (diff) | |
download | yuzu-10cf0585180bcf2eab38ebf65dc593fecc4ddf92.tar yuzu-10cf0585180bcf2eab38ebf65dc593fecc4ddf92.tar.gz yuzu-10cf0585180bcf2eab38ebf65dc593fecc4ddf92.tar.bz2 yuzu-10cf0585180bcf2eab38ebf65dc593fecc4ddf92.tar.lz yuzu-10cf0585180bcf2eab38ebf65dc593fecc4ddf92.tar.xz yuzu-10cf0585180bcf2eab38ebf65dc593fecc4ddf92.tar.zst yuzu-10cf0585180bcf2eab38ebf65dc593fecc4ddf92.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_opengl/present/layer.h | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/src/video_core/renderer_opengl/present/layer.h b/src/video_core/renderer_opengl/present/layer.h new file mode 100644 index 000000000..ef1055abf --- /dev/null +++ b/src/video_core/renderer_opengl/present/layer.h @@ -0,0 +1,80 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include <memory> +#include <vector> + +#include "video_core/host1x/gpu_device_memory_manager.h" +#include "video_core/renderer_opengl/gl_resource_manager.h" + +namespace Layout { +struct FramebufferLayout; +} + +namespace Service::android { +enum class PixelFormat : u32; +}; + +namespace Tegra { +struct FramebufferConfig; +} + +namespace OpenGL { + +struct FramebufferTextureInfo; +class FSR; +class FXAA; +class ProgramManager; +class RasterizerOpenGL; +class SMAA; + +/// Structure used for storing information about the textures for the Switch screen +struct TextureInfo { + OGLTexture resource; + GLsizei width; + GLsizei height; + GLenum gl_format; + GLenum gl_type; + Service::android::PixelFormat pixel_format; +}; + +struct ScreenRectVertex; + +class Layer { +public: + explicit Layer(RasterizerOpenGL& rasterizer, Tegra::MaxwellDeviceMemoryManager& device_memory); + ~Layer(); + + GLuint ConfigureDraw(std::array<GLfloat, 3 * 2>& out_matrix, + std::array<ScreenRectVertex, 4>& out_vertices, + ProgramManager& program_manager, + const Tegra::FramebufferConfig& framebuffer, + const Layout::FramebufferLayout& layout); + +private: + /// Loads framebuffer from emulated memory into the active OpenGL texture. + FramebufferTextureInfo LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuffer); + FramebufferTextureInfo PrepareRenderTarget(const Tegra::FramebufferConfig& framebuffer); + void ConfigureFramebufferTexture(const Tegra::FramebufferConfig& framebuffer); + + void CreateFXAA(); + void CreateSMAA(); + +private: + RasterizerOpenGL& rasterizer; + Tegra::MaxwellDeviceMemoryManager& device_memory; + + /// OpenGL framebuffer data + std::vector<u8> gl_framebuffer_data; + + /// Display information for Switch screen + TextureInfo framebuffer_texture; + + std::unique_ptr<FSR> fsr; + std::unique_ptr<FXAA> fxaa; + std::unique_ptr<SMAA> smaa; +}; + +} // namespace OpenGL |