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

Fix OpenGL support handling for plugins with dynamic GL support. #869

Merged
merged 1 commit into from Apr 4, 2023

Conversation

acolwell
Copy link
Collaborator

@acolwell acolwell commented Apr 3, 2023

Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. Additionally, make sure you've done all of these things:

PR Description

What type of PR is this? (Check one of the boxes below)

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (non-breaking change which does not add functionality nor fixes a bug but improves Natron in some way)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • My change requires a change to the documentation
    • I have updated the documentation accordingly

What does this pull request do?

OfxEffectInstance::onEnableOpenGLKnobValueChange() breaks rendering for plugins that change their OpenGL support based on the value of their parameters (e.g. OCIODisplay and friends). This method can cause "OpenGL enabled" render calls to be made on plugins that have explicitly stated they do not support OpenGL with their current parameter values. This function also violates the contract between host and plugin because it blindly changes the value of an instance property without the plugin having any way to know it happened or stop it. This logic is also not even needed because other logic in Node::getCurrentOpenGLRenderSupport() actually properly handles all the project, node, and plugin level overrides.

The following changes are include in this change:

  • Removed OfxEffectInstance::onEnableOpenGLKnobValueChanged() and related declarations in the EffectInstace base class.
  • Removed Project::isOpenGLRenderActivated() because it is basically identical to Project::isGPURenderingEnabledInProject().
  • Clean up logic in callers that used to call onEnableOpenGLKnobValueChanged().
  • Fixed a bug(?) where node "GPU render" knobs were not getting disabled when the project level knob caused GPU rendering to be disabled.
  • Minor cleanups to make code simpler and more consistent

Have you tested your changes (if applicable)? If so, how?

Yes. I verified that this change causes Natron to stop requesting GL renders from plugins, like OCIODisplay, that explicitly
state that they do not support GL requests given their current parameter values. I also verified that GL render calls are
made when the plugin signals that the parameter combination does allow GL support.

Futher details of this pull request

The following changes to the OCIO plugins also helped detect and verify these changes worked properly.
NatronGitHub/openfx-io#28
NatronGitHub/openfx-io#29

OfxEffectInstance::onEnableOpenGLKnobValueChange() breaks rendering
for plugins that change their OpenGL support based on the value
of their parameters (e.g. OCIODisplay and friends). This method
can cause "OpenGL enabled" render calls to be made on plugins that
have explicitly stated they do not support OpenGL with their current
parameter values. This function also violates the contract between
host and plugin because it blindly changes the value of an instance
property without the plugin having any way to know it happened or
stop it. This logic is also not even needed because other logic in
Node::getCurrentOpenGLRenderSupport() actually properly handles all
the project, node, and plugin level overrides.

The following changes are include in this change:
- Removed OfxEffectInstance::onEnableOpenGLKnobValueChanged() and
  related declarations in the EffectInstace base class.
- Removed Project::isOpenGLRenderActivated() because it is
  basically identical to Project::isGPURenderingEnabledInProject().
- Clean up logic in callers that used to call
  onEnableOpenGLKnobValueChanged().
- Fixed a bug(?) where node "GPU render" knobs were not getting
  disabled when the project level knob caused GPU rendering to be
  disabled.
- Minor cleanups to make code simpler and more consistent
Copy link
Member

@devernay devernay left a comment

Choose a reason for hiding this comment

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

Nice! I appreciate the documentation (both inside the code and in the PR) as well as the testing report. Thanks for finding out and fixing bugs!
LGTM

@devernay devernay merged commit e998bd6 into NatronGitHub:RB-2.5 Apr 4, 2023
2 checks passed
@acolwell acolwell deleted the fix_glsupport_handling branch April 5, 2023 01:05
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.

None yet

2 participants