From 4636413334a9f0418fdb320677939fcc4c73642a Mon Sep 17 00:00:00 2001 From: jp9000 Date: Tue, 11 May 2021 00:30:28 -0700 Subject: [PATCH] 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.) --- plugins/obs-transitions/transition-stinger.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/obs-transitions/transition-stinger.c b/plugins/obs-transitions/transition-stinger.c index 4f8d4d2f6..50826ac05 100644 --- a/plugins/obs-transitions/transition-stinger.c +++ b/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,