Skip to content

Commit

Permalink
PR #114
Browse files Browse the repository at this point in the history
14.06.24 - SpoutUtils.h - PR #114
   Correct conditional definition of EndTiming in header file
   Allow mingw to define USE_CHRONO if available
   Include <math.h> to fix mingw build
  • Loading branch information
leadedge committed Jun 14, 2024
1 parent 6240c2f commit 8878a8f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
5 changes: 5 additions & 0 deletions SPOUTSDK/SpoutGL/SpoutUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@
19.03.24 - Add icon/button option for variable arguments
29.03.24 - Correct ReadPathFromRegistry definition for default size argument
Correct EndTiming definition for microseconds argument
14.06.24 - SpoutUtils.h - PR #114
Correct conditional definition of EndTiming in header file
Allow mingw to define USE_CHRONO if available
Include <math.h> to fix mingw build
*/
Expand Down
21 changes: 13 additions & 8 deletions SPOUTSDK/SpoutGL/SpoutUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include <string>
#include <Shellapi.h> // for shellexecute
#include <Commctrl.h> // For TaskDialogIndirect
#include <math.h> // for round

//
// C++11 timer is only available for MS Visual Studio 2015 and above.
Expand All @@ -56,7 +57,9 @@
// If this is a problem, remove _MSC_VER_ and manually enable/disable the USE_CHRONO define.
//
// PR #84 Fixes for clang
#if _MSC_VER >= 1900 || (defined(__clang__) && __cplusplus >= 201103L)
// PR #114 Fixes for MingW
#if (defined(_MSC_VER) && (_MSC_VER >= 1900)) || (defined(__cplusplus) && (__cplusplus >= 201103L))

#define USE_CHRONO
#endif

Expand Down Expand Up @@ -312,21 +315,23 @@ namespace spoututils {
// Timing functions
//

// Monitor refresh rate
double SPOUT_DLLEXP GetRefreshRate();

// Start timing period
void SPOUT_DLLEXP StartTiming();

// Stop timing and return microseconds elapsed.
#ifdef USE_CHRONO
// Stop timing and return milliseconds or microseconds elapsed.
// (microseconds default).
// Code console output can be enabled for quick timing tests.
// Default milliseconds
double SPOUT_DLLEXP EndTiming(bool microseconds = false);

// Monitor refresh rate
double SPOUT_DLLEXP GetRefreshRate();

#ifdef USE_CHRONO
// Microseconds elapsed since epoch
double SPOUT_DLLEXP ElapsedMicroseconds();
#else
double SPOUT_DLLEXP EndTiming();
#endif

void SPOUT_DLLEXP StartCounter();
double SPOUT_DLLEXP GetCounter();

Expand Down

0 comments on commit 8878a8f

Please sign in to comment.