Start implementing video_driver_set_mvp properly

This commit is contained in:
twinaphex 2017-11-15 14:16:06 +01:00
parent 2b1481d97f
commit 619acbb5aa
2 changed files with 29 additions and 3 deletions

View File

@ -2528,9 +2528,27 @@ static void gl_unload_texture(void *data, uintptr_t id)
glDeleteTextures(1, &glid);
}
static void gl_set_coords(void *handle_data, void *shader_data,
const struct video_coords *coords)
{
gl_t *gl = (gl_t*)handle_data;
if (gl && gl->renderchain_driver->set_coords)
gl->renderchain_driver->set_coords(handle_data,
shader_data, coords);
}
static void gl_set_mvp(void *data, void *shader_data,
const void *mat_data)
{
gl_t *gl = (gl_t*)data;
if (gl && gl->renderchain_driver->set_mvp)
gl->renderchain_driver->set_mvp(data,
shader_data, mat_data);
}
static const video_poke_interface_t gl_poke_interface = {
NULL, /* set_coords */
NULL, /* set_mvp */
gl_set_coords,
gl_set_mvp,
gl_load_texture,
gl_unload_texture,
gl_set_video_mode,

View File

@ -3453,8 +3453,16 @@ void video_driver_set_coords(video_shader_ctx_coords_t *coords)
void video_driver_set_mvp(video_shader_ctx_mvp_t *mvp)
{
if (mvp->matrix && current_shader && current_shader->set_mvp)
if (!mvp || !mvp->matrix)
return;
if (current_shader && current_shader->set_mvp)
current_shader->set_mvp(mvp->data, shader_data, mvp->matrix);
else
{
if (video_driver_poke && video_driver_poke->set_mvp)
video_driver_poke->set_mvp(mvp->data, shader_data, mvp->matrix);
}
}
bool renderchain_d3d_init_first(