Skip to content

Commit

Permalink
[gpu.settings] added settings_get_vsync to query as to whether vsync …
Browse files Browse the repository at this point in the history
…is enabled or not. Also documented the new settings API functions
  • Loading branch information
harrand committed Nov 2, 2024
1 parent f7a0b39 commit 18773b6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
19 changes: 19 additions & 0 deletions include/tz/gpu/settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@

namespace tz::gpu
{
/**
* @ingroup tz_gpu
* @defgroup tz_gpu_settings Settings
* @brief Global settings that affect all passes and graphs. The kind of stuff you'd expect to see in a game's video options.
*/

/**
* @ingroup tz_gpu_settings
* @brief Query as to whether vsync is enabled.
*
* By default, vsync is disabled.
*/
bool settings_get_vsync();
/**
* @ingroup tz_gpu_settings
* @brief Enable/disable vsync.
*
* By default, vsync is disabled. You should assume that this function will take a significantly long time.
*/
void settings_set_vsync(bool enabled);
}

Expand Down
5 changes: 5 additions & 0 deletions src/tz/gpu/rhi_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1685,6 +1685,11 @@ namespace tz::gpu
current_frame = (current_frame + 1) % frame_overlap;
}

bool settings_get_vsync()
{
return settings.vsync_enabled;
}

void settings_set_vsync(bool enabled)
{
if(settings.vsync_enabled == enabled)
Expand Down

0 comments on commit 18773b6

Please sign in to comment.