Skip to content

Commit 92de1c4

Browse files
committed
Deploying to master from @ gfx-rs/wgpu@d291571 🚀
1 parent acda848 commit 92de1c4

File tree

373 files changed

+2001
-2021
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

373 files changed

+2001
-2021
lines changed

doc/search-index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/src/wgpu/api/adapter.rs.html

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,7 @@
195195
<a href="#194" id="194">194</a>
196196
<a href="#195" id="195">195</a>
197197
<a href="#196" id="196">196</a>
198-
<a href="#197" id="197">197</a>
199-
<a href="#198" id="198">198</a>
200-
<a href="#199" id="199">199</a>
201-
<a href="#200" id="200">200</a>
202-
<a href="#201" id="201">201</a>
203-
<a href="#202" id="202">202</a>
204-
<a href="#203" id="203">203</a>
205-
</pre></div><pre class="rust"><code><span class="kw">use </span>std::{future::Future, sync::Arc};
198+
</pre></div><pre class="rust"><code><span class="kw">use </span>std::future::Future;
206199

207200
<span class="kw">use crate</span>::<span class="kw-2">*</span>;
208201

@@ -219,7 +212,7 @@
219212
/// Corresponds to [WebGPU `GPUAdapter`](https://gpuweb.github.io/gpuweb/#gpu-adapter).
220213
</span><span class="attr">#[derive(Debug, Clone)]
221214
</span><span class="kw">pub struct </span>Adapter {
222-
<span class="kw">pub</span>(<span class="kw">crate</span>) inner: Arc&lt;dispatch::DispatchAdapter&gt;,
215+
<span class="kw">pub</span>(<span class="kw">crate</span>) inner: dispatch::DispatchAdapter,
223216
}
224217
<span class="attr">#[cfg(send_sync)]
225218
</span><span class="macro">static_assertions::assert_impl_all!</span>(Adapter: Send, Sync);
@@ -269,16 +262,9 @@
269262
) -&gt; <span class="kw">impl </span>Future&lt;Output = <span class="prelude-ty">Result</span>&lt;(Device, Queue), RequestDeviceError&gt;&gt; + WasmNotSend {
270263
<span class="kw">let </span>device = <span class="self">self</span>.inner.request_device(desc, trace_path);
271264
<span class="kw">async move </span>{
272-
device.<span class="kw">await</span>.map(|(device, queue)| {
273-
(
274-
Device {
275-
inner: Arc::new(device),
276-
},
277-
Queue {
278-
inner: Arc::new(queue),
279-
},
280-
)
281-
})
265+
device
266+
.<span class="kw">await
267+
</span>.map(|(device, queue)| (Device { inner: device }, Queue { inner: queue }))
282268
}
283269
}
284270

@@ -304,10 +290,10 @@
304290

305291
<span class="prelude-val">Ok</span>((
306292
Device {
307-
inner: Arc::new(device.into()),
293+
inner: device.into(),
308294
},
309295
Queue {
310-
inner: Arc::new(queue.into()),
296+
inner: queue.into(),
311297
},
312298
))
313299
}

doc/src/wgpu/api/bind_group.rs.html

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,7 @@
141141
<a href="#140" id="140">140</a>
142142
<a href="#141" id="141">141</a>
143143
<a href="#142" id="142">142</a>
144-
<a href="#143" id="143">143</a>
145-
<a href="#144" id="144">144</a>
146-
</pre></div><pre class="rust"><code><span class="kw">use </span>std::sync::Arc;
147-
148-
<span class="kw">use crate</span>::<span class="kw-2">*</span>;
144+
</pre></div><pre class="rust"><code><span class="kw">use crate</span>::<span class="kw-2">*</span>;
149145

150146
<span class="doccomment">/// Handle to a binding group.
151147
///
@@ -157,7 +153,7 @@
157153
/// Corresponds to [WebGPU `GPUBindGroup`](https://gpuweb.github.io/gpuweb/#gpubindgroup).
158154
</span><span class="attr">#[derive(Debug, Clone)]
159155
</span><span class="kw">pub struct </span>BindGroup {
160-
<span class="kw">pub</span>(<span class="kw">crate</span>) inner: Arc&lt;dispatch::DispatchBindGroup&gt;,
156+
<span class="kw">pub</span>(<span class="kw">crate</span>) inner: dispatch::DispatchBindGroup,
161157
}
162158
<span class="attr">#[cfg(send_sync)]
163159
</span><span class="macro">static_assertions::assert_impl_all!</span>(BindGroup: Send, Sync);

doc/src/wgpu/api/bind_group_layout.rs.html

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@
3636
<a href="#35" id="35">35</a>
3737
<a href="#36" id="36">36</a>
3838
<a href="#37" id="37">37</a>
39-
<a href="#38" id="38">38</a>
40-
<a href="#39" id="39">39</a>
41-
</pre></div><pre class="rust"><code><span class="kw">use </span>std::sync::Arc;
42-
43-
<span class="kw">use crate</span>::<span class="kw-2">*</span>;
39+
</pre></div><pre class="rust"><code><span class="kw">use crate</span>::<span class="kw-2">*</span>;
4440

4541
<span class="doccomment">/// Handle to a binding group layout.
4642
///
@@ -55,7 +51,7 @@
5551
/// https://gpuweb.github.io/gpuweb/#gpubindgrouplayout).
5652
</span><span class="attr">#[derive(Debug, Clone)]
5753
</span><span class="kw">pub struct </span>BindGroupLayout {
58-
<span class="kw">pub</span>(<span class="kw">crate</span>) inner: Arc&lt;dispatch::DispatchBindGroupLayout&gt;,
54+
<span class="kw">pub</span>(<span class="kw">crate</span>) inner: dispatch::DispatchBindGroupLayout,
5955
}
6056
<span class="attr">#[cfg(send_sync)]
6157
</span><span class="macro">static_assertions::assert_impl_all!</span>(BindGroupLayout: Send, Sync);

doc/src/wgpu/api/blas.rs.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,8 @@
180180
<a href="#179" id="179">179</a>
181181
<a href="#180" id="180">180</a>
182182
<a href="#181" id="181">181</a>
183-
<a href="#182" id="182">182</a>
184183
</pre></div><pre class="rust"><code><span class="kw">use </span><span class="kw">crate</span>::dispatch;
185184
<span class="kw">use crate</span>::{Buffer, Label};
186-
<span class="kw">use </span>std::sync::Arc;
187185
<span class="kw">use </span>wgt::WasmNotSendSync;
188186

189187
<span class="doccomment">/// Descriptor for the size defining attributes of a triangle geometry, for a bottom level acceleration structure.
@@ -227,7 +225,7 @@
227225
/// [TlasPackage]: crate::TlasPackage
228226
</span><span class="attr">#[derive(Debug, Clone)]
229227
</span><span class="kw">pub struct </span>TlasInstance {
230-
<span class="kw">pub</span>(<span class="kw">crate</span>) blas: Arc&lt;dispatch::DispatchBlas&gt;,
228+
<span class="kw">pub</span>(<span class="kw">crate</span>) blas: dispatch::DispatchBlas,
231229
<span class="doccomment">/// Affine transform matrix 3x4 (rows x columns, row major order).
232230
</span><span class="kw">pub </span>transform: [f32; <span class="number">12</span>],
233231
<span class="doccomment">/// Custom index for the instance used inside the shader.
@@ -321,7 +319,7 @@
321319
/// [Tlas]: crate::Tlas
322320
</span><span class="kw">pub struct </span>Blas {
323321
<span class="kw">pub</span>(<span class="kw">crate</span>) handle: <span class="prelude-ty">Option</span>&lt;u64&gt;,
324-
<span class="kw">pub</span>(<span class="kw">crate</span>) inner: Arc&lt;dispatch::DispatchBlas&gt;,
322+
<span class="kw">pub</span>(<span class="kw">crate</span>) inner: dispatch::DispatchBlas,
325323
}
326324
<span class="macro">static_assertions::assert_impl_all!</span>(Blas: WasmNotSendSync);
327325

doc/src/wgpu/api/buffer.rs.html

Lines changed: 21 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -742,30 +742,6 @@
742742
<a href="#741" id="741">741</a>
743743
<a href="#742" id="742">742</a>
744744
<a href="#743" id="743">743</a>
745-
<a href="#744" id="744">744</a>
746-
<a href="#745" id="745">745</a>
747-
<a href="#746" id="746">746</a>
748-
<a href="#747" id="747">747</a>
749-
<a href="#748" id="748">748</a>
750-
<a href="#749" id="749">749</a>
751-
<a href="#750" id="750">750</a>
752-
<a href="#751" id="751">751</a>
753-
<a href="#752" id="752">752</a>
754-
<a href="#753" id="753">753</a>
755-
<a href="#754" id="754">754</a>
756-
<a href="#755" id="755">755</a>
757-
<a href="#756" id="756">756</a>
758-
<a href="#757" id="757">757</a>
759-
<a href="#758" id="758">758</a>
760-
<a href="#759" id="759">759</a>
761-
<a href="#760" id="760">760</a>
762-
<a href="#761" id="761">761</a>
763-
<a href="#762" id="762">762</a>
764-
<a href="#763" id="763">763</a>
765-
<a href="#764" id="764">764</a>
766-
<a href="#765" id="765">765</a>
767-
<a href="#766" id="766">766</a>
768-
<a href="#767" id="767">767</a>
769745
</pre></div><pre class="rust"><code><span class="kw">use </span>std::{
770746
error, fmt,
771747
ops::{Bound, Deref, DerefMut, Range, RangeBounds},
@@ -776,15 +752,6 @@
776752

777753
<span class="kw">use crate</span>::<span class="kw-2">*</span>;
778754

779-
<span class="attr">#[derive(Debug)]
780-
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">struct </span>BufferShared {
781-
<span class="kw">pub </span>inner: dispatch::DispatchBuffer,
782-
<span class="kw">pub </span>map_context: Mutex&lt;MapContext&gt;,
783-
<span class="kw">pub </span>size: wgt::BufferAddress,
784-
<span class="kw">pub </span>usage: BufferUsages,
785-
<span class="comment">// Todo: missing map_state https://www.w3.org/TR/webgpu/#dom-gpubuffer-mapstate
786-
</span>}
787-
788755
<span class="doccomment">/// Handle to a GPU-accessible buffer.
789756
///
790757
/// Created with [`Device::create_buffer`] or
@@ -947,12 +914,16 @@
947914
/// [`MAP_WRITE`]: BufferUsages::MAP_WRITE
948915
</span><span class="attr">#[derive(Debug, Clone)]
949916
</span><span class="kw">pub struct </span>Buffer {
950-
<span class="kw">pub</span>(<span class="kw">crate</span>) shared: Arc&lt;BufferShared&gt;,
951-
}
917+
<span class="kw">pub</span>(<span class="kw">crate</span>) inner: dispatch::DispatchBuffer,
918+
<span class="kw">pub</span>(<span class="kw">crate</span>) map_context: Arc&lt;Mutex&lt;MapContext&gt;&gt;,
919+
<span class="kw">pub</span>(<span class="kw">crate</span>) size: wgt::BufferAddress,
920+
<span class="kw">pub</span>(<span class="kw">crate</span>) usage: BufferUsages,
921+
<span class="comment">// Todo: missing map_state https://www.w3.org/TR/webgpu/#dom-gpubuffer-mapstate
922+
</span>}
952923
<span class="attr">#[cfg(send_sync)]
953924
</span><span class="macro">static_assertions::assert_impl_all!</span>(Buffer: Send, Sync);
954925

955-
<span class="macro">crate::cmp::impl_eq_ord_hash_proxy!</span>(Buffer =&gt; .shared.inner);
926+
<span class="macro">crate::cmp::impl_eq_ord_hash_proxy!</span>(Buffer =&gt; .inner);
956927

957928
<span class="kw">impl </span>Buffer {
958929
<span class="doccomment">/// Return the binding view of the entire buffer.
@@ -980,7 +951,7 @@
980951
<span class="kw-2">&amp;</span><span class="self">self</span>,
981952
hal_buffer_callback: F,
982953
) -&gt; R {
983-
<span class="kw">if let </span><span class="prelude-val">Some</span>(buffer) = <span class="self">self</span>.shared.inner.as_core_opt() {
954+
<span class="kw">if let </span><span class="prelude-val">Some</span>(buffer) = <span class="self">self</span>.inner.as_core_opt() {
984955
<span class="kw">unsafe </span>{
985956
buffer
986957
.context
@@ -1007,7 +978,7 @@
1007978
/// end of the buffer.
1008979
</span><span class="kw">pub fn </span>slice&lt;S: RangeBounds&lt;BufferAddress&gt;&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, bounds: S) -&gt; BufferSlice&lt;<span class="lifetime">'_</span>&gt; {
1009980
<span class="kw">let </span>(offset, size) = range_to_offset_size(bounds);
1010-
check_buffer_bounds(<span class="self">self</span>.shared.size, offset, size);
981+
check_buffer_bounds(<span class="self">self</span>.size, offset, size);
1011982
BufferSlice {
1012983
buffer: <span class="self">self</span>,
1013984
offset,
@@ -1017,27 +988,27 @@
1017988

1018989
<span class="doccomment">/// Flushes any pending write operations and unmaps the buffer from host memory.
1019990
</span><span class="kw">pub fn </span>unmap(<span class="kw-2">&amp;</span><span class="self">self</span>) {
1020-
<span class="self">self</span>.shared.map_context.lock().reset();
1021-
<span class="self">self</span>.shared.inner.unmap();
991+
<span class="self">self</span>.map_context.lock().reset();
992+
<span class="self">self</span>.inner.unmap();
1022993
}
1023994

1024995
<span class="doccomment">/// Destroy the associated native resources as soon as possible.
1025996
</span><span class="kw">pub fn </span>destroy(<span class="kw-2">&amp;</span><span class="self">self</span>) {
1026-
<span class="self">self</span>.shared.inner.destroy();
997+
<span class="self">self</span>.inner.destroy();
1027998
}
1028999

10291000
<span class="doccomment">/// Returns the length of the buffer allocation in bytes.
10301001
///
10311002
/// This is always equal to the `size` that was specified when creating the buffer.
10321003
</span><span class="kw">pub fn </span>size(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; BufferAddress {
1033-
<span class="self">self</span>.shared.size
1004+
<span class="self">self</span>.size
10341005
}
10351006

10361007
<span class="doccomment">/// Returns the allowed usages for this `Buffer`.
10371008
///
10381009
/// This is always equal to the `usage` that was specified when creating the buffer.
10391010
</span><span class="kw">pub fn </span>usage(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; BufferUsages {
1040-
<span class="self">self</span>.shared.usage
1011+
<span class="self">self</span>.usage
10411012
}
10421013
}
10431014

@@ -1104,7 +1075,7 @@
11041075
mode: MapMode,
11051076
callback: <span class="kw">impl </span>FnOnce(<span class="prelude-ty">Result</span>&lt;(), BufferAsyncError&gt;) + WasmNotSend + <span class="lifetime">'static</span>,
11061077
) {
1107-
<span class="kw">let </span><span class="kw-2">mut </span>mc = <span class="self">self</span>.buffer.shared.map_context.lock();
1078+
<span class="kw">let </span><span class="kw-2">mut </span>mc = <span class="self">self</span>.buffer.map_context.lock();
11081079
<span class="macro">assert_eq!</span>(mc.initial_range, <span class="number">0</span>..<span class="number">0</span>, <span class="string">"Buffer is already mapped"</span>);
11091080
<span class="kw">let </span>end = <span class="kw">match </span><span class="self">self</span>.size {
11101081
<span class="prelude-val">Some</span>(s) =&gt; <span class="self">self</span>.offset + s.get(),
@@ -1113,7 +1084,6 @@
11131084
mc.initial_range = <span class="self">self</span>.offset..end;
11141085

11151086
<span class="self">self</span>.buffer
1116-
.shared
11171087
.inner
11181088
.map_async(mode, <span class="self">self</span>.offset..end, Box::new(callback));
11191089
}
@@ -1133,13 +1103,8 @@
11331103
///
11341104
/// [mapped]: Buffer#mapping-buffers
11351105
</span><span class="kw">pub fn </span>get_mapped_range(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; BufferView&lt;<span class="lifetime">'a</span>&gt; {
1136-
<span class="kw">let </span>end = <span class="self">self
1137-
</span>.buffer
1138-
.shared
1139-
.map_context
1140-
.lock()
1141-
.add(<span class="self">self</span>.offset, <span class="self">self</span>.size);
1142-
<span class="kw">let </span>range = <span class="self">self</span>.buffer.shared.inner.get_mapped_range(<span class="self">self</span>.offset..end);
1106+
<span class="kw">let </span>end = <span class="self">self</span>.buffer.map_context.lock().add(<span class="self">self</span>.offset, <span class="self">self</span>.size);
1107+
<span class="kw">let </span>range = <span class="self">self</span>.buffer.inner.get_mapped_range(<span class="self">self</span>.offset..end);
11431108
BufferView {
11441109
slice: <span class="kw-2">*</span><span class="self">self</span>,
11451110
inner: range,
@@ -1156,15 +1121,9 @@
11561121
/// This is only available on WebGPU, on any other backends this will return `None`.
11571122
</span><span class="attr">#[cfg(webgpu)]
11581123
</span><span class="kw">pub fn </span>get_mapped_range_as_array_buffer(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; <span class="prelude-ty">Option</span>&lt;js_sys::ArrayBuffer&gt; {
1159-
<span class="kw">let </span>end = <span class="self">self
1160-
</span>.buffer
1161-
.shared
1162-
.map_context
1163-
.lock()
1164-
.add(<span class="self">self</span>.offset, <span class="self">self</span>.size);
1124+
<span class="kw">let </span>end = <span class="self">self</span>.buffer.map_context.lock().add(<span class="self">self</span>.offset, <span class="self">self</span>.size);
11651125

11661126
<span class="self">self</span>.buffer
1167-
.shared
11681127
.inner
11691128
.get_mapped_range_as_array_buffer(<span class="self">self</span>.offset..end)
11701129
}
@@ -1184,17 +1143,12 @@
11841143
///
11851144
/// [mapped]: Buffer#mapping-buffers
11861145
</span><span class="kw">pub fn </span>get_mapped_range_mut(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; BufferViewMut&lt;<span class="lifetime">'a</span>&gt; {
1187-
<span class="kw">let </span>end = <span class="self">self
1188-
</span>.buffer
1189-
.shared
1190-
.map_context
1191-
.lock()
1192-
.add(<span class="self">self</span>.offset, <span class="self">self</span>.size);
1193-
<span class="kw">let </span>range = <span class="self">self</span>.buffer.shared.inner.get_mapped_range(<span class="self">self</span>.offset..end);
1146+
<span class="kw">let </span>end = <span class="self">self</span>.buffer.map_context.lock().add(<span class="self">self</span>.offset, <span class="self">self</span>.size);
1147+
<span class="kw">let </span>range = <span class="self">self</span>.buffer.inner.get_mapped_range(<span class="self">self</span>.offset..end);
11941148
BufferViewMut {
11951149
slice: <span class="kw-2">*</span><span class="self">self</span>,
11961150
inner: range,
1197-
readable: <span class="self">self</span>.buffer.shared.usage.contains(BufferUsages::MAP_READ),
1151+
readable: <span class="self">self</span>.buffer.usage.contains(BufferUsages::MAP_READ),
11981152
}
11991153
}
12001154
}
@@ -1419,7 +1373,6 @@
14191373
<span class="kw">fn </span>drop(<span class="kw-2">&amp;mut </span><span class="self">self</span>) {
14201374
<span class="self">self</span>.slice
14211375
.buffer
1422-
.shared
14231376
.map_context
14241377
.lock()
14251378
.remove(<span class="self">self</span>.slice.offset, <span class="self">self</span>.slice.size);
@@ -1430,7 +1383,6 @@
14301383
<span class="kw">fn </span>drop(<span class="kw-2">&amp;mut </span><span class="self">self</span>) {
14311384
<span class="self">self</span>.slice
14321385
.buffer
1433-
.shared
14341386
.map_context
14351387
.lock()
14361388
.remove(<span class="self">self</span>.slice.offset, <span class="self">self</span>.slice.size);

doc/src/wgpu/api/command_encoder.rs.html

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,6 @@
349349
<a href="#348" id="348">348</a>
350350
<a href="#349" id="349">349</a>
351351
<a href="#350" id="350">350</a>
352-
<a href="#351" id="351">351</a>
353352
</pre></div><pre class="rust"><code><span class="kw">use </span>std::{ops::Range, sync::Arc};
354353

355354
<span class="kw">use crate</span>::{
@@ -474,9 +473,9 @@
474473
copy_size: BufferAddress,
475474
) {
476475
<span class="self">self</span>.inner.copy_buffer_to_buffer(
477-
<span class="kw-2">&amp;</span>source.shared.inner,
476+
<span class="kw-2">&amp;</span>source.inner,
478477
source_offset,
479-
<span class="kw-2">&amp;</span>destination.shared.inner,
478+
<span class="kw-2">&amp;</span>destination.inner,
480479
destination_offset,
481480
copy_size,
482481
);
@@ -535,8 +534,7 @@
535534
/// - `CLEAR_TEXTURE` extension not enabled
536535
/// - Range is out of bounds
537536
</span><span class="kw">pub fn </span>clear_texture(<span class="kw-2">&amp;mut </span><span class="self">self</span>, texture: <span class="kw-2">&amp;</span>Texture, subresource_range: <span class="kw-2">&amp;</span>ImageSubresourceRange) {
538-
<span class="self">self</span>.inner
539-
.clear_texture(<span class="kw-2">&amp;</span>texture.shared.inner, subresource_range);
537+
<span class="self">self</span>.inner.clear_texture(<span class="kw-2">&amp;</span>texture.inner, subresource_range);
540538
}
541539

542540
<span class="doccomment">/// Clears buffer to zero.
@@ -551,7 +549,7 @@
551549
offset: BufferAddress,
552550
size: <span class="prelude-ty">Option</span>&lt;BufferAddress&gt;,
553551
) {
554-
<span class="self">self</span>.inner.clear_buffer(<span class="kw-2">&amp;</span>buffer.shared.inner, offset, size);
552+
<span class="self">self</span>.inner.clear_buffer(<span class="kw-2">&amp;</span>buffer.inner, offset, size);
555553
}
556554

557555
<span class="doccomment">/// Inserts debug marker.
@@ -584,7 +582,7 @@
584582
<span class="kw-2">&amp;</span>query_set.inner,
585583
query_range.start,
586584
query_range.end - query_range.start,
587-
<span class="kw-2">&amp;</span>destination.shared.inner,
585+
<span class="kw-2">&amp;</span>destination.inner,
588586
destination_offset,
589587
);
590588
}

0 commit comments

Comments
 (0)