Skip to content

libobs: Save and restore resolution of canvases#13102

Open
exeldro wants to merge 1 commit intoobsproject:masterfrom
exeldro:canvas_resolution
Open

libobs: Save and restore resolution of canvases#13102
exeldro wants to merge 1 commit intoobsproject:masterfrom
exeldro:canvas_resolution

Conversation

@exeldro
Copy link
Contributor

@exeldro exeldro commented Feb 9, 2026

Description

Save and restore resolution of canvases

Motivation and Context

When a canvas is loaded it needs a resolution otherwise all scenes on the canvas will have divide by 0 issues on the scene items.

How Has This Been Tested?

On windows 11 by having a scene collection with an extra canvas, but the plugin controlling that canvas disabled.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@RytoEX RytoEX requested review from PatTheMav and derrod February 9, 2026 21:30
Copy link
Member

@PatTheMav PatTheMav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems correct, except if there was a specific reason why this was omitted originally @derrod?

@derrod
Copy link
Member

derrod commented Feb 11, 2026

This seems correct, except if there was a specific reason why this was omitted originally @derrod?

The primary canvas doesn't store its video properties in the scene collection, so I figured I'd keep things consistent here and require the API user to set it to the desired configuration when loading.

Additionally, by leaving this empty until it is set, any canvases that are not in use are not rendered, which might save some resources e.g. if the user disables a feature or plugin that is using it.

@PatTheMav
Copy link
Member

This seems correct, except if there was a specific reason why this was omitted originally @derrod?

The primary canvas doesn't store its video properties in the scene collection, so I figured I'd keep things consistent here and require the API user to set it to the desired configuration when loading.

As I mentioned on #13310 I think we need to move away from "global" video functions that use the main canvas under the hood and instead make our code explicitly set up a canvas as the "main" canvas and use common API functions to manage it.

Thus the "main" canvas should be indistinguishable from other canvases as far as the canvas APIs are concerned and it's only the code utilising that canvas that makes the difference.

And by that token every canvas would need to have output resolutions set to be considered "complete" (the resolution becomes an invariant of the canvas). Otherwise we have this weird bifurcation in the canvas internals were some canvases are considered incomplete without this data and some magically aren't.

Additionally, by leaving this empty until it is set, any canvases that are not in use are not rendered, which might save some resources e.g. if the user disables a feature or plugin that is using it.

This is an important concern, but wouldn't it make more sense to have an explicit activity state on a canvas rather than interpreting the lack of an output resolution as an implicit state?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants