Merge pull request #6186 from lioncash/enum-class

VideoConfig: Make AspectMode and StereoMode enum classes
This commit is contained in:
Leo Lam
2017-11-19 15:08:16 +01:00
committed by GitHub
26 changed files with 123 additions and 115 deletions

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

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

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;