You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
812B

  1. #ifndef PERF_H
  2. #define PERF_H
  3. #include "nanovg.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. enum FPSrenderStyle {
  8. FPS_RENDER_FPS,
  9. FPS_RENDER_MS,
  10. };
  11. #define FPS_HISTORY_COUNT 100
  12. struct FPScounter {
  13. int style;
  14. char name[32];
  15. float values[FPS_HISTORY_COUNT];
  16. int head;
  17. };
  18. void initFPS(struct FPScounter* fps, int style, const char* name);
  19. void updateFPS(struct FPScounter* fps, float frameTime);
  20. void renderFPS(struct NVGcontext* vg, float x, float y, struct FPScounter* fps);
  21. #define GPU_QUERY_COUNT 5
  22. struct GPUtimer {
  23. int supported;
  24. int cur, ret;
  25. unsigned int queries[GPU_QUERY_COUNT];
  26. };
  27. void initGPUTimer(struct GPUtimer* timer);
  28. void startGPUTimer(struct GPUtimer* timer);
  29. int stopGPUTimer(struct GPUtimer* timer, float* times, int maxTimes);
  30. #ifdef __cplusplus
  31. }
  32. #endif
  33. #endif // PERF_H