diff --git a/Core/Config.cpp b/Core/Config.cpp index 3b719b6992..cb4044d8d1 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -384,9 +384,9 @@ static ConfigSetting generalSettings[] = { ConfigSetting("RemoteDebuggerOnStartup", &g_Config.bRemoteDebuggerOnStartup, false), #ifdef __ANDROID__ - ConfigSetting("ScreenRotation", &g_Config.iScreenRotation, 1), + ConfigSetting("ScreenRotation", &g_Config.iScreenRotation, ROTATION_LOCKED_HORIZONTAL), #endif - ConfigSetting("InternalScreenRotation", &g_Config.iInternalScreenRotation, 1), + ConfigSetting("InternalScreenRotation", &g_Config.iInternalScreenRotation, ROTATION_LOCKED_HORIZONTAL), #if defined(USING_WIN_UI) ConfigSetting("TopMost", &g_Config.bTopMost, false), @@ -454,7 +454,7 @@ static bool DefaultFrameskipUnthrottle() { } static int DefaultZoomType() { - return 2; + return (int)SmallDisplayZoom::AUTO; } static bool DefaultTimerHack() { @@ -519,7 +519,7 @@ static ConfigSetting graphicsSettings[] = { ReportedConfigSetting("HardwareTransform", &g_Config.bHardwareTransform, true, true, true), ReportedConfigSetting("SoftwareSkinning", &g_Config.bSoftwareSkinning, true, true, true), ReportedConfigSetting("TextureFiltering", &g_Config.iTexFiltering, 1, true, true), - ReportedConfigSetting("BufferFiltering", &g_Config.iBufFilter, 1, true, true), + ReportedConfigSetting("BufferFiltering", &g_Config.iBufFilter, SCALE_LINEAR, true, true), ReportedConfigSetting("InternalResolution", &g_Config.iInternalResolution, &DefaultInternalResolution, true, true), ReportedConfigSetting("AndroidHwScale", &g_Config.iAndroidHwScale, &DefaultAndroidHwScale), ReportedConfigSetting("HighQualityDepth", &g_Config.bHighQualityDepth, true, true, true), @@ -1484,5 +1484,5 @@ void Config::GetReportingInfo(UrlEncoder &data) { } bool Config::IsPortrait() const { - return (iInternalScreenRotation == ROTATION_LOCKED_VERTICAL || iInternalScreenRotation == ROTATION_LOCKED_VERTICAL180) && iRenderingMode != 0; + return (iInternalScreenRotation == ROTATION_LOCKED_VERTICAL || iInternalScreenRotation == ROTATION_LOCKED_VERTICAL180) && iRenderingMode != FB_NON_BUFFERED_MODE; } diff --git a/Core/Config.h b/Core/Config.h index f6b780269b..3898eba28e 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -157,7 +157,7 @@ public: bool bTrueColor; bool bReplaceTextures; bool bSaveNewTextures; - int iTexScalingLevel; // 1 = off, 2 = 2x, ..., 5 = 5x + int iTexScalingLevel; // 0 = auto, 1 = off, 2 = 2x, ..., 5 = 5x int iTexScalingType; // 0 = xBRZ, 1 = Hybrid bool bTexDeposterize; int iFpsLimit; diff --git a/Core/ConfigValues.h b/Core/ConfigValues.h index 8b31c957e5..bc2df61f37 100644 --- a/Core/ConfigValues.h +++ b/Core/ConfigValues.h @@ -65,3 +65,9 @@ enum IOTimingMethods { IOTIMING_REALISTIC = 2, }; +enum class SmallDisplayZoom { + STRETCH = 0, + PARTIAL_STRETCH = 1, + AUTO = 2, + MANUAL = 3, +}; diff --git a/GPU/Common/FramebufferCommon.cpp b/GPU/Common/FramebufferCommon.cpp index 7b99614947..b8b1b7a48a 100644 --- a/GPU/Common/FramebufferCommon.cpp +++ b/GPU/Common/FramebufferCommon.cpp @@ -48,11 +48,11 @@ void CenterDisplayOutputRect(float *x, float *y, float *w, float *h, float origW bool rotated = rotation == ROTATION_LOCKED_VERTICAL || rotation == ROTATION_LOCKED_VERTICAL180; - if (g_Config.iSmallDisplayZoomType == 0) { // Stretching + if (g_Config.iSmallDisplayZoomType == (int)SmallDisplayZoom::STRETCH) { outW = frameW; outH = frameH; } else { - if (g_Config.iSmallDisplayZoomType == 3) { // Manual Scaling + if (g_Config.iSmallDisplayZoomType == (int)SmallDisplayZoom::MANUAL) { float offsetX = (g_Config.fSmallDisplayOffsetX - 0.5f) * 2.0f * frameW; float offsetY = (g_Config.fSmallDisplayOffsetY - 0.5f) * 2.0f * frameH; // Have to invert Y for GL @@ -75,7 +75,7 @@ void CenterDisplayOutputRect(float *x, float *y, float *w, float *h, float origW *h = floorf(smallDisplayW); return; } - } else if (g_Config.iSmallDisplayZoomType == 2) { // Auto Scaling + } else if (g_Config.iSmallDisplayZoomType == (int)SmallDisplayZoom::AUTO) { // Stretch to 1080 for 272*4. But don't distort if not widescreen (i.e. ultrawide of halfwide.) float pixelCrop = frameH / 270.0f; float resCommonWidescreen = pixelCrop - floor(pixelCrop); @@ -96,13 +96,13 @@ void CenterDisplayOutputRect(float *x, float *y, float *w, float *h, float origW outW = frameW; outH = frameW / origRatio; // Stretch a little bit - if (!rotated && g_Config.iSmallDisplayZoomType == 1) // Partial Stretch + if (!rotated && g_Config.iSmallDisplayZoomType == (int)SmallDisplayZoom::PARTIAL_STRETCH) outH = (frameH + outH) / 2.0f; // (408 + 720) / 2 = 564 } else { // Image is taller than frame. Center horizontally. outW = frameH * origRatio; outH = frameH; - if (rotated && g_Config.iSmallDisplayZoomType == 1) // Partial Stretch + if (rotated && g_Config.iSmallDisplayZoomType == (int)SmallDisplayZoom::PARTIAL_STRETCH) outW = (frameH + outH) / 2.0f; // (408 + 720) / 2 = 564 } } diff --git a/GPU/Common/ShaderUniforms.cpp b/GPU/Common/ShaderUniforms.cpp index 2e57ee6b72..21aee1ec11 100644 --- a/GPU/Common/ShaderUniforms.cpp +++ b/GPU/Common/ShaderUniforms.cpp @@ -7,6 +7,7 @@ #include "math/math_util.h" #include "math/lin/vec3.h" #include "GPU/GPUState.h" +#include "GPU/Common/FramebufferCommon.h" #include "GPU/Common/GPUStateUtils.h" #include "GPU/Math3D.h" #include "Core/Reporting.h" @@ -82,7 +83,7 @@ void BaseUpdateUniforms(UB_VS_FS_Base *ub, uint64_t dirtyUniforms, bool flipView ConvertProjMatrixToVulkan(flippedMatrix); } - if (g_Config.iRenderingMode == 0 && g_display_rotation != DisplayRotation::ROTATE_0) { + if (g_Config.iRenderingMode == FB_NON_BUFFERED_MODE && g_display_rotation != DisplayRotation::ROTATE_0) { flippedMatrix = flippedMatrix * g_display_rot_matrix; } @@ -96,7 +97,7 @@ void BaseUpdateUniforms(UB_VS_FS_Base *ub, uint64_t dirtyUniforms, bool flipView } else { proj_through.setOrthoVulkan(0.0f, gstate_c.curRTWidth, 0, gstate_c.curRTHeight, 0, 1); } - if (g_Config.iRenderingMode == 0 && g_display_rotation != DisplayRotation::ROTATE_0) { + if (g_Config.iRenderingMode == FB_NON_BUFFERED_MODE && g_display_rotation != DisplayRotation::ROTATE_0) { proj_through = proj_through * g_display_rot_matrix; } CopyMatrix4x4(ub->proj_through, proj_through.getReadPtr()); diff --git a/GPU/GLES/GPU_GLES.cpp b/GPU/GLES/GPU_GLES.cpp index 6b4864c2c6..4e409ccd60 100644 --- a/GPU/GLES/GPU_GLES.cpp +++ b/GPU/GLES/GPU_GLES.cpp @@ -459,7 +459,7 @@ void GPU_GLES::CopyDisplayToOutput() { // If buffered, discard the depth buffer of the backbuffer. Don't even know if we need one. #if 0 #ifdef USING_GLES2 - if (gl_extensions.EXT_discard_framebuffer && g_Config.iRenderingMode != 0) { + if (gl_extensions.EXT_discard_framebuffer && g_Config.iRenderingMode != FB_NON_BUFFERED_MODE) { GLenum attachments[] = {GL_DEPTH_EXT, GL_STENCIL_EXT}; glDiscardFramebufferEXT(GL_FRAMEBUFFER, 2, attachments); } diff --git a/GPU/Software/Rasterizer.cpp b/GPU/Software/Rasterizer.cpp index 77d45c5191..f6b6e398e7 100644 --- a/GPU/Software/Rasterizer.cpp +++ b/GPU/Software/Rasterizer.cpp @@ -28,6 +28,7 @@ #include "Core/Reporting.h" #include "GPU/GPUState.h" +#include "GPU/Common/TextureCacheCommon.h" #include "GPU/Common/TextureDecoder.h" #include "GPU/Software/SoftGpu.h" #include "GPU/Software/Rasterizer.h" @@ -1081,9 +1082,9 @@ static inline void CalculateSamplingParams(const float ds, const float dt, const levelFrac = 0; } - if (g_Config.iTexFiltering == 3) { + if (g_Config.iTexFiltering == TEX_FILTER_LINEAR) { filt = true; - } else if (g_Config.iTexFiltering == 2) { + } else if (g_Config.iTexFiltering == TEX_FILTER_NEAREST) { filt = false; } else { filt = detail > 0 ? gstate.isMinifyFilteringEnabled() : gstate.isMagnifyFilteringEnabled(); diff --git a/GPU/Vulkan/DrawEngineVulkan.cpp b/GPU/Vulkan/DrawEngineVulkan.cpp index a85d32e52e..405c10fc54 100644 --- a/GPU/Vulkan/DrawEngineVulkan.cpp +++ b/GPU/Vulkan/DrawEngineVulkan.cpp @@ -784,7 +784,7 @@ void DrawEngineVulkan::DoFlush() { if (prim != lastPrim_ || gstate_c.IsDirty(DIRTY_BLEND_STATE | DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_RASTER_STATE | DIRTY_DEPTHSTENCIL_STATE)) { ConvertStateToVulkanKey(*framebufferManager_, shaderManager_, prim, pipelineKey_, dynState_); } - Draw::NativeObject object = g_Config.iRenderingMode != 0 ? Draw::NativeObject::FRAMEBUFFER_RENDERPASS : Draw::NativeObject::BACKBUFFER_RENDERPASS; + Draw::NativeObject object = g_Config.iRenderingMode != FB_NON_BUFFERED_MODE ? Draw::NativeObject::FRAMEBUFFER_RENDERPASS : Draw::NativeObject::BACKBUFFER_RENDERPASS; VkRenderPass renderPass = (VkRenderPass)draw_->GetNativeObject(object); VulkanPipeline *pipeline = pipelineManager_->GetOrCreatePipeline(pipelineLayout_, renderPass, pipelineKey_, &dec_->decFmt, vshader, fshader, true); if (!pipeline || !pipeline->pipeline) { @@ -860,9 +860,9 @@ void DrawEngineVulkan::DoFlush() { params.transformedExpanded = transformedExpanded; params.fbman = framebufferManager_; params.texCache = textureCache_; - // We have to force drawing of primitives if g_Config.iRenderingMode == 0 (non-buffered) because Vulkan clears + // We have to force drawing of primitives if g_Config.iRenderingMode == FB_NON_BUFFERED_MODE because Vulkan clears // do not respect scissor rects. - params.allowClear = g_Config.iRenderingMode != 0; + params.allowClear = g_Config.iRenderingMode != FB_NON_BUFFERED_MODE; params.allowSeparateAlphaClear = false; params.provokeFlatFirst = true; @@ -889,7 +889,7 @@ void DrawEngineVulkan::DoFlush() { if (prim != lastPrim_ || gstate_c.IsDirty(DIRTY_BLEND_STATE | DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_RASTER_STATE | DIRTY_DEPTHSTENCIL_STATE)) { ConvertStateToVulkanKey(*framebufferManager_, shaderManager_, prim, pipelineKey_, dynState_); } - Draw::NativeObject object = g_Config.iRenderingMode != 0 ? Draw::NativeObject::FRAMEBUFFER_RENDERPASS : Draw::NativeObject::BACKBUFFER_RENDERPASS; + Draw::NativeObject object = g_Config.iRenderingMode != FB_NON_BUFFERED_MODE ? Draw::NativeObject::FRAMEBUFFER_RENDERPASS : Draw::NativeObject::BACKBUFFER_RENDERPASS; VkRenderPass renderPass = (VkRenderPass)draw_->GetNativeObject(object); VulkanPipeline *pipeline = pipelineManager_->GetOrCreatePipeline(pipelineLayout_, renderPass, pipelineKey_, &dec_->decFmt, vshader, fshader, false); if (!pipeline || !pipeline->pipeline) { diff --git a/UI/DisplayLayoutScreen.cpp b/UI/DisplayLayoutScreen.cpp index a41b2b53cf..0ba1901811 100644 --- a/UI/DisplayLayoutScreen.cpp +++ b/UI/DisplayLayoutScreen.cpp @@ -73,7 +73,7 @@ bool DisplayLayoutScreen::touch(const TouchInput &touch) { using namespace UI; int mode = mode_ ? mode_->GetSelection() : 0; - if (g_Config.iSmallDisplayZoomType == 2) { mode = -1; } + if (g_Config.iSmallDisplayZoomType == (int)SmallDisplayZoom::AUTO) { mode = -1; } const Bounds &screen_bounds = screenManager()->getUIContext()->GetBounds(); if ((touch.flags & TOUCH_MOVE) && picked_ != 0) { @@ -186,7 +186,7 @@ UI::EventReturn DisplayLayoutScreen::OnCenter(UI::EventParams &e) { }; UI::EventReturn DisplayLayoutScreen::OnZoomTypeChange(UI::EventParams &e) { - if (g_Config.iSmallDisplayZoomType < 3) { + if (g_Config.iSmallDisplayZoomType < (int)SmallDisplayZoom::MANUAL) { const Bounds &bounds = screenManager()->getUIContext()->GetBounds(); float autoBound = bounds.w / 480.0f; g_Config.fSmallDisplayZoomLevel = autoBound; @@ -269,8 +269,8 @@ void DisplayLayoutScreen::CreateViews() { HighlightLabel *label = nullptr; mode_ = nullptr; - if (g_Config.iSmallDisplayZoomType > 1) { // Scaling - if (g_Config.iSmallDisplayZoomType == 2) { // Auto Scaling + if (g_Config.iSmallDisplayZoomType >= (int)SmallDisplayZoom::AUTO) { // Scaling + if (g_Config.iSmallDisplayZoomType == (int)SmallDisplayZoom::AUTO) { label = new HighlightLabel(gr->T("Auto Scaling"), new AnchorLayoutParams(WRAP_CONTENT, 64.0f, local_dp_xres / 2.0f, local_dp_yres / 2.0f, NONE, NONE, true)); float autoBound = local_dp_yres / 270.0f; // Case of screen rotated ~ only works with buffered rendering @@ -312,7 +312,7 @@ void DisplayLayoutScreen::CreateViews() { displayRepresentation_->SetVisibility(V_INVISIBLE); float width = previewWidth; float height = previewHeight; - if (g_Config.iSmallDisplayZoomType == 0) { // Stretched + if (g_Config.iSmallDisplayZoomType == (int)SmallDisplayZoom::STRETCH) { Choice *stretched = new Choice("", "", false, new AnchorLayoutParams(width, height, width - width / 2.0f, NONE, NONE, height - height / 2.0f)); stretched->SetEnabled(false); root_->Add(stretched); @@ -321,12 +321,12 @@ void DisplayLayoutScreen::CreateViews() { float frameRatio = width / height; if (origRatio > frameRatio) { height = width / origRatio; - if (!bRotated && g_Config.iSmallDisplayZoomType == 1) { + if (!bRotated && g_Config.iSmallDisplayZoomType == (int)SmallDisplayZoom::PARTIAL_STRETCH) { height = (272.0f + height) / 2.0f; } } else { width = height * origRatio; - if (bRotated && g_Config.iSmallDisplayZoomType == 1) { + if (bRotated && g_Config.iSmallDisplayZoomType == (int)SmallDisplayZoom::PARTIAL_STRETCH) { width = (272.0f + height) / 2.0f; } } diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index 1bf76c3a36..cc00b5326d 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -1060,7 +1060,7 @@ namespace MainWindow { CHECKITEM(ID_OPTIONS_VERTEXCACHE, g_Config.bVertexCache); CHECKITEM(ID_OPTIONS_SHOWFPS, g_Config.iShowFPSCounter); CHECKITEM(ID_OPTIONS_FRAMESKIP_AUTO, g_Config.bAutoFrameSkip); - CHECKITEM(ID_OPTIONS_FRAMESKIP, g_Config.iFrameSkip != 0); + CHECKITEM(ID_OPTIONS_FRAMESKIP, g_Config.iFrameSkip != FRAMESKIP_OFF); CHECKITEM(ID_OPTIONS_VSYNC, g_Config.bVSync); CHECKITEM(ID_OPTIONS_TOPMOST, g_Config.bTopMost); CHECKITEM(ID_OPTIONS_PAUSE_FOCUS, g_Config.bPauseOnLostFocus); diff --git a/headless/Headless.cpp b/headless/Headless.cpp index 6f939a909a..a03ab6664f 100644 --- a/headless/Headless.cpp +++ b/headless/Headless.cpp @@ -18,6 +18,7 @@ #include "Core/HLE/sceUtility.h" #include "Core/Host.h" #include "Core/SaveState.h" +#include "GPU/Common/FramebufferCommon.h" #include "Log.h" #include "LogManager.h" #include "base/NativeApp.h" @@ -349,7 +350,7 @@ int main(int argc, const char* argv[]) // Never report from tests. g_Config.sReportHost = ""; g_Config.bAutoSaveSymbolMap = false; - g_Config.iRenderingMode = 1; + g_Config.iRenderingMode = FB_BUFFERED_MODE; g_Config.bHardwareTransform = true; g_Config.iAnisotropyLevel = 0; // When testing mipmapping we really don't want this. g_Config.bVertexCache = true;