-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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 post-processing crash when disabling and re-enabling stages #9649
Conversation
… are enabled, not necessarily active
Thanks for the pull request @j9liu!
Reviewers, don't forget to make sure that:
|
I can confirm the fix works but it might be worth looking into the alternate approach I mentioned in #9204 (comment). I was curious what would happen so I hacked together a quick version of it and was surprised to see that it fixed the original issue and a totally separate issue #8345 with the full screen flash. I didn't really dive deep into why it fixed that but maybe it has something to do with the framebuffer and active stages being slightly out of sync with each other, like a one frame delay? |
Also, please add a test to |
Co-authored-by: Sean Lilley <[email protected]>
I tried to implement that fix, but the extra EDIT: I'll attach the failed tests for reference. Surprisingly, the same crash is happening in one of them, even though the extra |
It turned out to be something like that: |
Hm I'm not seeing those errors so maybe there was a difference in how we implemented it. Here's the code I added to the end of count = 0;
for (i = 0; i < length; ++i) {
stage = stages[i];
if (stage.ready && stage.enabled && stage._isSupported(context)) {
count++;
}
}
activeStagesChanged = count !== activeStages.length;
if (activeStagesChanged) {
this.update(context, useLogDepth, useHdr);
} Ultimately we arrived at similar fixes because both fixes call |
@lilleyse - that fix worked. I stripped my changes and added your fix instead. I also got rid of the Do you want me to do anything about the tonemapping issue I mentioned over Slack?
|
Tonemapping is only applied when I think the problem is that those tests are not removing the primitive they add to the scene so it interferes with subsequent tests. If you add |
@lilleyse - done! I temporarily moved my tests after the tonemapping ones just to be sure the |
Thanks @j9liu! |
Fix post-processing crash when disabling and re-enabling stages
Fixes #9204, also fixes #9528.
The crashes were happening because the texture cache wouldn't create framebuffers if no stages were marked as active, despite the fact that they are
enabled
. It will now create framebuffers if at least one stage is enabled.I ran the unit tests and looked through all of the post-processing Sandcastles, and I don't believe this change introduced any other bugs.
cc: @lilleyse @ebogo1