Files
phy/wgpu_hal/trait.Queue.html
Orion Kindel 0ce894e6b0 doc
2025-03-18 10:30:23 -05:00

95 lines
19 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `Queue` trait in crate `wgpu_hal`."><title>Queue in wgpu_hal - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="wgpu_hal" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.0 (9fc6b4312 2025-01-07)" data-channel="1.84.0" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../wgpu_hal/index.html">wgpu_<wbr>hal</a><span class="version">23.0.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Queue</a></h2><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.A" title="A">A</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.get_timestamp_period" title="get_timestamp_period">get_timestamp_period</a></li><li><a href="#tymethod.present" title="present">present</a></li><li><a href="#tymethod.submit" title="submit">submit</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate wgpu_<wbr>hal</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="index.html">wgpu_hal</a></span><h1>Trait <span class="trait">Queue</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/wgpu_hal/lib.rs.html#980-1063">Source</a> </span></div><pre class="rust item-decl"><code>pub trait Queue: <a class="trait" href="../wgpu_types/send_sync/trait.WasmNotSendSync.html" title="trait wgpu_types::send_sync::WasmNotSendSync">WasmNotSendSync</a> {
type <a href="#associatedtype.A" class="associatedtype">A</a>: <a class="trait" href="trait.Api.html" title="trait wgpu_hal::Api">Api</a>;
// Required methods
unsafe fn <a href="#tymethod.submit" class="fn">submit</a>(
&amp;self,
command_buffers: &amp;[&amp;&lt;Self::<a class="associatedtype" href="trait.Queue.html#associatedtype.A" title="type wgpu_hal::Queue::A">A</a> as <a class="trait" href="trait.Api.html" title="trait wgpu_hal::Api">Api</a>&gt;::<a class="associatedtype" href="trait.Api.html#associatedtype.CommandBuffer" title="type wgpu_hal::Api::CommandBuffer">CommandBuffer</a>],
surface_textures: &amp;[&amp;&lt;Self::<a class="associatedtype" href="trait.Queue.html#associatedtype.A" title="type wgpu_hal::Queue::A">A</a> as <a class="trait" href="trait.Api.html" title="trait wgpu_hal::Api">Api</a>&gt;::<a class="associatedtype" href="trait.Api.html#associatedtype.SurfaceTexture" title="type wgpu_hal::Api::SurfaceTexture">SurfaceTexture</a>],
signal_fence: (&amp;mut &lt;Self::<a class="associatedtype" href="trait.Queue.html#associatedtype.A" title="type wgpu_hal::Queue::A">A</a> as <a class="trait" href="trait.Api.html" title="trait wgpu_hal::Api">Api</a>&gt;::<a class="associatedtype" href="trait.Api.html#associatedtype.Fence" title="type wgpu_hal::Api::Fence">Fence</a>, <a class="type" href="type.FenceValue.html" title="type wgpu_hal::FenceValue">FenceValue</a>),
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.unit.html">()</a>, <a class="enum" href="enum.DeviceError.html" title="enum wgpu_hal::DeviceError">DeviceError</a>&gt;;
<span class="item-spacer"></span> unsafe fn <a href="#tymethod.present" class="fn">present</a>(
&amp;self,
surface: &amp;&lt;Self::<a class="associatedtype" href="trait.Queue.html#associatedtype.A" title="type wgpu_hal::Queue::A">A</a> as <a class="trait" href="trait.Api.html" title="trait wgpu_hal::Api">Api</a>&gt;::<a class="associatedtype" href="trait.Api.html#associatedtype.Surface" title="type wgpu_hal::Api::Surface">Surface</a>,
texture: &lt;Self::<a class="associatedtype" href="trait.Queue.html#associatedtype.A" title="type wgpu_hal::Queue::A">A</a> as <a class="trait" href="trait.Api.html" title="trait wgpu_hal::Api">Api</a>&gt;::<a class="associatedtype" href="trait.Api.html#associatedtype.SurfaceTexture" title="type wgpu_hal::Api::SurfaceTexture">SurfaceTexture</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.unit.html">()</a>, <a class="enum" href="enum.SurfaceError.html" title="enum wgpu_hal::SurfaceError">SurfaceError</a>&gt;;
<span class="item-spacer"></span> unsafe fn <a href="#tymethod.get_timestamp_period" class="fn">get_timestamp_period</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f32.html">f32</a>;
}</code></pre><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><section id="associatedtype.A" class="method"><a class="src rightside" href="../src/wgpu_hal/lib.rs.html#981">Source</a><h4 class="code-header">type <a href="#associatedtype.A" class="associatedtype">A</a>: <a class="trait" href="trait.Api.html" title="trait wgpu_hal::Api">Api</a></h4></section></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.submit" class="method"><a class="src rightside" href="../src/wgpu_hal/lib.rs.html#1051-1056">Source</a><h4 class="code-header">unsafe fn <a href="#tymethod.submit" class="fn">submit</a>(
&amp;self,
command_buffers: &amp;[&amp;&lt;Self::<a class="associatedtype" href="trait.Queue.html#associatedtype.A" title="type wgpu_hal::Queue::A">A</a> as <a class="trait" href="trait.Api.html" title="trait wgpu_hal::Api">Api</a>&gt;::<a class="associatedtype" href="trait.Api.html#associatedtype.CommandBuffer" title="type wgpu_hal::Api::CommandBuffer">CommandBuffer</a>],
surface_textures: &amp;[&amp;&lt;Self::<a class="associatedtype" href="trait.Queue.html#associatedtype.A" title="type wgpu_hal::Queue::A">A</a> as <a class="trait" href="trait.Api.html" title="trait wgpu_hal::Api">Api</a>&gt;::<a class="associatedtype" href="trait.Api.html#associatedtype.SurfaceTexture" title="type wgpu_hal::Api::SurfaceTexture">SurfaceTexture</a>],
signal_fence: (&amp;mut &lt;Self::<a class="associatedtype" href="trait.Queue.html#associatedtype.A" title="type wgpu_hal::Queue::A">A</a> as <a class="trait" href="trait.Api.html" title="trait wgpu_hal::Api">Api</a>&gt;::<a class="associatedtype" href="trait.Api.html#associatedtype.Fence" title="type wgpu_hal::Api::Fence">Fence</a>, <a class="type" href="type.FenceValue.html" title="type wgpu_hal::FenceValue">FenceValue</a>),
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.unit.html">()</a>, <a class="enum" href="enum.DeviceError.html" title="enum wgpu_hal::DeviceError">DeviceError</a>&gt;</h4></section></summary><div class="docblock"><p>Submit <code>command_buffers</code> for execution on GPU.</p>
<p>Update <code>fence</code> to <code>value</code> when the operation is complete. See
<a href="trait.Api.html#associatedtype.Fence" title="associated type wgpu_hal::Api::Fence"><code>Fence</code></a> for details.</p>
<p>A <code>wgpu_hal</code> queue is “single threaded”: all command buffers are
executed in the order theyre submitted, with each buffer able to see
previous buffers results. Specifically:</p>
<ul>
<li>
<p>If two calls to <code>submit</code> on a single <code>Queue</code> occur in a particular
order (that is, they happen on the same thread, or on two threads that
have synchronized to establish an ordering), then the first
submissions commands all complete execution before any of the second
submissions commands begin. All results produced by one submission
are visible to the next.</p>
</li>
<li>
<p>Within a submission, command buffers execute in the order in which they
appear in <code>command_buffers</code>. All results produced by one buffer are
visible to the next.</p>
</li>
</ul>
<p>If two calls to <code>submit</code> on a single <code>Queue</code> from different threads are
not synchronized to occur in a particular order, they must pass distinct
<a href="trait.Api.html#associatedtype.Fence" title="associated type wgpu_hal::Api::Fence"><code>Fence</code></a>s. As explained in the <a href="trait.Api.html#associatedtype.Fence" title="associated type wgpu_hal::Api::Fence"><code>Fence</code></a> documentation, waiting for
operations to complete is only trustworthy when operations finish in
order of increasing fence value, but submissions from different threads
cannot determine how to order the fence values if the submissions
themselves are unordered. If each thread uses a separate <a href="trait.Api.html#associatedtype.Fence" title="associated type wgpu_hal::Api::Fence"><code>Fence</code></a>, this
problem does not arise.</p>
<h5 id="safety"><a class="doc-anchor" href="#safety">§</a>Safety</h5>
<ul>
<li>
<p>Each <a href="trait.Api.html#associatedtype.CommandBuffer" title="associated type wgpu_hal::Api::CommandBuffer"><code>CommandBuffer</code></a> in <code>command_buffers</code> must have been created
from a <a href="trait.Api.html#associatedtype.CommandEncoder" title="associated type wgpu_hal::Api::CommandEncoder"><code>CommandEncoder</code></a> that was constructed from the
<a href="trait.Api.html#associatedtype.Device" title="associated type wgpu_hal::Api::Device"><code>Device</code></a> associated with this <a href="trait.Queue.html" title="trait wgpu_hal::Queue"><code>Queue</code></a>.</p>
</li>
<li>
<p>Each <a href="trait.Api.html#associatedtype.CommandBuffer" title="associated type wgpu_hal::Api::CommandBuffer"><code>CommandBuffer</code></a> must remain alive until the submitted
commands have finished execution. Since command buffers must not
outlive their encoders, this implies that the encoders must remain
alive as well.</p>
</li>
<li>
<p>All resources used by a submitted <a href="trait.Api.html#associatedtype.CommandBuffer" title="associated type wgpu_hal::Api::CommandBuffer"><code>CommandBuffer</code></a>
(<a href="trait.Api.html#associatedtype.Texture" title="associated type wgpu_hal::Api::Texture"><code>Texture</code></a>s, <a href="trait.Api.html#associatedtype.BindGroup" title="associated type wgpu_hal::Api::BindGroup"><code>BindGroup</code></a>s, <a href="trait.Api.html#associatedtype.RenderPipeline" title="associated type wgpu_hal::Api::RenderPipeline"><code>RenderPipeline</code></a>s, and so
on) must remain alive until the command buffer finishes execution.</p>
</li>
<li>
<p>Every <a href="trait.Api.html#associatedtype.SurfaceTexture" title="associated type wgpu_hal::Api::SurfaceTexture"><code>SurfaceTexture</code></a> that any command in <code>command_buffers</code>
writes to must appear in the <code>surface_textures</code> argument.</p>
</li>
<li>
<p>No <a href="trait.Api.html#associatedtype.SurfaceTexture" title="associated type wgpu_hal::Api::SurfaceTexture"><code>SurfaceTexture</code></a> may appear in the <code>surface_textures</code>
argument more than once.</p>
</li>
<li>
<p>Each <a href="trait.Api.html#associatedtype.SurfaceTexture" title="associated type wgpu_hal::Api::SurfaceTexture"><code>SurfaceTexture</code></a> in <code>surface_textures</code> must be configured
for use with the <a href="trait.Api.html#associatedtype.Device" title="associated type wgpu_hal::Api::Device"><code>Device</code></a> associated with this <a href="trait.Queue.html" title="trait wgpu_hal::Queue"><code>Queue</code></a>,
typically by calling <a href="trait.Surface.html#tymethod.configure" title="method wgpu_hal::Surface::configure"><code>Surface::configure</code></a>.</p>
</li>
<li>
<p>All calls to this function that include a given <a href="trait.Api.html#associatedtype.SurfaceTexture" title="associated type wgpu_hal::Api::SurfaceTexture"><code>SurfaceTexture</code></a>
in <code>surface_textures</code> must use the same <a href="trait.Api.html#associatedtype.Fence" title="associated type wgpu_hal::Api::Fence"><code>Fence</code></a>.</p>
</li>
<li>
<p>The <a href="trait.Api.html#associatedtype.Fence" title="associated type wgpu_hal::Api::Fence"><code>Fence</code></a> passed as <code>signal_fence.0</code> must remain alive until
all submissions that will signal it have completed.</p>
</li>
</ul>
</div></details><section id="tymethod.present" class="method"><a class="src rightside" href="../src/wgpu_hal/lib.rs.html#1057-1061">Source</a><h4 class="code-header">unsafe fn <a href="#tymethod.present" class="fn">present</a>(
&amp;self,
surface: &amp;&lt;Self::<a class="associatedtype" href="trait.Queue.html#associatedtype.A" title="type wgpu_hal::Queue::A">A</a> as <a class="trait" href="trait.Api.html" title="trait wgpu_hal::Api">Api</a>&gt;::<a class="associatedtype" href="trait.Api.html#associatedtype.Surface" title="type wgpu_hal::Api::Surface">Surface</a>,
texture: &lt;Self::<a class="associatedtype" href="trait.Queue.html#associatedtype.A" title="type wgpu_hal::Queue::A">A</a> as <a class="trait" href="trait.Api.html" title="trait wgpu_hal::Api">Api</a>&gt;::<a class="associatedtype" href="trait.Api.html#associatedtype.SurfaceTexture" title="type wgpu_hal::Api::SurfaceTexture">SurfaceTexture</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.unit.html">()</a>, <a class="enum" href="enum.SurfaceError.html" title="enum wgpu_hal::SurfaceError">SurfaceError</a>&gt;</h4></section><section id="tymethod.get_timestamp_period" class="method"><a class="src rightside" href="../src/wgpu_hal/lib.rs.html#1062">Source</a><h4 class="code-header">unsafe fn <a href="#tymethod.get_timestamp_period" class="fn">get_timestamp_period</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f32.html">f32</a></h4></section></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-Queue-for-Context" class="impl"><a class="src rightside" href="../src/wgpu_hal/empty.rs.html#139-161">Source</a><a href="#impl-Queue-for-Context" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Queue.html" title="trait wgpu_hal::Queue">Queue</a> for <a class="struct" href="empty/struct.Context.html" title="struct wgpu_hal::empty::Context">Context</a></h3></section></summary><div class="impl-items"><section id="associatedtype.A-1" class="associatedtype trait-impl"><a class="src rightside" href="../src/wgpu_hal/empty.rs.html#140">Source</a><a href="#associatedtype.A-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.A" class="associatedtype">A</a> = <a class="struct" href="empty/struct.Api.html" title="struct wgpu_hal::empty::Api">Api</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Queue-for-Queue" class="impl"><a class="src rightside" href="../src/wgpu_hal/gles/queue.rs.html#1816-1876">Source</a><a href="#impl-Queue-for-Queue" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Queue.html" title="trait wgpu_hal::Queue">Queue</a> for wgpu_hal::gles::<a class="struct" href="gles/struct.Queue.html" title="struct wgpu_hal::gles::Queue">Queue</a></h3></section></summary><div class="impl-items"><section id="associatedtype.A-2" class="associatedtype trait-impl"><a class="src rightside" href="../src/wgpu_hal/gles/queue.rs.html#1817">Source</a><a href="#associatedtype.A-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.A" class="associatedtype">A</a> = <a class="struct" href="gles/struct.Api.html" title="struct wgpu_hal::gles::Api">Api</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Queue-for-Queue-1" class="impl"><a class="src rightside" href="../src/wgpu_hal/vulkan/mod.rs.html#1105-1288">Source</a><a href="#impl-Queue-for-Queue-1" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Queue.html" title="trait wgpu_hal::Queue">Queue</a> for wgpu_hal::vulkan::<a class="struct" href="vulkan/struct.Queue.html" title="struct wgpu_hal::vulkan::Queue">Queue</a></h3></section></summary><div class="impl-items"><section id="associatedtype.A-3" class="associatedtype trait-impl"><a class="src rightside" href="../src/wgpu_hal/vulkan/mod.rs.html#1106">Source</a><a href="#associatedtype.A-3" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.A" class="associatedtype">A</a> = <a class="struct" href="vulkan/struct.Api.html" title="struct wgpu_hal::vulkan::Api">Api</a></h4></section></div></details></div><script src="../trait.impl/wgpu_hal/trait.Queue.js" async></script></section></div></main></body></html>