Fix scene processor resizing with highdpi/supersampling mode - #2840
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request deprecates the rescale method across various classes and contexts, shifting display scale reporting to the reshape method. It also updates FilterPostProcessor and HDRRenderer to initialize using the viewport's render target size rather than the camera's size, introduces a mechanism to track whether viewports should resize with the default framebuffer, and improves window event and swap failure handling in LwjglWindow. However, the refactored cleanup code in Filter and FilterPostProcessor incorrectly attempts to call a non-existent dispose() method on com.jme3.texture.Image objects; these should be updated to use renderer.deleteImage(image) instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2838
This pr:
deprecates the unused
rescalehook, likely a left over from a previous attempt at implementing high dpi support. Currently unused by the engine and a defacto no-op.handle resource and swap failures that can happen during fast window rescaling operations
add a
resizeWithDefaultFramebufferflag in ViewPort. When true the viewport will receive with and height values fromthe highdpi/supersampled framebuffer.
SceneProcessors, like FilterPostProcessor, rely on a sort of "hack" where they replace the viewport output framebuffer with their internal one, and then blit it back to the default framebuffer.
The problem is that the scene processors are resized to their own viewport and FilterPostProcessor resizes the viewport (and framebuffer) from its resize hook, so they resize each other recursively.
The only reason this currently working is that FilterPostProcessor used the camera sizes to do the scaling, instead of the viewport output size. This used to work fine before because camera sizes used to be equivalent to the render target size, but this is not true anymore now that we have proper highdpi/scaling support, since camera sizes will be the logical size of the viewport while the underlying render target can be much bigger. Point 3 solves this by making the engine aware of when a viewport wants to track the default framebuffer.