diff --git a/Source/Core/VideoBackends/Software/Rasterizer.cpp b/Source/Core/VideoBackends/Software/Rasterizer.cpp index ebd6033ae41..2839e05b739 100644 --- a/Source/Core/VideoBackends/Software/Rasterizer.cpp +++ b/Source/Core/VideoBackends/Software/Rasterizer.cpp @@ -116,7 +116,7 @@ void ScissorChanged() { auto scissor_result = BPFunctions::ComputeScissorRects(bpmem.scissorTL, bpmem.scissorBR, bpmem.scissorOffset, xfmem.viewport); - scissors = std::move(scissor_result.m_result); + scissors = std::move(scissor_result.rectangles); } // Returns approximation of log2(f) in s28.4 diff --git a/Source/Core/VideoCommon/BPFunctions.cpp b/Source/Core/VideoCommon/BPFunctions.cpp index 1018af01424..660d85c5989 100644 --- a/Source/Core/VideoCommon/BPFunctions.cpp +++ b/Source/Core/VideoCommon/BPFunctions.cpp @@ -131,7 +131,7 @@ ScissorResult::ScissorResult(ScissorPos scissor_top_left, ScissorPos scissor_bot RangeList x_ranges = ComputeScissorRanges(left, right, x_off, EFB_WIDTH); RangeList y_ranges = ComputeScissorRanges(top, bottom, y_off, EFB_HEIGHT); - m_result.reserve(x_ranges.size() * y_ranges.size()); + rectangles.reserve(x_ranges.size() * y_ranges.size()); // Now we need to form actual rectangles from the x and y ranges, // which is a simple Cartesian product of x_ranges_clamped and y_ranges_clamped. @@ -145,12 +145,12 @@ ScissorResult::ScissorResult(ScissorPos scissor_top_left, ScissorPos scissor_bot { DEBUG_ASSERT(y_range.start < y_range.end); DEBUG_ASSERT(static_cast(y_range.end) <= EFB_HEIGHT); - m_result.emplace_back(x_range, y_range); + rectangles.emplace_back(x_range, y_range); } } auto cmp = [&](const ScissorRect& lhs, const ScissorRect& rhs) { return IsWorse(lhs, rhs); }; - std::ranges::sort(m_result, cmp); + std::ranges::sort(rectangles, cmp); } ScissorRect ScissorResult::Best() const @@ -158,9 +158,9 @@ ScissorRect ScissorResult::Best() const // For now, simply choose the best rectangle (see ScissorResult::IsWorse). // This does mean we calculate all rectangles and only choose one, which is not optimal, but this // is called infrequently. Eventually, all backends will support multiple scissor rects. - if (!m_result.empty()) + if (!rectangles.empty()) { - return m_result.back(); + return rectangles.back(); } else { diff --git a/Source/Core/VideoCommon/BPFunctions.h b/Source/Core/VideoCommon/BPFunctions.h index 770d1c674de..a91b98cc401 100644 --- a/Source/Core/VideoCommon/BPFunctions.h +++ b/Source/Core/VideoCommon/BPFunctions.h @@ -76,7 +76,7 @@ struct ScissorResult : scissor_tl{.hex = other.scissor_tl.hex}, scissor_br{.hex = other.scissor_br.hex}, scissor_off{.hex = other.scissor_off.hex}, viewport_left{other.viewport_left}, viewport_right{other.viewport_right}, viewport_top{other.viewport_top}, - viewport_bottom{other.viewport_bottom}, m_result{other.m_result} + viewport_bottom{other.viewport_bottom}, rectangles{other.rectangles} { } ScissorResult& operator=(const ScissorResult& other) @@ -90,14 +90,14 @@ struct ScissorResult viewport_right = other.viewport_right; viewport_top = other.viewport_top; viewport_bottom = other.viewport_bottom; - m_result = other.m_result; + rectangles = other.rectangles; return *this; } ScissorResult(ScissorResult&& other) : scissor_tl{.hex = other.scissor_tl.hex}, scissor_br{.hex = other.scissor_br.hex}, scissor_off{.hex = other.scissor_off.hex}, viewport_left{other.viewport_left}, viewport_right{other.viewport_right}, viewport_top{other.viewport_top}, - viewport_bottom{other.viewport_bottom}, m_result{std::move(other.m_result)} + viewport_bottom{other.viewport_bottom}, rectangles{std::move(other.rectangles)} { } ScissorResult& operator=(ScissorResult&& other) @@ -111,7 +111,7 @@ struct ScissorResult viewport_right = other.viewport_right; viewport_top = other.viewport_top; viewport_bottom = other.viewport_bottom; - m_result = std::move(other.m_result); + rectangles = std::move(other.rectangles); return *this; } @@ -124,8 +124,7 @@ struct ScissorResult float viewport_top; float viewport_bottom; - // Actual result - std::vector m_result; + std::vector rectangles; ScissorRect Best() const; diff --git a/Source/Core/VideoCommon/Statistics.cpp b/Source/Core/VideoCommon/Statistics.cpp index b7e49feb198..db098db5c7f 100644 --- a/Source/Core/VideoCommon/Statistics.cpp +++ b/Source/Core/VideoCommon/Statistics.cpp @@ -313,13 +313,13 @@ void Statistics::DisplayScissor() draw_rect(info.viewport_left, info.viewport_top, info.viewport_right, info.viewport_bottom, col); } - for (size_t i = 0; i < info.m_result.size(); i++) + for (size_t i = 0; i < info.rectangles.size(); i++) { // The last entry in the sorted list of results is the one that is used by hardware backends - const u8 new_alpha = (i == info.m_result.size() - 1) ? 0x40 : 0x80; + const u8 new_alpha = (i == info.rectangles.size() - 1) ? 0x40 : 0x80; const ImU32 new_col = (col & ~IM_COL32_A_MASK) | (new_alpha << IM_COL32_A_SHIFT); - const auto& r = info.m_result[i]; + const auto& r = info.rectangles[i]; draw_list->AddRectFilled(vec(r.rect.left + r.x_off, r.rect.top + r.y_off), vec(r.rect.right + r.x_off, r.rect.bottom + r.y_off), new_col); } @@ -367,14 +367,14 @@ void Statistics::DisplayScissor() ImVec2 p2 = ImGui::GetCursorScreenPos(); // Use a height of 1 since we want this to span two table rows (if possible) ImGui::Dummy(ImVec2(EFB_WIDTH * scale_height, 1)); - for (size_t i = 0; i < info.m_result.size(); i++) + for (size_t i = 0; i < info.rectangles.size(); i++) { // The last entry in the sorted list of results is the one that is used by hardware backends - const u8 new_alpha = (i == info.m_result.size() - 1) ? 0x80 : 0x40; + const u8 new_alpha = (i == info.rectangles.size() - 1) ? 0x80 : 0x40; const ImU32 col = ImGui::GetColorU32(COLORS[index % COLORS.size()]); const ImU32 new_col = (col & ~IM_COL32_A_MASK) | (new_alpha << IM_COL32_A_SHIFT); - const auto& r = info.m_result[i]; + const auto& r = info.rectangles[i]; draw_list->AddRectFilled( ImVec2(p2.x + r.rect.left * scale_height, p2.y + r.rect.top * scale_height), ImVec2(p2.x + r.rect.right * scale_height, p2.y + r.rect.bottom * scale_height), new_col); @@ -382,7 +382,7 @@ void Statistics::DisplayScissor() draw_list->AddRect( p2, ImVec2(p2.x + EFB_WIDTH * scale_height, p2.y + EFB_HEIGHT * scale_height), light_grey); ImGui::SameLine(); - ImGui::Text("%d", int(info.m_result.size())); + ImGui::Text("%d", int(info.rectangles.size())); if (show_raw_scissors) {