X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fscreen.h;h=f66c7aa762e140c5d5d4b7798155b982f9945a2f;hp=ddcf8cace42c35083c763c874250fcd2009c7a63;hb=b95fd30aafb3f47d2bfc8aa8f75600db4fdb995c;hpb=bdda0103bf26d215d41093316ca0e15cd67fec1d diff --git a/src/screen.h b/src/screen.h index ddcf8ca..f66c7aa 100644 --- a/src/screen.h +++ b/src/screen.h @@ -7,6 +7,7 @@ #include "stb_truetype.h" #include "graphicsbuffer.h" +#include "shaderprogram.h" namespace IPDF { @@ -58,6 +59,11 @@ namespace IPDF void ScreenShot(const char * filename) const; void RenderBMP(const char * filename) const; + + // Returns the CPU time (in seconds) it took to render the last completed frame. + double GetLastFrameTimeCPU() const { return m_last_frame_time / SDL_GetPerformanceFrequency(); } + // Returns the GPU time (in seconds) it took to render the last completed frame. + double GetLastFrameTimeGPU() const; private: void ResizeViewport(int width, int height); void DebugFontFlush(); @@ -66,10 +72,18 @@ namespace IPDF int m_last_mouse_x; int m_last_mouse_y; + double m_last_frame_time; + double m_frame_begin_time; + GLuint m_frame_gpu_timer; + GLuint m_last_frame_gpu_timer; + int m_viewport_width; int m_viewport_height; SDL_Window *m_window; SDL_GLContext m_gl_context; + ShaderProgram m_texture_prog; + GLint m_colour_uniform_location; + GraphicsBuffer m_viewport_ubo; stbtt_bakedchar m_debug_font_rects[96]; unsigned int m_debug_font_atlas; float m_debug_font_x;