From 958fd385d2988768b85d47e754c1f41ef4b87ac3 Mon Sep 17 00:00:00 2001 From: Carter Anderson Date: Thu, 26 Oct 2023 16:30:09 -0700 Subject: [PATCH] Image Sampler Improvements (#10254) # Objective - Build on the changes in https://github.com/bevyengine/bevy/pull/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. --- src/loader.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/loader.rs b/src/loader.rs index 0c5a7f4..fa3085e 100644 --- a/src/loader.rs +++ b/src/loader.rs @@ -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()); }) } }; @@ -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, @@ -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), })