Statistics.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. // Copyright 2008 Dolphin Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include <array>
  5. #include <vector>
  6. #include "VideoCommon/BPFunctions.h"
  7. struct Statistics
  8. {
  9. int num_pixel_shaders_created = 0;
  10. int num_pixel_shaders_alive = 0;
  11. int num_vertex_shaders_created = 0;
  12. int num_vertex_shaders_alive = 0;
  13. int num_textures_created = 0;
  14. int num_textures_uploaded = 0;
  15. int num_textures_alive = 0;
  16. int num_vertex_loaders = 0;
  17. std::array<float, 6> proj{};
  18. std::array<float, 16> gproj{};
  19. std::array<float, 16> g2proj{};
  20. // For widescreen heuristic.
  21. float avg_persp_proj_viewport_ratio = 0;
  22. float avg_ortho_proj_viewport_ratio = 0;
  23. std::vector<BPFunctions::ScissorResult> scissors{};
  24. size_t current_scissor = 0; // 0 => all, otherwise index + 1
  25. int scissor_scale = 10;
  26. int scissor_expected_count = 0;
  27. bool allow_duplicate_scissors = false;
  28. bool show_scissors = true;
  29. bool show_raw_scissors = true;
  30. bool show_viewports = false;
  31. bool show_text = true;
  32. struct ThisFrame
  33. {
  34. int num_bp_loads = 0;
  35. int num_cp_loads = 0;
  36. int num_xf_loads = 0;
  37. int num_bp_loads_in_dl = 0;
  38. int num_cp_loads_in_dl = 0;
  39. int num_xf_loads_in_dl = 0;
  40. int num_prims = 0;
  41. int num_dl_prims = 0;
  42. int num_shader_changes = 0;
  43. int num_primitive_joins = 0;
  44. int num_draw_calls = 0;
  45. int num_dlists_called = 0;
  46. int bytes_vertex_streamed = 0;
  47. int bytes_index_streamed = 0;
  48. int bytes_uniform_streamed = 0;
  49. int num_triangles_clipped = 0;
  50. int num_triangles_in = 0;
  51. int num_triangles_rejected = 0;
  52. int num_triangles_culled = 0;
  53. int num_drawn_objects = 0;
  54. int rasterized_pixels = 0;
  55. int num_triangles_drawn = 0;
  56. int num_vertices_loaded = 0;
  57. int tev_pixels_in = 0;
  58. int tev_pixels_out = 0;
  59. int num_efb_peeks = 0;
  60. int num_efb_pokes = 0;
  61. int num_draw_done = 0;
  62. int num_token = 0;
  63. int num_token_int = 0;
  64. };
  65. ThisFrame this_frame;
  66. void ResetFrame();
  67. void SwapDL();
  68. void AddScissorRect();
  69. void Display() const;
  70. void DisplayProj() const;
  71. void DisplayScissor();
  72. };
  73. extern Statistics g_stats;
  74. #define STATISTICS
  75. #ifdef STATISTICS
  76. #define INCSTAT(a) \
  77. do \
  78. { \
  79. (a)++; \
  80. } while (false)
  81. #define ADDSTAT(a, b) \
  82. do \
  83. { \
  84. (a) += (b); \
  85. } while (false)
  86. #define SETSTAT(a, x) \
  87. do \
  88. { \
  89. (a) = static_cast<int>(x); \
  90. } while (false)
  91. #else
  92. #define INCSTAT(a) \
  93. do \
  94. { \
  95. } while (false)
  96. #define ADDSTAT(a, b) \
  97. do \
  98. { \
  99. } while (false)
  100. #define SETSTAT(a, x) \
  101. do \
  102. { \
  103. } while (false)
  104. #endif