Revert "Cleanup"

This reverts commit 576679ac05.
This commit is contained in:
twinaphex 2020-08-02 23:44:09 +02:00
parent da5806a810
commit 03fe023de4
1 changed files with 22 additions and 28 deletions

View File

@ -669,9 +669,7 @@ static bool gl_core_init_hw_render(gl_core_t *gl, unsigned width, unsigned heigh
return true; return true;
} }
static const gfx_ctx_driver_t *gl_core_get_context(gl_core_t *gl, static const gfx_ctx_driver_t *gl_core_get_context(gl_core_t *gl)
settings_t *settings,
struct retro_hw_render_callback *hwr)
{ {
unsigned major; unsigned major;
unsigned minor; unsigned minor;
@ -679,25 +677,25 @@ static const gfx_ctx_driver_t *gl_core_get_context(gl_core_t *gl,
gfx_ctx_flags_t flags; gfx_ctx_flags_t flags;
const gfx_ctx_driver_t *gfx_ctx = NULL; const gfx_ctx_driver_t *gfx_ctx = NULL;
void *ctx_data = NULL; void *ctx_data = NULL;
settings_t *settings = config_get_ptr();
struct retro_hw_render_callback *hwr = video_driver_get_hw_context();
#ifdef HAVE_OPENGLES3 #ifdef HAVE_OPENGLES3
api = GFX_CTX_OPENGL_ES_API; api = GFX_CTX_OPENGL_ES_API;
major = 3; major = 3;
minor = 0; minor = 0;
if (hwr && hwr->context_type == RETRO_HW_CONTEXT_OPENGLES_VERSION) if (hwr && hwr->context_type == RETRO_HW_CONTEXT_OPENGLES_VERSION)
{ {
major = hwr->version_major; major = hwr->version_major;
minor = hwr->version_minor; minor = hwr->version_minor;
} }
#else #else
api = GFX_CTX_OPENGL_API; api = GFX_CTX_OPENGL_API;
if (hwr && hwr->context_type != RETRO_HW_CONTEXT_NONE) if (hwr && hwr->context_type != RETRO_HW_CONTEXT_NONE)
{ {
major = hwr->version_major; major = hwr->version_major;
minor = hwr->version_minor; minor = hwr->version_minor;
gl_query_core_context_set( gl_query_core_context_set(hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE);
hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE);
if (hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE) if (hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE)
{ {
flags.flags = 0; flags.flags = 0;
@ -707,10 +705,10 @@ static const gfx_ctx_driver_t *gl_core_get_context(gl_core_t *gl,
} }
else else
{ {
major = 3; major = 3;
minor = 2; minor = 2;
gl_query_core_context_set(true); gl_query_core_context_set(true);
flags.flags = 0; flags.flags = 0;
BIT32_SET(flags.flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT); BIT32_SET(flags.flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT);
video_context_driver_set_flags(&flags); video_context_driver_set_flags(&flags);
} }
@ -718,19 +716,16 @@ static const gfx_ctx_driver_t *gl_core_get_context(gl_core_t *gl,
/* Force shared context. */ /* Force shared context. */
if (hwr) if (hwr)
gl->use_shared_context = gl->use_shared_context = hwr->context_type != RETRO_HW_CONTEXT_NONE;
hwr->context_type != RETRO_HW_CONTEXT_NONE;
gfx_ctx = gfx_ctx = video_context_driver_init_first(gl,
video_context_driver_init_first(gl, settings->arrays.video_context_driver,
settings->arrays.video_context_driver, api, major, minor, gl->use_shared_context, &ctx_data);
api, major, minor, gl->use_shared_context, &ctx_data);
if (ctx_data) if (ctx_data)
gl->ctx_data = ctx_data; gl->ctx_data = ctx_data;
/* Need to force here since video_context_driver_init /* Need to force here since video_context_driver_init also checks for global option. */
* also checks for global option. */
if (gfx_ctx->bind_hw_render) if (gfx_ctx->bind_hw_render)
gfx_ctx->bind_hw_render(ctx_data, gl->use_shared_context); gfx_ctx->bind_hw_render(ctx_data, gl->use_shared_context);
return gfx_ctx; return gfx_ctx;
@ -1173,9 +1168,8 @@ static void *gl_core_init(const video_info_t *video,
const char *version = NULL; const char *version = NULL;
char *error_string = NULL; char *error_string = NULL;
gl_core_t *gl = (gl_core_t*)calloc(1, sizeof(gl_core_t)); gl_core_t *gl = (gl_core_t*)calloc(1, sizeof(gl_core_t));
const gfx_ctx_driver_t *ctx_driver = gl_core_get_context(gl);
struct retro_hw_render_callback *hwr = video_driver_get_hw_context(); struct retro_hw_render_callback *hwr = video_driver_get_hw_context();
const gfx_ctx_driver_t *ctx_driver = gl_core_get_context(gl, settings,
hwr);
if (!gl || !ctx_driver) if (!gl || !ctx_driver)
goto error; goto error;