Create SHADER_CTL_INIT_FIRST

This commit is contained in:
twinaphex 2016-02-14 18:17:43 +01:00
parent f906e828ba
commit fe3c3f5203
3 changed files with 15 additions and 30 deletions

View File

@ -2683,7 +2683,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
hw_render->version_major, hw_render->version_minor);
#endif
if (!video_shader_driver_init_first())
if (!video_shader_driver_ctl(SHADER_CTL_INIT_FIRST, NULL))
goto error;
RARCH_LOG("[GL]: Default shader backend found: %s.\n",

View File

@ -58,26 +58,6 @@ const shader_backend_t *shader_ctx_find_driver(const char *ident)
return NULL;
}
/**
* video_shader_driver_init_first:
*
* Finds first suitable shader context driver.
*
* Returns: true (1) if found, otherwise false (0).
**/
bool video_shader_driver_init_first(void)
{
unsigned i;
for (i = 0; shader_ctx_drivers[i]; i++)
{
current_shader = shader_ctx_drivers[i];
return true;
}
return false;
}
struct video_shader *video_shader_driver_get_current_shader(void)
{
void *video_driver = video_driver_get_ptr(false);
@ -233,6 +213,18 @@ bool video_shader_driver_ctl(enum video_shader_driver_ctl_state state, void *dat
params->fbo_info_cnt);
}
break;
/* Finds first suitable shader context driver. */
case SHADER_CTL_INIT_FIRST:
{
unsigned i;
for (i = 0; shader_ctx_drivers[i]; i++)
{
current_shader = shader_ctx_drivers[i];
return true;
}
}
return false;
case SHADER_CTL_NONE:
default:
break;

View File

@ -33,6 +33,8 @@ extern "C" {
enum video_shader_driver_ctl_state
{
SHADER_CTL_NONE = 0,
/* Finds first suitable shader context driver. */
SHADER_CTL_INIT_FIRST,
SHADER_CTL_SET_PARAMS
};
@ -130,15 +132,6 @@ void video_shader_driver_scale(unsigned idx, struct gfx_fbo_scale *scale);
**/
const shader_backend_t *shader_ctx_find_driver(const char *ident);
/**
* video_shader_driver_init_first:
*
* Finds first suitable shader context driver.
*
* Returns: shader context driver if found, otherwise NULL.
**/
bool video_shader_driver_init_first(void);
struct video_shader *video_shader_driver_get_current_shader(void);
bool video_shader_driver_init(const shader_backend_t *shader,