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 asserts and build buster in debug build. #930

Merged
merged 1 commit into from
Nov 26, 2023

Conversation

acolwell
Copy link
Collaborator

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?
It fixes some assert() issues in debug builds that were introduced by #901 and #918 . It also updates the Tests GitHub Action so that it also runs a Linux debug build and runs the test for that build.

  • Fixed assert() in Tests/FileSystemModel_Test.cpp that broke the debug build.
  • Fixed asserts in Engine/EffectInstanceRenderRoI.cpp so that they are only checked if tiling is supported. The assert was accidentally applied to all cases when the code was refactored by Fix rendering bugs caused by intersecting rects with different mipMapLevels. #918
  • Updated Linux CI to build and test release AND debug builds. This should help avoid such issues from sneaking in going forward.

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

I've verified locally on Linux that debug builds work and pass their tests. I've also verified the GitHub action builds the debug and release builds on Linux. (https://github.com/acolwell/Natron/actions/runs/6552600450/job/17796244295) Currently the windows build is failing because #929 has not been approved and committed yet.

- Fixed assert() in Tests/FileSystemModel_Test.cpp that broke the
  debug build.
- Fixed asserts in Engine/EffectInstanceRenderRoI.cpp so that they
  are only checked if tiling is supported. The assert was
  accidentally applied to all cases when the code was refactored
  by NatronGitHub#918
- Updated Linux CI to build and test release AND debug builds.
  This should help avoid such issues from sneaking in going forward.
acolwell referenced this pull request Oct 17, 2023
- Added helper functions to reduce redundant code, improve readability,
  and help clarify intent.

- Added getSplitPath() and cleanPath() to FileSystemModel to make it
  easier to test and extend this functionality.

- Added unit tests for some FileSystemModel functions to document
  existing behavior and make it easier to see how behavior changes
  with bug fixes.

- Deleted unused code.
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.

Can we remove the function clipIfOverlaps() from the natron code?

if (frameArgs->tilesSupported && !roi.clipIfOverlaps(downscaledImageBoundsNc)) {
return eRenderRoIRetCodeOk;
if (frameArgs->tilesSupported) {
if (!roi.clipIfOverlaps(downscaledImageBoundsNc)) {
Copy link
Member

Choose a reason for hiding this comment

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

Could we avoid side effects in conditions, and either have a const function overlaps(), and do the clip outside of the condition?
I think this clipIfOverlaps() function should be removed from the code, because it is used as a test at many places but also has a dangerous and misleading side effect.
No one expects a condition to modify the variable being tested. See c++ core guideline es.40 https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#es40-avoid-complicated-expressions

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I take your point and have some ideas on how to rework the clipIfOverlap() call sites so they don't need this type of function in a conditional. Can I defer those changes to a follow-up PR? I'd like to land this and #929 so that Windows and debug builds start working again.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Friendly ping. I'd like to land this and #929 so the CI builds start working again. I'm happy to follow up with clipIfOverlap() fixes once the build and tests have been restored.

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.

LGTM
Thank you!

@acolwell acolwell merged commit 69ab44f into NatronGitHub:RB-2.5 Nov 26, 2023
1 of 2 checks passed
@acolwell acolwell deleted the fix_debug_build_asserts branch November 26, 2023 23:43
acolwell added a commit to acolwell/Natron that referenced this pull request Dec 29, 2023
This change removes the return value for clipIfOverlaps() and
updates all callers. This was done to address a comment made in
NatronGitHub#930 (comment)

- Removed return value from RectI::clipIfOverlaps() and RectD::clipIfOverlaps()

- Introduced clip() that updates a RectI or RectD with the intersection of
  itself and another rectangle.

- Reworked several clipIfOverlaps() callers to use clip() or intersect()
  instead of clipIfOverlaps().
acolwell added a commit to acolwell/Natron that referenced this pull request Feb 13, 2024
This change removes the return value for clipIfOverlaps() and
updates all callers. This was done to address a comment made in
NatronGitHub#930 (comment)

- Removed return value from RectI::clipIfOverlaps() and RectD::clipIfOverlaps()

- Introduced clip() that updates a RectI or RectD with the intersection of
  itself and another rectangle.

- Reworked several clipIfOverlaps() callers to use clip() or intersect()
  instead of clipIfOverlaps().
acolwell added a commit to acolwell/Natron that referenced this pull request Feb 13, 2024
This change removes the return value for clipIfOverlaps() and
updates all callers. This was done to address a comment made in
NatronGitHub#930 (comment)

- Removed return value from RectI::clipIfOverlaps() and RectD::clipIfOverlaps()

- Introduced clip() that updates a RectI or RectD with the intersection of
  itself and another rectangle.

- Reworked several clipIfOverlaps() callers to use clip() or intersect()
  instead of clipIfOverlaps().
acolwell added a commit to acolwell/Natron that referenced this pull request Feb 13, 2024
This change removes the return value for clipIfOverlaps() and
updates all callers. This was done to address a comment made in
NatronGitHub#930 (comment)

- Removed return value from RectI::clipIfOverlaps() and RectD::clipIfOverlaps()

- Introduced clip() that updates a RectI or RectD with the intersection of
  itself and another rectangle.

- Reworked several clipIfOverlaps() callers to use clip() or intersect()
  instead of clipIfOverlaps().
acolwell added a commit to acolwell/Natron that referenced this pull request Feb 13, 2024
This change removes the return value for clipIfOverlaps() and
updates all callers. This was done to address a comment made in
NatronGitHub#930 (comment)

- Removed return value from RectI::clipIfOverlaps() and RectD::clipIfOverlaps()

- Introduced clip() that updates a RectI or RectD with the intersection of
  itself and another rectangle.

- Reworked several clipIfOverlaps() callers to use clip() or intersect()
  instead of clipIfOverlaps().
acolwell added a commit to acolwell/Natron that referenced this pull request Feb 14, 2024
This change removes the return value for clipIfOverlaps() and
updates all callers. This was done to address a comment made in
NatronGitHub#930 (comment)

- Removed return value from RectI::clipIfOverlaps() and RectD::clipIfOverlaps()

- Introduced clip() that updates a RectI or RectD with the intersection of
  itself and another rectangle.

- Reworked several clipIfOverlaps() callers to use clip() or intersect()
  instead of clipIfOverlaps().
acolwell added a commit to acolwell/Natron that referenced this pull request Feb 17, 2024
This change removes the return value for clipIfOverlaps() and
updates all callers. This was done to address a comment made in
NatronGitHub#930 (comment)

- Removed return value from RectI::clipIfOverlaps() and RectD::clipIfOverlaps()

- Introduced clip() that updates a RectI or RectD with the intersection of
  itself and another rectangle.

- Reworked several clipIfOverlaps() callers to use clip() or intersect()
  instead of clipIfOverlaps().
acolwell added a commit that referenced this pull request Feb 20, 2024
This change removes the return value for clipIfOverlaps() and
updates all callers. This was done to address a comment made in
#930 (comment)

- Removed return value from RectI::clipIfOverlaps() and RectD::clipIfOverlaps()

- Introduced clip() that updates a RectI or RectD with the intersection of
  itself and another rectangle.

- Reworked several clipIfOverlaps() callers to use clip() or intersect()
  instead of clipIfOverlaps().
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.

2 participants