diff --git a/Common/GPU/Vulkan/VulkanRenderManager.h b/Common/GPU/Vulkan/VulkanRenderManager.h index 1914f5214c..d2adc7d346 100644 --- a/Common/GPU/Vulkan/VulkanRenderManager.h +++ b/Common/GPU/Vulkan/VulkanRenderManager.h @@ -185,13 +185,22 @@ public: // Clamp to curWidth_/curHeight_. Apparently an issue. if ((int)(rc.offset.x + rc.extent.width) > curWidth_) { - rc.extent.width = curWidth_ - rc.offset.x; + int newWidth = curWidth_ - rc.offset.x; + rc.extent.width = std::max(1, newWidth); + if (rc.offset.x >= curWidth_) { + // Fallback. + rc.offset.x = curWidth_ - rc.extent.width; + } } + if ((int)(rc.offset.y + rc.extent.height) > curHeight_) { - rc.extent.height = curHeight_ - rc.offset.y; + int newHeight = curHeight_ - rc.offset.y; + rc.extent.height = std::max(1, newHeight); + if (rc.offset.y >= curHeight_) { + // Fallback. + rc.offset.y = curHeight_ - rc.extent.height; + } } - _dbg_assert_((int)(rc.offset.x + rc.extent.width) <= curWidth_); - _dbg_assert_((int)(rc.offset.y + rc.extent.height) <= curHeight_); curRenderArea_.Apply(rc); VkRenderData data{ VKRRenderCommand::SCISSOR }; diff --git a/GPU/Common/PostShader.cpp b/GPU/Common/PostShader.cpp index fbb7297dea..b174b78191 100644 --- a/GPU/Common/PostShader.cpp +++ b/GPU/Common/PostShader.cpp @@ -83,7 +83,7 @@ void LoadPostShaderInfo(const std::vector &directories) { std::vector fileInfo; VFSGetFileListing(directories[d].c_str(), &fileInfo, "ini:"); - if (fileInfo.size() == 0) { + if (fileInfo.empty()) { File::GetFilesInDir(directories[d], &fileInfo, "ini:"); } diff --git a/UI/SavedataScreen.cpp b/UI/SavedataScreen.cpp index 1c44d8127c..747ebd5edc 100644 --- a/UI/SavedataScreen.cpp +++ b/UI/SavedataScreen.cpp @@ -317,13 +317,13 @@ void SavedataButton::Draw(UIContext &dc) { int availableWidth = bounds_.w - 150; float sineWidth = std::max(0.0f, (tw - availableWidth)) / 2.0f; - float tx = 150; + float tx = 150.0f; if (availableWidth < tw) { float overageRatio = 1.5f * availableWidth * 1.0f / tw; tx -= (1.0f + sin(time_now_d() * overageRatio)) * sineWidth; Bounds tb = bounds_; - tb.x = bounds_.x + 150; - tb.w = bounds_.w - 150; + tb.x = bounds_.x + 150.0f; + tb.w = std::max(1.0f, bounds_.w - 150.0f); dc.PushScissor(tb); } dc.DrawText(title_.c_str(), bounds_.x + tx, bounds_.y + 4, style.fgColor, ALIGN_TOPLEFT); @@ -443,6 +443,8 @@ bool SavedataBrowser::BySize(const UI::View *v1, const UI::View *v2) { if (GetTotalSize(b1) > GetTotalSize(b2)) return true; + else if (GetTotalSize(b1) < GetTotalSize(b2)) + return false; return strcmp(b1->GamePath().c_str(), b2->GamePath().c_str()) < 0; } @@ -469,6 +471,8 @@ bool SavedataBrowser::ByDate(const UI::View *v1, const UI::View *v2) { if (GetDateSeconds(b1) > GetDateSeconds(b2)) return true; + if (GetDateSeconds(b1) < GetDateSeconds(b2)) + return false; return strcmp(b1->GamePath().c_str(), b2->GamePath().c_str()) < 0; }