libobs: Add obs_load_effect function

Just creates an effect to the target variable only if its current value
is null.  This will be used for deinterlacing effects to prevent having
to compile the shaders unless they're actually being used.
This commit is contained in:
jp9000
2016-03-21 21:22:30 -07:00
parent 2278051985
commit 3019dccf87
2 changed files with 13 additions and 0 deletions
+2
View File
@@ -371,6 +371,8 @@ extern struct obs_core *obs;
extern void *obs_video_thread(void *param);
extern gs_effect_t *obs_load_effect(gs_effect_t **effect, const char *file);
extern bool audio_callback(void *param,
uint64_t start_ts_in, uint64_t end_ts_in, uint64_t *out_ts,
uint32_t mixers, struct audio_output_data *mixes);
+11
View File
@@ -215,6 +215,17 @@ static bool obs_init_textures(struct obs_video_info *ovi)
return true;
}
gs_effect_t *obs_load_effect(gs_effect_t **effect, const char *file)
{
if (!*effect) {
char *filename = find_libobs_data_file(file);
*effect = gs_effect_create_from_file(filename, NULL);
bfree(filename);
}
return *effect;
}
static int obs_init_graphics(struct obs_video_info *ovi)
{
struct obs_core_video *video = &obs->video;