diff --git a/libobs/graphics/graphics.c b/libobs/graphics/graphics.c index bf9848df7..00abe2ea4 100644 --- a/libobs/graphics/graphics.c +++ b/libobs/graphics/graphics.c @@ -325,22 +325,54 @@ const char *gs_get_device_name(void) const char *gs_get_driver_version(void) { - return gs_valid("gs_get_driver_version") ? thread_graphics->exports.gpu_get_driver_version() : NULL; + graphics_t *graphics = thread_graphics; + + if (!gs_valid("gs_get_driver_version")) + return NULL; + + if (graphics->exports.gpu_get_driver_version) + return (graphics->exports.gpu_get_driver_version()); + else + return NULL; } const char *gs_get_renderer(void) { - return gs_valid("gs_get_renderer") ? thread_graphics->exports.gpu_get_renderer() : NULL; + graphics_t *graphics = thread_graphics; + + if (!gs_valid("gs_get_renderer")) + return NULL; + + if (graphics->exports.gpu_get_renderer) + return (graphics->exports.gpu_get_renderer()); + else + return NULL; } uint64_t gs_get_gpu_dmem(void) { - return gs_valid("gs_get_gpu_dmem") ? thread_graphics->exports.gpu_get_dmem() : 0; + graphics_t *graphics = thread_graphics; + + if (!gs_valid("gs_get_gpu_dmem")) + return 0; + + if (graphics->exports.gpu_get_dmem) + return (graphics->exports.gpu_get_dmem()); + else + return 0; } uint64_t gs_get_gpu_smem(void) { - return gs_valid("gs_get_gpu_smem") ? thread_graphics->exports.gpu_get_smem() : 0; + graphics_t *graphics = thread_graphics; + + if (!gs_valid("gs_get_gpu_smem")) + return 0; + + if (graphics->exports.gpu_get_smem) + return (graphics->exports.gpu_get_smem()); + else + return 0; } int gs_get_device_type(void)