diff options
| author | Leo Lam <leolino.lam@gmail.com> | 2017-11-19 15:08:16 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-11-19 15:08:16 +0100 |
| commit | 80bcc0d58d7d3b39d0e1b7973cbce34d4cf61f4e (patch) | |
| tree | 22d2ccf22820d55938bd47c7d0a7e81c2d722c7d /Source/Core/VideoBackends/Vulkan | |
| parent | a75546747ead9aad27ea7e62d340d18e446dcaf3 (diff) | |
| parent | 5337e58284aa9c727cdd66a1a79d968861a70839 (diff) | |
Merge pull request #6186 from lioncash/enum-class
VideoConfig: Make AspectMode and StereoMode enum classes
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan')
4 files changed, 17 insertions, 15 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/FramebufferManager.cpp b/Source/Core/VideoBackends/Vulkan/FramebufferManager.cpp index 6910bfb235..78689b9638 100644 --- a/Source/Core/VideoBackends/Vulkan/FramebufferManager.cpp +++ b/Source/Core/VideoBackends/Vulkan/FramebufferManager.cpp @@ -251,7 +251,7 @@ bool FramebufferManager::CreateEFBFramebuffer() { u32 efb_width = static_cast<u32>(std::max(g_renderer->GetTargetWidth(), 1)); u32 efb_height = static_cast<u32>(std::max(g_renderer->GetTargetHeight(), 1)); - u32 efb_layers = (g_ActiveConfig.iStereoMode != STEREO_OFF) ? 2 : 1; + u32 efb_layers = (g_ActiveConfig.stereo_mode != StereoMode::Off) ? 2 : 1; VkSampleCountFlagBits efb_samples = static_cast<VkSampleCountFlagBits>(g_ActiveConfig.iMultisamples); INFO_LOG(VIDEO, "EFB size: %ux%ux%u", efb_width, efb_height, efb_layers); diff --git a/Source/Core/VideoBackends/Vulkan/Renderer.cpp b/Source/Core/VideoBackends/Vulkan/Renderer.cpp index d32e478292..8f83e2b202 100644 --- a/Source/Core/VideoBackends/Vulkan/Renderer.cpp +++ b/Source/Core/VideoBackends/Vulkan/Renderer.cpp @@ -624,7 +624,8 @@ void Renderer::BlitScreen(VkRenderPass render_pass, const TargetRectangle& dst_r const TargetRectangle& src_rect, const Texture2D* src_tex) { VulkanPostProcessing* post_processor = static_cast<VulkanPostProcessing*>(m_post_processor.get()); - if (g_ActiveConfig.iStereoMode == STEREO_SBS || g_ActiveConfig.iStereoMode == STEREO_TAB) + if (g_ActiveConfig.stereo_mode == StereoMode::SBS || + g_ActiveConfig.stereo_mode == StereoMode::TAB) { TargetRectangle left_rect; TargetRectangle right_rect; @@ -633,7 +634,7 @@ void Renderer::BlitScreen(VkRenderPass render_pass, const TargetRectangle& dst_r post_processor->BlitFromTexture(left_rect, src_rect, src_tex, 0, render_pass); post_processor->BlitFromTexture(right_rect, src_rect, src_tex, 1, render_pass); } - else if (g_ActiveConfig.iStereoMode == STEREO_QUADBUFFER) + else if (g_ActiveConfig.stereo_mode == StereoMode::QuadBuffer) { post_processor->BlitFromTexture(dst_rect, src_rect, src_tex, -1, render_pass); } @@ -712,10 +713,10 @@ void Renderer::CheckForSurfaceChange() void Renderer::CheckForConfigChanges() { // Save the video config so we can compare against to determine which settings have changed. - int old_anisotropy = g_ActiveConfig.iMaxAnisotropy; - int old_aspect_ratio = g_ActiveConfig.iAspectRatio; - int old_efb_scale = g_ActiveConfig.iEFBScale; - bool old_force_filtering = g_ActiveConfig.bForceFiltering; + const int old_anisotropy = g_ActiveConfig.iMaxAnisotropy; + const AspectMode old_aspect_mode = g_ActiveConfig.aspect_mode; + const int old_efb_scale = g_ActiveConfig.iEFBScale; + const bool old_force_filtering = g_ActiveConfig.bForceFiltering; // Copy g_Config to g_ActiveConfig. // NOTE: This can potentially race with the UI thread, however if it does, the changes will be @@ -723,10 +724,11 @@ void Renderer::CheckForConfigChanges() UpdateActiveConfig(); // Determine which (if any) settings have changed. - bool anisotropy_changed = old_anisotropy != g_ActiveConfig.iMaxAnisotropy; - bool force_texture_filtering_changed = old_force_filtering != g_ActiveConfig.bForceFiltering; - bool efb_scale_changed = old_efb_scale != g_ActiveConfig.iEFBScale; - bool aspect_changed = old_aspect_ratio != g_ActiveConfig.iAspectRatio; + const bool anisotropy_changed = old_anisotropy != g_ActiveConfig.iMaxAnisotropy; + const bool force_texture_filtering_changed = + old_force_filtering != g_ActiveConfig.bForceFiltering; + const bool efb_scale_changed = old_efb_scale != g_ActiveConfig.iEFBScale; + const bool aspect_changed = old_aspect_mode != g_ActiveConfig.aspect_mode; // Update texture cache settings with any changed options. TextureCache::GetInstance()->OnConfigChanged(g_ActiveConfig); @@ -765,7 +767,7 @@ void Renderer::CheckForConfigChanges() // For quad-buffered stereo we need to change the layer count, so recreate the swap chain. if (m_swap_chain && - (g_ActiveConfig.iStereoMode == STEREO_QUADBUFFER) != m_swap_chain->IsStereoEnabled()) + (g_ActiveConfig.stereo_mode == StereoMode::QuadBuffer) != m_swap_chain->IsStereoEnabled()) { g_command_buffer_mgr->WaitForGPUIdle(); m_swap_chain->RecreateSwapChain(); diff --git a/Source/Core/VideoBackends/Vulkan/ShaderCache.cpp b/Source/Core/VideoBackends/Vulkan/ShaderCache.cpp index ad5cdf523a..2c69267dfc 100644 --- a/Source/Core/VideoBackends/Vulkan/ShaderCache.cpp +++ b/Source/Core/VideoBackends/Vulkan/ShaderCache.cpp @@ -971,7 +971,7 @@ std::string ShaderCache::GetUtilityShaderHeader() const ss << "#define SSAA_ENABLED 1" << std::endl; } - u32 efb_layers = (g_ActiveConfig.iStereoMode != STEREO_OFF) ? 2 : 1; + u32 efb_layers = (g_ActiveConfig.stereo_mode != StereoMode::Off) ? 2 : 1; ss << "#define EFB_LAYERS " << efb_layers << std::endl; return ss.str(); @@ -1126,7 +1126,7 @@ bool ShaderCache::CompileSharedShaders() return false; } - if (g_ActiveConfig.iStereoMode != STEREO_OFF && g_vulkan_context->SupportsGeometryShaders()) + if (g_ActiveConfig.stereo_mode != StereoMode::Off && g_vulkan_context->SupportsGeometryShaders()) { m_screen_quad_geometry_shader = Util::CompileAndCreateGeometryShader(header + SCREEN_QUAD_GEOMETRY_SHADER_SOURCE); diff --git a/Source/Core/VideoBackends/Vulkan/SwapChain.cpp b/Source/Core/VideoBackends/Vulkan/SwapChain.cpp index abcd38c94a..58785130b0 100644 --- a/Source/Core/VideoBackends/Vulkan/SwapChain.cpp +++ b/Source/Core/VideoBackends/Vulkan/SwapChain.cpp @@ -321,7 +321,7 @@ bool SwapChain::CreateSwapChain() } // Select the number of image layers for Quad-Buffered stereoscopy - uint32_t image_layers = g_ActiveConfig.iStereoMode == STEREO_QUADBUFFER ? 2 : 1; + uint32_t image_layers = g_ActiveConfig.stereo_mode == StereoMode::QuadBuffer ? 2 : 1; // Store the old/current swap chain when recreating for resize VkSwapchainKHR old_swap_chain = m_swap_chain; |
