Skip to content

Commit 8c9ff68

Browse files
Deploying to master from @ gfx-rs/wgpu@a6d7e0d 🚀
1 parent 5f74af5 commit 8c9ff68

File tree

1,306 files changed

+5537
-5451
lines changed

Some content is hidden

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

1,306 files changed

+5537
-5451
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/wgpu-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/search.desc/wgpu/wgpu-desc-1-.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/search.desc/wgpu_types/wgpu_types-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_types/lib.rs.html

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7613,7 +7613,48 @@
76137613
<a href="#7612" id="7612">7612</a>
76147614
<a href="#7613" id="7613">7613</a>
76157615
<a href="#7614" id="7614">7614</a>
7616-
<a href="#7615" id="7615">7615</a></pre></div><pre class="rust"><code><span class="doccomment">//! This library describes the API surface of WebGPU that is agnostic of the backend.
7616+
<a href="#7615" id="7615">7615</a>
7617+
<a href="#7616" id="7616">7616</a>
7618+
<a href="#7617" id="7617">7617</a>
7619+
<a href="#7618" id="7618">7618</a>
7620+
<a href="#7619" id="7619">7619</a>
7621+
<a href="#7620" id="7620">7620</a>
7622+
<a href="#7621" id="7621">7621</a>
7623+
<a href="#7622" id="7622">7622</a>
7624+
<a href="#7623" id="7623">7623</a>
7625+
<a href="#7624" id="7624">7624</a>
7626+
<a href="#7625" id="7625">7625</a>
7627+
<a href="#7626" id="7626">7626</a>
7628+
<a href="#7627" id="7627">7627</a>
7629+
<a href="#7628" id="7628">7628</a>
7630+
<a href="#7629" id="7629">7629</a>
7631+
<a href="#7630" id="7630">7630</a>
7632+
<a href="#7631" id="7631">7631</a>
7633+
<a href="#7632" id="7632">7632</a>
7634+
<a href="#7633" id="7633">7633</a>
7635+
<a href="#7634" id="7634">7634</a>
7636+
<a href="#7635" id="7635">7635</a>
7637+
<a href="#7636" id="7636">7636</a>
7638+
<a href="#7637" id="7637">7637</a>
7639+
<a href="#7638" id="7638">7638</a>
7640+
<a href="#7639" id="7639">7639</a>
7641+
<a href="#7640" id="7640">7640</a>
7642+
<a href="#7641" id="7641">7641</a>
7643+
<a href="#7642" id="7642">7642</a>
7644+
<a href="#7643" id="7643">7643</a>
7645+
<a href="#7644" id="7644">7644</a>
7646+
<a href="#7645" id="7645">7645</a>
7647+
<a href="#7646" id="7646">7646</a>
7648+
<a href="#7647" id="7647">7647</a>
7649+
<a href="#7648" id="7648">7648</a>
7650+
<a href="#7649" id="7649">7649</a>
7651+
<a href="#7650" id="7650">7650</a>
7652+
<a href="#7651" id="7651">7651</a>
7653+
<a href="#7652" id="7652">7652</a>
7654+
<a href="#7653" id="7653">7653</a>
7655+
<a href="#7654" id="7654">7654</a>
7656+
<a href="#7655" id="7655">7655</a>
7657+
<a href="#7656" id="7656">7656</a></pre></div><pre class="rust"><code><span class="doccomment">//! This library describes the API surface of WebGPU that is agnostic of the backend.
76177658
//! This API is used for targeting both Web and Native.
76187659

76197660
</span><span class="attr">#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
@@ -11155,6 +11196,47 @@
1115511196
</span><span class="kw">pub fn </span>is_srgb(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; bool {
1115611197
<span class="kw-2">*</span><span class="self">self </span>!= <span class="self">self</span>.remove_srgb_suffix()
1115711198
}
11199+
11200+
<span class="doccomment">/// Returns the theoretical memory footprint of a texture with the given format and dimensions.
11201+
///
11202+
/// Actual memory usage may greatly exceed this value due to alignment and padding.
11203+
</span><span class="attr">#[must_use]
11204+
</span><span class="kw">pub fn </span>theoretical_memory_footprint(<span class="kw-2">&amp;</span><span class="self">self</span>, size: Extent3d) -&gt; u64 {
11205+
<span class="kw">let </span>(block_width, block_height) = <span class="self">self</span>.block_dimensions();
11206+
11207+
<span class="kw">let </span>block_size = <span class="self">self</span>.block_copy_size(<span class="prelude-val">None</span>);
11208+
11209+
<span class="kw">let </span>approximate_block_size = <span class="kw">match </span>block_size {
11210+
<span class="prelude-val">Some</span>(size) =&gt; size,
11211+
<span class="prelude-val">None </span>=&gt; <span class="kw">match </span><span class="self">self </span>{
11212+
<span class="comment">// One f16 per pixel
11213+
</span><span class="self">Self</span>::Depth16Unorm =&gt; <span class="number">2</span>,
11214+
<span class="comment">// One u24 per pixel, padded to 4 bytes
11215+
</span><span class="self">Self</span>::Depth24Plus =&gt; <span class="number">4</span>,
11216+
<span class="comment">// One u24 per pixel, plus one u8 per pixel
11217+
</span><span class="self">Self</span>::Depth24PlusStencil8 =&gt; <span class="number">4</span>,
11218+
<span class="comment">// One f32 per pixel
11219+
</span><span class="self">Self</span>::Depth32Float =&gt; <span class="number">4</span>,
11220+
<span class="comment">// One f32 per pixel, plus one u8 per pixel, with 3 bytes intermediary padding
11221+
</span><span class="self">Self</span>::Depth32FloatStencil8 =&gt; <span class="number">8</span>,
11222+
<span class="comment">// One u8 per pixel
11223+
</span><span class="self">Self</span>::Stencil8 =&gt; <span class="number">1</span>,
11224+
<span class="comment">// Two chroma bytes per block, one luma byte per block
11225+
</span><span class="self">Self</span>::NV12 =&gt; <span class="number">3</span>,
11226+
f =&gt; {
11227+
<span class="macro">log::warn!</span>(<span class="string">"Memory footprint for format {:?} is not implemented"</span>, f);
11228+
<span class="number">0
11229+
</span>}
11230+
},
11231+
};
11232+
11233+
<span class="kw">let </span>width_blocks = size.width.div_ceil(block_width) <span class="kw">as </span>u64;
11234+
<span class="kw">let </span>height_blocks = size.height.div_ceil(block_height) <span class="kw">as </span>u64;
11235+
11236+
<span class="kw">let </span>total_blocks = width_blocks * height_blocks * size.depth_or_array_layers <span class="kw">as </span>u64;
11237+
11238+
total_blocks * approximate_block_size <span class="kw">as </span>u64
11239+
}
1115811240
}
1115911241

1116011242
<span class="attr">#[test]

0 commit comments

Comments
 (0)