Skip to content

Commit 39669fb

Browse files
committed
Deploying to master from @ gfx-rs/wgpu@3a5d0f2 🚀
1 parent c78255f commit 39669fb

File tree

97 files changed

+893
-850
lines changed

Some content is hidden

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

97 files changed

+893
-850
lines changed

doc/search-index.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/search.desc/wgpu_core/wgpu_core-desc-0-.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_core/command/clear.rs.html

Lines changed: 127 additions & 135 deletions
Large diffs are not rendered by default.

doc/src/wgpu_core/command/mod.rs.html

Lines changed: 79 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,32 @@
12411241
<a href="#1240" id="1240">1240</a>
12421242
<a href="#1241" id="1241">1241</a>
12431243
<a href="#1242" id="1242">1242</a>
1244-
<a href="#1243" id="1243">1243</a></pre></div><pre class="rust"><code><span class="kw">mod </span>allocator;
1244+
<a href="#1243" id="1243">1243</a>
1245+
<a href="#1244" id="1244">1244</a>
1246+
<a href="#1245" id="1245">1245</a>
1247+
<a href="#1246" id="1246">1246</a>
1248+
<a href="#1247" id="1247">1247</a>
1249+
<a href="#1248" id="1248">1248</a>
1250+
<a href="#1249" id="1249">1249</a>
1251+
<a href="#1250" id="1250">1250</a>
1252+
<a href="#1251" id="1251">1251</a>
1253+
<a href="#1252" id="1252">1252</a>
1254+
<a href="#1253" id="1253">1253</a>
1255+
<a href="#1254" id="1254">1254</a>
1256+
<a href="#1255" id="1255">1255</a>
1257+
<a href="#1256" id="1256">1256</a>
1258+
<a href="#1257" id="1257">1257</a>
1259+
<a href="#1258" id="1258">1258</a>
1260+
<a href="#1259" id="1259">1259</a>
1261+
<a href="#1260" id="1260">1260</a>
1262+
<a href="#1261" id="1261">1261</a>
1263+
<a href="#1262" id="1262">1262</a>
1264+
<a href="#1263" id="1263">1263</a>
1265+
<a href="#1264" id="1264">1264</a>
1266+
<a href="#1265" id="1265">1265</a>
1267+
<a href="#1266" id="1266">1266</a>
1268+
<a href="#1267" id="1267">1267</a>
1269+
<a href="#1268" id="1268">1268</a></pre></div><pre class="rust"><code><span class="kw">mod </span>allocator;
12451270
<span class="kw">mod </span>bind;
12461271
<span class="kw">mod </span>bundle;
12471272
<span class="kw">mod </span>clear;
@@ -1280,7 +1305,7 @@
12801305
<span class="kw">use </span><span class="kw">crate</span>::snatch::SnatchGuard;
12811306

12821307
<span class="kw">use </span><span class="kw">crate</span>::init_tracker::BufferInitTrackerAction;
1283-
<span class="kw">use </span><span class="kw">crate</span>::ray_tracing::AsAction;
1308+
<span class="kw">use </span><span class="kw">crate</span>::ray_tracing::{AsAction, BuildAccelerationStructureError};
12841309
<span class="kw">use </span><span class="kw">crate</span>::resource::{
12851310
DestroyedResourceError, Fallible, InvalidResourceError, Labeled, ParentDevice <span class="kw">as _</span>, QuerySet,
12861311
};
@@ -1349,17 +1374,6 @@
13491374
}
13501375

13511376
<span class="kw">impl </span>CommandEncoderStatus {
1352-
<span class="doccomment">/// Checks that the encoder is in the [`Self::Recording`] state.
1353-
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>record(<span class="kw-2">&amp;mut </span><span class="self">self</span>) -&gt; <span class="prelude-ty">Result</span>&lt;RecordingGuard&lt;<span class="lifetime">'_</span>&gt;, EncoderStateError&gt; {
1354-
<span class="kw">match </span><span class="self">self </span>{
1355-
<span class="self">Self</span>::Recording(<span class="kw">_</span>) =&gt; <span class="prelude-val">Ok</span>(RecordingGuard { inner: <span class="self">self </span>}),
1356-
<span class="self">Self</span>::Locked(<span class="kw">_</span>) =&gt; <span class="prelude-val">Err</span>(<span class="self">self</span>.invalidate(EncoderStateError::Locked)),
1357-
<span class="self">Self</span>::Finished(<span class="kw">_</span>) =&gt; <span class="prelude-val">Err</span>(EncoderStateError::Ended),
1358-
<span class="self">Self</span>::Error(<span class="kw">_</span>) =&gt; <span class="prelude-val">Err</span>(EncoderStateError::Invalid),
1359-
<span class="self">Self</span>::Transitioning =&gt; <span class="macro">unreachable!</span>(),
1360-
}
1361-
}
1362-
13631377
<span class="doccomment">/// Record commands using the supplied closure.
13641378
///
13651379
/// If the encoder is in the [`Self::Recording`] state, calls the closure to
@@ -1381,29 +1395,50 @@
13811395
<span class="kw-2">&amp;mut </span><span class="self">self</span>,
13821396
f: F,
13831397
) -&gt; <span class="prelude-ty">Result</span>&lt;(), EncoderStateError&gt; {
1384-
<span class="kw">let </span>err = <span class="kw">match </span><span class="self">self</span>.record() {
1385-
<span class="prelude-val">Ok</span>(guard) =&gt; {
1386-
guard.record(f);
1387-
<span class="kw">return </span><span class="prelude-val">Ok</span>(());
1398+
<span class="kw">match </span><span class="self">self </span>{
1399+
<span class="self">Self</span>::Recording(<span class="kw">_</span>) =&gt; {
1400+
RecordingGuard { inner: <span class="self">self </span>}.record(f);
1401+
<span class="prelude-val">Ok</span>(())
13881402
}
1389-
<span class="prelude-val">Err</span>(err) =&gt; err,
1390-
};
1391-
<span class="kw">match </span>err {
1392-
err @ EncoderStateError::Locked =&gt; {
1403+
<span class="self">Self</span>::Locked(<span class="kw">_</span>) =&gt; {
13931404
<span class="comment">// Invalidate the encoder and do not record anything, but do not
13941405
// return an immediate validation error.
1395-
</span><span class="self">self</span>.invalidate(err);
1406+
</span><span class="self">self</span>.invalidate(EncoderStateError::Locked);
13961407
<span class="prelude-val">Ok</span>(())
13971408
}
1398-
err @ EncoderStateError::Ended =&gt; {
1399-
<span class="comment">// Invalidate the encoder, do not record anything, and return an
1400-
// immediate validation error.
1401-
</span><span class="prelude-val">Err</span>(<span class="self">self</span>.invalidate(err))
1402-
}
1409+
<span class="comment">// Encoder is ended. Invalidate the encoder, do not record anything,
1410+
// and return an immediate validation error.
1411+
</span><span class="self">Self</span>::Finished(<span class="kw">_</span>) =&gt; <span class="prelude-val">Err</span>(<span class="self">self</span>.invalidate(EncoderStateError::Ended)),
14031412
<span class="comment">// Encoder is already invalid. Do not record anything, but do not
14041413
// return an immediate validation error.
1405-
</span>EncoderStateError::Invalid =&gt; <span class="prelude-val">Ok</span>(()),
1406-
EncoderStateError::Unlocked | EncoderStateError::Submitted =&gt; <span class="macro">unreachable!</span>(),
1414+
</span><span class="self">Self</span>::Error(<span class="kw">_</span>) =&gt; <span class="prelude-val">Ok</span>(()),
1415+
<span class="self">Self</span>::Transitioning =&gt; <span class="macro">unreachable!</span>(),
1416+
}
1417+
}
1418+
1419+
<span class="doccomment">/// Special version of record used by `command_encoder_as_hal_mut`. This
1420+
/// differs from the regular version in two ways:
1421+
///
1422+
/// 1. The recording closure is infallible.
1423+
/// 2. The recording closure takes `Option&lt;&amp;mut CommandBufferMutable&gt;`, and
1424+
/// in the case that the encoder is not in a valid state for recording, the
1425+
/// closure is still called, with `None` as its argument.
1426+
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>record_as_hal_mut&lt;T, F: FnOnce(<span class="prelude-ty">Option</span>&lt;<span class="kw-2">&amp;mut </span>CommandBufferMutable&gt;) -&gt; T&gt;(
1427+
<span class="kw-2">&amp;mut </span><span class="self">self</span>,
1428+
f: F,
1429+
) -&gt; T {
1430+
<span class="kw">match </span><span class="self">self </span>{
1431+
<span class="self">Self</span>::Recording(<span class="kw">_</span>) =&gt; RecordingGuard { inner: <span class="self">self </span>}.record_as_hal_mut(f),
1432+
<span class="self">Self</span>::Locked(<span class="kw">_</span>) =&gt; {
1433+
<span class="self">self</span>.invalidate(EncoderStateError::Locked);
1434+
f(<span class="prelude-val">None</span>)
1435+
}
1436+
<span class="self">Self</span>::Finished(<span class="kw">_</span>) =&gt; {
1437+
<span class="self">self</span>.invalidate(EncoderStateError::Ended);
1438+
f(<span class="prelude-val">None</span>)
1439+
}
1440+
<span class="self">Self</span>::Error(<span class="kw">_</span>) =&gt; f(<span class="prelude-val">None</span>),
1441+
<span class="self">Self</span>::Transitioning =&gt; <span class="macro">unreachable!</span>(),
14071442
}
14081443
}
14091444

@@ -1538,6 +1573,17 @@
15381573
}
15391574
}
15401575
}
1576+
1577+
<span class="doccomment">/// Special version of record used by `command_encoder_as_hal_mut`. This
1578+
/// version takes an infallible recording closure.
1579+
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>record_as_hal_mut&lt;T, F: FnOnce(<span class="prelude-ty">Option</span>&lt;<span class="kw-2">&amp;mut </span>CommandBufferMutable&gt;) -&gt; T&gt;(
1580+
<span class="kw-2">mut </span><span class="self">self</span>,
1581+
f: F,
1582+
) -&gt; T {
1583+
<span class="kw">let </span>res = f(<span class="prelude-val">Some</span>(<span class="kw-2">&amp;mut </span><span class="self">self</span>));
1584+
<span class="self">self</span>.mark_successful();
1585+
res
1586+
}
15411587
}
15421588

15431589
<span class="kw">impl</span>&lt;<span class="lifetime">'a</span>&gt; Drop <span class="kw">for </span>RecordingGuard&lt;<span class="lifetime">'a</span>&gt; {
@@ -2142,6 +2188,10 @@
21422188
<span class="attr">#[error(transparent)]
21432189
</span>Clear(<span class="attr">#[from] </span>ClearError),
21442190
<span class="attr">#[error(transparent)]
2191+
</span>Query(<span class="attr">#[from] </span>QueryError),
2192+
<span class="attr">#[error(transparent)]
2193+
</span>BuildAccelerationStructure(<span class="attr">#[from] </span>BuildAccelerationStructureError),
2194+
<span class="attr">#[error(transparent)]
21452195
</span>TransitionResources(<span class="attr">#[from] </span>TransitionResourcesError),
21462196
<span class="attr">#[error(
21472197
<span class="string">"begin and end indices of pass timestamp writes are both set to {idx}, which is not allowed"

0 commit comments

Comments
 (0)