mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Rewrite From/TryFrom conversions on generated types to avoid future orphan rule violations (#34554)
* script: Add traits to allow converting between types that are not defined in the script crate. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Rewrite all From/TryFrom implementations on generated WebIDL types to use new Convert/TryConvert traits. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
e10e989abb
commit
e0cbab2fbb
40 changed files with 439 additions and 380 deletions
|
@ -6,6 +6,7 @@ use dom_struct::dom_struct;
|
|||
use webgpu::wgc::resource::SamplerDescriptor;
|
||||
use webgpu::{WebGPU, WebGPUDevice, WebGPURequest, WebGPUSampler};
|
||||
|
||||
use crate::conversions::Convert;
|
||||
use crate::dom::bindings::cell::DomRefCell;
|
||||
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{
|
||||
GPUSamplerDescriptor, GPUSamplerMethods,
|
||||
|
@ -79,18 +80,18 @@ impl GPUSampler {
|
|||
let sampler_id = device.global().wgpu_id_hub().create_sampler_id();
|
||||
let compare_enable = descriptor.compare.is_some();
|
||||
let desc = SamplerDescriptor {
|
||||
label: (&descriptor.parent).into(),
|
||||
label: (&descriptor.parent).convert(),
|
||||
address_modes: [
|
||||
descriptor.addressModeU.into(),
|
||||
descriptor.addressModeV.into(),
|
||||
descriptor.addressModeW.into(),
|
||||
descriptor.addressModeU.convert(),
|
||||
descriptor.addressModeV.convert(),
|
||||
descriptor.addressModeW.convert(),
|
||||
],
|
||||
mag_filter: descriptor.magFilter.into(),
|
||||
min_filter: descriptor.minFilter.into(),
|
||||
mipmap_filter: descriptor.mipmapFilter.into(),
|
||||
mag_filter: descriptor.magFilter.convert(),
|
||||
min_filter: descriptor.minFilter.convert(),
|
||||
mipmap_filter: descriptor.mipmapFilter.convert(),
|
||||
lod_min_clamp: *descriptor.lodMinClamp,
|
||||
lod_max_clamp: *descriptor.lodMaxClamp,
|
||||
compare: descriptor.compare.map(Into::into),
|
||||
compare: descriptor.compare.map(Convert::convert),
|
||||
anisotropy_clamp: 1,
|
||||
border_color: None,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue