From ae83d02e548409c139e9bb748da565c219d5ecd2 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 2 Oct 2019 11:07:17 +1000 Subject: [PATCH] Drop 3D Vision Support --- Source/Core/Core/HotkeyManager.cpp | 5 +- Source/Core/Core/HotkeyManager.h | 1 - .../Config/Graphics/AdvancedWidget.cpp | 3 +- .../Config/Graphics/EnhancementsWidget.cpp | 20 ++---- Source/Core/DolphinQt/HotkeyScheduler.cpp | 15 ---- Source/Core/VideoBackends/D3D/Render.cpp | 72 ------------------- Source/Core/VideoBackends/D3D/Render.h | 6 -- Source/Core/VideoCommon/VideoConfig.h | 3 +- 8 files changed, 8 insertions(+), 117 deletions(-) diff --git a/Source/Core/Core/HotkeyManager.cpp b/Source/Core/Core/HotkeyManager.cpp index b001000be5..8f58768710 100644 --- a/Source/Core/Core/HotkeyManager.cpp +++ b/Source/Core/Core/HotkeyManager.cpp @@ -20,7 +20,7 @@ #include "InputCommon/GCPadStatus.h" // clang-format off -constexpr std::array s_hotkey_labels{{ +constexpr std::array s_hotkey_labels{{ _trans("Open"), _trans("Change Disc"), _trans("Eject Disc"), @@ -126,7 +126,6 @@ constexpr std::array s_hotkey_labels{{ _trans("Toggle 3D Side-by-Side"), _trans("Toggle 3D Top-Bottom"), _trans("Toggle 3D Anaglyph"), - _trans("Toggle 3D Vision"), _trans("Decrease Depth"), _trans("Increase Depth"), _trans("Decrease Convergence"), @@ -291,7 +290,7 @@ constexpr std::array s_groups_info = { {_trans("Internal Resolution"), HK_INCREASE_IR, HK_DECREASE_IR}, {_trans("Freelook"), HK_FREELOOK_DECREASE_SPEED, HK_FREELOOK_RESET}, // i18n: Stereoscopic 3D - {_trans("3D"), HK_TOGGLE_STEREO_SBS, HK_TOGGLE_STEREO_3DVISION}, + {_trans("3D"), HK_TOGGLE_STEREO_SBS, HK_TOGGLE_STEREO_ANAGLYPH}, // i18n: Stereoscopic 3D {_trans("3D Depth"), HK_DECREASE_DEPTH, HK_INCREASE_CONVERGENCE}, {_trans("Load State"), HK_LOAD_STATE_SLOT_1, HK_LOAD_STATE_SLOT_SELECTED}, diff --git a/Source/Core/Core/HotkeyManager.h b/Source/Core/Core/HotkeyManager.h index 618fe7c00f..3115d33e2b 100644 --- a/Source/Core/Core/HotkeyManager.h +++ b/Source/Core/Core/HotkeyManager.h @@ -114,7 +114,6 @@ enum Hotkey HK_TOGGLE_STEREO_SBS, HK_TOGGLE_STEREO_TAB, HK_TOGGLE_STEREO_ANAGLYPH, - HK_TOGGLE_STEREO_3DVISION, HK_DECREASE_DEPTH, HK_INCREASE_DEPTH, diff --git a/Source/Core/DolphinQt/Config/Graphics/AdvancedWidget.cpp b/Source/Core/DolphinQt/Config/Graphics/AdvancedWidget.cpp index f84885798f..2496ac5c09 100644 --- a/Source/Core/DolphinQt/Config/Graphics/AdvancedWidget.cpp +++ b/Source/Core/DolphinQt/Config/Graphics/AdvancedWidget.cpp @@ -235,8 +235,7 @@ void AdvancedWidget::AddDescriptions() "Implements fullscreen mode with a borderless window spanning the whole screen instead of " "using exclusive mode. Allows for faster transitions between fullscreen and windowed mode, " "but slightly increases input latency, makes movement less smooth and slightly decreases " - "performance.\n\nExclusive mode is required for Nvidia 3D Vision to work in the Direct3D " - "backend.\n\nIf unsure, leave this unchecked."); + "performance.\n\nIf unsure, leave this unchecked."); #endif AddDescription(m_enable_wireframe, TR_WIREFRAME_DESCRIPTION); diff --git a/Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.cpp b/Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.cpp index e8ed48f336..14d6d0f773 100644 --- a/Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.cpp +++ b/Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.cpp @@ -110,10 +110,9 @@ void EnhancementsWidget::CreateWidgets() auto* stereoscopy_layout = new QGridLayout(); stereoscopy_box->setLayout(stereoscopy_layout); - m_3d_mode = - new GraphicsChoice({tr("Off"), tr("Side-by-Side"), tr("Top-and-Bottom"), tr("Anaglyph"), - tr("HDMI 3D"), tr("Passive"), tr("NVIDIA 3D Vision")}, - Config::GFX_STEREO_MODE); + m_3d_mode = new GraphicsChoice({tr("Off"), tr("Side-by-Side"), tr("Top-and-Bottom"), + tr("Anaglyph"), tr("HDMI 3D"), tr("Passive")}, + Config::GFX_STEREO_MODE); m_3d_depth = new GraphicsSlider(0, 100, Config::GFX_STEREO_DEPTH); m_3d_convergence = new GraphicsSlider(0, 200, Config::GFX_STEREO_CONVERGENCE, 100); m_3d_swap_eyes = new GraphicsBool(tr("Swap Eyes"), Config::GFX_STEREO_SWAP_EYES); @@ -227,18 +226,7 @@ void EnhancementsWidget::LoadSettings() LoadPPShaders(); // Stereoscopy - bool supports_stereoscopy = g_Config.backend_info.bSupportsGeometryShaders; - bool supports_3dvision = g_Config.backend_info.bSupports3DVision; - - if (m_3d_mode->currentIndex() == int(StereoMode::Nvidia3DVision) && !supports_3dvision) - { - m_3d_mode->setCurrentIndex(int(StereoMode::Off)); - - ModalMessageBox::information(this, tr("NVIDIA 3D Vision"), - tr("NVIDIA 3D Vision is unsupported by the selected backend. " - "Stereoscopy has been disabled.")); - } - + const bool supports_stereoscopy = g_Config.backend_info.bSupportsGeometryShaders; m_3d_mode->setEnabled(supports_stereoscopy); m_3d_convergence->setEnabled(supports_stereoscopy); m_3d_depth->setEnabled(supports_stereoscopy); diff --git a/Source/Core/DolphinQt/HotkeyScheduler.cpp b/Source/Core/DolphinQt/HotkeyScheduler.cpp index 4983634b64..14949fd3f8 100644 --- a/Source/Core/DolphinQt/HotkeyScheduler.cpp +++ b/Source/Core/DolphinQt/HotkeyScheduler.cpp @@ -496,21 +496,6 @@ void HotkeyScheduler::Run() Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, ""); } } - - if (IsHotkey(HK_TOGGLE_STEREO_3DVISION)) - { - if (Config::Get(Config::GFX_STEREO_MODE) != StereoMode::Nvidia3DVision) - { - if (Config::Get(Config::GFX_ENHANCE_POST_SHADER) == DUBOIS_ALGORITHM_SHADER) - Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, ""); - - Config::SetCurrent(Config::GFX_STEREO_MODE, StereoMode::Nvidia3DVision); - } - else - { - Config::SetCurrent(Config::GFX_STEREO_MODE, StereoMode::Off); - } - } } const auto stereo_depth = Config::Get(Config::GFX_STEREO_DEPTH); diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp index d16a530c81..83a177342e 100644 --- a/Source/Core/VideoBackends/D3D/Render.cpp +++ b/Source/Core/VideoBackends/D3D/Render.cpp @@ -38,18 +38,6 @@ namespace DX11 { -// Nvidia stereo blitting struct defined in "nvstereo.h" from the Nvidia SDK -typedef struct _Nv_Stereo_Image_Header -{ - unsigned int dwSignature; - unsigned int dwWidth; - unsigned int dwHeight; - unsigned int dwBPP; - unsigned int dwFlags; -} NVSTEREOIMAGEHEADER, *LPNVSTEREOIMAGEHEADER; - -#define NVSTEREO_IMAGE_SIGNATURE 0x4433564e - Renderer::Renderer(std::unique_ptr swap_chain, float backbuffer_scale) : ::Renderer(swap_chain ? swap_chain->GetWidth() : 0, swap_chain ? swap_chain->GetHeight() : 0, backbuffer_scale, @@ -60,35 +48,6 @@ Renderer::Renderer(std::unique_ptr swap_chain, float backbuffer_scale Renderer::~Renderer() = default; -void Renderer::Create3DVisionTexture(int width, int height) -{ - // Create a staging texture for 3D vision with signature information in the last row. - // Nvidia 3D Vision supports full SBS, so there is no loss in resolution during this process. - NVSTEREOIMAGEHEADER header; - header.dwSignature = NVSTEREO_IMAGE_SIGNATURE; - header.dwWidth = static_cast(width * 2); - header.dwHeight = static_cast(height + 1); - header.dwBPP = 32; - header.dwFlags = 0; - - const u32 pitch = static_cast(4 * width * 2); - const auto memory = std::make_unique((height + 1) * pitch); - u8* image_header_location = &memory[height * pitch]; - std::memcpy(image_header_location, &header, sizeof(header)); - - D3D11_SUBRESOURCE_DATA sys_data; - sys_data.SysMemPitch = pitch; - sys_data.pSysMem = memory.get(); - - CD3D11_TEXTURE2D_DESC texture_desc(DXGI_FORMAT_R8G8B8A8_UNORM, width * 2, height + 1, 1, 1, - D3D11_BIND_RENDER_TARGET, D3D11_USAGE_DEFAULT, 0, 1, 0, 0); - ComPtr texture; - HRESULT hr = D3D::device->CreateTexture2D(&texture_desc, &sys_data, texture.GetAddressOf()); - CHECK(SUCCEEDED(hr), "Create 3D Vision Texture"); - m_3d_vision_texture = DXTexture::CreateAdopted(std::move(texture)); - m_3d_vision_framebuffer = DXFramebuffer::Create(m_3d_vision_texture.get(), nullptr); -} - bool Renderer::IsHeadless() const { return !m_swap_chain; @@ -237,8 +196,6 @@ void Renderer::CheckForSwapChainChanges() m_backbuffer_width = m_swap_chain->GetWidth(); m_backbuffer_height = m_swap_chain->GetHeight(); - m_3d_vision_framebuffer.reset(); - m_3d_vision_texture.reset(); } void Renderer::SetFramebuffer(AbstractFramebuffer* framebuffer) @@ -328,35 +285,6 @@ void Renderer::WaitForGPUIdle() D3D::context->Flush(); } -void Renderer::RenderXFBToScreen(const MathUtil::Rectangle& target_rc, - const AbstractTexture* source_texture, - const MathUtil::Rectangle& source_rc) -{ - if (g_ActiveConfig.stereo_mode != StereoMode::Nvidia3DVision) - return ::Renderer::RenderXFBToScreen(target_rc, source_texture, source_rc); - - if (!m_3d_vision_texture) - Create3DVisionTexture(m_backbuffer_width, m_backbuffer_height); - - // Render to staging texture which is double the width of the backbuffer - SetAndClearFramebuffer(m_3d_vision_framebuffer.get()); - - m_post_processor->BlitFromTexture(target_rc, source_rc, source_texture, 0); - m_post_processor->BlitFromTexture( - MathUtil::Rectangle(target_rc.left + m_backbuffer_width, target_rc.top, - target_rc.right + m_backbuffer_width, target_rc.bottom), - source_rc, source_texture, 1); - - // Copy the left eye to the backbuffer, if Nvidia 3D Vision is enabled it should - // recognize the signature and automatically include the right eye frame. - const CD3D11_BOX box(0, 0, 0, m_swap_chain->GetWidth(), m_swap_chain->GetHeight(), 1); - D3D::context->CopySubresourceRegion(m_swap_chain->GetTexture()->GetD3DTexture(), 0, 0, 0, 0, - m_3d_vision_texture->GetD3DTexture(), 0, &box); - - // Restore render target to backbuffer - SetFramebuffer(m_swap_chain->GetFramebuffer()); -} - void Renderer::SetFullscreen(bool enable_fullscreen) { if (m_swap_chain) diff --git a/Source/Core/VideoBackends/D3D/Render.h b/Source/Core/VideoBackends/D3D/Render.h index 4cd73a456d..68f99f0fe1 100644 --- a/Source/Core/VideoBackends/D3D/Render.h +++ b/Source/Core/VideoBackends/D3D/Render.h @@ -67,19 +67,13 @@ public: void Flush() override; void WaitForGPUIdle() override; - void RenderXFBToScreen(const MathUtil::Rectangle& target_rc, - const AbstractTexture* source_texture, - const MathUtil::Rectangle& source_rc) override; void OnConfigChanged(u32 bits) override; private: - void Create3DVisionTexture(int width, int height); void CheckForSwapChainChanges(); StateCache m_state_cache; std::unique_ptr m_swap_chain; - std::unique_ptr m_3d_vision_texture; - std::unique_ptr m_3d_vision_framebuffer; }; } // namespace DX11 diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h index 7008199a84..0a31b3c943 100644 --- a/Source/Core/VideoCommon/VideoConfig.h +++ b/Source/Core/VideoCommon/VideoConfig.h @@ -40,8 +40,7 @@ enum class StereoMode : int TAB, Anaglyph, QuadBuffer, - Passive, - Nvidia3DVision, + Passive }; enum class ShaderCompilationMode : int