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
1 changed files with 19 additions and 4 deletions

View File

@ -23,7 +23,10 @@
#include <boolean.h> #include <boolean.h>
#include "gl_capabilities.h" #include "gl_capabilities.h"
#ifdef RARCH_INTERNAL
#include "../video_driver.h" #include "../video_driver.h"
#endif
static bool gl_core_context = false; static bool gl_core_context = false;
@ -42,6 +45,19 @@ void gl_query_core_context_unset(void)
gl_core_context = false; 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) static bool gl_query_extension(const char *ext)
{ {
bool ret = false; bool ret = false;
@ -205,12 +221,11 @@ bool gl_check_capability(enum gl_capability_enum enum_idx)
break; break;
case GL_CAPS_PACKED_DEPTH_STENCIL: case GL_CAPS_PACKED_DEPTH_STENCIL:
{ {
struct retro_hw_render_callback *hwr = if (!has_hardware_stencil())
video_driver_get_hw_context(); return false;
if (major >= 3) if (major >= 3)
return true; return true;
if (hwr->stencil if ( !gl_query_extension("OES_packed_depth_stencil")
&& !gl_query_extension("OES_packed_depth_stencil")
&& !gl_query_extension("EXT_packed_depth_stencil")) && !gl_query_extension("EXT_packed_depth_stencil"))
return false; return false;
} }