summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2024-01-28 01:10:22 +0100
committerLiam <byteslice@airmail.cc>2024-02-09 15:20:53 +0100
commit78aac6b403de732e33a83c1b78eaa5384fd2ae61 (patch)
tree5c48687e626ff1a5dd1b993aa57d26c752812725 /src/video_core/renderer_opengl
parentnvnflinger/gpu: implement applet capture (diff)
downloadyuzu-78aac6b403de732e33a83c1b78eaa5384fd2ae61.tar
yuzu-78aac6b403de732e33a83c1b78eaa5384fd2ae61.tar.gz
yuzu-78aac6b403de732e33a83c1b78eaa5384fd2ae61.tar.bz2
yuzu-78aac6b403de732e33a83c1b78eaa5384fd2ae61.tar.lz
yuzu-78aac6b403de732e33a83c1b78eaa5384fd2ae61.tar.xz
yuzu-78aac6b403de732e33a83c1b78eaa5384fd2ae61.tar.zst
yuzu-78aac6b403de732e33a83c1b78eaa5384fd2ae61.zip
Diffstat (limited to 'src/video_core/renderer_opengl')
-rw-r--r--src/video_core/renderer_opengl/gl_blit_screen.cpp11
-rw-r--r--src/video_core/renderer_opengl/gl_blit_screen.h5
-rw-r--r--src/video_core/renderer_opengl/present/layer.cpp10
-rw-r--r--src/video_core/renderer_opengl/present/layer.h6
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp8
5 files changed, 26 insertions, 14 deletions
diff --git a/src/video_core/renderer_opengl/gl_blit_screen.cpp b/src/video_core/renderer_opengl/gl_blit_screen.cpp
index 0282905ee..9260a4dc4 100644
--- a/src/video_core/renderer_opengl/gl_blit_screen.cpp
+++ b/src/video_core/renderer_opengl/gl_blit_screen.cpp
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "common/settings.h"
+#include "video_core/present.h"
#include "video_core/renderer_opengl/gl_blit_screen.h"
#include "video_core/renderer_opengl/gl_state_tracker.h"
#include "video_core/renderer_opengl/present/filters.h"
@@ -13,9 +14,9 @@ namespace OpenGL {
BlitScreen::BlitScreen(RasterizerOpenGL& rasterizer_,
Tegra::MaxwellDeviceMemoryManager& device_memory_,
StateTracker& state_tracker_, ProgramManager& program_manager_,
- Device& device_)
+ Device& device_, const PresentFilters& filters_)
: rasterizer(rasterizer_), device_memory(device_memory_), state_tracker(state_tracker_),
- program_manager(program_manager_), device(device_) {}
+ program_manager(program_manager_), device(device_), filters(filters_) {}
BlitScreen::~BlitScreen() = default;
@@ -56,7 +57,7 @@ void BlitScreen::DrawScreen(std::span<const Tegra::FramebufferConfig> framebuffe
glDepthRangeIndexed(0, 0.0, 0.0);
while (layers.size() < framebuffers.size()) {
- layers.emplace_back(rasterizer, device_memory);
+ layers.emplace_back(rasterizer, device_memory, filters);
}
CreateWindowAdapt();
@@ -67,11 +68,11 @@ void BlitScreen::DrawScreen(std::span<const Tegra::FramebufferConfig> framebuffe
}
void BlitScreen::CreateWindowAdapt() {
- if (window_adapt && Settings::values.scaling_filter.GetValue() == current_window_adapt) {
+ if (window_adapt && filters.get_scaling_filter() == current_window_adapt) {
return;
}
- current_window_adapt = Settings::values.scaling_filter.GetValue();
+ current_window_adapt = filters.get_scaling_filter();
switch (current_window_adapt) {
case Settings::ScalingFilter::NearestNeighbor:
window_adapt = MakeNearestNeighbor(device);
diff --git a/src/video_core/renderer_opengl/gl_blit_screen.h b/src/video_core/renderer_opengl/gl_blit_screen.h
index 4e261d333..df2da9424 100644
--- a/src/video_core/renderer_opengl/gl_blit_screen.h
+++ b/src/video_core/renderer_opengl/gl_blit_screen.h
@@ -15,6 +15,8 @@ namespace Layout {
struct FramebufferLayout;
}
+struct PresentFilters;
+
namespace Tegra {
struct FramebufferConfig;
}
@@ -46,7 +48,7 @@ public:
explicit BlitScreen(RasterizerOpenGL& rasterizer,
Tegra::MaxwellDeviceMemoryManager& device_memory,
StateTracker& state_tracker, ProgramManager& program_manager,
- Device& device);
+ Device& device, const PresentFilters& filters);
~BlitScreen();
/// Draws the emulated screens to the emulator window.
@@ -61,6 +63,7 @@ private:
StateTracker& state_tracker;
ProgramManager& program_manager;
Device& device;
+ const PresentFilters& filters;
Settings::ScalingFilter current_window_adapt{};
std::unique_ptr<WindowAdaptPass> window_adapt;
diff --git a/src/video_core/renderer_opengl/present/layer.cpp b/src/video_core/renderer_opengl/present/layer.cpp
index 3e4377db4..6c7092d22 100644
--- a/src/video_core/renderer_opengl/present/layer.cpp
+++ b/src/video_core/renderer_opengl/present/layer.cpp
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "video_core/framebuffer_config.h"
+#include "video_core/present.h"
#include "video_core/renderer_opengl/gl_blit_screen.h"
#include "video_core/renderer_opengl/gl_rasterizer.h"
#include "video_core/renderer_opengl/present/fsr.h"
@@ -14,8 +15,9 @@
namespace OpenGL {
-Layer::Layer(RasterizerOpenGL& rasterizer_, Tegra::MaxwellDeviceMemoryManager& device_memory_)
- : rasterizer(rasterizer_), device_memory(device_memory_) {
+Layer::Layer(RasterizerOpenGL& rasterizer_, Tegra::MaxwellDeviceMemoryManager& device_memory_,
+ const PresentFilters& filters_)
+ : rasterizer(rasterizer_), device_memory(device_memory_), filters(filters_) {
// Allocate textures for the screen
framebuffer_texture.resource.Create(GL_TEXTURE_2D);
@@ -39,7 +41,7 @@ GLuint Layer::ConfigureDraw(std::array<GLfloat, 3 * 2>& out_matrix,
auto crop = Tegra::NormalizeCrop(framebuffer, info.width, info.height);
GLuint texture = info.display_texture;
- auto anti_aliasing = Settings::values.anti_aliasing.GetValue();
+ auto anti_aliasing = filters.get_anti_aliasing();
if (anti_aliasing != Settings::AntiAliasing::None) {
glEnablei(GL_SCISSOR_TEST, 0);
auto viewport_width = Settings::values.resolution_info.ScaleUp(framebuffer_texture.width);
@@ -64,7 +66,7 @@ GLuint Layer::ConfigureDraw(std::array<GLfloat, 3 * 2>& out_matrix,
glDisablei(GL_SCISSOR_TEST, 0);
- if (Settings::values.scaling_filter.GetValue() == Settings::ScalingFilter::Fsr) {
+ if (filters.get_scaling_filter() == Settings::ScalingFilter::Fsr) {
if (!fsr || fsr->NeedsRecreation(layout.screen)) {
fsr = std::make_unique<FSR>(layout.screen.GetWidth(), layout.screen.GetHeight());
}
diff --git a/src/video_core/renderer_opengl/present/layer.h b/src/video_core/renderer_opengl/present/layer.h
index 77bb97f4f..5b15b730f 100644
--- a/src/video_core/renderer_opengl/present/layer.h
+++ b/src/video_core/renderer_opengl/present/layer.h
@@ -13,6 +13,8 @@ namespace Layout {
struct FramebufferLayout;
}
+struct PresentFilters;
+
namespace Service::android {
enum class PixelFormat : u32;
};
@@ -44,7 +46,8 @@ struct ScreenRectVertex;
class Layer {
public:
- explicit Layer(RasterizerOpenGL& rasterizer, Tegra::MaxwellDeviceMemoryManager& device_memory);
+ explicit Layer(RasterizerOpenGL& rasterizer, Tegra::MaxwellDeviceMemoryManager& device_memory,
+ const PresentFilters& filters);
~Layer();
GLuint ConfigureDraw(std::array<GLfloat, 3 * 2>& out_matrix,
@@ -65,6 +68,7 @@ private:
private:
RasterizerOpenGL& rasterizer;
Tegra::MaxwellDeviceMemoryManager& device_memory;
+ const PresentFilters& filters;
/// OpenGL framebuffer data
std::vector<u8> gl_framebuffer_data;
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index a1a8491e5..5fb54635d 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -17,6 +17,7 @@
#include "core/frontend/emu_window.h"
#include "core/telemetry_session.h"
#include "video_core/capture.h"
+#include "video_core/present.h"
#include "video_core/renderer_opengl/gl_blit_screen.h"
#include "video_core/renderer_opengl/gl_rasterizer.h"
#include "video_core/renderer_opengl/gl_shader_manager.h"
@@ -121,9 +122,10 @@ RendererOpenGL::RendererOpenGL(Core::TelemetrySession& telemetry_session_,
glEnableClientState(GL_ELEMENT_ARRAY_UNIFIED_NV);
}
blit_screen = std::make_unique<BlitScreen>(rasterizer, device_memory, state_tracker,
- program_manager, device);
- blit_applet = std::make_unique<BlitScreen>(rasterizer, device_memory, state_tracker,
- program_manager, device);
+ program_manager, device, PresentFiltersForDisplay);
+ blit_applet =
+ std::make_unique<BlitScreen>(rasterizer, device_memory, state_tracker, program_manager,
+ device, PresentFiltersForAppletCapture);
capture_framebuffer.Create();
capture_renderbuffer.Create();
glBindRenderbuffer(GL_RENDERBUFFER, capture_renderbuffer.handle);