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 crash when executing SubViewport.set_size_2d_override_stretch #65477

Merged
merged 1 commit into from
Sep 7, 2022

Conversation

timothyqiu
Copy link
Member

Fixes #65456

I did not find a way to reproduce the crash, but the cause of the crash is quite obvious according to the crash log.

  • sample_count is a VkSampleCountFlagBits enum, it's equal to the actual number of bits (1, 2, 4, 8, 16, ...).
  • rasterization_sample_count is an array to map TextureSamples to VkSampleCountFlagBits.
  • p_requested_sample_count is a TextureSamples enum, it can be used to index rasterization_sample_count.

So using sample_count to index rasterization_sample_count will result in a crash when it's greater than TEXTURE_SAMPLES_MAX (7).

sample_count should be used directly like in the other if branch.

@timothyqiu timothyqiu added this to the 4.0 milestone Sep 7, 2022
@timothyqiu timothyqiu requested a review from a team as a code owner September 7, 2022 14:12
@akien-mga akien-mga merged commit edf8749 into godotengine:master Sep 7, 2022
@akien-mga
Copy link
Member

Thanks!

@timothyqiu timothyqiu deleted the bit-flags branch September 7, 2022 22:50
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.

Very random crashes when executing SubViewport.set_size_2d_override_stretch
2 participants