Skip to content

Commit ab2874d

Browse files
committed
Deploying to master from @ gfx-rs/wgpu@ef0e6f7 🚀
1 parent 0382517 commit ab2874d

File tree

143 files changed

+444
-629
lines changed

Some content is hidden

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

143 files changed

+444
-629
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/bundle.rs.html

Lines changed: 24 additions & 186 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,88 +1690,7 @@
16901690
<a href="#1689" id="1689">1689</a>
16911691
<a href="#1690" id="1690">1690</a>
16921692
<a href="#1691" id="1691">1691</a>
1693-
<a href="#1692" id="1692">1692</a>
1694-
<a href="#1693" id="1693">1693</a>
1695-
<a href="#1694" id="1694">1694</a>
1696-
<a href="#1695" id="1695">1695</a>
1697-
<a href="#1696" id="1696">1696</a>
1698-
<a href="#1697" id="1697">1697</a>
1699-
<a href="#1698" id="1698">1698</a>
1700-
<a href="#1699" id="1699">1699</a>
1701-
<a href="#1700" id="1700">1700</a>
1702-
<a href="#1701" id="1701">1701</a>
1703-
<a href="#1702" id="1702">1702</a>
1704-
<a href="#1703" id="1703">1703</a>
1705-
<a href="#1704" id="1704">1704</a>
1706-
<a href="#1705" id="1705">1705</a>
1707-
<a href="#1706" id="1706">1706</a>
1708-
<a href="#1707" id="1707">1707</a>
1709-
<a href="#1708" id="1708">1708</a>
1710-
<a href="#1709" id="1709">1709</a>
1711-
<a href="#1710" id="1710">1710</a>
1712-
<a href="#1711" id="1711">1711</a>
1713-
<a href="#1712" id="1712">1712</a>
1714-
<a href="#1713" id="1713">1713</a>
1715-
<a href="#1714" id="1714">1714</a>
1716-
<a href="#1715" id="1715">1715</a>
1717-
<a href="#1716" id="1716">1716</a>
1718-
<a href="#1717" id="1717">1717</a>
1719-
<a href="#1718" id="1718">1718</a>
1720-
<a href="#1719" id="1719">1719</a>
1721-
<a href="#1720" id="1720">1720</a>
1722-
<a href="#1721" id="1721">1721</a>
1723-
<a href="#1722" id="1722">1722</a>
1724-
<a href="#1723" id="1723">1723</a>
1725-
<a href="#1724" id="1724">1724</a>
1726-
<a href="#1725" id="1725">1725</a>
1727-
<a href="#1726" id="1726">1726</a>
1728-
<a href="#1727" id="1727">1727</a>
1729-
<a href="#1728" id="1728">1728</a>
1730-
<a href="#1729" id="1729">1729</a>
1731-
<a href="#1730" id="1730">1730</a>
1732-
<a href="#1731" id="1731">1731</a>
1733-
<a href="#1732" id="1732">1732</a>
1734-
<a href="#1733" id="1733">1733</a>
1735-
<a href="#1734" id="1734">1734</a>
1736-
<a href="#1735" id="1735">1735</a>
1737-
<a href="#1736" id="1736">1736</a>
1738-
<a href="#1737" id="1737">1737</a>
1739-
<a href="#1738" id="1738">1738</a>
1740-
<a href="#1739" id="1739">1739</a>
1741-
<a href="#1740" id="1740">1740</a>
1742-
<a href="#1741" id="1741">1741</a>
1743-
<a href="#1742" id="1742">1742</a>
1744-
<a href="#1743" id="1743">1743</a>
1745-
<a href="#1744" id="1744">1744</a>
1746-
<a href="#1745" id="1745">1745</a>
1747-
<a href="#1746" id="1746">1746</a>
1748-
<a href="#1747" id="1747">1747</a>
1749-
<a href="#1748" id="1748">1748</a>
1750-
<a href="#1749" id="1749">1749</a>
1751-
<a href="#1750" id="1750">1750</a>
1752-
<a href="#1751" id="1751">1751</a>
1753-
<a href="#1752" id="1752">1752</a>
1754-
<a href="#1753" id="1753">1753</a>
1755-
<a href="#1754" id="1754">1754</a>
1756-
<a href="#1755" id="1755">1755</a>
1757-
<a href="#1756" id="1756">1756</a>
1758-
<a href="#1757" id="1757">1757</a>
1759-
<a href="#1758" id="1758">1758</a>
1760-
<a href="#1759" id="1759">1759</a>
1761-
<a href="#1760" id="1760">1760</a>
1762-
<a href="#1761" id="1761">1761</a>
1763-
<a href="#1762" id="1762">1762</a>
1764-
<a href="#1763" id="1763">1763</a>
1765-
<a href="#1764" id="1764">1764</a>
1766-
<a href="#1765" id="1765">1765</a>
1767-
<a href="#1766" id="1766">1766</a>
1768-
<a href="#1767" id="1767">1767</a>
1769-
<a href="#1768" id="1768">1768</a>
1770-
<a href="#1769" id="1769">1769</a>
1771-
<a href="#1770" id="1770">1770</a>
1772-
<a href="#1771" id="1771">1771</a>
1773-
<a href="#1772" id="1772">1772</a>
1774-
<a href="#1773" id="1773">1773</a></pre></div><pre class="rust"><code><span class="doccomment">/*! Render Bundles
1693+
<a href="#1692" id="1692">1692</a></pre></div><pre class="rust"><code><span class="doccomment">/*! Render Bundles
17751694

17761695
A render bundle is a prerecorded sequence of commands that can be replayed on a
17771696
command encoder with a single call. A single bundle can replayed any number of
@@ -1884,91 +1803,6 @@
18841803
DrawKind,
18851804
};
18861805

1887-
<span class="doccomment">/// &lt;https://gpuweb.github.io/gpuweb/#dom-gpurendercommandsmixin-draw&gt;
1888-
</span><span class="kw">fn </span>validate_draw(
1889-
vertex: <span class="kw-2">&amp;</span>[<span class="prelude-ty">Option</span>&lt;VertexState&gt;],
1890-
step: <span class="kw-2">&amp;</span>[VertexStep],
1891-
first_vertex: u32,
1892-
vertex_count: u32,
1893-
first_instance: u32,
1894-
instance_count: u32,
1895-
) -&gt; <span class="prelude-ty">Result</span>&lt;(), DrawError&gt; {
1896-
<span class="kw">let </span>vertices_end = first_vertex <span class="kw">as </span>u64 + vertex_count <span class="kw">as </span>u64;
1897-
<span class="kw">let </span>instances_end = first_instance <span class="kw">as </span>u64 + instance_count <span class="kw">as </span>u64;
1898-
1899-
<span class="kw">for </span>(idx, (vbs, step)) <span class="kw">in </span>vertex.iter().zip(step).enumerate() {
1900-
<span class="kw">let </span><span class="prelude-val">Some</span>(vbs) = vbs <span class="kw">else </span>{
1901-
<span class="kw">continue</span>;
1902-
};
1903-
1904-
<span class="kw">let </span>stride_count = <span class="kw">match </span>step.mode {
1905-
wgt::VertexStepMode::Vertex =&gt; vertices_end,
1906-
wgt::VertexStepMode::Instance =&gt; instances_end,
1907-
};
1908-
1909-
<span class="kw">if </span>stride_count == <span class="number">0 </span>{
1910-
<span class="kw">continue</span>;
1911-
}
1912-
1913-
<span class="kw">let </span>offset = (stride_count - <span class="number">1</span>) * step.stride + step.last_stride;
1914-
<span class="kw">let </span>limit = vbs.range.end - vbs.range.start;
1915-
<span class="kw">if </span>offset &gt; limit {
1916-
<span class="kw">return </span><span class="prelude-val">Err</span>(DrawError::VertexOutOfBounds {
1917-
step_mode: step.mode,
1918-
offset,
1919-
limit,
1920-
slot: idx <span class="kw">as </span>u32,
1921-
});
1922-
}
1923-
}
1924-
1925-
<span class="prelude-val">Ok</span>(())
1926-
}
1927-
1928-
<span class="comment">// See https://gpuweb.github.io/gpuweb/#dom-gpurendercommandsmixin-drawindexed
1929-
</span><span class="kw">fn </span>validate_indexed_draw(
1930-
vertex: <span class="kw-2">&amp;</span>[<span class="prelude-ty">Option</span>&lt;VertexState&gt;],
1931-
step: <span class="kw-2">&amp;</span>[VertexStep],
1932-
index_state: <span class="kw-2">&amp;</span>IndexState,
1933-
first_index: u32,
1934-
index_count: u32,
1935-
first_instance: u32,
1936-
instance_count: u32,
1937-
) -&gt; <span class="prelude-ty">Result</span>&lt;(), DrawError&gt; {
1938-
<span class="kw">let </span>last_index = first_index <span class="kw">as </span>u64 + index_count <span class="kw">as </span>u64;
1939-
<span class="kw">let </span>index_limit = index_state.limit();
1940-
<span class="kw">if </span>last_index &gt; index_limit {
1941-
<span class="kw">return </span><span class="prelude-val">Err</span>(DrawError::IndexBeyondLimit {
1942-
last_index,
1943-
index_limit,
1944-
});
1945-
}
1946-
1947-
<span class="kw">let </span>stride_count = first_instance <span class="kw">as </span>u64 + instance_count <span class="kw">as </span>u64;
1948-
<span class="kw">for </span>(idx, (vbs, step)) <span class="kw">in </span>vertex.iter().zip(step).enumerate() {
1949-
<span class="kw">let </span><span class="prelude-val">Some</span>(vbs) = vbs <span class="kw">else </span>{
1950-
<span class="kw">continue</span>;
1951-
};
1952-
1953-
<span class="kw">if </span>stride_count == <span class="number">0 </span>|| step.mode != wgt::VertexStepMode::Instance {
1954-
<span class="kw">continue</span>;
1955-
}
1956-
1957-
<span class="kw">let </span>offset = (stride_count - <span class="number">1</span>) * step.stride + step.last_stride;
1958-
<span class="kw">let </span>limit = vbs.range.end - vbs.range.start;
1959-
<span class="kw">if </span>offset &gt; limit {
1960-
<span class="kw">return </span><span class="prelude-val">Err</span>(DrawError::VertexOutOfBounds {
1961-
step_mode: step.mode,
1962-
offset,
1963-
limit,
1964-
slot: idx <span class="kw">as </span>u32,
1965-
});
1966-
}
1967-
}
1968-
1969-
<span class="prelude-val">Ok</span>(())
1970-
}
1971-
19721806
<span class="doccomment">/// Describes a [`RenderBundleEncoder`].
19731807
</span><span class="attr">#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
19741808
#[cfg_attr(feature = <span class="string">"serde"</span>, derive(serde::Serialize, serde::Deserialize))]
@@ -2132,7 +1966,7 @@
21321966
trackers: RenderBundleScope::new(),
21331967
pipeline: <span class="prelude-val">None</span>,
21341968
bind: (<span class="number">0</span>..hal::MAX_BIND_GROUPS).map(|<span class="kw">_</span>| <span class="prelude-val">None</span>).collect(),
2135-
vertex: (<span class="number">0</span>..hal::MAX_VERTEX_BUFFERS).map(|<span class="kw">_</span>| <span class="prelude-val">None</span>).collect(),
1969+
vertex: Default::default(),
21361970
index: <span class="prelude-val">None</span>,
21371971
flat_dynamic_offsets: Vec::new(),
21381972
device: device.clone(),
@@ -2554,14 +2388,9 @@
25542388
<span class="kw">let </span>pipeline = state.pipeline()<span class="question-mark">?</span>;
25552389
<span class="kw">let </span>used_bind_groups = pipeline.used_bind_groups;
25562390

2557-
validate_draw(
2558-
<span class="kw-2">&amp;</span>state.vertex[..],
2559-
<span class="kw-2">&amp;</span>pipeline.steps,
2560-
first_vertex,
2561-
vertex_count,
2562-
first_instance,
2563-
instance_count,
2564-
)<span class="question-mark">?</span>;
2391+
<span class="kw">let </span>vertex_limits = <span class="kw">super</span>::VertexLimits::new(state.vertex_buffer_sizes(), <span class="kw-2">&amp;</span>pipeline.steps);
2392+
vertex_limits.validate_vertex_limit(first_vertex, vertex_count)<span class="question-mark">?</span>;
2393+
vertex_limits.validate_instance_limit(first_instance, instance_count)<span class="question-mark">?</span>;
25652394

25662395
<span class="kw">if </span>instance_count &gt; <span class="number">0 </span>&amp;&amp; vertex_count &gt; <span class="number">0 </span>{
25672396
state.flush_vertices();
@@ -2592,15 +2421,18 @@
25922421
<span class="prelude-val">None </span>=&gt; <span class="kw">return </span><span class="prelude-val">Err</span>(DrawError::MissingIndexBuffer.into()),
25932422
};
25942423

2595-
validate_indexed_draw(
2596-
<span class="kw-2">&amp;</span>state.vertex[..],
2597-
<span class="kw-2">&amp;</span>pipeline.steps,
2598-
index,
2599-
first_index,
2600-
index_count,
2601-
first_instance,
2602-
instance_count,
2603-
)<span class="question-mark">?</span>;
2424+
<span class="kw">let </span>vertex_limits = <span class="kw">super</span>::VertexLimits::new(state.vertex_buffer_sizes(), <span class="kw-2">&amp;</span>pipeline.steps);
2425+
2426+
<span class="kw">let </span>last_index = first_index <span class="kw">as </span>u64 + index_count <span class="kw">as </span>u64;
2427+
<span class="kw">let </span>index_limit = index.limit();
2428+
<span class="kw">if </span>last_index &gt; index_limit {
2429+
<span class="kw">return </span><span class="prelude-val">Err</span>(DrawError::IndexBeyondLimit {
2430+
last_index,
2431+
index_limit,
2432+
}
2433+
.into());
2434+
}
2435+
vertex_limits.validate_instance_limit(first_instance, instance_count)<span class="question-mark">?</span>;
26042436

26052437
<span class="kw">if </span>instance_count &gt; <span class="number">0 </span>&amp;&amp; index_count &gt; <span class="number">0 </span>{
26062438
state.flush_index();
@@ -3103,7 +2935,7 @@
31032935
</span>bind: ArrayVec&lt;<span class="prelude-ty">Option</span>&lt;BindState&gt;, { hal::MAX_BIND_GROUPS }&gt;,
31042936

31052937
<span class="doccomment">/// The state of each vertex buffer slot.
3106-
</span>vertex: ArrayVec&lt;<span class="prelude-ty">Option</span>&lt;VertexState&gt;, { hal::MAX_VERTEX_BUFFERS }&gt;,
2938+
</span>vertex: [<span class="prelude-ty">Option</span>&lt;VertexState&gt;; hal::MAX_VERTEX_BUFFERS],
31072939

31082940
<span class="doccomment">/// The current index buffer, if one has been set. We flush this state
31092941
/// before indexed draw commands.
@@ -3286,6 +3118,12 @@
32863118

32873119
<span class="self">self</span>.commands.extend(commands);
32883120
}
3121+
3122+
<span class="kw">fn </span>vertex_buffer_sizes(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; <span class="kw">impl </span>Iterator&lt;Item = <span class="prelude-ty">Option</span>&lt;wgt::BufferAddress&gt;&gt; + <span class="lifetime">'_ </span>{
3123+
<span class="self">self</span>.vertex
3124+
.iter()
3125+
.map(|vbs| vbs.as_ref().map(|vbs| vbs.range.end - vbs.range.start))
3126+
}
32893127
}
32903128

32913129
<span class="doccomment">/// Error encountered when finishing recording a render bundle.

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

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -97,23 +97,14 @@
9797
<a href="#96" id="96">96</a>
9898
<a href="#97" id="97">97</a>
9999
<a href="#98" id="98">98</a>
100-
<a href="#99" id="99">99</a>
101-
<a href="#100" id="100">100</a>
102-
<a href="#101" id="101">101</a>
103-
<a href="#102" id="102">102</a>
104-
<a href="#103" id="103">103</a>
105-
<a href="#104" id="104">104</a>
106-
<a href="#105" id="105">105</a>
107-
<a href="#106" id="106">106</a>
108-
<a href="#107" id="107">107</a></pre></div><pre class="rust"><code><span class="kw">use crate</span>::{
100+
<a href="#99" id="99">99</a></pre></div><pre class="rust"><code><span class="kw">use crate</span>::{
109101
binding_model::{LateMinBufferBindingSizeMismatch, PushConstantUploadError},
110102
resource::{
111103
DestroyedResourceError, MissingBufferUsageError, MissingTextureUsageError,
112104
ResourceErrorIdent,
113105
},
114106
track::ResourceUsageCompatibilityError,
115107
};
116-
<span class="kw">use </span>wgt::VertexStepMode;
117108

118109
<span class="kw">use </span>thiserror::Error;
119110

@@ -142,13 +133,6 @@
142133
vertex_limit: u64,
143134
slot: u32,
144135
},
145-
<span class="attr">#[error(<span class="string">"{step_mode:?} buffer out of bounds at slot {slot}. Offset {offset} beyond limit {limit}. Did you bind the correct `Vertex` step-rate vertex buffer?"</span>)]
146-
</span>VertexOutOfBounds {
147-
step_mode: VertexStepMode,
148-
offset: u64,
149-
limit: u64,
150-
slot: u32,
151-
},
152136
<span class="attr">#[error(<span class="string">"Instance {last_instance} extends beyond limit {instance_limit} imposed by the buffer in slot {slot}. Did you bind the correct `Instance` step-rate vertex buffer?"</span>)]
153137
</span>InstanceBeyondLimit {
154138
last_instance: u64,

0 commit comments

Comments
 (0)