Browse Source

obs-transitions: Reset track matte texture in tick

This causes the track matte render target to only be reset once per
frame, rather than potentially multiple times per frame. Palakis most
likely did not know that you're supposed to reset only once per frame in
order to prevent the render target from being rendered more than once
per frame.

(Jim note: I probably should have made texrender objects automatically
detect new frames internally so it wouldn't require this. Not Palakis'
fault.)
jp9000 4 years ago
parent
commit
4636413334
1 changed files with 12 additions and 1 deletions
  1. 12 1
      plugins/obs-transitions/transition-stinger.c

+ 12 - 1
plugins/obs-transitions/transition-stinger.c

@@ -219,7 +219,6 @@ static void stinger_matte_render(void *data, gs_texture_t *a, gs_texture_t *b,
 		(s->matte_layout == MATTE_LAYOUT_VERTICAL ? (-matte_cy) : 0.0f);
 
 	// Track matte media render
-	gs_texrender_reset(s->matte_tex);
 	if (matte_cx > 0 && matte_cy > 0) {
 		float scale_x = (float)cx / matte_cx;
 		float scale_y = (float)cy / matte_cy;
@@ -301,6 +300,17 @@ static void stinger_video_render(void *data, gs_effect_t *effect)
 	UNUSED_PARAMETER(effect);
 }
 
+static void stinger_video_tick(void *data, float seconds)
+{
+	struct stinger_info *s = data;
+
+	if (s->track_matte_enabled) {
+		gs_texrender_reset(s->matte_tex);
+	}
+
+	UNUSED_PARAMETER(seconds);
+}
+
 static inline float calc_fade(float t, float mul)
 {
 	t *= mul;
@@ -645,6 +655,7 @@ struct obs_source_info stinger_transition = {
 	.update = stinger_update,
 	.get_defaults = stinger_defaults,
 	.video_render = stinger_video_render,
+	.video_tick = stinger_video_tick,
 	.audio_render = stinger_audio_render,
 	.get_properties = stinger_properties,
 	.enum_active_sources = stinger_enum_active_sources,