Skip to main content

web_sys/features/
gen_GpuTextureDescriptor.rs

1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[cfg(web_sys_unstable_apis)]
6#[wasm_bindgen]
7extern "C" {
8    # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUTextureDescriptor)]
9    #[derive(Debug, Clone, PartialEq, Eq)]
10    #[doc = "The `GpuTextureDescriptor` dictionary."]
11    #[doc = ""]
12    #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`*"]
13    #[doc = ""]
14    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
15    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
16    pub type GpuTextureDescriptor;
17    #[cfg(web_sys_unstable_apis)]
18    #[doc = "Get the `label` field of this object."]
19    #[doc = ""]
20    #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`*"]
21    #[doc = ""]
22    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
23    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
24    #[wasm_bindgen(method, getter = "label")]
25    pub fn get_label(this: &GpuTextureDescriptor) -> Option<::alloc::string::String>;
26    #[cfg(web_sys_unstable_apis)]
27    #[doc = "Change the `label` field of this object."]
28    #[doc = ""]
29    #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`*"]
30    #[doc = ""]
31    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
32    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
33    #[wasm_bindgen(method, setter = "label")]
34    pub fn set_label(this: &GpuTextureDescriptor, val: &str);
35    #[cfg(web_sys_unstable_apis)]
36    #[cfg(feature = "GpuTextureDimension")]
37    #[doc = "Get the `dimension` field of this object."]
38    #[doc = ""]
39    #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`, `GpuTextureDimension`*"]
40    #[doc = ""]
41    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
42    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
43    #[wasm_bindgen(method, getter = "dimension")]
44    pub fn get_dimension(this: &GpuTextureDescriptor) -> Option<GpuTextureDimension>;
45    #[cfg(web_sys_unstable_apis)]
46    #[cfg(feature = "GpuTextureDimension")]
47    #[doc = "Change the `dimension` field of this object."]
48    #[doc = ""]
49    #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`, `GpuTextureDimension`*"]
50    #[doc = ""]
51    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
52    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
53    #[wasm_bindgen(method, setter = "dimension")]
54    pub fn set_dimension(this: &GpuTextureDescriptor, val: GpuTextureDimension);
55    #[cfg(web_sys_unstable_apis)]
56    #[cfg(feature = "GpuTextureFormat")]
57    #[doc = "Get the `format` field of this object."]
58    #[doc = ""]
59    #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`, `GpuTextureFormat`*"]
60    #[doc = ""]
61    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
62    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
63    #[wasm_bindgen(method, getter = "format")]
64    pub fn get_format(this: &GpuTextureDescriptor) -> GpuTextureFormat;
65    #[cfg(web_sys_unstable_apis)]
66    #[cfg(feature = "GpuTextureFormat")]
67    #[doc = "Change the `format` field of this object."]
68    #[doc = ""]
69    #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`, `GpuTextureFormat`*"]
70    #[doc = ""]
71    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
72    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
73    #[wasm_bindgen(method, setter = "format")]
74    pub fn set_format(this: &GpuTextureDescriptor, val: GpuTextureFormat);
75    #[cfg(web_sys_unstable_apis)]
76    #[doc = "Get the `mipLevelCount` field of this object."]
77    #[doc = ""]
78    #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`*"]
79    #[doc = ""]
80    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
81    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
82    #[wasm_bindgen(method, getter = "mipLevelCount")]
83    pub fn get_mip_level_count(this: &GpuTextureDescriptor) -> Option<u32>;
84    #[cfg(web_sys_unstable_apis)]
85    #[doc = "Change the `mipLevelCount` field of this object."]
86    #[doc = ""]
87    #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`*"]
88    #[doc = ""]
89    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
90    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
91    #[wasm_bindgen(method, setter = "mipLevelCount")]
92    pub fn set_mip_level_count(this: &GpuTextureDescriptor, val: u32);
93    #[cfg(web_sys_unstable_apis)]
94    #[doc = "Get the `sampleCount` field of this object."]
95    #[doc = ""]
96    #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`*"]
97    #[doc = ""]
98    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
99    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
100    #[wasm_bindgen(method, getter = "sampleCount")]
101    pub fn get_sample_count(this: &GpuTextureDescriptor) -> Option<u32>;
102    #[cfg(web_sys_unstable_apis)]
103    #[doc = "Change the `sampleCount` field of this object."]
104    #[doc = ""]
105    #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`*"]
106    #[doc = ""]
107    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
108    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
109    #[wasm_bindgen(method, setter = "sampleCount")]
110    pub fn set_sample_count(this: &GpuTextureDescriptor, val: u32);
111    #[cfg(web_sys_unstable_apis)]
112    #[doc = "Get the `size` field of this object."]
113    #[doc = ""]
114    #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`*"]
115    #[doc = ""]
116    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
117    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
118    #[wasm_bindgen(method, getter = "size")]
119    pub fn get_size(this: &GpuTextureDescriptor) -> ::wasm_bindgen::JsValue;
120    #[cfg(web_sys_unstable_apis)]
121    #[doc = "Change the `size` field of this object."]
122    #[doc = ""]
123    #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`*"]
124    #[doc = ""]
125    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
126    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
127    #[wasm_bindgen(method, setter = "size")]
128    pub fn set_size(this: &GpuTextureDescriptor, val: &[::js_sys::Number]);
129    #[cfg(web_sys_unstable_apis)]
130    #[cfg(feature = "GpuExtent3dDict")]
131    #[doc = "Change the `size` field of this object."]
132    #[doc = ""]
133    #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`*"]
134    #[doc = ""]
135    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
136    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
137    #[wasm_bindgen(method, setter = "size")]
138    pub fn set_size_gpu_extent_3d_dict(this: &GpuTextureDescriptor, val: &GpuExtent3dDict);
139    #[cfg(web_sys_unstable_apis)]
140    #[cfg(feature = "GpuTextureViewDimension")]
141    #[doc = "Get the `textureBindingViewDimension` field of this object."]
142    #[doc = ""]
143    #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`, `GpuTextureViewDimension`*"]
144    #[doc = ""]
145    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
146    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
147    #[wasm_bindgen(method, getter = "textureBindingViewDimension")]
148    pub fn get_texture_binding_view_dimension(
149        this: &GpuTextureDescriptor,
150    ) -> Option<GpuTextureViewDimension>;
151    #[cfg(web_sys_unstable_apis)]
152    #[cfg(feature = "GpuTextureViewDimension")]
153    #[doc = "Change the `textureBindingViewDimension` field of this object."]
154    #[doc = ""]
155    #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`, `GpuTextureViewDimension`*"]
156    #[doc = ""]
157    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
158    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
159    #[wasm_bindgen(method, setter = "textureBindingViewDimension")]
160    pub fn set_texture_binding_view_dimension(
161        this: &GpuTextureDescriptor,
162        val: GpuTextureViewDimension,
163    );
164    #[cfg(web_sys_unstable_apis)]
165    #[doc = "Get the `usage` field of this object."]
166    #[doc = ""]
167    #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`*"]
168    #[doc = ""]
169    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
170    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
171    #[wasm_bindgen(method, getter = "usage")]
172    pub fn get_usage(this: &GpuTextureDescriptor) -> u32;
173    #[cfg(web_sys_unstable_apis)]
174    #[doc = "Change the `usage` field of this object."]
175    #[doc = ""]
176    #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`*"]
177    #[doc = ""]
178    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
179    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
180    #[wasm_bindgen(method, setter = "usage")]
181    pub fn set_usage(this: &GpuTextureDescriptor, val: u32);
182    #[cfg(web_sys_unstable_apis)]
183    #[doc = "Get the `viewFormats` field of this object."]
184    #[doc = ""]
185    #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`*"]
186    #[doc = ""]
187    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
188    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
189    #[wasm_bindgen(method, getter = "viewFormats")]
190    pub fn get_view_formats(
191        this: &GpuTextureDescriptor,
192    ) -> Option<::js_sys::Array<::js_sys::JsString>>;
193    #[cfg(web_sys_unstable_apis)]
194    #[doc = "Change the `viewFormats` field of this object."]
195    #[doc = ""]
196    #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`*"]
197    #[doc = ""]
198    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
199    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
200    #[wasm_bindgen(method, setter = "viewFormats")]
201    pub fn set_view_formats(this: &GpuTextureDescriptor, val: &[::js_sys::JsString]);
202}
203#[cfg(web_sys_unstable_apis)]
204impl GpuTextureDescriptor {
205    #[cfg(feature = "GpuTextureFormat")]
206    #[doc = "Construct a new `GpuTextureDescriptor`."]
207    #[doc = ""]
208    #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`, `GpuTextureFormat`*"]
209    #[doc = ""]
210    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
211    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
212    pub fn new(format: GpuTextureFormat, size: &[::js_sys::Number], usage: u32) -> Self {
213        #[allow(unused_mut)]
214        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
215        ret.set_format(format);
216        ret.set_size(size);
217        ret.set_usage(usage);
218        ret
219    }
220    #[cfg(all(feature = "GpuExtent3dDict", feature = "GpuTextureFormat",))]
221    #[doc = "Construct a new `GpuTextureDescriptor`."]
222    #[doc = ""]
223    #[doc = "*This API requires the following crate features to be activated: `GpuExtent3dDict`, `GpuTextureDescriptor`, `GpuTextureFormat`*"]
224    #[doc = ""]
225    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
226    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
227    pub fn new_with_gpu_extent_3d_dict(
228        format: GpuTextureFormat,
229        size: &GpuExtent3dDict,
230        usage: u32,
231    ) -> Self {
232        #[allow(unused_mut)]
233        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
234        ret.set_format(format);
235        ret.set_size_gpu_extent_3d_dict(size);
236        ret.set_usage(usage);
237        ret
238    }
239    #[cfg(web_sys_unstable_apis)]
240    #[deprecated = "Use `set_label()` instead."]
241    pub fn label(&mut self, val: &str) -> &mut Self {
242        self.set_label(val);
243        self
244    }
245    #[cfg(web_sys_unstable_apis)]
246    #[cfg(feature = "GpuTextureDimension")]
247    #[deprecated = "Use `set_dimension()` instead."]
248    pub fn dimension(&mut self, val: GpuTextureDimension) -> &mut Self {
249        self.set_dimension(val);
250        self
251    }
252    #[cfg(web_sys_unstable_apis)]
253    #[cfg(feature = "GpuTextureFormat")]
254    #[deprecated = "Use `set_format()` instead."]
255    pub fn format(&mut self, val: GpuTextureFormat) -> &mut Self {
256        self.set_format(val);
257        self
258    }
259    #[cfg(web_sys_unstable_apis)]
260    #[deprecated = "Use `set_mip_level_count()` instead."]
261    pub fn mip_level_count(&mut self, val: u32) -> &mut Self {
262        self.set_mip_level_count(val);
263        self
264    }
265    #[cfg(web_sys_unstable_apis)]
266    #[deprecated = "Use `set_sample_count()` instead."]
267    pub fn sample_count(&mut self, val: u32) -> &mut Self {
268        self.set_sample_count(val);
269        self
270    }
271    #[cfg(web_sys_unstable_apis)]
272    #[deprecated = "Use `set_size()` instead."]
273    pub fn size(&mut self, val: &[::js_sys::Number]) -> &mut Self {
274        self.set_size(val);
275        self
276    }
277    #[cfg(web_sys_unstable_apis)]
278    #[cfg(feature = "GpuTextureViewDimension")]
279    #[deprecated = "Use `set_texture_binding_view_dimension()` instead."]
280    pub fn texture_binding_view_dimension(&mut self, val: GpuTextureViewDimension) -> &mut Self {
281        self.set_texture_binding_view_dimension(val);
282        self
283    }
284    #[cfg(web_sys_unstable_apis)]
285    #[deprecated = "Use `set_usage()` instead."]
286    pub fn usage(&mut self, val: u32) -> &mut Self {
287        self.set_usage(val);
288        self
289    }
290    #[cfg(web_sys_unstable_apis)]
291    #[deprecated = "Use `set_view_formats()` instead."]
292    pub fn view_formats(&mut self, val: &[::js_sys::JsString]) -> &mut Self {
293        self.set_view_formats(val);
294        self
295    }
296}