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

Quickhull - reduce warning spam and make hideable #51469

Merged
merged 1 commit into from
Aug 10, 2021

Conversation

lawnjelly
Copy link
Member

Added one more warning to the hideable warnings. These seem to be benign warnings and are hidden during use in rooms and portals. When used from other areas, only one warning is displayed per run, instead of for every occurrence.

Fixes warning reported by @timothyqiu

Notes

  • I just missed one of the warnings when doing this originally (this warning occurs more rarely).

@lawnjelly lawnjelly requested a review from a team as a code owner August 10, 2021 08:19
ERR_CONTINUE(!F2);

if (unlikely(!F2)) {
warning_not_f2 = true;
Copy link
Member

Choose a reason for hiding this comment

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

Could you use WARN_PRINT_ONCE() here instead of using booleans to defer it?

Copy link
Member Author

@lawnjelly lawnjelly Aug 10, 2021

Choose a reason for hiding this comment

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

I can easily change these to WARN_PRINT_ONCEs within the if statements.

This is just me, my reflex action is to write less branches 😁 . But in this case readability is probably the most important factor.

Copy link
Member Author

@lawnjelly lawnjelly Aug 10, 2021

Choose a reason for hiding this comment

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

Ah no on second thoughts, it would involve 3 if statements because of the _flag_warnings parameter. So it may be better how it currently is, otherwise the logic in the hot loop could become harder to follow in terms of readability...

I.e. it would end up being:

if (unlikely(!F2))
{
    if (_flag_warnings)
    {
        WARN_PRINT_ONCE etc
    }
    continue;
}

I don't know which is preferred. I'd still slightly come out with the WARN_PRINTs separate as slightly better, but either is fine, I can change it, just let me know.

Copy link
Member

Choose a reason for hiding this comment

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

All that logic is quite awkward IMO.

Errors and warnings should point at things that are either:

  • Engine bugs that we need to fix.
  • User mistakes where they pass invalid input.

If it's neither of those and those are benign cases which are not meant to call the user's attention, they should just be replaced by silent continue. If they are signs that the user or the engine is using bogus data, that's something we should fix.

@lawnjelly
Copy link
Member Author

Not sure what the CI failure is about. Has something been merged that hasn't updated the docs?

@akien-mga
Copy link
Member

Not sure what the CI failure is about. Has something been merged that hasn't updated the docs?

Something was merged that had updated the docs properly, but we since changed the docs formatting :D

@akien-mga
Copy link
Member

Something was merged that had updated the docs properly, but we since changed the docs formatting :D

Fixed.

Added one more warning to the hideable warnings. These seem to be benign warnings and are hidden during use in rooms and portals. When used from other areas, only one warning is displayed per run, instead of for every occurrence.
@akien-mga akien-mga merged commit 48faf66 into godotengine:3.x Aug 10, 2021
@akien-mga
Copy link
Member

Thanks!

@lawnjelly lawnjelly deleted the quickhull_hide_warning branch August 10, 2021 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants