Get rid of video_context_driver_bind_hw_render

This commit is contained in:
twinaphex 2018-10-14 19:49:24 +02:00
parent 2edd03361c
commit 454761a6ed
3 changed files with 29 additions and 36 deletions

View File

@ -118,10 +118,11 @@ static const GLfloat white_color[] = {
static bool gl_shared_context_use = false;
void context_bind_hw_render(bool enable)
void context_bind_hw_render(void *data, bool enable)
{
gl_t *gl = (gl_t*)data;
if (gl_shared_context_use)
video_context_driver_bind_hw_render(&enable);
gl->ctx_driver->bind_hw_render(gl->ctx_data, enable);
}
@ -678,7 +679,7 @@ static void gl_set_texture_frame(void *data,
if (!gl)
return;
context_bind_hw_render(false);
context_bind_hw_render(gl, false);
menu_filter = settings->bools.menu_linear_filter ? TEXTURE_FILTER_LINEAR : TEXTURE_FILTER_NEAREST;
@ -695,7 +696,7 @@ static void gl_set_texture_frame(void *data,
gl->menu_texture_alpha = alpha;
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
context_bind_hw_render(true);
context_bind_hw_render(gl, true);
}
static void gl_set_texture_enable(void *data, bool state, bool full_screen)
@ -958,7 +959,7 @@ static bool gl_frame(void *data, const void *frame,
return false;
#endif
context_bind_hw_render(false);
context_bind_hw_render(gl, false);
if (gl->core_context_in_use && gl->renderchain_driver->bind_vao)
gl->renderchain_driver->bind_vao(gl, gl->renderchain_data);
@ -1226,7 +1227,7 @@ static bool gl_frame(void *data, const void *frame,
gl->renderchain_driver->unbind_vao(gl,
gl->renderchain_data);
context_bind_hw_render(true);
context_bind_hw_render(gl, true);
return true;
}
@ -1266,7 +1267,7 @@ static void gl_free(void *data)
if (!gl)
return;
context_bind_hw_render(false);
context_bind_hw_render(gl, false);
if (gl->have_sync)
{
@ -1332,13 +1333,13 @@ static void gl_set_nonblock_state(void *data, bool state)
RARCH_LOG("[GL]: VSync => %s\n", state ? "off" : "on");
context_bind_hw_render(false);
context_bind_hw_render(gl, false);
if (!state)
interval = settings->uints.video_swap_interval;
video_context_driver_swap_interval(&interval);
context_bind_hw_render(true);
context_bind_hw_render(gl, true);
}
static bool resolve_extensions(gl_t *gl, const char *context_ident, const video_info_t *video)
@ -1870,9 +1871,9 @@ static void *gl_init(const video_info_t *video,
* create textures. */
gl->textures = 1;
#ifdef GL_DEBUG
context_bind_hw_render(true);
context_bind_hw_render(gl, true);
gl_begin_debug(gl);
context_bind_hw_render(false);
context_bind_hw_render(gl, false);
#endif
}
@ -2008,7 +2009,7 @@ static void *gl_init(const video_info_t *video,
goto error;
}
context_bind_hw_render(true);
context_bind_hw_render(gl, true);
return gl;
error:
@ -2065,7 +2066,7 @@ static void gl_update_tex_filter_frame(gl_t *gl)
wrap_info.idx = 0;
wrap_info.type = RARCH_WRAP_BORDER;
context_bind_hw_render(false);
context_bind_hw_render(gl, false);
shader_filter.index = 1;
shader_filter.smooth = &smooth;
@ -2102,7 +2103,7 @@ static void gl_update_tex_filter_frame(gl_t *gl)
}
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
context_bind_hw_render(true);
context_bind_hw_render(gl, true);
}
static bool gl_set_shader(void *data,
@ -2117,7 +2118,7 @@ static bool gl_set_shader(void *data,
if (!gl)
return false;
context_bind_hw_render(false);
context_bind_hw_render(gl, false);
if (type == RARCH_SHADER_NONE)
return false;
@ -2200,13 +2201,13 @@ static bool gl_set_shader(void *data,
/* Apparently need to set viewport for passes when we aren't using FBOs. */
gl_set_shader_viewports(gl);
context_bind_hw_render(true);
context_bind_hw_render(gl, true);
#endif
return true;
error:
context_bind_hw_render(true);
context_bind_hw_render(gl, true);
return false;
}
@ -2304,7 +2305,7 @@ static bool gl_overlay_load(void *data,
if (!gl)
return false;
context_bind_hw_render(false);
context_bind_hw_render(gl, false);
gl_free_overlay(gl);
gl->overlay_tex = (GLuint*)
@ -2312,7 +2313,7 @@ static bool gl_overlay_load(void *data,
if (!gl->overlay_tex)
{
context_bind_hw_render(true);
context_bind_hw_render(gl, true);
return false;
}
@ -2350,7 +2351,7 @@ static bool gl_overlay_load(void *data,
gl->overlay_color_coord[16 * i + j] = 1.0f;
}
context_bind_hw_render(true);
context_bind_hw_render(gl, true);
return true;
}

View File

@ -164,7 +164,7 @@ static void gl2_renderchain_bind_backbuffer(void *data,
#endif
}
void context_bind_hw_render(bool enable);
void context_bind_hw_render(void *data, bool enable);
void gl_load_texture_data(
uint32_t id_data,
@ -532,7 +532,7 @@ static void gl2_renderchain_deinit_hw_render(
if (!gl)
return;
context_bind_hw_render(true);
context_bind_hw_render(gl, true);
if (gl->hw_render_fbo_init)
gl2_delete_fb(gl->textures, gl->hw_render_fbo);
@ -540,7 +540,7 @@ static void gl2_renderchain_deinit_hw_render(
gl2_delete_rb(gl->textures, chain->hw_render_depth);
gl->hw_render_fbo_init = false;
context_bind_hw_render(false);
context_bind_hw_render(gl, false);
}
static void gl2_renderchain_free(gl_t *gl, void *chain_data)
@ -956,7 +956,7 @@ static bool gl2_renderchain_init_hw_render(
/* We can only share texture objects through contexts.
* FBOs are "abstract" objects and are not shared. */
context_bind_hw_render(true);
context_bind_hw_render(gl, true);
RARCH_LOG("[GL]: Initializing HW render (%u x %u).\n", width, height);
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_fbo_size);
@ -1037,7 +1037,7 @@ static bool gl2_renderchain_init_hw_render(
gl2_renderchain_bind_backbuffer(gl, chain_data);
gl->hw_render_fbo_init = true;
context_bind_hw_render(false);
context_bind_hw_render(gl, false);
return true;
}
@ -1076,7 +1076,7 @@ static bool gl2_renderchain_read_viewport(
if (!gl)
return false;
context_bind_hw_render(false);
context_bind_hw_render(gl, false);
num_pixels = gl->vp.width * gl->vp.height;
@ -1160,11 +1160,11 @@ static bool gl2_renderchain_read_viewport(
gl->readback_buffer_screenshot = NULL;
}
context_bind_hw_render(true);
context_bind_hw_render(gl, true);
return true;
error:
context_bind_hw_render(true);
context_bind_hw_render(gl, true);
return false;
}

View File

@ -3119,14 +3119,6 @@ bool video_context_driver_get_video_output_next(void)
return true;
}
bool video_context_driver_bind_hw_render(bool *enable)
{
if (!current_video_context.bind_hw_render)
return false;
current_video_context.bind_hw_render(video_context_data, *enable);
return true;
}
void video_context_driver_make_current(bool release)
{
if (current_video_context.make_current)