Browse Source

libobs: Fix rendering at end of the filter chain

When the filter chain finally reaches the source and the last filter in
the chain is set to not render directly (meaning it has to render to
texture), it would not render the source with any effect due to the fact
that it expects a filter to be present.
jp9000 10 years ago
parent
commit
44f103de9c
1 changed files with 6 additions and 1 deletions
  1. 6 1
      libobs/obs-source.c

+ 6 - 1
libobs/obs-source.c

@@ -2058,13 +2058,18 @@ void obs_source_process_filter(obs_source_t *filter, gs_effect_t *effect,
 				GS_ZS_NONE);
 				GS_ZS_NONE);
 
 
 	if (gs_texrender_begin(filter->filter_texrender, cx, cy)) {
 	if (gs_texrender_begin(filter->filter_texrender, cx, cy)) {
+		bool custom_draw = (parent_flags & OBS_SOURCE_CUSTOM_DRAW) != 0;
+		bool async = (parent_flags & OBS_SOURCE_ASYNC) != 0;
 		struct vec4 clear_color;
 		struct vec4 clear_color;
 
 
 		vec4_zero(&clear_color);
 		vec4_zero(&clear_color);
 		gs_clear(GS_CLEAR_COLOR, &clear_color, 0.0f, 0);
 		gs_clear(GS_CLEAR_COLOR, &clear_color, 0.0f, 0);
 		gs_ortho(0.0f, (float)cx, 0.0f, (float)cy, -100.0f, 100.0f);
 		gs_ortho(0.0f, (float)cx, 0.0f, (float)cy, -100.0f, 100.0f);
 
 
-		obs_source_video_render(target);
+		if (target == parent && !custom_draw && !async)
+			obs_source_default_render(target, use_matrix);
+		else
+			obs_source_video_render(target);
 
 
 		gs_texrender_end(filter->filter_texrender);
 		gs_texrender_end(filter->filter_texrender);
 	}
 	}