libobs: Add function to check fast clear capability

This commit is contained in:
Ryan Foster
2023-07-29 16:34:47 -07:00
committed by Lain
parent a8f770fdfc
commit e5d5df879c
5 changed files with 19 additions and 0 deletions
+5
View File
@@ -3593,3 +3593,8 @@ uint32_t gs_get_adapter_count(void)
return count;
}
extern "C" EXPORT bool device_can_adapter_fast_clear(gs_device_t *device)
{
return device->fastClearSupported;
}
+1
View File
@@ -221,6 +221,7 @@ bool load_graphics_imports(struct gs_exports *exports, void *module,
GRAPHICS_IMPORT_OPTIONAL(gs_duplicator_get_color_space);
GRAPHICS_IMPORT_OPTIONAL(gs_duplicator_get_sdr_white_level);
GRAPHICS_IMPORT_OPTIONAL(gs_get_adapter_count);
GRAPHICS_IMPORT_OPTIONAL(device_can_adapter_fast_clear);
GRAPHICS_IMPORT_OPTIONAL(device_texture_create_gdi);
GRAPHICS_IMPORT_OPTIONAL(gs_texture_get_dc);
GRAPHICS_IMPORT_OPTIONAL(gs_texture_release_dc);
+1
View File
@@ -312,6 +312,7 @@ struct gs_exports {
float (*gs_duplicator_get_sdr_white_level)(gs_duplicator_t *duplicator);
uint32_t (*gs_get_adapter_count)(void);
bool (*device_can_adapter_fast_clear)(gs_device_t *device);
gs_texture_t *(*device_texture_create_gdi)(gs_device_t *device,
uint32_t width,
+11
View File
@@ -3040,6 +3040,17 @@ uint32_t gs_get_adapter_count(void)
return thread_graphics->exports.gs_get_adapter_count();
}
bool gs_can_adapter_fast_clear(void)
{
if (!gs_valid("gs_can_adapter_fast_clear"))
return false;
if (!thread_graphics->exports.device_can_adapter_fast_clear)
return false;
return thread_graphics->exports.device_can_adapter_fast_clear(
thread_graphics->device);
}
gs_texture_t *gs_duplicator_get_texture(gs_duplicator_t *duplicator)
{
if (!gs_valid_p("gs_duplicator_get_texture", duplicator))
+1
View File
@@ -924,6 +924,7 @@ gs_duplicator_get_color_space(gs_duplicator_t *duplicator);
EXPORT float gs_duplicator_get_sdr_white_level(gs_duplicator_t *duplicator);
EXPORT uint32_t gs_get_adapter_count(void);
EXPORT bool gs_can_adapter_fast_clear(void);
/** creates a windows GDI-lockable texture */
EXPORT gs_texture_t *gs_texture_create_gdi(uint32_t width, uint32_t height);