mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-12-16 04:09:39 +00:00
VideoCommon: rename ScissorResult 'm_result' to 'rectangles' to better reflect what the member is
This commit is contained in:
parent
ee7c476e24
commit
6728007cb4
@ -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
|
||||
|
||||
@ -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<u32>(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
|
||||
{
|
||||
|
||||
@ -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<ScissorRect> m_result;
|
||||
std::vector<ScissorRect> rectangles;
|
||||
|
||||
ScissorRect Best() const;
|
||||
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user