diff --git a/libobs-d3d11/d3d11-subsystem.cpp b/libobs-d3d11/d3d11-subsystem.cpp index 75288746c..7f2d21203 100644 --- a/libobs-d3d11/d3d11-subsystem.cpp +++ b/libobs-d3d11/d3d11-subsystem.cpp @@ -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; +} diff --git a/libobs/graphics/graphics-imports.c b/libobs/graphics/graphics-imports.c index ddf8e96e4..f0e5c433f 100644 --- a/libobs/graphics/graphics-imports.c +++ b/libobs/graphics/graphics-imports.c @@ -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); diff --git a/libobs/graphics/graphics-internal.h b/libobs/graphics/graphics-internal.h index 6cf5cf577..4801acaf0 100644 --- a/libobs/graphics/graphics-internal.h +++ b/libobs/graphics/graphics-internal.h @@ -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, diff --git a/libobs/graphics/graphics.c b/libobs/graphics/graphics.c index d84df70c8..bedc69590 100644 --- a/libobs/graphics/graphics.c +++ b/libobs/graphics/graphics.c @@ -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)) diff --git a/libobs/graphics/graphics.h b/libobs/graphics/graphics.h index 759f0b1b3..365b1575e 100644 --- a/libobs/graphics/graphics.h +++ b/libobs/graphics/graphics.h @@ -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);