diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp index 59f873a84..d9e950987 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp +++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp @@ -2,19 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -//#define GLM_FORCE_DEPTH_ZERO_TO_ONE -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include "common/assert.h" -#include "common/bit_field.h" #include "common/logging/log.h" #include "common/microprofile.h" #include "core/core.h" @@ -27,10 +16,8 @@ #include "core/hw/lcd.h" #include "core/memory.h" #include "core/settings.h" -#include "core/tracer/recorder.h" #include "video_core/debug_utils/debug_utils.h" #include "video_core/rasterizer_interface.h" -#include "video_core/renderer_vulkan/vk_state.h" #include "video_core/renderer_vulkan/renderer_vulkan.h" #include "video_core/renderer_vulkan/vk_task_scheduler.h" #include "video_core/renderer_vulkan/vk_pipeline_builder.h" @@ -386,85 +373,6 @@ void RendererVulkan::DrawSingleScreen(u32 screen_id, float x, float y, float w, cmdbuffer.draw(4, 1, offset / sizeof(ScreenRectVertex), 0); } -/** - * Draws a single texture to the emulator window, rotating the texture to correct for the 3DS's LCD - * rotation. - */ -void RendererVulkan::DrawSingleScreenStereoRotated(const ScreenInfo& screen_info_l, - const ScreenInfo& screen_info_r, float x, - float y, float w, float h) { - ASSERT(false); - //DrawSingleScreenRotated(screen_info_l, x, y, w, h); - /*const auto& texcoords = screen_info_l.display_texcoords; - - const std::array vertices = {{ - ScreenRectVertex(x, y, texcoords.bottom, texcoords.left), - ScreenRectVertex(x + w, y, texcoords.bottom, texcoords.right), - ScreenRectVertex(x, y + h, texcoords.top, texcoords.left), - ScreenRectVertex(x + w, y + h, texcoords.top, texcoords.right), - }}; - - const u16 scale_factor = VideoCore::GetResolutionScaleFactor(); - auto [width_l, height_l] = screen_info_l.texture.GetArea().extent; - - draw_info.i_resolution = glm::vec4{width_l * scale_factor, height_l * scale_factor, - 1.0f / (width_l * scale_factor), - 1.0f / (height_l * scale_factor)}; - draw_info.o_resolution = glm::vec4{h, w, 1.0f / h, 1.0f / w}; - - state.texture_units[0].texture_2d = screen_info_l.display_texture; - state.texture_units[1].texture_2d = screen_info_r.display_texture; - state.texture_units[0].sampler = filter_sampler.handle; - state.texture_units[1].sampler = filter_sampler.handle; - state.Apply(); - - glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertices), vertices.data()); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - - state.texture_units[0].texture_2d = 0; - state.texture_units[1].texture_2d = 0; - state.texture_units[0].sampler = 0; - state.texture_units[1].sampler = 0; - state.Apply();*/ -} - -void RendererVulkan::DrawSingleScreenStereo(const ScreenInfo& screen_info_l, - const ScreenInfo& screen_info_r, float x, float y, - float w, float h) { - ASSERT(false); - //DrawSingleScreen(screen_info_l, x, y, w, h); - /*const auto& texcoords = screen_info_l.display_texcoords; - - const std::array vertices = {{ - ScreenRectVertex(x, y, texcoords.bottom, texcoords.right), - ScreenRectVertex(x + w, y, texcoords.top, texcoords.right), - ScreenRectVertex(x, y + h, texcoords.bottom, texcoords.left), - ScreenRectVertex(x + w, y + h, texcoords.top, texcoords.left), - }}; - - const u16 scale_factor = VideoCore::GetResolutionScaleFactor(); - glUniform4f(uniform_i_resolution, - static_cast(screen_info_l.texture.width * scale_factor), - static_cast(screen_info_l.texture.height * scale_factor), - 1.0f / static_cast(screen_info_l.texture.width * scale_factor), - 1.0f / static_cast(screen_info_l.texture.height * scale_factor)); - glUniform4f(uniform_o_resolution, w, h, 1.0f / w, 1.0f / h); - state.texture_units[0].texture_2d = screen_info_l.display_texture; - state.texture_units[1].texture_2d = screen_info_r.display_texture; - state.texture_units[0].sampler = filter_sampler.handle; - state.texture_units[1].sampler = filter_sampler.handle; - state.Apply(); - - glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertices), vertices.data()); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - - state.texture_units[0].texture_2d = 0; - state.texture_units[1].texture_2d = 0; - state.texture_units[0].sampler = 0; - state.texture_units[1].sampler = 0; - state.Apply();*/ -} - /** * Draws the emulated screens to the emulator window. */ @@ -498,11 +406,6 @@ void RendererVulkan::DrawScreens(const Layout::FramebufferLayout& layout, bool f Settings::values.render_3d == Settings::StereoRenderOption::Interlaced || Settings::values.render_3d == Settings::StereoRenderOption::ReverseInterlaced*/; - // Bind a second texture for the right eye if in Anaglyph mode - if (stereo_single_screen) { - //glUniform1i(uniform_color_texture_r, 1); - } - auto& image = swapchain->GetCurrentImage(); auto& state = VulkanState::Get(); @@ -538,10 +441,6 @@ void RendererVulkan::DrawScreens(const Layout::FramebufferLayout& layout, bool f ((float)layout.width / 2), layout.top_screen.top, layout.top_screen.GetWidth(), layout.top_screen.GetHeight()); - } else if (stereo_single_screen) { - DrawSingleScreenStereoRotated( - screen_infos[0], screen_infos[1], (float)top_screen.left, (float)top_screen.top, - (float)top_screen.GetWidth(), (float)top_screen.GetHeight()); } } else { if (Settings::values.render_3d == Settings::StereoRenderOption::Off) { @@ -563,10 +462,6 @@ void RendererVulkan::DrawScreens(const Layout::FramebufferLayout& layout, bool f layout.cardboard.top_screen_right_eye + ((float)layout.width / 2), layout.top_screen.top, layout.top_screen.GetWidth(), layout.top_screen.GetHeight()); - } else if (stereo_single_screen) { - DrawSingleScreenStereo(screen_infos[0], screen_infos[1], (float)top_screen.left, - (float)top_screen.top, (float)top_screen.GetWidth(), - (float)top_screen.GetHeight()); } } } @@ -597,11 +492,6 @@ void RendererVulkan::DrawScreens(const Layout::FramebufferLayout& layout, bool f ((float)layout.width / 2), layout.bottom_screen.top, layout.bottom_screen.GetWidth(), layout.bottom_screen.GetHeight()); - } else if (stereo_single_screen) { - DrawSingleScreenStereoRotated(screen_infos[2], screen_infos[2], - (float)bottom_screen.left, (float)bottom_screen.top, - (float)bottom_screen.GetWidth(), - (float)bottom_screen.GetHeight()); } } else { if (Settings::values.render_3d == Settings::StereoRenderOption::Off) { @@ -627,10 +517,6 @@ void RendererVulkan::DrawScreens(const Layout::FramebufferLayout& layout, bool f ((float)layout.width / 2), layout.bottom_screen.top, layout.bottom_screen.GetWidth(), layout.bottom_screen.GetHeight()); - } else if (stereo_single_screen) { - DrawSingleScreenStereo(screen_infos[2], screen_infos[2], (float)bottom_screen.left, - (float)bottom_screen.top, (float)bottom_screen.GetWidth(), - (float)bottom_screen.GetHeight()); } } } diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.h b/src/video_core/renderer_vulkan/renderer_vulkan.h index 103c03b1a..de3dd539e 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.h +++ b/src/video_core/renderer_vulkan/renderer_vulkan.h @@ -20,9 +20,9 @@ namespace Vulkan { /// Structure used for storing information about the display target for each 3DS screen struct ScreenInfo { - Vulkan::VKTexture* display_texture; + VKTexture* display_texture; Common::Rectangle display_texcoords; - Vulkan::VKTexture texture; + VKTexture texture; GPU::Regs::PixelFormat format; }; @@ -47,19 +47,12 @@ public: private: void CreateVulkanObjects(); - void ConfigureRenderPipeline(); void PrepareRendertarget(); void ConfigureFramebufferTexture(ScreenInfo& screen, const GPU::Regs::FramebufferConfig& framebuffer); void DrawScreens(const Layout::FramebufferLayout& layout, bool flipped); void DrawSingleScreenRotated(u32 screen_id, float x, float y, float w, float h); void DrawSingleScreen(u32 screen_id, float x, float y, float w, float h); - void DrawSingleScreenStereoRotated(const ScreenInfo& screen_info_l, - const ScreenInfo& screen_info_r, float x, float y, float w, float h); - void DrawSingleScreenStereo(const ScreenInfo& screen_info_l, const ScreenInfo& screen_info_r, - float x, float y, float w, float h); - - void UpdateFramerate(); // Loads framebuffer from emulated memory into the display information structure void LoadFBToScreenInfo(const GPU::Regs::FramebufferConfig& framebuffer,