diff options
| author | lizzie <lizzie@eden-emu.dev> | 2025-12-31 17:00:29 +0100 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2025-12-31 17:00:29 +0100 |
| commit | 46b32b76886b5cd0cfc8dfee1a02c3e83fb1e7d7 (patch) | |
| tree | 281a110374e3cdaf60fec43cc043fb3cccc016a1 /src/video_core/renderer_opengl/present/layer.cpp | |
| parent | 55646657e17a99a9ddd3da4b552f3d9ac233037b (diff) | |
[vk, ogl/IR, dynarmic/IR] friendlier IR identity pointer chasing, inline AA passes (#2565)
- use std::optional instead of std::unique_ptr for the Antialias (FXAA, etc) passes to avoid the extra deref
- use a pattern for deferencing the IR pointer chasing loop as suggested on the intel optimization manual
- this also removes std::vector<> overhead by using boost::container::small_vector<> (not a silver bullet but in the case of this function reduces access times)
Signed-off-by: lizzie <lizzie@eden-emu.dev>
Co-authored-by: Caio Oliveira <caiooliveirafarias0@gmail.com>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2565
Reviewed-by: Maufeat <sahyno1996@gmail.com>
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
Diffstat (limited to 'src/video_core/renderer_opengl/present/layer.cpp')
| -rw-r--r-- | src/video_core/renderer_opengl/present/layer.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/video_core/renderer_opengl/present/layer.cpp b/src/video_core/renderer_opengl/present/layer.cpp index 6c7092d229..f18600e692 100644 --- a/src/video_core/renderer_opengl/present/layer.cpp +++ b/src/video_core/renderer_opengl/present/layer.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -54,12 +57,12 @@ GLuint Layer::ConfigureDraw(std::array<GLfloat, 3 * 2>& out_matrix, switch (anti_aliasing) { case Settings::AntiAliasing::Fxaa: CreateFXAA(); - texture = fxaa->Draw(program_manager, info.display_texture); + texture = std::get<FXAA>(anti_alias).Draw(program_manager, info.display_texture); break; case Settings::AntiAliasing::Smaa: default: CreateSMAA(); - texture = smaa->Draw(program_manager, info.display_texture); + texture = std::get<SMAA>(anti_alias).Draw(program_manager, info.display_texture); break; } } @@ -68,7 +71,7 @@ GLuint Layer::ConfigureDraw(std::array<GLfloat, 3 * 2>& out_matrix, 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()); + fsr.emplace(layout.screen.GetWidth(), layout.screen.GetHeight()); } texture = fsr->Draw(program_manager, texture, info.scaled_width, info.scaled_height, crop); @@ -199,23 +202,20 @@ void Layer::ConfigureFramebufferTexture(const Tegra::FramebufferConfig& framebuf glTextureStorage2D(framebuffer_texture.resource.handle, 1, internal_format, framebuffer_texture.width, framebuffer_texture.height); - fxaa.reset(); - smaa.reset(); + anti_alias.emplace<std::monostate>(); } void Layer::CreateFXAA() { - smaa.reset(); - if (!fxaa) { - fxaa = std::make_unique<FXAA>( + if (!std::holds_alternative<FXAA>(anti_alias)) { + anti_alias.emplace<FXAA>( Settings::values.resolution_info.ScaleUp(framebuffer_texture.width), Settings::values.resolution_info.ScaleUp(framebuffer_texture.height)); } } void Layer::CreateSMAA() { - fxaa.reset(); - if (!smaa) { - smaa = std::make_unique<SMAA>( + if (!std::holds_alternative<SMAA>(anti_alias)) { + anti_alias.emplace<SMAA>( Settings::values.resolution_info.ScaleUp(framebuffer_texture.width), Settings::values.resolution_info.ScaleUp(framebuffer_texture.height)); } |
