mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
[rs] Rustify the example's use of Extensions and SamplerDescriptor
This commit is contained in:
@@ -28,14 +28,14 @@ vulkan = ["wgc/gfx-backend-vulkan"]
|
||||
package = "wgpu-core"
|
||||
version = "0.5"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "9120f0399ce8d8cc48b0b87c26d58c71b2e925be"
|
||||
rev = "ac9587e9ced5b043abad68e260cb8c9e812cffb5"
|
||||
features = ["raw-window-handle"]
|
||||
|
||||
[dependencies.wgt]
|
||||
package = "wgpu-types"
|
||||
version = "0.5"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "9120f0399ce8d8cc48b0b87c26d58c71b2e925be"
|
||||
rev = "ac9587e9ced5b043abad68e260cb8c9e812cffb5"
|
||||
|
||||
[dependencies]
|
||||
arrayvec = "0.5"
|
||||
|
||||
@@ -19,9 +19,7 @@ async fn run() {
|
||||
let (device, queue) = adapter
|
||||
.request_device(
|
||||
&wgpu::DeviceDescriptor {
|
||||
extensions: wgpu::Extensions {
|
||||
anisotropic_filtering: false,
|
||||
},
|
||||
extensions: wgpu::Extensions::empty(),
|
||||
limits: wgpu::Limits::default(),
|
||||
},
|
||||
None,
|
||||
|
||||
@@ -204,8 +204,8 @@ impl framework::Example for Example {
|
||||
mipmap_filter: wgpu::FilterMode::Nearest,
|
||||
lod_min_clamp: 0.0,
|
||||
lod_max_clamp: 100.0,
|
||||
compare: wgpu::CompareFunction::Undefined,
|
||||
anisotropy_clamp: 1,
|
||||
compare: None,
|
||||
anisotropy_clamp: None,
|
||||
});
|
||||
let mx_total = Self::generate_matrix(sc_desc.width as f32 / sc_desc.height as f32);
|
||||
let mx_ref: &[f32; 16] = mx_total.as_ref();
|
||||
|
||||
@@ -75,9 +75,7 @@ async fn run_async<E: Example>(event_loop: EventLoop<()>, window: Window) {
|
||||
let (device, queue) = adapter
|
||||
.request_device(
|
||||
&wgpu::DeviceDescriptor {
|
||||
extensions: wgpu::Extensions {
|
||||
anisotropic_filtering: false,
|
||||
},
|
||||
extensions: wgpu::Extensions::empty(),
|
||||
limits: wgpu::Limits::default(),
|
||||
},
|
||||
trace_dir.ok().as_ref().map(std::path::Path::new),
|
||||
|
||||
@@ -37,9 +37,7 @@ async fn execute_gpu(numbers: Vec<u32>) -> Vec<u32> {
|
||||
let (device, queue) = adapter
|
||||
.request_device(
|
||||
&wgpu::DeviceDescriptor {
|
||||
extensions: wgpu::Extensions {
|
||||
anisotropic_filtering: false,
|
||||
},
|
||||
extensions: wgpu::Extensions::empty(),
|
||||
limits: wgpu::Limits::default(),
|
||||
},
|
||||
None,
|
||||
|
||||
@@ -22,9 +22,7 @@ async fn run(event_loop: EventLoop<()>, window: Window, swapchain_format: wgpu::
|
||||
let (device, queue) = adapter
|
||||
.request_device(
|
||||
&wgpu::DeviceDescriptor {
|
||||
extensions: wgpu::Extensions {
|
||||
anisotropic_filtering: false,
|
||||
},
|
||||
extensions: wgpu::Extensions::empty(),
|
||||
limits: wgpu::Limits::default(),
|
||||
},
|
||||
None,
|
||||
|
||||
@@ -156,8 +156,8 @@ impl Example {
|
||||
mipmap_filter: wgpu::FilterMode::Nearest,
|
||||
lod_min_clamp: 0.0,
|
||||
lod_max_clamp: 100.0,
|
||||
compare: wgpu::CompareFunction::Undefined,
|
||||
anisotropy_clamp: 1,
|
||||
compare: None,
|
||||
anisotropy_clamp: None,
|
||||
});
|
||||
|
||||
let views = (0..mip_count)
|
||||
@@ -309,8 +309,8 @@ impl framework::Example for Example {
|
||||
mipmap_filter: wgpu::FilterMode::Linear,
|
||||
lod_min_clamp: 0.0,
|
||||
lod_max_clamp: 100.0,
|
||||
compare: wgpu::CompareFunction::Undefined,
|
||||
anisotropy_clamp: 1,
|
||||
compare: None,
|
||||
anisotropy_clamp: None,
|
||||
});
|
||||
let mx_total = Self::generate_matrix(sc_desc.width as f32 / sc_desc.height as f32);
|
||||
let mx_ref: &[f32; 16] = mx_total.as_ref();
|
||||
|
||||
@@ -352,8 +352,8 @@ impl framework::Example for Example {
|
||||
mipmap_filter: wgpu::FilterMode::Nearest,
|
||||
lod_min_clamp: -100.0,
|
||||
lod_max_clamp: 100.0,
|
||||
compare: wgpu::CompareFunction::LessEqual,
|
||||
anisotropy_clamp: 1,
|
||||
compare: Some(wgpu::CompareFunction::LessEqual),
|
||||
anisotropy_clamp: None,
|
||||
});
|
||||
|
||||
let shadow_texture = device.create_texture(&wgpu::TextureDescriptor {
|
||||
|
||||
@@ -129,8 +129,8 @@ impl framework::Example for Skybox {
|
||||
mipmap_filter: wgpu::FilterMode::Nearest,
|
||||
lod_min_clamp: 0.0,
|
||||
lod_max_clamp: 100.0,
|
||||
compare: wgpu::CompareFunction::Undefined,
|
||||
anisotropy_clamp: 1,
|
||||
compare: None,
|
||||
anisotropy_clamp: None,
|
||||
});
|
||||
|
||||
let paths: [&'static [u8]; 6] = [
|
||||
|
||||
@@ -703,9 +703,7 @@ impl crate::Context for Context {
|
||||
|
||||
fn adapter_extensions(&self, _adapter: &Self::AdapterId) -> wgt::Extensions {
|
||||
// TODO: web-sys has no way of getting extensions on adapters
|
||||
wgt::Extensions {
|
||||
anisotropic_filtering: false,
|
||||
}
|
||||
wgt::Extensions::empty()
|
||||
}
|
||||
|
||||
fn adapter_limits(&self, _adapter: &Self::AdapterId) -> wgt::Limits {
|
||||
@@ -715,9 +713,7 @@ impl crate::Context for Context {
|
||||
|
||||
fn device_extensions(&self, _device: &Self::DeviceId) -> wgt::Extensions {
|
||||
// TODO: web-sys has no way of getting extensions on devices
|
||||
wgt::Extensions {
|
||||
anisotropic_filtering: false,
|
||||
}
|
||||
wgt::Extensions::empty()
|
||||
}
|
||||
|
||||
fn device_limits(&self, _device: &Self::DeviceId) -> wgt::Limits {
|
||||
@@ -991,7 +987,7 @@ impl crate::Context for Context {
|
||||
mapped_desc.address_mode_u(map_address_mode(desc.address_mode_u));
|
||||
mapped_desc.address_mode_v(map_address_mode(desc.address_mode_v));
|
||||
mapped_desc.address_mode_w(map_address_mode(desc.address_mode_w));
|
||||
if let Some(compare) = map_compare_function(desc.compare) {
|
||||
if let Some(compare) = desc.compare.and_then(map_compare_function) {
|
||||
mapped_desc.compare(compare);
|
||||
}
|
||||
mapped_desc.lod_max_clamp(desc.lod_max_clamp);
|
||||
|
||||
Reference in New Issue
Block a user