From e512065d7dd69f914d0cadce1ab686e6b29dd5ef Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 24 Oct 2016 03:55:14 +0200 Subject: [PATCH] Start making gl_capabilities.c more usable by libretro-common --- gfx/drivers/gl_capabilities.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/gfx/drivers/gl_capabilities.c b/gfx/drivers/gl_capabilities.c index 327f3ec3eb..a3e2ec6de7 100644 --- a/gfx/drivers/gl_capabilities.c +++ b/gfx/drivers/gl_capabilities.c @@ -23,7 +23,10 @@ #include #include "gl_capabilities.h" + +#ifdef RARCH_INTERNAL #include "../video_driver.h" +#endif static bool gl_core_context = false; @@ -42,6 +45,19 @@ void gl_query_core_context_unset(void) gl_core_context = false; } +static bool has_hardware_stencil(void) +{ +#ifdef RARCH_INTERNAL + struct retro_hw_render_callback *hwr = + video_driver_get_hw_context(); + if (!hwr) + return false; + return hwr->stencil; +#else + return true; +#endif +} + static bool gl_query_extension(const char *ext) { bool ret = false; @@ -205,12 +221,11 @@ bool gl_check_capability(enum gl_capability_enum enum_idx) break; case GL_CAPS_PACKED_DEPTH_STENCIL: { - struct retro_hw_render_callback *hwr = - video_driver_get_hw_context(); + if (!has_hardware_stencil()) + return false; if (major >= 3) return true; - if (hwr->stencil - && !gl_query_extension("OES_packed_depth_stencil") + if ( !gl_query_extension("OES_packed_depth_stencil") && !gl_query_extension("EXT_packed_depth_stencil")) return false; }