-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Implement Anisotropic Filtering Extension and Expose Extension Interface #690
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,6 +88,10 @@ impl From<Backend> for BackendBit { | |
#[cfg_attr(feature = "trace", derive(Serialize))] | ||
#[cfg_attr(feature = "replay", derive(Deserialize))] | ||
pub struct Extensions { | ||
/// This is a native only extension. Support is planned to be added to webgpu, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this is even required to be specified, actually. If you are running on the Web, the adapter will just not expose this extension. There is no extra benefit of knowing that it's native-only. |
||
/// but it is not yet implemented. | ||
/// | ||
/// https://github.com/gpuweb/gpuweb/issues/696 | ||
pub anisotropic_filtering: bool, | ||
} | ||
|
||
|
@@ -926,6 +930,11 @@ pub struct SamplerDescriptor<L> { | |
pub lod_min_clamp: f32, | ||
pub lod_max_clamp: f32, | ||
pub compare: CompareFunction, | ||
/// Anisotropic filtering extension must be enabled if this value is | ||
/// anything other than 0 and 1. | ||
/// | ||
/// Valid values are 0, 1, 2, 4, 8, and 16. | ||
pub anisotropy_clamp: u8, | ||
} | ||
|
||
impl<L> SamplerDescriptor<L> { | ||
|
@@ -941,6 +950,7 @@ impl<L> SamplerDescriptor<L> { | |
lod_min_clamp: self.lod_min_clamp, | ||
lod_max_clamp: self.lod_max_clamp, | ||
compare: self.compare, | ||
anisotropy_clamp: self.anisotropy_clamp, | ||
} | ||
} | ||
} | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should Extensions/Limits be marked as
#[non_exhaustive]
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would imagine so. I should add that note to #691. I anticipate discussion on that issue changing this PR before it's merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize now that another benefit to this is that adding extensions that don't modify structures become a non breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, we may need to add extensions that do change structures in a non-breaking way, at some point, probably soon. I.e. we don't want to break wgpu-core API after WebGPU is out and we are just adding more extensions :/
We could do this by adding a private
PhantomData
field to structures, which implementDefault
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're okay with the MSRV bump, we can just use
#[non_exhaustive]
on basically every struct.