mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-21 22:33:49 +00:00
rename DeviceDescriptor.limits
to DeviceDescriptor.required_limits
This commit is contained in:
parent
9be6c8890f
commit
da73522720
@ -658,7 +658,7 @@ pub async fn op_webgpu_request_device(
|
||||
let descriptor = wgpu_types::DeviceDescriptor {
|
||||
label: Some(Cow::Owned(label)),
|
||||
required_features: required_features.into(),
|
||||
limits: required_limits.unwrap_or_default(),
|
||||
required_limits: required_limits.unwrap_or_default(),
|
||||
};
|
||||
|
||||
let (device, _queue, maybe_err) = gfx_select!(adapter => instance.adapter_request_device(
|
||||
|
@ -318,7 +318,7 @@ impl ExampleContext {
|
||||
&wgpu::DeviceDescriptor {
|
||||
label: None,
|
||||
required_features: (optional_features & adapter_features) | required_features,
|
||||
limits: needed_limits,
|
||||
required_limits: needed_limits,
|
||||
},
|
||||
trace_dir.ok().as_ref().map(std::path::Path::new),
|
||||
)
|
||||
|
@ -49,7 +49,7 @@ async fn execute_gpu(numbers: &[u32]) -> Option<Vec<u32>> {
|
||||
&wgpu::DeviceDescriptor {
|
||||
label: None,
|
||||
required_features: wgpu::Features::empty(),
|
||||
limits: wgpu::Limits::downlevel_defaults(),
|
||||
required_limits: wgpu::Limits::downlevel_defaults(),
|
||||
},
|
||||
None,
|
||||
)
|
||||
|
@ -18,7 +18,7 @@ async fn run() {
|
||||
&wgpu::DeviceDescriptor {
|
||||
label: None,
|
||||
required_features: wgpu::Features::empty(),
|
||||
limits: wgpu::Limits::downlevel_defaults(),
|
||||
required_limits: wgpu::Limits::downlevel_defaults(),
|
||||
},
|
||||
None,
|
||||
)
|
||||
|
@ -30,7 +30,7 @@ async fn run(event_loop: EventLoop<()>, window: Window) {
|
||||
label: None,
|
||||
required_features: wgpu::Features::empty(),
|
||||
// Make sure we use the texture resolution limits from the adapter, so we can support images the size of the swapchain.
|
||||
limits: wgpu::Limits::downlevel_webgl2_defaults()
|
||||
required_limits: wgpu::Limits::downlevel_webgl2_defaults()
|
||||
.using_resolution(adapter.limits()),
|
||||
},
|
||||
None,
|
||||
|
@ -83,7 +83,7 @@ async fn run(event_loop: EventLoop<()>, viewports: Vec<(Arc<Window>, wgpu::Color
|
||||
&wgpu::DeviceDescriptor {
|
||||
label: None,
|
||||
required_features: wgpu::Features::empty(),
|
||||
limits: wgpu::Limits::downlevel_defaults(),
|
||||
required_limits: wgpu::Limits::downlevel_defaults(),
|
||||
},
|
||||
None,
|
||||
)
|
||||
|
@ -31,7 +31,7 @@ async fn run() {
|
||||
&wgpu::DeviceDescriptor {
|
||||
label: None,
|
||||
required_features: wgpu::Features::empty(),
|
||||
limits: wgpu::Limits::downlevel_defaults(),
|
||||
required_limits: wgpu::Limits::downlevel_defaults(),
|
||||
},
|
||||
None,
|
||||
)
|
||||
|
@ -20,7 +20,7 @@ async fn run(_path: Option<String>) {
|
||||
&wgpu::DeviceDescriptor {
|
||||
label: None,
|
||||
required_features: wgpu::Features::empty(),
|
||||
limits: wgpu::Limits::downlevel_defaults(),
|
||||
required_limits: wgpu::Limits::downlevel_defaults(),
|
||||
},
|
||||
None,
|
||||
)
|
||||
|
@ -168,7 +168,7 @@ impl WgpuContext {
|
||||
&wgpu::DeviceDescriptor {
|
||||
label: None,
|
||||
required_features: wgpu::Features::empty(),
|
||||
limits: wgpu::Limits::downlevel_defaults(),
|
||||
required_limits: wgpu::Limits::downlevel_defaults(),
|
||||
},
|
||||
None,
|
||||
)
|
||||
|
@ -34,7 +34,7 @@ async fn run(_path: Option<String>) {
|
||||
&wgpu::DeviceDescriptor {
|
||||
label: None,
|
||||
required_features: wgpu::Features::empty(),
|
||||
limits: wgpu::Limits::downlevel_defaults(),
|
||||
required_limits: wgpu::Limits::downlevel_defaults(),
|
||||
},
|
||||
None,
|
||||
)
|
||||
|
@ -215,7 +215,7 @@ async fn run() {
|
||||
&wgpu::DeviceDescriptor {
|
||||
label: None,
|
||||
required_features: features,
|
||||
limits: wgpu::Limits::downlevel_defaults(),
|
||||
required_limits: wgpu::Limits::downlevel_defaults(),
|
||||
},
|
||||
None,
|
||||
)
|
||||
|
@ -114,7 +114,7 @@ impl WgpuContext {
|
||||
&wgpu::DeviceDescriptor {
|
||||
label: None,
|
||||
required_features: wgpu::Features::empty(),
|
||||
limits: wgpu::Limits::downlevel_defaults(),
|
||||
required_limits: wgpu::Limits::downlevel_defaults(),
|
||||
},
|
||||
None,
|
||||
)
|
||||
|
@ -90,7 +90,7 @@ impl Test<'_> {
|
||||
&wgt::DeviceDescriptor {
|
||||
label: None,
|
||||
required_features: self.features,
|
||||
limits: wgt::Limits::default(),
|
||||
required_limits: wgt::Limits::default(),
|
||||
},
|
||||
None,
|
||||
device_id,
|
||||
|
@ -86,7 +86,7 @@ pub async fn initialize_device(
|
||||
&wgpu::DeviceDescriptor {
|
||||
label: None,
|
||||
required_features: features,
|
||||
limits,
|
||||
required_limits: limits,
|
||||
},
|
||||
None,
|
||||
)
|
||||
|
@ -80,7 +80,7 @@ async fn request_device_error_message() {
|
||||
&wgpu::DeviceDescriptor {
|
||||
// Force a failure by requesting absurd limits.
|
||||
required_features: wgpu::Features::all(),
|
||||
limits: wgpu::Limits {
|
||||
required_limits: wgpu::Limits {
|
||||
max_texture_dimension_1d: u32::MAX,
|
||||
max_texture_dimension_2d: u32::MAX,
|
||||
max_texture_dimension_3d: u32::MAX,
|
||||
|
@ -272,7 +272,7 @@ impl<A: HalApi> Device<A> {
|
||||
}
|
||||
})),
|
||||
alignments,
|
||||
limits: desc.limits.clone(),
|
||||
limits: desc.required_limits.clone(),
|
||||
features: desc.required_features,
|
||||
downlevel,
|
||||
instance_flags,
|
||||
|
@ -372,17 +372,20 @@ impl<A: HalApi> Adapter<A> {
|
||||
//TODO
|
||||
}
|
||||
|
||||
if let Some(failed) = check_limits(&desc.limits, &caps.limits).pop() {
|
||||
if let Some(failed) = check_limits(&desc.required_limits, &caps.limits).pop() {
|
||||
return Err(RequestDeviceError::LimitsExceeded(failed));
|
||||
}
|
||||
|
||||
let open = unsafe { self.raw.adapter.open(desc.required_features, &desc.limits) }.map_err(
|
||||
|err| match err {
|
||||
hal::DeviceError::Lost => RequestDeviceError::DeviceLost,
|
||||
hal::DeviceError::OutOfMemory => RequestDeviceError::OutOfMemory,
|
||||
hal::DeviceError::ResourceCreationFailed => RequestDeviceError::Internal,
|
||||
},
|
||||
)?;
|
||||
let open = unsafe {
|
||||
self.raw
|
||||
.adapter
|
||||
.open(desc.required_features, &desc.required_limits)
|
||||
}
|
||||
.map_err(|err| match err {
|
||||
hal::DeviceError::Lost => RequestDeviceError::DeviceLost,
|
||||
hal::DeviceError::OutOfMemory => RequestDeviceError::OutOfMemory,
|
||||
hal::DeviceError::ResourceCreationFailed => RequestDeviceError::Internal,
|
||||
})?;
|
||||
|
||||
self.create_device_and_queue_from_hal(open, desc, instance_flags, trace_path)
|
||||
}
|
||||
|
@ -1656,7 +1656,7 @@ pub struct DeviceDescriptor<L> {
|
||||
pub required_features: Features,
|
||||
/// Limits that the device should support. If any limit is "better" than the limit exposed by
|
||||
/// the adapter, creating a device will panic.
|
||||
pub limits: Limits,
|
||||
pub required_limits: Limits,
|
||||
}
|
||||
|
||||
impl<L> DeviceDescriptor<L> {
|
||||
@ -1665,7 +1665,7 @@ impl<L> DeviceDescriptor<L> {
|
||||
DeviceDescriptor {
|
||||
label: fun(&self.label),
|
||||
required_features: self.required_features,
|
||||
limits: self.limits.clone(),
|
||||
required_limits: self.required_limits.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1151,7 +1151,7 @@ impl crate::context::Context for Context {
|
||||
|
||||
// TODO: Migrate to a web_sys api.
|
||||
// See https://github.com/rustwasm/wasm-bindgen/issues/3587
|
||||
let limits_object = map_js_sys_limits(&desc.limits);
|
||||
let limits_object = map_js_sys_limits(&desc.required_limits);
|
||||
|
||||
js_sys::Reflect::set(
|
||||
&mapped_desc,
|
||||
|
Loading…
Reference in New Issue
Block a user