Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render only once per video tick #16

Merged
merged 1 commit into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/obs-composite-blur-filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ static void composite_blur_video_render(void *data, gs_effect_t *effect)
UNUSED_PARAMETER(effect);
struct composite_blur_filter_data *filter = data;

if (filter->rendered) {
draw_output_to_source(filter);
return;
}

if (filter->rendering) {
obs_source_skip_video_filter(filter->context);
return;
Expand All @@ -235,6 +240,7 @@ static void composite_blur_video_render(void *data, gs_effect_t *effect)

// 3. Draw result (filter->output_texrender) to source
draw_output_to_source(filter);
filter->rendered = true;
}

filter->rendering = false;
Expand Down Expand Up @@ -517,6 +523,7 @@ static void composite_blur_video_tick(void *data, float seconds)
filter->height = (uint32_t)obs_source_get_base_height(target);
filter->uv_size.x = (float)filter->width;
filter->uv_size.y = (float)filter->height;
filter->rendered = false;
}

static void composite_blur_reload_effect(composite_blur_filter_data_t *filter)
Expand Down
1 change: 1 addition & 0 deletions src/obs-composite-blur-filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ struct composite_blur_filter_data {

bool rendering;
bool reload;
bool rendered;

struct vec2 uv_size;

Expand Down