Example #1
0
effect_t gs_create_effect(const char *effect_string, const char *filename,
		char **error_string)
{
	if (!thread_graphics || !effect_string)
		return NULL;

	struct gs_effect *effect = bzalloc(sizeof(struct gs_effect));
	struct effect_parser parser;
	bool success;

	effect->graphics = thread_graphics;

	ep_init(&parser);
	success = ep_parse(&parser, effect, effect_string, filename);
	if (!success) {
		if (error_string)
			*error_string = error_data_buildstring(
					&parser.cfp.error_list);
		effect_destroy(effect);
		effect = NULL;
	}

	ep_free(&parser);
	return effect;
}
Example #2
0
static void obs_free_graphics()
{
	struct obs_video *video = &obs->video;
	size_t i;

	if (video->graphics) {
		int cur_texture = video->cur_texture;
		gs_entercontext(video->graphics);

		if (video->copy_mapped)
			stagesurface_unmap(video->copy_surfaces[cur_texture]);

		for (i = 0; i < NUM_TEXTURES; i++) {
			stagesurface_destroy(video->copy_surfaces[i]);
			texture_destroy(video->render_textures[i]);
			texture_destroy(video->output_textures[i]);

			video->copy_surfaces[i]   = NULL;
			video->render_textures[i] = NULL;
			video->output_textures[i] = NULL;
		}

		effect_destroy(video->default_effect);
		video->default_effect = NULL;

		gs_leavecontext();

		gs_destroy(video->graphics);
		video->graphics = NULL;
		video->cur_texture = 0;
	}
}
Example #3
0
static void obs_free_graphics(void)
{
	struct obs_core_video *video = &obs->video;

	if (video->graphics) {
		gs_entercontext(video->graphics);

		effect_destroy(video->default_effect);
		effect_destroy(video->solid_effect);
		effect_destroy(video->conversion_effect);
		video->default_effect = NULL;

		gs_leavecontext();

		gs_destroy(video->graphics);
		video->graphics = NULL;
	}
}
Example #4
0
void test_destroy(struct test_filter *tf)
{
	if (tf) {
		gs_entercontext(obs_graphics());

		effect_destroy(tf->whatever);
		texrender_destroy(tf->texrender);
		bfree(tf);

		gs_leavecontext();
	}
}
Example #5
0
static void monitor_capture_destroy(void *data)
{
	struct monitor_capture *capture = data;

	gs_entercontext(obs_graphics());

	dc_capture_free(&capture->data);
	effect_destroy(capture->opaque_effect);

	gs_leavecontext();

	bfree(capture);
}
Example #6
0
static void filter_destroy(void *data)
{
	struct test_filter *tf = data;

	if (tf) {
		gs_entercontext(obs_graphics());

		effect_destroy(tf->whatever);
		bfree(tf);

		gs_leavecontext();
	}
}