-
Notifications
You must be signed in to change notification settings - Fork 543
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 mirror clamped to edge filter #2100
Comments
Need to figure out first how to expose extensions in gfx |
How about something like this? (Granted, I haven't really looked at the gfx codebase at all until a few hours ago). This way, an application can request an abstract naming of extensions which vulkan/metal/dx12 can translate, ignore, or fail during device creation if they can't be supported.
mod hal {
enum Extension {
SamplerMirrorOnce, // VK_KHR_sampler_mirror_clamp_to_edge,
..
}
}
fn open(
&self,
families: &[(&QueueFamily, &[hal::QueuePriority])],
extensions: &[Extension],
) -> Result<hal::Gpu<Backend>, DeviceCreationError>
pub enum ExtensionError {
ImplicitlySupported, // Or return Option<&'static str>, whatever
NotSupported, // PhysicalDevice can't do what's requested, HAL can try to find another that can?
}
pub fn map_ext(ext: Extension) -> Result<&'static str, ExtensionError> {
map ext {
Extension::SamplerMirrorOnce => Ok(extensions::VK_KHR_Sampler_mirror_clamp_to_edge),
_ => Err(ExtensionError::NotSupported),
}
} A fancier version of this would integrate the builder pattern for PhysicalDevice opening, with methods that accept HAL abstractions for extensions, as well as backend-specific versions which could be used for testing, or adding backend support before HAL integration is ready, which would be better for developers of gfx-rs (by allowing the advancement of individual backend features without being blocked on support in other backends or the HAL) e.g. backend_vulkan::PhysicalDevice::open()
// testing some extension that doesn't exist in HAL --- doesn't require handling in other backends
.with_vulkan_extensions(&["VK_KHR_sampler_mirror_clamp_to_edge"])
// using extensions which are exposed in HAL, and are known about by all backends.
.with_extensions(&[Extension::QuerySurfaceCapabilities]); |
of course, making the abstract extension enums/bitfields isn’t very future-proof (would mean removing them or adding new ones is always a API breaking change) so there are downsides |
@msiglreith I suggest just extending |
I'm trying to cover our bases for releaing 0.5, will add a flag for this. |
3172: MirrorClamp feature r=msiglreith a=kvark Fixes #2100 PR checklist: - [x] `make` succeeds (on *nix) - [ ] `make reftests` succeeds - [ ] tested examples with the following backends: - [ ] `rustfmt` run on changed code Co-authored-by: Dzmitry Malyshau <[email protected]>
Support the one time mirroring filter extension (VK_KHR_sampler_mirror_clamp_to_edge).
Named
D3D12_TEXTURE_ADDRESS_MODE_MIRROR_ONCE
in D3D12The text was updated successfully, but these errors were encountered: