Set context driver's set_flags function when core GL context

is requested, and query the core GL context set bit when
loading a Cg shader
This commit is contained in:
twinaphex 2016-05-05 17:40:38 +02:00
parent 10b0fca258
commit c04122d385
2 changed files with 11 additions and 7 deletions

View File

@ -39,6 +39,7 @@
#include "libretro_version_1.h"
#include "performance.h"
#include "system.h"
#include "gfx/video_context_driver.h"
#include "cores/internal_cores.h"
#include "frontend/frontend_driver.h"
@ -970,8 +971,15 @@ bool rarch_environment_cb(unsigned cmd, void *data)
break;
case RETRO_HW_CONTEXT_OPENGL_CORE:
RARCH_LOG("Requesting core OpenGL context (%u.%u).\n",
cb->version_major, cb->version_minor);
{
gfx_ctx_flags_t flags;
BIT32_SET(flags.flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT);
gfx_ctx_ctl(GFX_CTL_SET_FLAGS, &flags);
RARCH_LOG("Requesting core OpenGL context (%u.%u).\n",
cb->version_major, cb->version_minor);
}
break;
#endif

View File

@ -43,12 +43,9 @@ static const shader_backend_t *video_shader_set_backend(enum rarch_shader_type t
#ifdef HAVE_CG
gfx_ctx_flags_t flags;
struct retro_hw_render_callback *hwr = NULL;
gfx_ctx_ctl(GFX_CTL_GET_FLAGS, &flags);
video_driver_ctl(RARCH_DISPLAY_CTL_HW_CONTEXT_GET, &hwr);
#if 0
if ((flags.flags && (1UL << GFX_CTX_FLAGS_GL_CORE_CONTEXT)) && hwr && hwr->context_type != RETRO_HW_CONTEXT_NONE)
if (flags.flags && (1UL << GFX_CTX_FLAGS_GL_CORE_CONTEXT))
{
RARCH_ERR("[Shader driver]: Cg cannot be used with core GL context. Trying to fall back to GLSL...\n");
#ifdef HAVE_GLSL
@ -56,7 +53,6 @@ static const shader_backend_t *video_shader_set_backend(enum rarch_shader_type t
#endif
}
else
#endif
{
RARCH_LOG("[Shader driver]: Using Cg shader backend.\n");
return &gl_cg_backend;