Move more variables

This commit is contained in:
twinaphex 2017-12-04 13:03:14 +01:00
parent f47888aeda
commit 48c3a50932
4 changed files with 20 additions and 18 deletions

View File

@ -180,7 +180,6 @@ typedef struct gl
bool have_full_npot_support;
bool have_mipmap;
bool egl_images;
bool overlay_enable;
bool overlay_full_screen;
bool menu_texture_enable;

View File

@ -544,11 +544,9 @@ static void gl_init_textures_data(gl_t *gl)
static void gl_init_textures(gl_t *gl, const video_info_t *video)
{
unsigned i;
GLenum internal_fmt, texture_type = 0, texture_fmt = 0;
/* Use regular textures if we use HW render. */
gl->egl_images = !gl->hw_render_use && gl_check_capability(GL_CAPS_EGLIMAGE) &&
video_context_driver_init_image_buffer(video);
GLenum internal_fmt = gl->internal_fmt;
GLenum texture_type = gl->texture_type;
GLenum texture_fmt = gl->texture_fmt;
#ifdef HAVE_PSGL
if (!gl->pbo)
@ -560,10 +558,6 @@ static void gl_init_textures(gl_t *gl, const video_info_t *video)
NULL, GL_STREAM_DRAW);
#endif
internal_fmt = gl->internal_fmt;
texture_type = gl->texture_type;
texture_fmt = gl->texture_fmt;
#if defined(HAVE_OPENGLES) && !defined(HAVE_PSGL)
/* GLES is picky about which format we use here.
* Without extensions, we can *only* render to 16-bit FBOs. */
@ -1339,7 +1333,7 @@ static void gl_set_nonblock_state(void *data, bool state)
context_bind_hw_render(true);
}
static bool resolve_extensions(gl_t *gl, const char *context_ident)
static bool resolve_extensions(gl_t *gl, const char *context_ident, const video_info_t *video)
{
settings_t *settings = config_get_ptr();
@ -1365,7 +1359,7 @@ static bool resolve_extensions(gl_t *gl, const char *context_ident)
video_driver_unset_rgba();
if (gl->renderchain_driver->resolve_extensions)
gl->renderchain_driver->resolve_extensions(gl, gl->renderchain_data, context_ident);
gl->renderchain_driver->resolve_extensions(gl, gl->renderchain_data, context_ident, video);
#if defined(HAVE_OPENGLES) && !defined(HAVE_PSGL)
if (!gl_check_capability(GL_CAPS_BGRA8888))
@ -1790,7 +1784,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBlendEquation(GL_FUNC_ADD);
if (!resolve_extensions(gl, ctx_driver->ident))
if (!resolve_extensions(gl, ctx_driver->ident, video))
goto error;
#ifdef GL_DEBUG

View File

@ -55,6 +55,7 @@
typedef struct gl2_renderchain
{
bool egl_images;
bool has_fp_fbo;
bool has_srgb_fbo_gles3;
bool has_srgb_fbo;
@ -1253,7 +1254,7 @@ static void gl2_renderchain_copy_frame(
}
#elif defined(HAVE_OPENGLES)
#if defined(HAVE_EGL)
if (gl->egl_images)
if (chain->egl_images)
{
gfx_ctx_image_t img_info;
bool new_egl = false;
@ -1449,7 +1450,8 @@ static void gl2_renderchain_init_textures_reference(
unsigned internal_fmt, unsigned texture_fmt,
unsigned texture_type)
{
gl_t *gl = (gl_t*)data;
gl_t *gl = (gl_t*)data;
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data;
#ifdef HAVE_PSGL
glTextureReferenceSCE(GL_TEXTURE_2D, 1,
gl->tex_w, gl->tex_h, 0,
@ -1457,7 +1459,7 @@ static void gl2_renderchain_init_textures_reference(
gl->tex_w * gl->base_size,
gl->tex_w * gl->tex_h * i * gl->base_size);
#else
if (gl->egl_images)
if (chain->egl_images)
return;
gl_load_texture_image(GL_TEXTURE_2D,
@ -1471,8 +1473,10 @@ static void gl2_renderchain_init_textures_reference(
}
static void gl2_renderchain_resolve_extensions(void *data,
void *chain_data, const char *context_ident)
void *chain_data, const char *context_ident,
const video_info_t *video)
{
gl_t *gl = (gl_t*)data;
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data;
settings_t *settings = config_get_ptr();
@ -1486,6 +1490,10 @@ static void gl2_renderchain_resolve_extensions(void *data,
if (!settings->bools.video_force_srgb_disable)
chain->has_srgb_fbo = gl_check_capability(GL_CAPS_SRGB_FBO);
/* Use regular textures if we use HW render. */
chain->egl_images = !gl->hw_render_use && gl_check_capability(GL_CAPS_EGLIMAGE) &&
video_context_driver_init_image_buffer(video);
}
gl_renderchain_driver_t gl2_renderchain = {

View File

@ -907,7 +907,8 @@ typedef struct gl_renderchain_driver
void (*resolve_extensions)(
void *data,
void *chain_data,
const char *context_ident);
const char *context_ident,
const video_info_t *video);
const char *ident;
} gl_renderchain_driver_t;