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

[Merged by Bors] - Include 2x/8x sample counts for Msaa #7684

Closed
wants to merge 3 commits into from

Conversation

Aceeri
Copy link
Member

@Aceeri Aceeri commented Feb 15, 2023

Objective

Fixes #7295

Should we maybe default to 4x if 2x/8x is selected but not supported?


Changelog

  • Added 2x and 8x sample counts for MSAA.

@Aceeri Aceeri added C-Enhancement A new feature A-Rendering Drawing game state to the screen labels Feb 15, 2023
Copy link
Contributor

@kurtkuehnert kurtkuehnert left a comment

Choose a reason for hiding this comment

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

A nice and simple change. I think disabling MSAA for unsupported levels is probably the right choice.

@james7132 james7132 added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Feb 15, 2023
Copy link
Member

@mockersf mockersf left a comment

Choose a reason for hiding this comment

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

This should default to the default value (so 4) if it's supported and not what is asked, then disable if even the default value is not supported

So

  • 2x / 8x requested but not supported, 4x is supported -> set it to 4x
  • 2x / 4x / 8x not supported -> set it to off

@Aceeri
Copy link
Member Author

Aceeri commented Feb 15, 2023

This should default to the default value (so 4) if it's supported and not what is asked, then disable if even the default value is not supported

So

* 2x / 8x requested but not supported, 4x is supported -> set it to 4x

* 2x / 4x / 8x not supported -> set it to off

This should be the case now

msaa.samples(),
);
*msaa = Msaa::Off;
if sample_flags.sample_count_supported(Msaa::default().samples()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than two different log statements in and f, use the if statement to determine the fallback sample count, and then set that once and use one log statement. That will be cleaner.

Pseudo code:

let fallback_sample = if default_supported() { default } else { off };
log("Not supported, falling back to {fallback_sample}");
*msaa = fallback_sample;

Msaa::Off
};

let fallback_str = if fallback == Msaa::Off {
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually small nit. Remove to_owned(), and &borrow the format!().

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think that will work since it doesn't live long enough

Comment on lines +248 to +252
let fallback_str = if fallback == Msaa::Off {
"disabling MSAA".to_owned()
} else {
format!("MSAA {}x", fallback.samples())
};
Copy link
Member

Choose a reason for hiding this comment

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

It would be nicer to use a Debug (or Display) impl of the Masa enum

@JMS55 JMS55 added this to the 0.10 milestone Feb 17, 2023
Copy link
Contributor

@superdump superdump left a comment

Choose a reason for hiding this comment

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

bors r+

bors bot pushed a commit that referenced this pull request Feb 17, 2023
# Objective
Fixes #7295 

Should we maybe default to 4x if 2x/8x is selected but not supported?

---

## Changelog
- Added 2x and 8x sample counts for MSAA.
@bors bors bot changed the title Include 2x/8x sample counts for Msaa [Merged by Bors] - Include 2x/8x sample counts for Msaa Feb 17, 2023
@bors bors bot closed this Feb 17, 2023
myreprise1 pushed a commit to myreprise1/bevy that referenced this pull request Feb 18, 2023
# Objective
Fixes bevyengine#7295 

Should we maybe default to 4x if 2x/8x is selected but not supported?

---

## Changelog
- Added 2x and 8x sample counts for MSAA.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Enhancement A new feature S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support MSAA with 2x and 8x samples
7 participants