Skip to content

Commit 5caadeb

Browse files
committed
Deploying to master from @ gfx-rs/wgpu@0d61648 🚀
1 parent 4d77fa1 commit 5caadeb

37 files changed

+430
-92
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_hal/wgpu_hal-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_hal/vulkan/adapter.rs.html

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2779,8 +2779,33 @@
27792779
<a href="#2778" id="2778">2778</a>
27802780
<a href="#2779" id="2779">2779</a>
27812781
<a href="#2780" id="2780">2780</a>
2782-
<a href="#2781" id="2781">2781</a></pre></div><pre class="rust"><code><span class="kw">use </span>alloc::{borrow::ToOwned <span class="kw">as _</span>, collections::BTreeMap, sync::Arc, vec::Vec};
2783-
<span class="kw">use </span>core::ffi::CStr;
2782+
<a href="#2781" id="2781">2781</a>
2783+
<a href="#2782" id="2782">2782</a>
2784+
<a href="#2783" id="2783">2783</a>
2785+
<a href="#2784" id="2784">2784</a>
2786+
<a href="#2785" id="2785">2785</a>
2787+
<a href="#2786" id="2786">2786</a>
2788+
<a href="#2787" id="2787">2787</a>
2789+
<a href="#2788" id="2788">2788</a>
2790+
<a href="#2789" id="2789">2789</a>
2791+
<a href="#2790" id="2790">2790</a>
2792+
<a href="#2791" id="2791">2791</a>
2793+
<a href="#2792" id="2792">2792</a>
2794+
<a href="#2793" id="2793">2793</a>
2795+
<a href="#2794" id="2794">2794</a>
2796+
<a href="#2795" id="2795">2795</a>
2797+
<a href="#2796" id="2796">2796</a>
2798+
<a href="#2797" id="2797">2797</a>
2799+
<a href="#2798" id="2798">2798</a>
2800+
<a href="#2799" id="2799">2799</a>
2801+
<a href="#2800" id="2800">2800</a>
2802+
<a href="#2801" id="2801">2801</a>
2803+
<a href="#2802" id="2802">2802</a>
2804+
<a href="#2803" id="2803">2803</a>
2805+
<a href="#2804" id="2804">2804</a>
2806+
<a href="#2805" id="2805">2805</a>
2807+
<a href="#2806" id="2806">2806</a></pre></div><pre class="rust"><code><span class="kw">use </span>alloc::{borrow::ToOwned <span class="kw">as _</span>, boxed::Box, collections::BTreeMap, sync::Arc, vec::Vec};
2808+
<span class="kw">use </span>core::{ffi::CStr, marker::PhantomData};
27842809

27852810
<span class="kw">use </span>ash::{ext, google, khr, vk};
27862811
<span class="kw">use </span>parking_lot::Mutex;
@@ -5068,25 +5093,37 @@
50685093
<span class="kw">pub fn </span>texture_format_as_raw(<span class="kw-2">&amp;</span><span class="self">self</span>, texture_format: wgt::TextureFormat) -&gt; vk::Format {
50695094
<span class="self">self</span>.private_caps.map_texture_format(texture_format)
50705095
}
5071-
}
5072-
5073-
<span class="kw">impl </span><span class="kw">crate</span>::Adapter <span class="kw">for </span><span class="kw">super</span>::Adapter {
5074-
<span class="kw">type </span>A = <span class="kw">super</span>::Api;
50755096

5076-
<span class="kw">unsafe fn </span>open(
5097+
<span class="doccomment">/// # Safety:
5098+
/// - Same as `open` plus
5099+
/// - The callback may not change anything that the device does not support.
5100+
/// - The callback may not remove features.
5101+
</span><span class="kw">pub unsafe fn </span>open_with_callback&lt;<span class="lifetime">'a</span>&gt;(
50775102
<span class="kw-2">&amp;</span><span class="self">self</span>,
50785103
features: wgt::Features,
5079-
_limits: <span class="kw-2">&amp;</span>wgt::Limits,
50805104
memory_hints: <span class="kw-2">&amp;</span>wgt::MemoryHints,
5105+
callback: <span class="prelude-ty">Option</span>&lt;Box&lt;<span class="kw">super</span>::CreateDeviceCallback&lt;<span class="lifetime">'a</span>&gt;&gt;&gt;,
50815106
) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="kw">crate</span>::OpenDevice&lt;<span class="kw">super</span>::Api&gt;, <span class="kw">crate</span>::DeviceError&gt; {
5082-
<span class="kw">let </span>enabled_extensions = <span class="self">self</span>.required_device_extensions(features);
5107+
<span class="kw">let </span><span class="kw-2">mut </span>enabled_extensions = <span class="self">self</span>.required_device_extensions(features);
50835108
<span class="kw">let </span><span class="kw-2">mut </span>enabled_phd_features = <span class="self">self</span>.physical_device_features(<span class="kw-2">&amp;</span>enabled_extensions, features);
50845109

50855110
<span class="kw">let </span>family_index = <span class="number">0</span>; <span class="comment">//TODO
50865111
</span><span class="kw">let </span>family_info = vk::DeviceQueueCreateInfo::default()
50875112
.queue_family_index(family_index)
50885113
.queue_priorities(<span class="kw-2">&amp;</span>[<span class="number">1.0</span>]);
5089-
<span class="kw">let </span>family_infos = [family_info];
5114+
<span class="kw">let </span><span class="kw-2">mut </span>family_infos = Vec::from([family_info]);
5115+
5116+
<span class="kw">let </span><span class="kw-2">mut </span>pre_info = vk::DeviceCreateInfo::default();
5117+
5118+
<span class="kw">if let </span><span class="prelude-val">Some</span>(callback) = callback {
5119+
callback(<span class="kw">super</span>::CreateDeviceCallbackArgs {
5120+
extensions: <span class="kw-2">&amp;mut </span>enabled_extensions,
5121+
device_features: <span class="kw-2">&amp;mut </span>enabled_phd_features,
5122+
queue_create_infos: <span class="kw-2">&amp;mut </span>family_infos,
5123+
create_info: <span class="kw-2">&amp;mut </span>pre_info,
5124+
_phantom: PhantomData,
5125+
})
5126+
}
50905127

50915128
<span class="kw">let </span>str_pointers = enabled_extensions
50925129
.iter()
@@ -5096,7 +5133,7 @@
50965133
})
50975134
.collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;();
50985135

5099-
<span class="kw">let </span>pre_info = vk::DeviceCreateInfo::default()
5136+
<span class="kw">let </span>pre_info = pre_info
51005137
.queue_create_infos(<span class="kw-2">&amp;</span>family_infos)
51015138
.enabled_extension_names(<span class="kw-2">&amp;</span>str_pointers);
51025139
<span class="kw">let </span>info = enabled_phd_features.add_to_device_create(pre_info);
@@ -5132,6 +5169,19 @@
51325169
)
51335170
}
51345171
}
5172+
}
5173+
5174+
<span class="kw">impl </span><span class="kw">crate</span>::Adapter <span class="kw">for </span><span class="kw">super</span>::Adapter {
5175+
<span class="kw">type </span>A = <span class="kw">super</span>::Api;
5176+
5177+
<span class="kw">unsafe fn </span>open(
5178+
<span class="kw-2">&amp;</span><span class="self">self</span>,
5179+
features: wgt::Features,
5180+
_limits: <span class="kw-2">&amp;</span>wgt::Limits,
5181+
memory_hints: <span class="kw-2">&amp;</span>wgt::MemoryHints,
5182+
) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="kw">crate</span>::OpenDevice&lt;<span class="kw">super</span>::Api&gt;, <span class="kw">crate</span>::DeviceError&gt; {
5183+
<span class="kw">unsafe </span>{ <span class="self">self</span>.open_with_callback(features, memory_hints, <span class="prelude-val">None</span>) }
5184+
}
51355185

51365186
<span class="kw">unsafe fn </span>texture_format_capabilities(
51375187
<span class="kw-2">&amp;</span><span class="self">self</span>,

doc/src/wgpu_hal/vulkan/instance.rs.html

Lines changed: 75 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,9 +1137,36 @@
11371137
<a href="#1136" id="1136">1136</a>
11381138
<a href="#1137" id="1137">1137</a>
11391139
<a href="#1138" id="1138">1138</a>
1140-
<a href="#1139" id="1139">1139</a></pre></div><pre class="rust"><code><span class="kw">use </span>alloc::{borrow::ToOwned <span class="kw">as _</span>, boxed::Box, ffi::CString, string::String, sync::Arc, vec::Vec};
1140+
<a href="#1139" id="1139">1139</a>
1141+
<a href="#1140" id="1140">1140</a>
1142+
<a href="#1141" id="1141">1141</a>
1143+
<a href="#1142" id="1142">1142</a>
1144+
<a href="#1143" id="1143">1143</a>
1145+
<a href="#1144" id="1144">1144</a>
1146+
<a href="#1145" id="1145">1145</a>
1147+
<a href="#1146" id="1146">1146</a>
1148+
<a href="#1147" id="1147">1147</a>
1149+
<a href="#1148" id="1148">1148</a>
1150+
<a href="#1149" id="1149">1149</a>
1151+
<a href="#1150" id="1150">1150</a>
1152+
<a href="#1151" id="1151">1151</a>
1153+
<a href="#1152" id="1152">1152</a>
1154+
<a href="#1153" id="1153">1153</a>
1155+
<a href="#1154" id="1154">1154</a>
1156+
<a href="#1155" id="1155">1155</a>
1157+
<a href="#1156" id="1156">1156</a>
1158+
<a href="#1157" id="1157">1157</a>
1159+
<a href="#1158" id="1158">1158</a>
1160+
<a href="#1159" id="1159">1159</a>
1161+
<a href="#1160" id="1160">1160</a>
1162+
<a href="#1161" id="1161">1161</a>
1163+
<a href="#1162" id="1162">1162</a>
1164+
<a href="#1163" id="1163">1163</a>
1165+
<a href="#1164" id="1164">1164</a>
1166+
<a href="#1165" id="1165">1165</a></pre></div><pre class="rust"><code><span class="kw">use </span>alloc::{borrow::ToOwned <span class="kw">as _</span>, boxed::Box, ffi::CString, string::String, sync::Arc, vec::Vec};
11411167
<span class="kw">use </span>core::{
11421168
ffi::{c_void, CStr},
1169+
marker::PhantomData,
11431170
slice,
11441171
str::FromStr,
11451172
};
@@ -1724,27 +1751,19 @@
17241751
swapchain: RwLock::new(<span class="prelude-val">None</span>),
17251752
}
17261753
}
1727-
}
1728-
1729-
<span class="kw">impl </span>Drop <span class="kw">for </span><span class="kw">super</span>::InstanceShared {
1730-
<span class="kw">fn </span>drop(<span class="kw-2">&amp;mut </span><span class="self">self</span>) {
1731-
<span class="kw">unsafe </span>{
1732-
<span class="comment">// Keep du alive since destroy_instance may also log
1733-
</span><span class="kw">let </span>_du = <span class="self">self</span>.debug_utils.take().inspect(|du| {
1734-
du.extension
1735-
.destroy_debug_utils_messenger(du.messenger, <span class="prelude-val">None</span>);
1736-
});
1737-
<span class="kw">if </span><span class="self">self</span>.drop_guard.is_none() {
1738-
<span class="self">self</span>.raw.destroy_instance(<span class="prelude-val">None</span>);
1739-
}
1740-
}
1741-
}
1742-
}
1743-
1744-
<span class="kw">impl </span><span class="kw">crate</span>::Instance <span class="kw">for </span><span class="kw">super</span>::Instance {
1745-
<span class="kw">type </span>A = <span class="kw">super</span>::Api;
17461754

1747-
<span class="kw">unsafe fn </span>init(desc: <span class="kw-2">&amp;</span><span class="kw">crate</span>::InstanceDescriptor) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="self">Self</span>, <span class="kw">crate</span>::InstanceError&gt; {
1755+
<span class="doccomment">/// `Instance::init` but with a callback.
1756+
/// If you want to add extensions, add the to the `Vec&lt;'static CStr&gt;` not the create info, otherwise
1757+
/// it will be overwritten
1758+
///
1759+
/// # Safety:
1760+
/// Same as `init` but additionally
1761+
/// - Callback must not remove features.
1762+
/// - Callback must not change anything to what the instance does not support.
1763+
</span><span class="kw">pub unsafe fn </span>init_with_callback(
1764+
desc: <span class="kw-2">&amp;</span><span class="kw">crate</span>::InstanceDescriptor,
1765+
callback: <span class="prelude-ty">Option</span>&lt;Box&lt;<span class="kw">super</span>::CreateInstanceCallback&gt;&gt;,
1766+
) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="self">Self</span>, <span class="kw">crate</span>::InstanceError&gt; {
17481767
<span class="macro">profiling::scope!</span>(<span class="string">"Init Vulkan Backend"</span>);
17491768

17501769
<span class="kw">let </span>entry = <span class="kw">unsafe </span>{
@@ -1793,7 +1812,17 @@
17931812
},
17941813
);
17951814

1796-
<span class="kw">let </span>extensions = <span class="self">Self</span>::desired_extensions(<span class="kw-2">&amp;</span>entry, instance_api_version, desc.flags)<span class="question-mark">?</span>;
1815+
<span class="kw">let </span><span class="kw-2">mut </span>extensions = <span class="self">Self</span>::desired_extensions(<span class="kw-2">&amp;</span>entry, instance_api_version, desc.flags)<span class="question-mark">?</span>;
1816+
<span class="kw">let </span><span class="kw-2">mut </span>create_info = vk::InstanceCreateInfo::default();
1817+
1818+
<span class="kw">if let </span><span class="prelude-val">Some</span>(callback) = callback {
1819+
callback(<span class="kw">super</span>::CreateInstanceCallbackArgs {
1820+
extensions: <span class="kw-2">&amp;mut </span>extensions,
1821+
create_info: <span class="kw-2">&amp;mut </span>create_info,
1822+
entry: <span class="kw-2">&amp;</span>entry,
1823+
_phantom: PhantomData,
1824+
});
1825+
}
17971826

17981827
<span class="kw">let </span>instance_layers = {
17991828
<span class="macro">profiling::scope!</span>(<span class="string">"vkEnumerateInstanceLayerProperties"</span>);
@@ -1953,7 +1982,7 @@
19531982
})
19541983
.collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;();
19551984

1956-
<span class="kw">let </span><span class="kw-2">mut </span>create_info = vk::InstanceCreateInfo::default()
1985+
create_info = create_info
19571986
.flags(flags)
19581987
.application_info(<span class="kw-2">&amp;</span>app_info)
19591988
.enabled_layer_names(<span class="kw-2">&amp;</span>str_pointers[..layers.len()])
@@ -2015,6 +2044,29 @@
20152044
)
20162045
}
20172046
}
2047+
}
2048+
2049+
<span class="kw">impl </span>Drop <span class="kw">for </span><span class="kw">super</span>::InstanceShared {
2050+
<span class="kw">fn </span>drop(<span class="kw-2">&amp;mut </span><span class="self">self</span>) {
2051+
<span class="kw">unsafe </span>{
2052+
<span class="comment">// Keep du alive since destroy_instance may also log
2053+
</span><span class="kw">let </span>_du = <span class="self">self</span>.debug_utils.take().inspect(|du| {
2054+
du.extension
2055+
.destroy_debug_utils_messenger(du.messenger, <span class="prelude-val">None</span>);
2056+
});
2057+
<span class="kw">if </span><span class="self">self</span>.drop_guard.is_none() {
2058+
<span class="self">self</span>.raw.destroy_instance(<span class="prelude-val">None</span>);
2059+
}
2060+
}
2061+
}
2062+
}
2063+
2064+
<span class="kw">impl </span><span class="kw">crate</span>::Instance <span class="kw">for </span><span class="kw">super</span>::Instance {
2065+
<span class="kw">type </span>A = <span class="kw">super</span>::Api;
2066+
2067+
<span class="kw">unsafe fn </span>init(desc: <span class="kw-2">&amp;</span><span class="kw">crate</span>::InstanceDescriptor) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="self">Self</span>, <span class="kw">crate</span>::InstanceError&gt; {
2068+
<span class="kw">unsafe </span>{ <span class="self">Self</span>::init_with_callback(desc, <span class="prelude-val">None</span>) }
2069+
}
20182070

20192071
<span class="kw">unsafe fn </span>create_surface(
20202072
<span class="kw-2">&amp;</span><span class="self">self</span>,

0 commit comments

Comments
 (0)