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

Add an extra backbuffer color texture that can be used when an upscaler is in use. #83192

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

DarioSamo
Copy link
Contributor

@DarioSamo DarioSamo commented Oct 12, 2023

Fixes #83152. Due to how BLUR_0 is reused for multiple purposes and requires being at native resolution for some post-processing effects to work, FSR2 will use an alternate texture at internal size to use as the screen texture read by shaders instead. The rendering pipeline will prefer using this texture if it exists.

Anything that used screen textures inside a custom shader was affected when FSR2 was enabled with a resolution scale below 1.0.

@DarioSamo DarioSamo requested a review from a team as a code owner October 12, 2023 11:09
@AThousandShips
Copy link
Member

Please rebase your branch to solve CI

@DarioSamo
Copy link
Contributor Author

Oops, guess I didn't make it in time yesterday when I branched off master. Hopefully it works now.

@AThousandShips
Copy link
Member

My bad seems you did catch that one, unsure why it fails now

@akien-mga
Copy link
Member

My attempt at fixing this CI issue didn't work. Still don't know why it's randomly failing. Manually restarting it once all builds have completed might fix it.

…er is in use.

Fixes issue godotengine#83152. Due to how BLUR_0 is reused for multiple purposes and requires being at native resolution for some post-processing effects to work, FSR2 will use an alternate texture at internal size to use as the screen texture read by shaders instead. The rendering pipeline will prefer using this texture if it exists.
Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

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

Looks good to me! Tested locally and can confirm that it fixes the issue

// dedicated backbuffer copy texture instead if the blur texture is not an option so shader effects work correctly.
Size2i target_size = rb->get_target_size();
bool using_fsr2 = (rb->get_scaling_3d_mode() == RS::VIEWPORT_SCALING_3D_MODE_FSR2);
bool internal_size_matches = (size.width == target_size.width) && (size.height == target_size.height);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
bool internal_size_matches = (size.width == target_size.width) && (size.height == target_size.height);
bool internal_size_matches = (size == target_size);

Copy link
Member

Choose a reason for hiding this comment

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

Missed this when merging from command line. Could be tweaked next time surrounding code is modified.

@akien-mga akien-mga merged commit ecc2bd6 into godotengine:master Oct 20, 2023
15 checks passed
@akien-mga
Copy link
Member

Thanks!

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.

FSR 2.2 causes some shaders to glitch with 3d scaling below 1.0
6 participants