Пример #1
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;
	}
}
Пример #2
0
stagesurf_t device_create_stagesurface(device_t device, uint32_t width,
		uint32_t height, enum gs_color_format color_format)
{
	struct gs_stage_surface *surf;
	surf = bzalloc(sizeof(struct gs_stage_surface));
	surf->device             = device;
	surf->format             = color_format;
	surf->width              = width;
	surf->height             = height;
	surf->gl_format          = convert_gs_format(color_format);
	surf->gl_internal_format = convert_gs_internal_format(color_format);
	surf->gl_type            = get_gl_format_type(color_format);
	surf->bytes_per_pixel    = gs_get_format_bpp(color_format)/8;

	if (!create_pixel_pack_buffer(surf)) {
		blog(LOG_ERROR, "device_create_stagesurface (GL) failed");
		stagesurface_destroy(surf);
		return NULL;
	}

	return surf;
}
Пример #3
0
static void obs_free_video(void)
{
	struct obs_core_video *video = &obs->video;

	if (video->video) {
		obs_display_free(&video->main_display);
		video_output_close(video->video);
		video->video = NULL;

		if (!video->graphics)
			return;

		gs_entercontext(video->graphics);

		if (video->mapped_surface) {
			stagesurface_unmap(video->mapped_surface);
			video->mapped_surface = NULL;
		}

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

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

		gs_leavecontext();

		video->cur_texture = 0;
	}
}