195 lines
42 KiB
HTML
195 lines
42 KiB
HTML
<!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="A cross-platform unsafe graphics abstraction."><title>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="../crates.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 mod crate"><!--[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"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#primary-backends" title="Primary backends">Primary backends</a></li><li><a href="#secondary-backends" title="Secondary backends">Secondary backends</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#validation-is-the-calling-codes-responsibility-not-wgpu-hals" title="Validation is the calling code’s responsibility, not `wgpu-hal`’s">Validation is the calling code’s responsibility, not <code>wgpu-hal</code>’s</a></li><li><a href="#debugging" title="Debugging">Debugging</a></li></ul><h3><a href="#modules">Crate Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#constants" title="Constants">Constants</a></li><li><a href="#statics" title="Statics">Statics</a></li><li><a href="#traits-1" title="Traits">Traits</a></li><li><a href="#types" title="Type Aliases">Type Aliases</a></li></ul></section><div id="rustdoc-modnav"></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"><h1>Crate <span>wgpu_hal</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#1-2519">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A cross-platform unsafe graphics abstraction.</p>
|
||
<p>This crate defines a set of traits abstracting over modern graphics APIs,
|
||
with implementations (“backends”) for Vulkan, Metal, Direct3D, and GL.</p>
|
||
<p><code>wgpu-hal</code> is a spiritual successor to
|
||
<a href="https://github.com/gfx-rs/gfx">gfx-hal</a>, but with reduced scope, and
|
||
oriented towards WebGPU implementation goals. It has no overhead for
|
||
validation or tracking, and the API translation overhead is kept to the bare
|
||
minimum by the design of WebGPU. This API can be used for resource-demanding
|
||
applications and engines.</p>
|
||
<p>The <code>wgpu-hal</code> crate’s main design choices:</p>
|
||
<ul>
|
||
<li>
|
||
<p>Our traits are meant to be <em>portable</em>: proper use
|
||
should get equivalent results regardless of the backend.</p>
|
||
</li>
|
||
<li>
|
||
<p>Our traits’ contracts are <em>unsafe</em>: implementations perform minimal
|
||
validation, if any, and incorrect use will often cause undefined behavior.
|
||
This allows us to minimize the overhead we impose over the underlying
|
||
graphics system. If you need safety, the <a href="https://crates.io/crates/wgpu-core"><code>wgpu-core</code></a> crate provides a
|
||
safe API for driving <code>wgpu-hal</code>, implementing all necessary validation,
|
||
resource state tracking, and so on. (Note that <code>wgpu-core</code> is designed for
|
||
use via FFI; the <a href="https://crates.io/crates/wgpu"><code>wgpu</code></a> crate provides more idiomatic Rust bindings for
|
||
<code>wgpu-core</code>.) Or, you can do your own validation.</p>
|
||
</li>
|
||
<li>
|
||
<p>In the same vein, returned errors <em>only cover cases the user can’t
|
||
anticipate</em>, like running out of memory or losing the device. Any errors
|
||
that the user could reasonably anticipate are their responsibility to
|
||
avoid. For example, <code>wgpu-hal</code> returns no error for mapping a buffer that’s
|
||
not mappable: as the buffer creator, the user should already know if they
|
||
can map it.</p>
|
||
</li>
|
||
<li>
|
||
<p>We use <em>static dispatch</em>. The traits are not
|
||
generally object-safe. You must select a specific backend type
|
||
like <a href="vulkan/struct.Api.html"><code>vulkan::Api</code></a> or <a href="metal/struct.Api.html"><code>metal::Api</code></a>, and then use that
|
||
according to the main traits, or call backend-specific methods.</p>
|
||
</li>
|
||
<li>
|
||
<p>We use <em>idiomatic Rust parameter passing</em>,
|
||
taking objects by reference, returning them by value, and so on,
|
||
unlike <code>wgpu-core</code>, which refers to objects by ID.</p>
|
||
</li>
|
||
<li>
|
||
<p>We map buffer contents <em>persistently</em>. This means that the buffer can
|
||
remain mapped on the CPU while the GPU reads or writes to it. You must
|
||
explicitly indicate when data might need to be transferred between CPU and
|
||
GPU, if <a href="trait.Device.html#tymethod.map_buffer" title="method wgpu_hal::Device::map_buffer"><code>Device::map_buffer</code></a> indicates that this is necessary.</p>
|
||
</li>
|
||
<li>
|
||
<p>You must record <em>explicit barriers</em> between different usages of a
|
||
resource. For example, if a buffer is written to by a compute
|
||
shader, and then used as and index buffer to a draw call, you
|
||
must use <a href="trait.CommandEncoder.html#tymethod.transition_buffers" title="method wgpu_hal::CommandEncoder::transition_buffers"><code>CommandEncoder::transition_buffers</code></a> between those two
|
||
operations.</p>
|
||
</li>
|
||
<li>
|
||
<p>Pipeline layouts are <em>explicitly specified</em> when setting bind groups.
|
||
Incompatible layouts disturb groups bound at higher indices.</p>
|
||
</li>
|
||
<li>
|
||
<p>The API <em>accepts collections as iterators</em>, to avoid forcing the user to
|
||
store data in particular containers. The implementation doesn’t guarantee
|
||
that any of the iterators are drained, unless stated otherwise by the
|
||
function documentation. For this reason, we recommend that iterators don’t
|
||
do any mutating work.</p>
|
||
</li>
|
||
</ul>
|
||
<p>Unfortunately, <code>wgpu-hal</code>‘s safety requirements are not fully documented.
|
||
Ideally, all trait methods would have doc comments setting out the
|
||
requirements users must meet to ensure correct and portable behavior. If you
|
||
are aware of a specific requirement that a backend imposes that is not
|
||
ensured by the traits’ documented rules, please file an issue. Or, if you are
|
||
a capable technical writer, please file a pull request!</p>
|
||
<h3 id="primary-backends"><a class="doc-anchor" href="#primary-backends">§</a>Primary backends</h3>
|
||
<p>The <code>wgpu-hal</code> crate has full-featured backends implemented on the following
|
||
platform graphics APIs:</p>
|
||
<ul>
|
||
<li>
|
||
<p>Vulkan, available on Linux, Android, and Windows, using the <a href="https://crates.io/crates/ash"><code>ash</code></a> crate’s
|
||
Vulkan bindings. It’s also available on macOS, if you install <a href="https://github.com/KhronosGroup/MoltenVK">MoltenVK</a>.</p>
|
||
</li>
|
||
<li>
|
||
<p>Metal on macOS, using the <a href="https://crates.io/crates/metal"><code>metal</code></a> crate’s bindings.</p>
|
||
</li>
|
||
<li>
|
||
<p>Direct3D 12 on Windows, using the <a href="https://crates.io/crates/d3d12"><code>d3d12</code></a> crate’s bindings.</p>
|
||
</li>
|
||
</ul>
|
||
<h3 id="secondary-backends"><a class="doc-anchor" href="#secondary-backends">§</a>Secondary backends</h3>
|
||
<p>The <code>wgpu-hal</code> crate has a partial implementation based on the following
|
||
platform graphics API:</p>
|
||
<ul>
|
||
<li>The GL backend is available anywhere OpenGL, OpenGL ES, or WebGL are
|
||
available. See the <a href="gles/index.html"><code>gles</code></a> module documentation for details.</li>
|
||
</ul>
|
||
<p>You can see what capabilities an adapter is missing by checking the
|
||
<a href="../wgpu_types/struct.DownlevelCapabilities.html" title="struct wgpu_types::DownlevelCapabilities"><code>DownlevelCapabilities</code></a> in <a href="struct.ExposedAdapter.html#structfield.capabilities" title="field wgpu_hal::ExposedAdapter::capabilities"><code>ExposedAdapter::capabilities</code></a>, available
|
||
from <a href="trait.Instance.html#tymethod.enumerate_adapters" title="method wgpu_hal::Instance::enumerate_adapters"><code>Instance::enumerate_adapters</code></a>.</p>
|
||
<p>The API is generally designed to fit the primary backends better than the
|
||
secondary backends, so the latter may impose more overhead.</p>
|
||
<h3 id="traits"><a class="doc-anchor" href="#traits">§</a>Traits</h3>
|
||
<p>The <code>wgpu-hal</code> crate defines a handful of traits that together
|
||
represent a cross-platform abstraction for modern GPU APIs.</p>
|
||
<ul>
|
||
<li>
|
||
<p>The <a href="trait.Api.html" title="trait wgpu_hal::Api"><code>Api</code></a> trait represents a <code>wgpu-hal</code> backend. It has no methods of its
|
||
own, only a collection of associated types.</p>
|
||
</li>
|
||
<li>
|
||
<p><a href="trait.Api.html#associatedtype.Instance" title="associated type wgpu_hal::Api::Instance"><code>Api::Instance</code></a> implements the <a href="trait.Instance.html" title="trait wgpu_hal::Instance"><code>Instance</code></a> trait. <a href="trait.Instance.html#tymethod.init" title="associated function wgpu_hal::Instance::init"><code>Instance::init</code></a>
|
||
creates an instance value, which you can use to enumerate the adapters
|
||
available on the system. For example, <a href="trait.Instance.html#tymethod.init" title="associated function wgpu_hal::Instance::init"><code>vulkan::Api::Instance::init</code></a>
|
||
returns an instance that can enumerate the Vulkan physical devices on your
|
||
system.</p>
|
||
</li>
|
||
<li>
|
||
<p><a href="trait.Api.html#associatedtype.Adapter" title="associated type wgpu_hal::Api::Adapter"><code>Api::Adapter</code></a> implements the <a href="trait.Adapter.html" title="trait wgpu_hal::Adapter"><code>Adapter</code></a> trait, representing a
|
||
particular device from a particular backend. For example, a Vulkan instance
|
||
might have a Lavapipe software adapter and a GPU-based adapter.</p>
|
||
</li>
|
||
<li>
|
||
<p><a href="trait.Api.html#associatedtype.Device" title="associated type wgpu_hal::Api::Device"><code>Api::Device</code></a> implements the <a href="trait.Device.html" title="trait wgpu_hal::Device"><code>Device</code></a> trait, representing an active
|
||
link to a device. You get a device value by calling <a href="trait.Adapter.html#tymethod.open" title="method wgpu_hal::Adapter::open"><code>Adapter::open</code></a>, and
|
||
then use it to create buffers, textures, shader modules, and so on.</p>
|
||
</li>
|
||
<li>
|
||
<p><a href="trait.Api.html#associatedtype.Queue" title="associated type wgpu_hal::Api::Queue"><code>Api::Queue</code></a> implements the <a href="trait.Queue.html" title="trait wgpu_hal::Queue"><code>Queue</code></a> trait, which you use to submit
|
||
command buffers to a given device.</p>
|
||
</li>
|
||
<li>
|
||
<p><a href="trait.Api.html#associatedtype.CommandEncoder" title="associated type wgpu_hal::Api::CommandEncoder"><code>Api::CommandEncoder</code></a> implements the <a href="trait.CommandEncoder.html" title="trait wgpu_hal::CommandEncoder"><code>CommandEncoder</code></a> trait, which you
|
||
use to build buffers of commands to submit to a queue. This has all the
|
||
methods for drawing and running compute shaders, which is presumably what
|
||
you’re here for.</p>
|
||
</li>
|
||
<li>
|
||
<p><a href="trait.Api.html#associatedtype.Surface" title="associated type wgpu_hal::Api::Surface"><code>Api::Surface</code></a> implements the <a href="trait.Surface.html" title="trait wgpu_hal::Surface"><code>Surface</code></a> trait, which represents a
|
||
swapchain for presenting images on the screen, via interaction with the
|
||
system’s window manager.</p>
|
||
</li>
|
||
</ul>
|
||
<p>The <a href="trait.Api.html" title="trait wgpu_hal::Api"><code>Api</code></a> trait has various other associated types like <a href="trait.Api.html#associatedtype.Buffer" title="associated type wgpu_hal::Api::Buffer"><code>Api::Buffer</code></a> and
|
||
<a href="trait.Api.html#associatedtype.Texture" title="associated type wgpu_hal::Api::Texture"><code>Api::Texture</code></a> that represent resources the rest of the interface can
|
||
operate on, but these generally do not have their own traits.</p>
|
||
<h3 id="validation-is-the-calling-codes-responsibility-not-wgpu-hals"><a class="doc-anchor" href="#validation-is-the-calling-codes-responsibility-not-wgpu-hals">§</a>Validation is the calling code’s responsibility, not <code>wgpu-hal</code>’s</h3>
|
||
<p>As much as possible, <code>wgpu-hal</code> traits place the burden of validation,
|
||
resource tracking, and state tracking on the caller, not on the trait
|
||
implementations themselves. Anything which can reasonably be handled in
|
||
backend-independent code should be. A <code>wgpu_hal</code> backend’s sole obligation is
|
||
to provide portable behavior, and report conditions that the calling code
|
||
can’t reasonably anticipate, like device loss or running out of memory.</p>
|
||
<p>The <code>wgpu</code> crate collection is intended for use in security-sensitive
|
||
applications, like web browsers, where the API is available to untrusted
|
||
code. This means that <code>wgpu-core</code>’s validation is not simply a service to
|
||
developers, to be provided opportunistically when the performance costs are
|
||
acceptable and the necessary data is ready at hand. Rather, <code>wgpu-core</code>’s
|
||
validation must be exhaustive, to ensure that even malicious content cannot
|
||
provoke and exploit undefined behavior in the platform’s graphics API.</p>
|
||
<p>Because graphics APIs’ requirements are complex, the only practical way for
|
||
<code>wgpu</code> to provide exhaustive validation is to comprehensively track the
|
||
lifetime and state of all the resources in the system. Implementing this
|
||
separately for each backend is infeasible; effort would be better spent
|
||
making the cross-platform validation in <code>wgpu-core</code> legible and trustworthy.
|
||
Fortunately, the requirements are largely similar across the various
|
||
platforms, so cross-platform validation is practical.</p>
|
||
<p>Some backends have specific requirements that aren’t practical to foist off
|
||
on the <code>wgpu-hal</code> user. For example, properly managing macOS Objective-C or
|
||
Microsoft COM reference counts is best handled by using appropriate pointer
|
||
types within the backend.</p>
|
||
<p>A desire for “defense in depth” may suggest performing additional validation
|
||
in <code>wgpu-hal</code> when the opportunity arises, but this must be done with
|
||
caution. Even experienced contributors infer the expectations their changes
|
||
must meet by considering not just requirements made explicit in types, tests,
|
||
assertions, and comments, but also those implicit in the surrounding code.
|
||
When one sees validation or state-tracking code in <code>wgpu-hal</code>, it is tempting
|
||
to conclude, “Oh, <code>wgpu-hal</code> checks for this, so <code>wgpu-core</code> needn’t worry
|
||
about it - that would be redundant!” The responsibility for exhaustive
|
||
validation always rests with <code>wgpu-core</code>, regardless of what may or may not
|
||
be checked in <code>wgpu-hal</code>.</p>
|
||
<p>To this end, any “defense in depth” validation that does appear in <code>wgpu-hal</code>
|
||
for requirements that <code>wgpu-core</code> should have enforced should report failure
|
||
via the <code>unreachable!</code> macro, because problems detected at this stage always
|
||
indicate a bug in <code>wgpu-core</code>.</p>
|
||
<h3 id="debugging"><a class="doc-anchor" href="#debugging">§</a>Debugging</h3>
|
||
<p>Most of the information on the wiki <a href="https://github.com/gfx-rs/wgpu/wiki/Debugging-wgpu-Applications">Debugging wgpu Applications</a>
|
||
page still applies to this API, with the exception of API tracing/replay
|
||
functionality, which is only available in <code>wgpu-core</code>.</p>
|
||
</div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="mod" href="api/index.html" title="mod wgpu_hal::api">api</a></div></li><li><div class="item-name"><a class="mod" href="auxil/index.html" title="mod wgpu_hal::auxil">auxil</a></div></li><li><div class="item-name"><a class="mod" href="empty/index.html" title="mod wgpu_hal::empty">empty</a></div><div class="desc docblock-short">A dummy API implementation.</div></li><li><div class="item-name"><a class="mod" href="gles/index.html" title="mod wgpu_hal::gles">gles</a></div><div class="desc docblock-short">GLES API internals.</div></li><li><div class="item-name"><a class="mod" href="vulkan/index.html" title="mod wgpu_hal::vulkan">vulkan</a></div><div class="desc docblock-short">Vulkan API internals.</div></li></ul><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.AccelerationStructureAABBs.html" title="struct wgpu_hal::AccelerationStructureAABBs">Acceleration<wbr>StructureAAB<wbr>Bs</a></div><div class="desc docblock-short"><code>offset</code> - offset in bytes</div></li><li><div class="item-name"><a class="struct" href="struct.AccelerationStructureBarrier.html" title="struct wgpu_hal::AccelerationStructureBarrier">Acceleration<wbr>Structure<wbr>Barrier</a></div></li><li><div class="item-name"><a class="struct" href="struct.AccelerationStructureBuildFlags.html" title="struct wgpu_hal::AccelerationStructureBuildFlags">Acceleration<wbr>Structure<wbr>Build<wbr>Flags</a></div><div class="desc docblock-short">Flags for acceleration structures</div></li><li><div class="item-name"><a class="struct" href="struct.AccelerationStructureBuildSizes.html" title="struct wgpu_hal::AccelerationStructureBuildSizes">Acceleration<wbr>Structure<wbr>Build<wbr>Sizes</a></div><div class="desc docblock-short">Information of the required size for a corresponding entries struct (+ flags)</div></li><li><div class="item-name"><a class="struct" href="struct.AccelerationStructureDescriptor.html" title="struct wgpu_hal::AccelerationStructureDescriptor">Acceleration<wbr>Structure<wbr>Descriptor</a></div></li><li><div class="item-name"><a class="struct" href="struct.AccelerationStructureGeometryFlags.html" title="struct wgpu_hal::AccelerationStructureGeometryFlags">Acceleration<wbr>Structure<wbr>Geometry<wbr>Flags</a></div><div class="desc docblock-short">Flags for acceleration structure geometries</div></li><li><div class="item-name"><a class="struct" href="struct.AccelerationStructureInstances.html" title="struct wgpu_hal::AccelerationStructureInstances">Acceleration<wbr>Structure<wbr>Instances</a></div><div class="desc docblock-short"><code>offset</code> - offset in bytes</div></li><li><div class="item-name"><a class="struct" href="struct.AccelerationStructureTriangleIndices.html" title="struct wgpu_hal::AccelerationStructureTriangleIndices">Acceleration<wbr>Structure<wbr>Triangle<wbr>Indices</a></div><div class="desc docblock-short"><code>offset</code> - offset in bytes</div></li><li><div class="item-name"><a class="struct" href="struct.AccelerationStructureTriangleTransform.html" title="struct wgpu_hal::AccelerationStructureTriangleTransform">Acceleration<wbr>Structure<wbr>Triangle<wbr>Transform</a></div><div class="desc docblock-short"><code>offset</code> - offset in bytes</div></li><li><div class="item-name"><a class="struct" href="struct.AccelerationStructureTriangles.html" title="struct wgpu_hal::AccelerationStructureTriangles">Acceleration<wbr>Structure<wbr>Triangles</a></div><div class="desc docblock-short"><code>first_vertex</code> - offset in the vertex buffer (as number of vertices)<code>indices</code> - optional index buffer with attributes<code>transform</code> - optional transform</div></li><li><div class="item-name"><a class="struct" href="struct.AccelerationStructureUses.html" title="struct wgpu_hal::AccelerationStructureUses">Acceleration<wbr>Structure<wbr>Uses</a></div></li><li><div class="item-name"><a class="struct" href="struct.AcquiredSurfaceTexture.html" title="struct wgpu_hal::AcquiredSurfaceTexture">Acquired<wbr>Surface<wbr>Texture</a></div></li><li><div class="item-name"><a class="struct" href="struct.Alignments.html" title="struct wgpu_hal::Alignments">Alignments</a></div></li><li><div class="item-name"><a class="struct" href="struct.Attachment.html" title="struct wgpu_hal::Attachment">Attachment</a></div></li><li><div class="item-name"><a class="struct" href="struct.AttachmentOps.html" title="struct wgpu_hal::AttachmentOps">Attachment<wbr>Ops</a></div></li><li><div class="item-name"><a class="struct" href="struct.BindGroupDescriptor.html" title="struct wgpu_hal::BindGroupDescriptor">Bind<wbr>Group<wbr>Descriptor</a></div><div class="desc docblock-short">BindGroup descriptor.</div></li><li><div class="item-name"><a class="struct" href="struct.BindGroupEntry.html" title="struct wgpu_hal::BindGroupEntry">Bind<wbr>Group<wbr>Entry</a></div></li><li><div class="item-name"><a class="struct" href="struct.BindGroupLayoutDescriptor.html" title="struct wgpu_hal::BindGroupLayoutDescriptor">Bind<wbr>Group<wbr>Layout<wbr>Descriptor</a></div><div class="desc docblock-short">BindGroupLayout descriptor.</div></li><li><div class="item-name"><a class="struct" href="struct.BindGroupLayoutFlags.html" title="struct wgpu_hal::BindGroupLayoutFlags">Bind<wbr>Group<wbr>Layout<wbr>Flags</a></div><div class="desc docblock-short">Pipeline layout creation flags.</div></li><li><div class="item-name"><a class="struct" href="struct.BufferBarrier.html" title="struct wgpu_hal::BufferBarrier">Buffer<wbr>Barrier</a></div></li><li><div class="item-name"><a class="struct" href="struct.BufferBinding.html" title="struct wgpu_hal::BufferBinding">Buffer<wbr>Binding</a></div><div class="desc docblock-short">A region of a buffer made visible to shaders via a <a href="trait.Api.html#associatedtype.BindGroup" title="associated type wgpu_hal::Api::BindGroup"><code>BindGroup</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.BufferCopy.html" title="struct wgpu_hal::BufferCopy">Buffer<wbr>Copy</a></div></li><li><div class="item-name"><a class="struct" href="struct.BufferDescriptor.html" title="struct wgpu_hal::BufferDescriptor">Buffer<wbr>Descriptor</a></div></li><li><div class="item-name"><a class="struct" href="struct.BufferMapping.html" title="struct wgpu_hal::BufferMapping">Buffer<wbr>Mapping</a></div></li><li><div class="item-name"><a class="struct" href="struct.BufferTextureCopy.html" title="struct wgpu_hal::BufferTextureCopy">Buffer<wbr>Texture<wbr>Copy</a></div></li><li><div class="item-name"><a class="struct" href="struct.BufferUses.html" title="struct wgpu_hal::BufferUses">Buffer<wbr>Uses</a></div><div class="desc docblock-short">Similar to <code>wgt::BufferUsages</code> but for internal use.</div></li><li><div class="item-name"><a class="struct" href="struct.BuildAccelerationStructureDescriptor.html" title="struct wgpu_hal::BuildAccelerationStructureDescriptor">Build<wbr>Acceleration<wbr>Structure<wbr>Descriptor</a></div><div class="desc docblock-short">Updates use source_acceleration_structure if present, else the update will be performed in place.
|
||
For updates, only the data is allowed to change (not the meta data or sizes).</div></li><li><div class="item-name"><a class="struct" href="struct.Capabilities.html" title="struct wgpu_hal::Capabilities">Capabilities</a></div></li><li><div class="item-name"><a class="struct" href="struct.ColorAttachment.html" title="struct wgpu_hal::ColorAttachment">Color<wbr>Attachment</a></div></li><li><div class="item-name"><a class="struct" href="struct.CommandEncoderDescriptor.html" title="struct wgpu_hal::CommandEncoderDescriptor">Command<wbr>Encoder<wbr>Descriptor</a></div></li><li><div class="item-name"><a class="struct" href="struct.ComputePassDescriptor.html" title="struct wgpu_hal::ComputePassDescriptor">Compute<wbr>Pass<wbr>Descriptor</a></div></li><li><div class="item-name"><a class="struct" href="struct.ComputePipelineDescriptor.html" title="struct wgpu_hal::ComputePipelineDescriptor">Compute<wbr>Pipeline<wbr>Descriptor</a></div><div class="desc docblock-short">Describes a compute pipeline.</div></li><li><div class="item-name"><a class="struct" href="struct.CopyExtent.html" title="struct wgpu_hal::CopyExtent">Copy<wbr>Extent</a></div></li><li><div class="item-name"><a class="struct" href="struct.DebugSource.html" title="struct wgpu_hal::DebugSource">Debug<wbr>Source</a></div></li><li><div class="item-name"><a class="struct" href="struct.DepthStencilAttachment.html" title="struct wgpu_hal::DepthStencilAttachment">Depth<wbr>Stencil<wbr>Attachment</a></div></li><li><div class="item-name"><a class="struct" href="struct.DropGuard.html" title="struct wgpu_hal::DropGuard">Drop<wbr>Guard</a></div></li><li><div class="item-name"><a class="struct" href="struct.DynAcquiredSurfaceTexture.html" title="struct wgpu_hal::DynAcquiredSurfaceTexture">DynAcquired<wbr>Surface<wbr>Texture</a></div></li><li><div class="item-name"><a class="struct" href="struct.DynExposedAdapter.html" title="struct wgpu_hal::DynExposedAdapter">DynExposed<wbr>Adapter</a></div></li><li><div class="item-name"><a class="struct" href="struct.DynOpenDevice.html" title="struct wgpu_hal::DynOpenDevice">DynOpen<wbr>Device</a></div></li><li><div class="item-name"><a class="struct" href="struct.ExposedAdapter.html" title="struct wgpu_hal::ExposedAdapter">Exposed<wbr>Adapter</a></div></li><li><div class="item-name"><a class="struct" href="struct.FormatAspects.html" title="struct wgpu_hal::FormatAspects">Format<wbr>Aspects</a></div><div class="desc docblock-short">Texture format capability flags.</div></li><li><div class="item-name"><a class="struct" href="struct.GetAccelerationStructureBuildSizesDescriptor.html" title="struct wgpu_hal::GetAccelerationStructureBuildSizesDescriptor">GetAcceleration<wbr>Structure<wbr>Build<wbr>Sizes<wbr>Descriptor</a></div><div class="desc docblock-short">All buffers, buffer addresses and offsets will be ignored.The build mode will be ignored.Reducing the amount of Instances, Triangle groups or AABB groups (or the number of Triangles/AABBs in corresponding groups),
|
||
may result in reduced size requirements.Any other change may result in a bigger or smaller size requirement.</div></li><li><div class="item-name"><a class="struct" href="struct.InstanceDescriptor.html" title="struct wgpu_hal::InstanceDescriptor">Instance<wbr>Descriptor</a></div></li><li><div class="item-name"><a class="struct" href="struct.InstanceError.html" title="struct wgpu_hal::InstanceError">Instance<wbr>Error</a></div><div class="desc docblock-short">Error occurring while trying to create an instance, or create a surface from an instance;
|
||
typically relating to the state of the underlying graphics API or hardware.</div></li><li><div class="item-name"><a class="struct" href="struct.MemoryFlags.html" title="struct wgpu_hal::MemoryFlags">Memory<wbr>Flags</a></div></li><li><div class="item-name"><a class="struct" href="struct.NagaShader.html" title="struct wgpu_hal::NagaShader">Naga<wbr>Shader</a></div><div class="desc docblock-short">Naga shader module.</div></li><li><div class="item-name"><a class="struct" href="struct.OpenDevice.html" title="struct wgpu_hal::OpenDevice">Open<wbr>Device</a></div></li><li><div class="item-name"><a class="struct" href="struct.PassTimestampWrites.html" title="struct wgpu_hal::PassTimestampWrites">Pass<wbr>Timestamp<wbr>Writes</a></div></li><li><div class="item-name"><a class="struct" href="struct.PipelineCacheDescriptor.html" title="struct wgpu_hal::PipelineCacheDescriptor">Pipeline<wbr>Cache<wbr>Descriptor</a></div></li><li><div class="item-name"><a class="struct" href="struct.PipelineLayoutDescriptor.html" title="struct wgpu_hal::PipelineLayoutDescriptor">Pipeline<wbr>Layout<wbr>Descriptor</a></div></li><li><div class="item-name"><a class="struct" href="struct.PipelineLayoutFlags.html" title="struct wgpu_hal::PipelineLayoutFlags">Pipeline<wbr>Layout<wbr>Flags</a></div><div class="desc docblock-short">Pipeline layout creation flags.</div></li><li><div class="item-name"><a class="struct" href="struct.ProgrammableStage.html" title="struct wgpu_hal::ProgrammableStage">Programmable<wbr>Stage</a></div><div class="desc docblock-short">Describes a programmable pipeline stage.</div></li><li><div class="item-name"><a class="struct" href="struct.Rect.html" title="struct wgpu_hal::Rect">Rect</a></div></li><li><div class="item-name"><a class="struct" href="struct.RenderPassDescriptor.html" title="struct wgpu_hal::RenderPassDescriptor">Render<wbr>Pass<wbr>Descriptor</a></div></li><li><div class="item-name"><a class="struct" href="struct.RenderPipelineDescriptor.html" title="struct wgpu_hal::RenderPipelineDescriptor">Render<wbr>Pipeline<wbr>Descriptor</a></div><div class="desc docblock-short">Describes a render (graphics) pipeline.</div></li><li><div class="item-name"><a class="struct" href="struct.SamplerDescriptor.html" title="struct wgpu_hal::SamplerDescriptor">Sampler<wbr>Descriptor</a></div></li><li><div class="item-name"><a class="struct" href="struct.ShaderModuleDescriptor.html" title="struct wgpu_hal::ShaderModuleDescriptor">Shader<wbr>Module<wbr>Descriptor</a></div></li><li><div class="item-name"><a class="struct" href="struct.SurfaceCapabilities.html" title="struct wgpu_hal::SurfaceCapabilities">Surface<wbr>Capabilities</a></div><div class="desc docblock-short">Describes information about what a <code>Surface</code>’s presentation capabilities are.
|
||
Fetch this with <a href="trait.Adapter.html#tymethod.surface_capabilities" title="method wgpu_hal::Adapter::surface_capabilities">Adapter::surface_capabilities</a>.</div></li><li><div class="item-name"><a class="struct" href="struct.SurfaceConfiguration.html" title="struct wgpu_hal::SurfaceConfiguration">Surface<wbr>Configuration</a></div></li><li><div class="item-name"><a class="struct" href="struct.TextureBarrier.html" title="struct wgpu_hal::TextureBarrier">Texture<wbr>Barrier</a></div></li><li><div class="item-name"><a class="struct" href="struct.TextureBinding.html" title="struct wgpu_hal::TextureBinding">Texture<wbr>Binding</a></div></li><li><div class="item-name"><a class="struct" href="struct.TextureCopy.html" title="struct wgpu_hal::TextureCopy">Texture<wbr>Copy</a></div></li><li><div class="item-name"><a class="struct" href="struct.TextureCopyBase.html" title="struct wgpu_hal::TextureCopyBase">Texture<wbr>Copy<wbr>Base</a></div></li><li><div class="item-name"><a class="struct" href="struct.TextureDescriptor.html" title="struct wgpu_hal::TextureDescriptor">Texture<wbr>Descriptor</a></div></li><li><div class="item-name"><a class="struct" href="struct.TextureFormatCapabilities.html" title="struct wgpu_hal::TextureFormatCapabilities">Texture<wbr>Format<wbr>Capabilities</a></div><div class="desc docblock-short">Texture format capability flags.</div></li><li><div class="item-name"><a class="struct" href="struct.TextureUses.html" title="struct wgpu_hal::TextureUses">Texture<wbr>Uses</a></div><div class="desc docblock-short">Similar to <code>wgt::TextureUsages</code> but for internal use.</div></li><li><div class="item-name"><a class="struct" href="struct.TextureViewDescriptor.html" title="struct wgpu_hal::TextureViewDescriptor">Texture<wbr>View<wbr>Descriptor</a></div><div class="desc docblock-short">TextureView descriptor.</div></li><li><div class="item-name"><a class="struct" href="struct.ValidationCanary.html" title="struct wgpu_hal::ValidationCanary">Validation<wbr>Canary</a></div><div class="desc docblock-short">Flag for internal testing.</div></li><li><div class="item-name"><a class="struct" href="struct.VertexBufferLayout.html" title="struct wgpu_hal::VertexBufferLayout">Vertex<wbr>Buffer<wbr>Layout</a></div><div class="desc docblock-short">Describes how the vertex buffer is interpreted.</div></li></ul><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="enum" href="enum.AccelerationStructureBuildMode.html" title="enum wgpu_hal::AccelerationStructureBuildMode">Acceleration<wbr>Structure<wbr>Build<wbr>Mode</a></div></li><li><div class="item-name"><a class="enum" href="enum.AccelerationStructureEntries.html" title="enum wgpu_hal::AccelerationStructureEntries">Acceleration<wbr>Structure<wbr>Entries</a></div><div class="desc docblock-short">Entries for a single descriptor</div></li><li><div class="item-name"><a class="enum" href="enum.AccelerationStructureFormat.html" title="enum wgpu_hal::AccelerationStructureFormat">Acceleration<wbr>Structure<wbr>Format</a></div></li><li><div class="item-name"><a class="enum" href="enum.DeviceError.html" title="enum wgpu_hal::DeviceError">Device<wbr>Error</a></div></li><li><div class="item-name"><a class="enum" href="enum.PipelineCacheError.html" title="enum wgpu_hal::PipelineCacheError">Pipeline<wbr>Cache<wbr>Error</a></div></li><li><div class="item-name"><a class="enum" href="enum.PipelineError.html" title="enum wgpu_hal::PipelineError">Pipeline<wbr>Error</a></div></li><li><div class="item-name"><a class="enum" href="enum.ShaderError.html" title="enum wgpu_hal::ShaderError">Shader<wbr>Error</a></div></li><li><div class="item-name"><a class="enum" href="enum.ShaderInput.html" title="enum wgpu_hal::ShaderInput">Shader<wbr>Input</a></div><div class="desc docblock-short">Shader input.</div></li><li><div class="item-name"><a class="enum" href="enum.SurfaceError.html" title="enum wgpu_hal::SurfaceError">Surface<wbr>Error</a></div></li></ul><h2 id="constants" class="section-header">Constants<a href="#constants" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="constant" href="constant.MAX_ANISOTROPY.html" title="constant wgpu_hal::MAX_ANISOTROPY">MAX_<wbr>ANISOTROPY</a></div></li><li><div class="item-name"><a class="constant" href="constant.MAX_BIND_GROUPS.html" title="constant wgpu_hal::MAX_BIND_GROUPS">MAX_<wbr>BIND_<wbr>GROUPS</a></div></li><li><div class="item-name"><a class="constant" href="constant.MAX_COLOR_ATTACHMENTS.html" title="constant wgpu_hal::MAX_COLOR_ATTACHMENTS">MAX_<wbr>COLOR_<wbr>ATTACHMENTS</a></div></li><li><div class="item-name"><a class="constant" href="constant.MAX_CONCURRENT_SHADER_STAGES.html" title="constant wgpu_hal::MAX_CONCURRENT_SHADER_STAGES">MAX_<wbr>CONCURRENT_<wbr>SHADER_<wbr>STAGES</a></div></li><li><div class="item-name"><a class="constant" href="constant.MAX_MIP_LEVELS.html" title="constant wgpu_hal::MAX_MIP_LEVELS">MAX_<wbr>MIP_<wbr>LEVELS</a></div></li><li><div class="item-name"><a class="constant" href="constant.MAX_VERTEX_BUFFERS.html" title="constant wgpu_hal::MAX_VERTEX_BUFFERS">MAX_<wbr>VERTEX_<wbr>BUFFERS</a></div></li><li><div class="item-name"><a class="constant" href="constant.QUERY_SIZE.html" title="constant wgpu_hal::QUERY_SIZE">QUERY_<wbr>SIZE</a></div><div class="desc docblock-short">Size of a single occlusion/timestamp query, when copied into a buffer, in bytes.</div></li></ul><h2 id="statics" class="section-header">Statics<a href="#statics" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="static" href="static.VALIDATION_CANARY.html" title="static wgpu_hal::VALIDATION_CANARY">VALIDATION_<wbr>CANARY</a></div><div class="desc docblock-short">Stores the text of any validation errors that have occurred since
|
||
the last call to <code>get_and_reset</code>.</div></li></ul><h2 id="traits-1" class="section-header">Traits<a href="#traits-1" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="trait" href="trait.Adapter.html" title="trait wgpu_hal::Adapter">Adapter</a></div></li><li><div class="item-name"><a class="trait" href="trait.Api.html" title="trait wgpu_hal::Api">Api</a></div></li><li><div class="item-name"><a class="trait" href="trait.CommandEncoder.html" title="trait wgpu_hal::CommandEncoder">Command<wbr>Encoder</a></div><div class="desc docblock-short">Encoder and allocation pool for <code>CommandBuffer</code>s.</div></li><li><div class="item-name"><a class="trait" href="trait.Device.html" title="trait wgpu_hal::Device">Device</a></div><div class="desc docblock-short">A connection to a GPU and a pool of resources to use with it.</div></li><li><div class="item-name"><a class="trait" href="trait.DynAccelerationStructure.html" title="trait wgpu_hal::DynAccelerationStructure">DynAcceleration<wbr>Structure</a></div></li><li><div class="item-name"><a class="trait" href="trait.DynAdapter.html" title="trait wgpu_hal::DynAdapter">DynAdapter</a></div></li><li><div class="item-name"><a class="trait" href="trait.DynBindGroup.html" title="trait wgpu_hal::DynBindGroup">DynBind<wbr>Group</a></div></li><li><div class="item-name"><a class="trait" href="trait.DynBindGroupLayout.html" title="trait wgpu_hal::DynBindGroupLayout">DynBind<wbr>Group<wbr>Layout</a></div></li><li><div class="item-name"><a class="trait" href="trait.DynBuffer.html" title="trait wgpu_hal::DynBuffer">DynBuffer</a></div></li><li><div class="item-name"><a class="trait" href="trait.DynCommandBuffer.html" title="trait wgpu_hal::DynCommandBuffer">DynCommand<wbr>Buffer</a></div></li><li><div class="item-name"><a class="trait" href="trait.DynCommandEncoder.html" title="trait wgpu_hal::DynCommandEncoder">DynCommand<wbr>Encoder</a></div></li><li><div class="item-name"><a class="trait" href="trait.DynComputePipeline.html" title="trait wgpu_hal::DynComputePipeline">DynCompute<wbr>Pipeline</a></div></li><li><div class="item-name"><a class="trait" href="trait.DynDevice.html" title="trait wgpu_hal::DynDevice">DynDevice</a></div></li><li><div class="item-name"><a class="trait" href="trait.DynFence.html" title="trait wgpu_hal::DynFence">DynFence</a></div></li><li><div class="item-name"><a class="trait" href="trait.DynInstance.html" title="trait wgpu_hal::DynInstance">DynInstance</a></div></li><li><div class="item-name"><a class="trait" href="trait.DynPipelineCache.html" title="trait wgpu_hal::DynPipelineCache">DynPipeline<wbr>Cache</a></div></li><li><div class="item-name"><a class="trait" href="trait.DynPipelineLayout.html" title="trait wgpu_hal::DynPipelineLayout">DynPipeline<wbr>Layout</a></div></li><li><div class="item-name"><a class="trait" href="trait.DynQuerySet.html" title="trait wgpu_hal::DynQuerySet">DynQuery<wbr>Set</a></div></li><li><div class="item-name"><a class="trait" href="trait.DynQueue.html" title="trait wgpu_hal::DynQueue">DynQueue</a></div></li><li><div class="item-name"><a class="trait" href="trait.DynRenderPipeline.html" title="trait wgpu_hal::DynRenderPipeline">DynRender<wbr>Pipeline</a></div></li><li><div class="item-name"><a class="trait" href="trait.DynResource.html" title="trait wgpu_hal::DynResource">DynResource</a></div><div class="desc docblock-short">Base trait for all resources, allows downcasting via <a href="https://doc.rust-lang.org/1.84.0/core/any/trait.Any.html" title="trait core::any::Any"><code>Any</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.DynSampler.html" title="trait wgpu_hal::DynSampler">DynSampler</a></div></li><li><div class="item-name"><a class="trait" href="trait.DynShaderModule.html" title="trait wgpu_hal::DynShaderModule">DynShader<wbr>Module</a></div></li><li><div class="item-name"><a class="trait" href="trait.DynSurface.html" title="trait wgpu_hal::DynSurface">DynSurface</a></div></li><li><div class="item-name"><a class="trait" href="trait.DynSurfaceTexture.html" title="trait wgpu_hal::DynSurfaceTexture">DynSurface<wbr>Texture</a></div></li><li><div class="item-name"><a class="trait" href="trait.DynTexture.html" title="trait wgpu_hal::DynTexture">DynTexture</a></div></li><li><div class="item-name"><a class="trait" href="trait.DynTextureView.html" title="trait wgpu_hal::DynTextureView">DynTexture<wbr>View</a></div></li><li><div class="item-name"><a class="trait" href="trait.Instance.html" title="trait wgpu_hal::Instance">Instance</a></div></li><li><div class="item-name"><a class="trait" href="trait.Queue.html" title="trait wgpu_hal::Queue">Queue</a></div></li><li><div class="item-name"><a class="trait" href="trait.Surface.html" title="trait wgpu_hal::Surface">Surface</a></div></li></ul><h2 id="types" class="section-header">Type Aliases<a href="#types" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="type" href="type.AtomicFenceValue.html" title="type wgpu_hal::AtomicFenceValue">Atomic<wbr>Fence<wbr>Value</a></div></li><li><div class="item-name"><a class="type" href="type.DropCallback.html" title="type wgpu_hal::DropCallback">Drop<wbr>Callback</a></div><div class="desc docblock-short">A callback to signal that wgpu is no longer using a resource.</div></li><li><div class="item-name"><a class="type" href="type.FenceValue.html" title="type wgpu_hal::FenceValue">Fence<wbr>Value</a></div></li><li><div class="item-name"><a class="type" href="type.Label.html" title="type wgpu_hal::Label">Label</a></div></li><li><div class="item-name"><a class="type" href="type.MemoryRange.html" title="type wgpu_hal::MemoryRange">Memory<wbr>Range</a></div></li></ul></section></div></main></body></html> |