Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use thicker lines on hiDPI displays in the editor profiler and visual profiler #99084

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Nov 11, 2024

  • Draw a line in the middle between the CPU and GPU graphs.
  • Make the target FPS line/legend styling match the one used in the Monitors tab.

Preview

Profiler

Profiler

Visual Profiler

Visual Profiler

@Calinou Calinou added this to the 4.4 milestone Nov 11, 2024
@Calinou Calinou requested a review from a team as a code owner November 11, 2024 18:27
… profiler

- Draw a line in the middle between the CPU and GPU graphs.
- Make the target FPS line/legend styling match the one used in the
  Monitors tab.
@Calinou Calinou force-pushed the editor-profiler-hidpi-thick-lines branch from 22d4bc0 to 73a1def Compare November 11, 2024 18:35
@fire fire requested a review from a team November 11, 2024 19:03
Copy link
Member

@fire fire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use a hidpi display.

Comment on lines +292 to +298
if (EDSCALE > (1.5 - CMP_EPSILON)) {
// Make the line thicker for hiDPI displays.
column[j * 4 + 4] += Math::fast_ftoi(CLAMP(col.r * 255, 0, 255));
column[j * 4 + 5] += Math::fast_ftoi(CLAMP(col.g * 255, 0, 255));
column[j * 4 + 6] += Math::fast_ftoi(CLAMP(col.b * 255, 0, 255));
column[j * 4 + 7] += 1;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have additional check for j value. Not sure if this ever happens, but seems like plot_pos can point to the last column (h - 1), and in this case it will go out of bounds of columns (size h * 4).

@@ -453,44 +453,57 @@ void EditorVisualProfiler::_graph_tex_draw() {
int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
const Color color = get_theme_color(SceneStringName(font_color), EditorStringName(Editor));

const int half_width = graph->get_size().x / 2;
// Draw a line in the middle to separate the CPU graph from the GPU graph.
graph->draw_line(Vector2(half_width, 0), Vector2(half_width, graph->get_size().y), color * Color(1, 1, 1, 0.3), Math::round(EDSCALE));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EDSCALE can be less than one, so can be rounded to zero if it's too small (UI clamps it to 0.5), and seems like draw_line will draw nothing if width is zero (bug?).

Copy link
Member Author

@Calinou Calinou Nov 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Math::round(EDSCALE) is a pattern we use a lot currently, and I don't think anyone is using an editor scale below 0.5. The value 0.5 rounds to 1.0 anyway since round() always rounds away from 0.0. The smallest preset available is 0.75, and it's the smallest value I expect to be practically usable (it was designed for 1366×768 displays which are getting uncommon).

@Repiteo Repiteo modified the milestones: 4.4, 4.x Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants