VideoConfig: Make StereoMode an enum class

Makes for more strongly-typed identifiers (and doesn't pollute
surrounding namespaces)
This commit is contained in:
Lioncash 2017-11-10 22:55:00 -05:00
parent 10697bcbe3
commit 5337e58284
25 changed files with 78 additions and 74 deletions

View File

@ -220,7 +220,7 @@ void DolphinAnalytics::MakePerGameBuilder()
builder.AddData("cfg-gfx-ssaa", g_Config.bSSAA);
builder.AddData("cfg-gfx-anisotropy", g_Config.iMaxAnisotropy);
builder.AddData("cfg-gfx-vsync", g_Config.bVSync);
builder.AddData("cfg-gfx-aspect-ratio", g_Config.iAspectRatio);
builder.AddData("cfg-gfx-aspect-ratio", static_cast<int>(g_Config.aspect_mode));
builder.AddData("cfg-gfx-efb-access", g_Config.bEFBAccessEnable);
builder.AddData("cfg-gfx-efb-copy-format-changes", g_Config.bEFBEmulateFormatChanges);
builder.AddData("cfg-gfx-efb-copy-ram", !g_Config.bSkipEFBCopyToRam);
@ -229,7 +229,7 @@ void DolphinAnalytics::MakePerGameBuilder()
builder.AddData("cfg-gfx-efb-copy-scaled", g_Config.bCopyEFBScaled);
builder.AddData("cfg-gfx-internal-resolution", g_Config.iEFBScale);
builder.AddData("cfg-gfx-tc-samples", g_Config.iSafeTextureCache_ColorSamples);
builder.AddData("cfg-gfx-stereo-mode", g_Config.iStereoMode);
builder.AddData("cfg-gfx-stereo-mode", static_cast<int>(g_Config.stereo_mode));
builder.AddData("cfg-gfx-per-pixel-lighting", g_Config.bEnablePixelLighting);
builder.AddData("cfg-gfx-ubershader-mode", GetUbershaderMode(g_Config));
builder.AddData("cfg-gfx-fast-depth", g_Config.bFastDepthCalc);

View File

@ -146,7 +146,7 @@ void EnhancementsWidget::LoadSettings()
// Post Processing Shader
std::vector<std::string> shaders =
g_Config.iStereoMode == STEREO_ANAGLYPH ?
g_Config.stereo_mode == StereoMode::Anaglyph ?
PostProcessingShaderImplementation::GetAnaglyphShaderList(
g_Config.backend_info.api_type) :
PostProcessingShaderImplementation::GetShaderList(g_Config.backend_info.api_type);

View File

@ -264,46 +264,46 @@ void HotkeyScheduler::Run()
// Stereoscopy
if (IsHotkey(HK_TOGGLE_STEREO_SBS) || IsHotkey(HK_TOGGLE_STEREO_TAB))
{
if (g_Config.iStereoMode != STEREO_SBS)
if (g_Config.stereo_mode != StereoMode::SBS)
{
// Disable post-processing shader, as stereoscopy itself is currently a shader
if (g_Config.sPostProcessingShader == DUBOIS_ALGORITHM_SHADER)
g_Config.sPostProcessingShader = "";
g_Config.iStereoMode = IsHotkey(HK_TOGGLE_STEREO_SBS) ? STEREO_SBS : STEREO_TAB;
g_Config.stereo_mode = IsHotkey(HK_TOGGLE_STEREO_SBS) ? StereoMode::SBS : StereoMode::TAB;
}
else
{
g_Config.iStereoMode = STEREO_OFF;
g_Config.stereo_mode = StereoMode::Off;
}
}
if (IsHotkey(HK_TOGGLE_STEREO_ANAGLYPH))
{
if (g_Config.iStereoMode != STEREO_ANAGLYPH)
if (g_Config.stereo_mode != StereoMode::Anaglyph)
{
g_Config.iStereoMode = STEREO_ANAGLYPH;
g_Config.stereo_mode = StereoMode::Anaglyph;
g_Config.sPostProcessingShader = DUBOIS_ALGORITHM_SHADER;
}
else
{
g_Config.iStereoMode = STEREO_OFF;
g_Config.stereo_mode = StereoMode::Off;
g_Config.sPostProcessingShader = "";
}
}
if (IsHotkey(HK_TOGGLE_STEREO_3DVISION))
{
if (g_Config.iStereoMode != STEREO_3DVISION)
if (g_Config.stereo_mode != StereoMode::Nvidia3DVision)
{
if (g_Config.sPostProcessingShader == DUBOIS_ALGORITHM_SHADER)
g_Config.sPostProcessingShader = "";
g_Config.iStereoMode = STEREO_3DVISION;
g_Config.stereo_mode = StereoMode::Nvidia3DVision;
}
else
{
g_Config.iStereoMode = STEREO_OFF;
g_Config.stereo_mode = StereoMode::Off;
}
}
}

View File

@ -1549,7 +1549,7 @@ void CFrame::ParseHotkeys()
if (IsHotkey(HK_TOGGLE_STEREO_SBS))
{
if (g_Config.iStereoMode != STEREO_SBS)
if (g_Config.stereo_mode != StereoMode::SBS)
{
// Current implementation of anaglyph stereoscopy uses a
// post-processing shader. Thus the shader needs to be to be
@ -1558,56 +1558,56 @@ void CFrame::ParseHotkeys()
{
Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, std::string(""));
}
Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(STEREO_SBS));
Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(StereoMode::SBS));
}
else
{
Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(STEREO_OFF));
Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(StereoMode::Off));
}
}
if (IsHotkey(HK_TOGGLE_STEREO_TAB))
{
if (g_Config.iStereoMode != STEREO_TAB)
if (g_Config.stereo_mode != StereoMode::TAB)
{
if (g_Config.sPostProcessingShader == "dubois")
{
Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, std::string(""));
}
Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(STEREO_TAB));
Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(StereoMode::TAB));
}
else
{
Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(STEREO_OFF));
Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(StereoMode::Off));
}
}
if (IsHotkey(HK_TOGGLE_STEREO_ANAGLYPH))
{
if (g_Config.iStereoMode != STEREO_ANAGLYPH)
if (g_Config.stereo_mode != StereoMode::Anaglyph)
{
// Setting the anaglyph mode also requires a specific
// post-processing shader to be activated.
Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(STEREO_ANAGLYPH));
Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(StereoMode::Anaglyph));
Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, std::string("dubois"));
}
else
{
Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(STEREO_OFF));
Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(StereoMode::Off));
Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, std::string(""));
}
}
if (IsHotkey(HK_TOGGLE_STEREO_3DVISION))
{
if (g_Config.iStereoMode != STEREO_3DVISION)
if (g_Config.stereo_mode != StereoMode::Nvidia3DVision)
{
if (g_Config.sPostProcessingShader == "dubois")
{
Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, std::string(""));
}
Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(STEREO_3DVISION));
Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(StereoMode::Nvidia3DVision));
}
else
{
Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(STEREO_OFF));
Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(StereoMode::Off));
}
}

View File

@ -1199,7 +1199,7 @@ void VideoConfigDiag::CreateDescriptionArea(wxPanel* const page, wxBoxSizer* con
void VideoConfigDiag::PopulatePostProcessingShaders()
{
std::vector<std::string> shaders =
vconfig.iStereoMode == STEREO_ANAGLYPH ?
vconfig.stereo_mode == StereoMode::Anaglyph ?
PostProcessingShaderImplementation::GetAnaglyphShaderList(vconfig.backend_info.api_type) :
PostProcessingShaderImplementation::GetShaderList(vconfig.backend_info.api_type);
@ -1223,7 +1223,7 @@ void VideoConfigDiag::PopulatePostProcessingShaders()
// Invalid shader, reset it to default
choice_ppshader->Select(0);
if (vconfig.iStereoMode == STEREO_ANAGLYPH)
if (vconfig.stereo_mode == StereoMode::Anaglyph)
{
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_POST_SHADER, std::string("dubois"));
choice_ppshader->SetStringSelection(StrToWxStr(vconfig.sPostProcessingShader));

View File

@ -318,7 +318,7 @@ HRESULT Create(HWND wnd)
swap_chain_desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
swap_chain_desc.Width = xres;
swap_chain_desc.Height = yres;
swap_chain_desc.Stereo = g_ActiveConfig.iStereoMode == STEREO_QUADBUFFER;
swap_chain_desc.Stereo = g_ActiveConfig.stereo_mode == StereoMode::QuadBuffer;
// This flag is necessary if we want to use a flip-model swapchain without locking the framerate
swap_chain_desc.Flags = allow_tearing_supported ? DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING : 0;
@ -634,7 +634,7 @@ void Present()
if (AllowTearingSupported() && !g_ActiveConfig.IsVSync() && !GetFullscreenState())
present_flags |= DXGI_PRESENT_ALLOW_TEARING;
if (swapchain->IsTemporaryMonoSupported() && g_ActiveConfig.iStereoMode != STEREO_QUADBUFFER)
if (swapchain->IsTemporaryMonoSupported() && g_ActiveConfig.stereo_mode != StereoMode::QuadBuffer)
present_flags |= DXGI_PRESENT_STEREO_TEMPORARY_MONO;
// TODO: Is 1 the correct value for vsyncing?

View File

@ -137,7 +137,7 @@ FramebufferManager::FramebufferManager(int target_width, int target_height)
D3D11_TEXTURE2D_DESC texdesc;
HRESULT hr;
m_EFBLayers = m_efb.slices = (g_ActiveConfig.iStereoMode > 0) ? 2 : 1;
m_EFBLayers = m_efb.slices = (g_ActiveConfig.stereo_mode != StereoMode::Off) ? 2 : 1;
// EFB color texture - primary render target
texdesc =

View File

@ -37,11 +37,11 @@ LinearDiskCache<GeometryShaderUid, u8> g_gs_disk_cache;
ID3D11GeometryShader* GeometryShaderCache::GetClearGeometryShader()
{
return (g_ActiveConfig.iStereoMode > 0) ? ClearGeometryShader : nullptr;
return (g_ActiveConfig.stereo_mode != StereoMode::Off) ? ClearGeometryShader : nullptr;
}
ID3D11GeometryShader* GeometryShaderCache::GetCopyGeometryShader()
{
return (g_ActiveConfig.iStereoMode > 0) ? CopyGeometryShader : nullptr;
return (g_ActiveConfig.stereo_mode != StereoMode::Off) ? CopyGeometryShader : nullptr;
}
ID3D11Buffer* gscbuf = nullptr;

View File

@ -209,7 +209,7 @@ static void Create3DVisionTexture(int width, int height)
Renderer::Renderer() : ::Renderer(D3D::GetBackBufferWidth(), D3D::GetBackBufferHeight())
{
s_last_multisamples = g_ActiveConfig.iMultisamples;
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
s_last_stereo_mode = g_ActiveConfig.stereo_mode != StereoMode::Off;
s_last_fullscreen_mode = D3D::GetFullscreenState();
g_framebuffer_manager = std::make_unique<FramebufferManager>(m_target_width, m_target_height);
@ -658,7 +658,7 @@ void Renderer::SwapImpl(AbstractTexture* texture, const EFBRectangle& xfb_region
// Resize the back buffers NOW to avoid flickering
if (CalculateTargetSize() || window_resized || fs_changed ||
s_last_multisamples != g_ActiveConfig.iMultisamples ||
s_last_stereo_mode != (g_ActiveConfig.iStereoMode > 0))
s_last_stereo_mode != (g_ActiveConfig.stereo_mode != StereoMode::Off))
{
s_last_multisamples = g_ActiveConfig.iMultisamples;
s_last_fullscreen_mode = fullscreen;
@ -676,7 +676,7 @@ void Renderer::SwapImpl(AbstractTexture* texture, const EFBRectangle& xfb_region
UpdateDrawRectangle();
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
s_last_stereo_mode = g_ActiveConfig.stereo_mode != StereoMode::Off;
D3D::context->OMSetRenderTargets(1, &D3D::GetBackBuffer()->GetRTV(), nullptr);
@ -810,7 +810,8 @@ void Renderer::BBoxWrite(int index, u16 _value)
void Renderer::BlitScreen(TargetRectangle src, TargetRectangle dst, D3DTexture2D* src_texture,
u32 src_width, u32 src_height, float Gamma)
{
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 leftRc, rightRc;
std::tie(leftRc, rightRc) = ConvertStereoRectangle(dst);
@ -832,7 +833,7 @@ void Renderer::BlitScreen(TargetRectangle src, TargetRectangle dst, D3DTexture2D
VertexShaderCache::GetSimpleVertexShader(),
VertexShaderCache::GetSimpleInputLayout(), nullptr, Gamma, 1);
}
else if (g_ActiveConfig.iStereoMode == STEREO_3DVISION)
else if (g_ActiveConfig.stereo_mode == StereoMode::Nvidia3DVision)
{
if (!s_3d_vision_texture)
Create3DVisionTexture(m_backbuffer_width, m_backbuffer_height);
@ -872,10 +873,10 @@ void Renderer::BlitScreen(TargetRectangle src, TargetRectangle dst, D3DTexture2D
(float)dst.GetHeight());
D3D::context->RSSetViewports(1, &vp);
ID3D11PixelShader* pixelShader = (g_Config.iStereoMode == STEREO_ANAGLYPH) ?
ID3D11PixelShader* pixelShader = (g_Config.stereo_mode == StereoMode::Anaglyph) ?
PixelShaderCache::GetAnaglyphProgram() :
PixelShaderCache::GetColorCopyProgram(false);
ID3D11GeometryShader* geomShader = (g_ActiveConfig.iStereoMode == STEREO_QUADBUFFER) ?
ID3D11GeometryShader* geomShader = (g_ActiveConfig.stereo_mode == StereoMode::QuadBuffer) ?
GeometryShaderCache::GetCopyGeometryShader() :
nullptr;
D3D::drawShadedTexQuad(src_texture->GetSRV(), src.AsRECT(), src_width, src_height, pixelShader,

View File

@ -133,7 +133,7 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms
glActiveTexture(GL_TEXTURE9);
m_EFBLayers = (g_ActiveConfig.iStereoMode > 0) ? 2 : 1;
m_EFBLayers = (g_ActiveConfig.stereo_mode != StereoMode::Off) ? 2 : 1;
m_efbFramebuffer.resize(m_EFBLayers);
m_resolvedFramebuffer.resize(m_EFBLayers);

View File

@ -548,7 +548,7 @@ Renderer::Renderer()
g_ogl_config.bSupports2DTextureStorageMultisample = true;
g_Config.backend_info.bSupportsBitfield = true;
g_Config.backend_info.bSupportsDynamicSamplerIndexing = g_ogl_config.bSupportsAEP;
if (g_ActiveConfig.iStereoMode > 0 && g_ActiveConfig.iMultisamples > 1 &&
if (g_ActiveConfig.stereo_mode != StereoMode::Off && g_ActiveConfig.iMultisamples > 1 &&
!g_ogl_config.bSupports3DTextureStorageMultisample)
{
// GLES 3.1 can't support stereo rendering and MSAA
@ -725,7 +725,7 @@ Renderer::Renderer()
s_last_multisamples = g_ActiveConfig.iMultisamples;
s_MSAASamples = s_last_multisamples;
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
s_last_stereo_mode = g_ActiveConfig.stereo_mode != StereoMode::Off;
// Handle VSync on/off
s_vsync = g_ActiveConfig.IsVSync();
@ -1216,12 +1216,13 @@ void Renderer::BlitScreen(TargetRectangle src, TargetRectangle dst, GLuint src_t
int src_width, int src_height)
{
OpenGLPostProcessing* post_processor = static_cast<OpenGLPostProcessing*>(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 leftRc, rightRc;
// Top-and-Bottom mode needs to compensate for inverted vertical screen coordinates.
if (g_ActiveConfig.iStereoMode == STEREO_TAB)
if (g_ActiveConfig.stereo_mode == StereoMode::TAB)
std::tie(rightRc, leftRc) = ConvertStereoRectangle(dst);
else
std::tie(leftRc, rightRc) = ConvertStereoRectangle(dst);
@ -1229,7 +1230,7 @@ void Renderer::BlitScreen(TargetRectangle src, TargetRectangle dst, GLuint src_t
post_processor->BlitFromTexture(src, leftRc, src_texture, src_width, src_height, 0);
post_processor->BlitFromTexture(src, rightRc, src_texture, src_width, src_height, 1);
}
else if (g_ActiveConfig.iStereoMode == STEREO_QUADBUFFER)
else if (g_ActiveConfig.stereo_mode == StereoMode::QuadBuffer)
{
glDrawBuffer(GL_BACK_LEFT);
post_processor->BlitFromTexture(src, dst, src_texture, src_width, src_height, 0);
@ -1378,7 +1379,7 @@ void Renderer::SwapImpl(AbstractTexture* texture, const EFBRectangle& xfb_region
bool fb_needs_update = target_size_changed ||
s_last_multisamples != g_ActiveConfig.iMultisamples ||
stencil_buffer_enabled != BoundingBox::NeedsStencilBuffer() ||
s_last_stereo_mode != (g_ActiveConfig.iStereoMode > 0);
s_last_stereo_mode != (g_ActiveConfig.stereo_mode != StereoMode::Off);
if (window_resized || fb_needs_update)
{
@ -1386,7 +1387,7 @@ void Renderer::SwapImpl(AbstractTexture* texture, const EFBRectangle& xfb_region
}
if (fb_needs_update)
{
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
s_last_stereo_mode = g_ActiveConfig.stereo_mode != StereoMode::Off;
s_last_multisamples = g_ActiveConfig.iMultisamples;
s_MSAASamples = s_last_multisamples;

View File

@ -178,7 +178,7 @@ bool TextureCache::CompileShaders()
" gl_Position = vec4(rawpos*2.0-1.0, 0.0, 1.0);\n"
"}\n";
const std::string geo_program = g_ActiveConfig.iStereoMode > 0 ?
const std::string geo_program = g_ActiveConfig.stereo_mode != StereoMode::Off ?
"layout(triangles) in;\n"
"layout(triangle_strip, max_vertices = 6) out;\n"
"in vec3 v_uv0[3];\n"

View File

@ -170,7 +170,7 @@ bool VideoBackend::Initialize(void* window_handle)
InitInterface();
GLInterface->SetMode(GLInterfaceMode::MODE_DETECT);
if (!GLInterface->Create(window_handle, g_ActiveConfig.iStereoMode == STEREO_QUADBUFFER))
if (!GLInterface->Create(window_handle, g_ActiveConfig.stereo_mode == StereoMode::QuadBuffer))
return false;
return true;

View File

@ -253,7 +253,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);

View File

@ -629,7 +629,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;
@ -638,7 +639,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);
}
@ -771,7 +772,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();

View File

@ -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);

View File

@ -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;

View File

@ -20,7 +20,7 @@ constexpr std::array<const char*, 4> primitives_d3d = {{"point", "line", "triang
bool geometry_shader_uid_data::IsPassthrough() const
{
const bool stereo = g_ActiveConfig.iStereoMode > 0;
const bool stereo = g_ActiveConfig.stereo_mode != StereoMode::Off;
const bool wireframe = g_ActiveConfig.bWireFrame;
return primitive_type >= static_cast<u32>(PrimitiveType::Triangles) && !stereo && !wireframe;
}

View File

@ -41,7 +41,7 @@ void GeometryShaderManager::Dirty()
void GeometryShaderManager::SetConstants()
{
if (s_projection_changed && g_ActiveConfig.iStereoMode > 0)
if (s_projection_changed && g_ActiveConfig.stereo_mode != StereoMode::Off)
{
s_projection_changed = false;

View File

@ -70,7 +70,8 @@ std::string PostProcessingShaderConfiguration::LoadShader(std::string shader)
shader = g_ActiveConfig.sPostProcessingShader;
m_current_shader = shader;
const std::string sub_dir = (g_Config.iStereoMode == STEREO_ANAGLYPH) ? ANAGLYPH_DIR DIR_SEP : "";
const std::string sub_dir =
(g_Config.stereo_mode == StereoMode::Anaglyph) ? ANAGLYPH_DIR DIR_SEP : "";
// loading shader code
std::string code;

View File

@ -185,7 +185,7 @@ Renderer::ConvertStereoRectangle(const TargetRectangle& rc) const
{
// Resize target to half its original size
TargetRectangle draw_rc = rc;
if (g_ActiveConfig.iStereoMode == STEREO_TAB)
if (g_ActiveConfig.stereo_mode == StereoMode::TAB)
{
// The height may be negative due to flipped rectangles
int height = rc.bottom - rc.top;
@ -202,7 +202,7 @@ Renderer::ConvertStereoRectangle(const TargetRectangle& rc) const
// Create two target rectangle offset to the sides of the backbuffer
TargetRectangle left_rc = draw_rc;
TargetRectangle right_rc = draw_rc;
if (g_ActiveConfig.iStereoMode == STEREO_TAB)
if (g_ActiveConfig.stereo_mode == StereoMode::TAB)
{
left_rc.top -= m_backbuffer_height / 4;
left_rc.bottom -= m_backbuffer_height / 4;

View File

@ -13,7 +13,7 @@ ShaderHostConfig ShaderHostConfig::GetCurrent()
bits.msaa = g_ActiveConfig.iMultisamples > 1;
bits.ssaa = g_ActiveConfig.iMultisamples > 1 && g_ActiveConfig.bSSAA &&
g_ActiveConfig.backend_info.bSupportsSSAA;
bits.stereo = g_ActiveConfig.iStereoMode > 0;
bits.stereo = g_ActiveConfig.stereo_mode != StereoMode::Off;
bits.wireframe = g_ActiveConfig.bWireFrame;
bits.per_pixel_lighting = g_ActiveConfig.bEnablePixelLighting;
bits.vertex_rounding = g_ActiveConfig.UseVertexRounding();

View File

@ -130,7 +130,7 @@ void TextureCacheBase::OnConfigChanged(VideoConfig& config)
g_ActiveConfig.bTexFmtOverlayCenter);
}
if ((config.iStereoMode > 0) != backup_config.stereo_3d ||
if ((config.stereo_mode != StereoMode::Off) != backup_config.stereo_3d ||
config.bStereoEFBMonoDepth != backup_config.efb_mono_depth)
{
g_texture_cache->DeleteShaders();
@ -222,7 +222,7 @@ void TextureCacheBase::SetBackupConfig(const VideoConfig& config)
backup_config.texfmt_overlay_center = config.bTexFmtOverlayCenter;
backup_config.hires_textures = config.bHiresTextures;
backup_config.cache_hires_textures = config.bCacheHiresTextures;
backup_config.stereo_3d = config.iStereoMode > 0;
backup_config.stereo_3d = config.stereo_mode != StereoMode::Off;
backup_config.efb_mono_depth = config.bStereoEFBMonoDepth;
backup_config.gpu_texture_decoding = config.bEnableGPUTextureDecoding;
}

View File

@ -122,7 +122,7 @@ void VideoConfig::Refresh()
sPostProcessingShader = Config::Get(Config::GFX_ENHANCE_POST_SHADER);
bForceTrueColor = Config::Get(Config::GFX_ENHANCE_FORCE_TRUE_COLOR);
iStereoMode = Config::Get(Config::GFX_STEREO_MODE);
stereo_mode = static_cast<StereoMode>(Config::Get(Config::GFX_STEREO_MODE));
iStereoDepth = Config::Get(Config::GFX_STEREO_DEPTH);
iStereoConvergencePercentage = Config::Get(Config::GFX_STEREO_CONVERGENCE_PERCENTAGE);
bStereoSwapEyes = Config::Get(Config::GFX_STEREO_SWAP_EYES);
@ -162,14 +162,14 @@ void VideoConfig::VerifyValidity()
backend_info.AAModes.end())
iMultisamples = 1;
if (iStereoMode > 0)
if (stereo_mode != StereoMode::Off)
{
if (!backend_info.bSupportsGeometryShaders)
{
OSD::AddMessage(
"Stereoscopic 3D isn't supported by your GPU, support for OpenGL 3.2 is required.",
10000);
iStereoMode = 0;
stereo_mode = StereoMode::Off;
}
}
}

View File

@ -32,14 +32,14 @@ enum class AspectMode
Stretch,
};
enum StereoMode
enum class StereoMode
{
STEREO_OFF = 0,
STEREO_SBS,
STEREO_TAB,
STEREO_ANAGLYPH,
STEREO_QUADBUFFER,
STEREO_3DVISION
Off,
SBS,
TAB,
Anaglyph,
QuadBuffer,
Nvidia3DVision
};
struct ProjectionHackConfig final
@ -130,7 +130,7 @@ struct VideoConfig final
int iSaveTargetId; // TODO: Should be dropped
// Stereoscopy
int iStereoMode;
StereoMode stereo_mode;
int iStereoDepth;
int iStereoConvergence;
int iStereoConvergencePercentage;