Start making gl_capabilities.c more usable by libretro-common

This commit is contained in:
twinaphex 2016-10-24 03:55:14 +02:00
parent 3702fde113
commit e512065d7d

View File

@ -23,7 +23,10 @@
#include <boolean.h>
#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;
}