| 466 | |
| 467 | |
| 468 | static void Draw(HRenderProfile render_profile, dmRender::HRenderContext render_context, dmRender::HFontMap font_map, const Size display_size, DisplayMode display_mode) |
| 469 | { |
| 470 | uint32_t batch_key = 0; |
| 471 | { |
| 472 | HashState64 key_state; |
| 473 | dmHashInit64(&key_state, false); |
| 474 | dmHashUpdateBuffer64(&key_state, &font_map, sizeof(font_map)); |
| 475 | uint16_t render_order = 0; |
| 476 | dmHashUpdateBuffer64(&key_state, &render_order, sizeof(uint16_t)); |
| 477 | batch_key = dmHashFinal64(&key_state); |
| 478 | } |
| 479 | |
| 480 | const int SAMPLE_FRAMES_NAME_WIDTH = display_mode == DISPLAYMODE_LANDSCAPE ? LANDSCAPE_SAMPLE_FRAMES_NAME_WIDTH : PORTRAIT_SAMPLE_FRAMES_NAME_WIDTH; |
| 481 | |
| 482 | const Area profiler_area = GetProfilerArea(display_mode, display_size); |
| 483 | FillArea(render_context, profiler_area, PROFILER_BG_COLOR); |
| 484 | |
| 485 | const Area header_area = GetHeaderArea(display_mode, profiler_area); |
| 486 | const Area details_area = GetDetailsArea(display_mode, profiler_area, header_area); |
| 487 | |
| 488 | ProfilerFrame empty_frame; |
| 489 | ProfilerFrame* frame = render_profile->m_ActiveFrame ? render_profile->m_ActiveFrame : render_profile->m_CurrentFrame; |
| 490 | frame = frame ? frame : &empty_frame; |
| 491 | |
| 492 | std::sort(frame->m_Threads.Begin(), frame->m_Threads.End(), ThreadSortTimePred()); |
| 493 | |
| 494 | const uint32_t properties_count = frame->m_Properties.Size(); |
| 495 | const uint32_t extra_lines = 3; // a few extra lines for "Properties" word and offset in top |
| 496 | |
| 497 | const Area properties_area = GetPropertiesArea(display_mode, profiler_area, properties_count + extra_lines); |
| 498 | const Area samples_area = GetSamplesArea(display_mode, details_area); |
| 499 | const Area sample_frames_area = GetSampleFramesArea(display_mode, SAMPLE_FRAMES_NAME_WIDTH, samples_area, properties_area); |
| 500 | |
| 501 | char buffer[256]; |
| 502 | |
| 503 | dmRender::DrawTextParams params; |
| 504 | params.m_FaceColor = TITLE_FACE_COLOR; |
| 505 | params.m_ShadowColor = TITLE_SHADOW_COLOR; |
| 506 | params.m_RenderOrder = 0xFFFFFFu; |
| 507 | |
| 508 | ProfilerThread* thread = GetSelectedThread(render_profile, frame); |
| 509 | |
| 510 | uint64_t ticks_per_second = render_profile->m_TicksPerSecond; |
| 511 | uint64_t max_frame_time = render_profile->m_MaxFrameTime; |
| 512 | uint64_t frame_time = thread->m_SamplesTotalTime; |
| 513 | uint32_t drawcalls = 0; |
| 514 | |
| 515 | float frame_time_f = frame_time / (float)ticks_per_second; |
| 516 | float max_frame_time_f = max_frame_time / (float)ticks_per_second; |
| 517 | |
| 518 | { |
| 519 | // Properties |
| 520 | int y = properties_area.p.y + properties_area.s.h - LINE_SPACING; |
| 521 | |
| 522 | int name_x = properties_area.p.x; |
| 523 | int count_x = name_x + COUNTERS_NAME_WIDTH + CHARACTER_WIDTH; |
| 524 | |
| 525 | params.m_FaceColor = TITLE_FACE_COLOR; |