Create video_shader_scale

This commit is contained in:
twinaphex 2015-10-07 18:18:49 +02:00
parent e352f15da6
commit a61104dba3
3 changed files with 18 additions and 10 deletions

View File

@ -333,13 +333,6 @@ static INLINE GLenum min_filter_to_mag(GLenum type)
}
#ifdef HAVE_FBO
static void gl_shader_scale(gl_t *gl, unsigned idx,
struct gfx_fbo_scale *scale)
{
scale->valid = false;
gl->shader->shader_scale(idx, scale);
}
/* Compute FBO geometry.
* When width/height changes or window sizes change,
* we have to recalculate geometry of our FBO. */
@ -635,8 +628,8 @@ static void gl_init_fbo(gl_t *gl, unsigned fbo_width, unsigned fbo_height)
video_driver_get_size(&width, &height);
gl_shader_scale(gl, 1, &scale);
gl_shader_scale(gl, gl->shader->num_shaders(), &scale_last);
video_shader_scale(1, gl->shader, &scale);
video_shader_scale(gl->shader->num_shaders(), gl->shader, &scale_last);
/* we always want FBO to be at least initialized on startup for consoles */
if (gl->shader->num_shaders() == 1 && !scale.valid)
@ -664,7 +657,7 @@ static void gl_init_fbo(gl_t *gl, unsigned fbo_width, unsigned fbo_height)
for (i = 1; i < gl->fbo_pass; i++)
{
gl_shader_scale(gl, i + 1, &gl->fbo_scale[i]);
video_shader_scale(i + 1, gl->shader, &gl->fbo_scale[i]);
if (!gl->fbo_scale[i].valid)
{

View File

@ -82,3 +82,15 @@ struct video_shader *video_shader_driver_get_current_shader(void)
return NULL;
return driver->video_poke->get_current_shader(driver->video_data);
}
void video_shader_scale(unsigned idx,
const shader_backend_t *shader, struct gfx_fbo_scale *scale)
{
if (!scale || shader)
return;
scale->valid = false;
if (shader->shader_scale)
shader->shader_scale(idx, scale);
}

View File

@ -86,6 +86,9 @@ extern const shader_backend_t shader_null_backend;
#endif
void video_shader_scale(unsigned idx,
const shader_backend_t *shader, struct gfx_fbo_scale *scale);
/**
* shader_ctx_find_driver:
* @ident : Identifier of shader context driver to find.