Fix filter chain rendering#1343
Merged
Merged
Conversation
We now check if both the target (filter above our own, OR parent if we're in first place) and the actual filter parent are valid instead of just the target. Additionally, we get the source width and height for the filter, which if it's in first place will give the original source width and height (otherwise it would've picked the parent's and that will be with all filters *afterwards* applied, such as Crop or Aspect Ratio) Also, I moved the known width and height check / update before the texrender logic. Inside the render call we check if the target is the parent and if so, we render the filter via. `obs_source_skip_video_filter`, otherwise we just use `obs_source_video_render` on the target.
Lordmau5
marked this pull request as draft
August 18, 2025 16:10
Contributor
Author
|
Change to draft because I've not done enough tests yet. Causes some issues with one of my setups so I need to see if I can get those sorted |
Offscreen isn't really necessary - sync also works for async sources. This fixes an issue with e.g. Color Correction (and potentially other filters) being above the Dedicated NDI Output filter and rendering everything black. Additionally, the `video_output_lock_frame` method was put in an inner `gs_stagesurface_map` call, as it returns a boolean on whether or not it was able to map it. Performance seems to be on-par with the offscreen method, though with the stagesurface_map change I was getting slightly better performance (at least when I last tested it a few weeks ago for the other PR)
Lordmau5
marked this pull request as ready for review
August 18, 2025 16:24
Contributor
Author
|
There we go. |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the rendering pipeline for NDI filters by improving the filter chain validation and render target logic. The changes ensure proper video filtering when the NDI filter is first in the chain versus when it has other filters before it.
- Updates filter validation to check both target and parent sources
- Changes width/height calculation to use the filter's source dimensions instead of target dimensions
- Moves the render callback from a main render callback to the video render function for better integration
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Since we can just use `get_width` and `height` on our own source (the filter) and get proper dimensions of either the filter above us or the parent source before any other filters are applied (first position) we'll just use that for simplicity and to keep things in line with the other code changes.
Trouffman
approved these changes
Aug 26, 2025
Trouffman
left a comment
Collaborator
There was a problem hiding this comment.
Simplified this, found some outdated parameters while at it.
This was referenced Aug 29, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We now check if both the target (filter above our own, OR parent if we're in first place) and the actual filter parent are valid instead of just the target.
Additionally, we get the source width and height for the filter, which if it's in first place will give the original source width and height (otherwise it would've picked the parent's and that will be with all filters afterwards applied, such as Crop or Aspect Ratio)
Also, I moved the known width and height check / update before the texrender logic.
Inside the render call we check if the target is the parent and if so, we render the filter via.
obs_source_skip_video_filter, otherwise we just useobs_source_video_renderon the target.