mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Merge pull request #6186 from lioncash/enum-class
VideoConfig: Make AspectMode and StereoMode enum classes
This commit is contained in:
@ -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?
|
||||
|
@ -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 =
|
||||
|
@ -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;
|
||||
|
@ -205,7 +205,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);
|
||||
@ -654,7 +654,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;
|
||||
@ -672,7 +672,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);
|
||||
|
||||
@ -806,7 +806,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);
|
||||
@ -828,7 +829,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);
|
||||
@ -868,10 +869,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,
|
||||
|
@ -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);
|
||||
|
||||
|
@ -546,7 +546,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
|
||||
@ -723,7 +723,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();
|
||||
@ -1214,12 +1214,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);
|
||||
@ -1227,7 +1228,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);
|
||||
@ -1376,7 +1377,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)
|
||||
{
|
||||
@ -1384,7 +1385,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;
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user