Skip to content

Commit

Permalink
Image Sampler Improvements (#10254)
Browse files Browse the repository at this point in the history
# Objective

- Build on the changes in bevyengine/bevy#9982
- Use `ImageSamplerDescriptor` as the "public image sampler descriptor"
interface in all places (for consistency)
- Make it possible to configure textures to use the "default" sampler
(as configured in the `DefaultImageSampler` resource)
- Fix a bug introduced in #9982 that prevents configured samplers from
being used in Basis, KTX2, and DDS textures

---

## Migration Guide

- When using the `Image` API, use `ImageSamplerDescriptor` instead of
`wgpu::SamplerDescriptor`
- If writing custom wgpu renderer features that work with `Image`, call
`&image_sampler.as_wgpu()` to convert to a wgpu descriptor.
  • Loading branch information
cart committed Oct 26, 2023
1 parent ac8830b commit 958fd38
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ async fn load_gltf<'a, 'b, 'c>(
} => {
load_context.load_with_settings(path, move |settings: &mut ImageLoaderSettings| {
settings.is_srgb = is_srgb;
settings.sampler_descriptor = sampler_descriptor;
settings.sampler = ImageSampler::Descriptor(sampler_descriptor.clone());
})
}
};
Expand Down Expand Up @@ -684,7 +684,7 @@ async fn load_image<'a, 'b>(
ImageType::MimeType(mime_type),
supported_compressed_formats,
is_srgb,
ImageSampler::Descriptor(sampler_descriptor.into()),
ImageSampler::Descriptor(sampler_descriptor),
)?;
Ok(ImageOrPath::Image {
image,
Expand All @@ -705,7 +705,7 @@ async fn load_image<'a, 'b>(
mime_type.map(ImageType::MimeType).unwrap_or(image_type),
supported_compressed_formats,
is_srgb,
ImageSampler::Descriptor(sampler_descriptor.into()),
ImageSampler::Descriptor(sampler_descriptor),
)?,
label: texture_label(&gltf_texture),
})
Expand Down

0 comments on commit 958fd38

Please sign in to comment.