Skip to content

Commit e0ca24b

Browse files
committed
Deploying to master from @ 5c33e23b6615048cd2e9ff9b547773d905a9b533 🚀
1 parent 575c332 commit e0ca24b

26 files changed

+240
-192
lines changed

‎doc/src/wgpu/backend/direct.rs.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -3422,7 +3422,7 @@
34223422
<span class="kw">match </span><span class="macro">wgc::gfx_select!</span>(adapter =&gt; global.surface_get_supported_formats(surface.id, <span class="kw-2">*</span>adapter))
34233423
{
34243424
<span class="prelude-val">Ok</span>(formats) =&gt; formats,
3425-
<span class="prelude-val">Err</span>(wgc::instance::GetSurfaceSupportError::UnsupportedQueueFamily) =&gt; <span class="macro">vec!</span>[],
3425+
<span class="prelude-val">Err</span>(wgc::instance::GetSurfaceSupportError::Unsupported) =&gt; <span class="macro">vec!</span>[],
34263426
<span class="prelude-val">Err</span>(err) =&gt; <span class="self">self</span>.handle_error_fatal(err, <span class="string">&quot;Surface::get_supported_formats&quot;</span>),
34273427
}
34283428
}
@@ -3436,7 +3436,7 @@
34363436
<span class="kw">match </span><span class="macro">wgc::gfx_select!</span>(adapter =&gt; global.surface_get_supported_present_modes(surface.id, <span class="kw-2">*</span>adapter))
34373437
{
34383438
<span class="prelude-val">Ok</span>(modes) =&gt; modes,
3439-
<span class="prelude-val">Err</span>(wgc::instance::GetSurfaceSupportError::UnsupportedQueueFamily) =&gt; <span class="macro">vec!</span>[],
3439+
<span class="prelude-val">Err</span>(wgc::instance::GetSurfaceSupportError::Unsupported) =&gt; <span class="macro">vec!</span>[],
34403440
<span class="prelude-val">Err</span>(err) =&gt; <span class="self">self</span>.handle_error_fatal(err, <span class="string">&quot;Surface::get_supported_present_modes&quot;</span>),
34413441
}
34423442
}
@@ -3450,7 +3450,7 @@
34503450
<span class="kw">match </span><span class="macro">wgc::gfx_select!</span>(adapter =&gt; global.surface_get_supported_alpha_modes(surface.id, <span class="kw-2">*</span>adapter))
34513451
{
34523452
<span class="prelude-val">Ok</span>(modes) =&gt; modes,
3453-
<span class="prelude-val">Err</span>(wgc::instance::GetSurfaceSupportError::UnsupportedQueueFamily) =&gt; {
3453+
<span class="prelude-val">Err</span>(wgc::instance::GetSurfaceSupportError::Unsupported) =&gt; {
34543454
<span class="macro">vec!</span>[CompositeAlphaMode::Opaque]
34553455
}
34563456
<span class="prelude-val">Err</span>(err) =&gt; <span class="self">self</span>.handle_error_fatal(err, <span class="string">&quot;Surface::get_supported_alpha_modes&quot;</span>),

‎doc/src/wgpu/lib.rs.html

+6
Original file line numberDiff line numberDiff line change
@@ -3776,6 +3776,9 @@
37763776
<span id="3774">3774</span>
37773777
<span id="3775">3775</span>
37783778
<span id="3776">3776</span>
3779+
<span id="3777">3777</span>
3780+
<span id="3778">3778</span>
3781+
<span id="3779">3779</span>
37793782
</pre><pre class="rust"><code><span class="doccomment">//! A cross-platform graphics and compute library based on [WebGPU](https://gpuweb.github.io/gpuweb/).
37803783
//!
37813784
//! To start using the API, create an [`Instance`].
@@ -5591,6 +5594,9 @@
55915594

55925595
<span class="doccomment">/// Creates a surface from a raw window handle.
55935596
///
5597+
/// If the specified display and window handle are not supported by any of the backends, then the surface
5598+
/// will not be supported by any adapters.
5599+
///
55945600
/// # Safety
55955601
///
55965602
/// - Raw Window Handle must be a valid object to create a surface upon and

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

+69-29
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,26 @@
786786
<span id="786">786</span>
787787
<span id="787">787</span>
788788
<span id="788">788</span>
789+
<span id="789">789</span>
790+
<span id="790">790</span>
791+
<span id="791">791</span>
792+
<span id="792">792</span>
793+
<span id="793">793</span>
794+
<span id="794">794</span>
795+
<span id="795">795</span>
796+
<span id="796">796</span>
797+
<span id="797">797</span>
798+
<span id="798">798</span>
799+
<span id="799">799</span>
800+
<span id="800">800</span>
801+
<span id="801">801</span>
802+
<span id="802">802</span>
803+
<span id="803">803</span>
804+
<span id="804">804</span>
805+
<span id="805">805</span>
806+
<span id="806">806</span>
807+
<span id="807">807</span>
808+
<span id="808">808</span>
789809
</pre><pre class="rust"><code><span class="kw">use </span>std::{
790810
ffi::{c_void, CStr, CString},
791811
slice,
@@ -1091,9 +1111,10 @@
10911111
<span class="kw-2">&amp;</span><span class="self">self</span>,
10921112
dpy: <span class="kw-2">*mut </span>vk::Display,
10931113
window: vk::Window,
1094-
) -&gt; <span class="kw">super</span>::Surface {
1114+
) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="kw">super</span>::Surface, <span class="kw">crate</span>::InstanceError&gt; {
10951115
<span class="kw">if </span>!<span class="self">self</span>.shared.extensions.contains(<span class="kw-2">&amp;</span>khr::XlibSurface::name()) {
1096-
<span class="macro">panic!</span>(<span class="string">&quot;Vulkan driver does not support VK_KHR_XLIB_SURFACE&quot;</span>);
1116+
<span class="macro">log::warn!</span>(<span class="string">&quot;Vulkan driver does not support VK_KHR_xlib_surface&quot;</span>);
1117+
<span class="kw">return </span><span class="prelude-val">Err</span>(<span class="kw">crate</span>::InstanceError);
10971118
}
10981119

10991120
<span class="kw">let </span>surface = {
@@ -1107,17 +1128,18 @@
11071128
.expect(<span class="string">&quot;XlibSurface::create_xlib_surface() failed&quot;</span>)
11081129
};
11091130

1110-
<span class="self">self</span>.create_surface_from_vk_surface_khr(surface)
1131+
<span class="prelude-val">Ok</span>(<span class="self">self</span>.create_surface_from_vk_surface_khr(surface))
11111132
}
11121133

11131134
<span class="attribute">#[allow(dead_code)]
11141135
</span><span class="kw">fn </span>create_surface_from_xcb(
11151136
<span class="kw-2">&amp;</span><span class="self">self</span>,
11161137
connection: <span class="kw-2">*mut </span>vk::xcb_connection_t,
11171138
window: vk::xcb_window_t,
1118-
) -&gt; <span class="kw">super</span>::Surface {
1139+
) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="kw">super</span>::Surface, <span class="kw">crate</span>::InstanceError&gt; {
11191140
<span class="kw">if </span>!<span class="self">self</span>.shared.extensions.contains(<span class="kw-2">&amp;</span>khr::XcbSurface::name()) {
1120-
<span class="macro">panic!</span>(<span class="string">&quot;Vulkan driver does not support VK_KHR_XCB_SURFACE&quot;</span>);
1141+
<span class="macro">log::warn!</span>(<span class="string">&quot;Vulkan driver does not support VK_KHR_xcb_surface&quot;</span>);
1142+
<span class="kw">return </span><span class="prelude-val">Err</span>(<span class="kw">crate</span>::InstanceError);
11211143
}
11221144

11231145
<span class="kw">let </span>surface = {
@@ -1131,21 +1153,22 @@
11311153
.expect(<span class="string">&quot;XcbSurface::create_xcb_surface() failed&quot;</span>)
11321154
};
11331155

1134-
<span class="self">self</span>.create_surface_from_vk_surface_khr(surface)
1156+
<span class="prelude-val">Ok</span>(<span class="self">self</span>.create_surface_from_vk_surface_khr(surface))
11351157
}
11361158

11371159
<span class="attribute">#[allow(dead_code)]
11381160
</span><span class="kw">fn </span>create_surface_from_wayland(
11391161
<span class="kw-2">&amp;</span><span class="self">self</span>,
11401162
display: <span class="kw-2">*mut </span>c_void,
11411163
surface: <span class="kw-2">*mut </span>c_void,
1142-
) -&gt; <span class="kw">super</span>::Surface {
1164+
) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="kw">super</span>::Surface, <span class="kw">crate</span>::InstanceError&gt; {
11431165
<span class="kw">if </span>!<span class="self">self
11441166
</span>.shared
11451167
.extensions
11461168
.contains(<span class="kw-2">&amp;</span>khr::WaylandSurface::name())
11471169
{
1148-
<span class="macro">panic!</span>(<span class="string">&quot;Vulkan driver does not support VK_KHR_WAYLAND_SURFACE&quot;</span>);
1170+
<span class="macro">log::debug!</span>(<span class="string">&quot;Vulkan driver does not support VK_KHR_wayland_surface&quot;</span>);
1171+
<span class="kw">return </span><span class="prelude-val">Err</span>(<span class="kw">crate</span>::InstanceError);
11491172
}
11501173

11511174
<span class="kw">let </span>surface = {
@@ -1158,11 +1181,23 @@
11581181
<span class="kw">unsafe </span>{ w_loader.create_wayland_surface(<span class="kw-2">&amp;</span>info, <span class="prelude-val">None</span>) }.expect(<span class="string">&quot;WaylandSurface failed&quot;</span>)
11591182
};
11601183

1161-
<span class="self">self</span>.create_surface_from_vk_surface_khr(surface)
1184+
<span class="prelude-val">Ok</span>(<span class="self">self</span>.create_surface_from_vk_surface_khr(surface))
11621185
}
11631186

11641187
<span class="attribute">#[allow(dead_code)]
1165-
</span><span class="kw">fn </span>create_surface_android(<span class="kw-2">&amp;</span><span class="self">self</span>, window: <span class="kw-2">*const </span>c_void) -&gt; <span class="kw">super</span>::Surface {
1188+
</span><span class="kw">fn </span>create_surface_android(
1189+
<span class="kw-2">&amp;</span><span class="self">self</span>,
1190+
window: <span class="kw-2">*const </span>c_void,
1191+
) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="kw">super</span>::Surface, <span class="kw">crate</span>::InstanceError&gt; {
1192+
<span class="kw">if </span>!<span class="self">self
1193+
</span>.shared
1194+
.extensions
1195+
.contains(<span class="kw-2">&amp;</span>khr::AndroidSurface::name())
1196+
{
1197+
<span class="macro">log::warn!</span>(<span class="string">&quot;Vulkan driver does not support VK_KHR_android_surface&quot;</span>);
1198+
<span class="kw">return </span><span class="prelude-val">Err</span>(<span class="kw">crate</span>::InstanceError);
1199+
}
1200+
11661201
<span class="kw">let </span>surface = {
11671202
<span class="kw">let </span>a_loader = khr::AndroidSurface::new(<span class="kw-2">&amp;</span><span class="self">self</span>.shared.entry, <span class="kw-2">&amp;</span><span class="self">self</span>.shared.raw);
11681203
<span class="kw">let </span>info = vk::AndroidSurfaceCreateInfoKHR::builder()
@@ -1172,17 +1207,18 @@
11721207
<span class="kw">unsafe </span>{ a_loader.create_android_surface(<span class="kw-2">&amp;</span>info, <span class="prelude-val">None</span>) }.expect(<span class="string">&quot;AndroidSurface failed&quot;</span>)
11731208
};
11741209

1175-
<span class="self">self</span>.create_surface_from_vk_surface_khr(surface)
1210+
<span class="prelude-val">Ok</span>(<span class="self">self</span>.create_surface_from_vk_surface_khr(surface))
11761211
}
11771212

11781213
<span class="attribute">#[allow(dead_code)]
11791214
</span><span class="kw">fn </span>create_surface_from_hwnd(
11801215
<span class="kw-2">&amp;</span><span class="self">self</span>,
11811216
hinstance: <span class="kw-2">*mut </span>c_void,
11821217
hwnd: <span class="kw-2">*mut </span>c_void,
1183-
) -&gt; <span class="kw">super</span>::Surface {
1218+
) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="kw">super</span>::Surface, <span class="kw">crate</span>::InstanceError&gt; {
11841219
<span class="kw">if </span>!<span class="self">self</span>.shared.extensions.contains(<span class="kw-2">&amp;</span>khr::Win32Surface::name()) {
1185-
<span class="macro">panic!</span>(<span class="string">&quot;Vulkan driver does not support VK_KHR_WIN32_SURFACE&quot;</span>);
1220+
<span class="macro">log::debug!</span>(<span class="string">&quot;Vulkan driver does not support VK_KHR_win32_surface&quot;</span>);
1221+
<span class="kw">return </span><span class="prelude-val">Err</span>(<span class="kw">crate</span>::InstanceError);
11861222
}
11871223

11881224
<span class="kw">let </span>surface = {
@@ -1198,11 +1234,19 @@
11981234
}
11991235
};
12001236

1201-
<span class="self">self</span>.create_surface_from_vk_surface_khr(surface)
1237+
<span class="prelude-val">Ok</span>(<span class="self">self</span>.create_surface_from_vk_surface_khr(surface))
12021238
}
12031239

12041240
<span class="attribute">#[cfg(any(target_os = <span class="string">&quot;macos&quot;</span>, target_os = <span class="string">&quot;ios&quot;</span>))]
1205-
</span><span class="kw">fn </span>create_surface_from_view(<span class="kw-2">&amp;</span><span class="self">self</span>, view: <span class="kw-2">*mut </span>c_void) -&gt; <span class="kw">super</span>::Surface {
1241+
</span><span class="kw">fn </span>create_surface_from_view(
1242+
<span class="kw-2">&amp;</span><span class="self">self</span>,
1243+
view: <span class="kw-2">*mut </span>c_void,
1244+
) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="kw">super</span>::Surface, <span class="kw">crate</span>::InstanceError&gt; {
1245+
<span class="kw">if </span>!<span class="self">self</span>.shared.extensions.contains(<span class="kw-2">&amp;</span>ext::MetalSurface::name()) {
1246+
<span class="macro">log::warn!</span>(<span class="string">&quot;Vulkan driver does not support VK_EXT_metal_surface&quot;</span>);
1247+
<span class="kw">return </span><span class="prelude-val">Err</span>(<span class="kw">crate</span>::InstanceError);
1248+
}
1249+
12061250
<span class="kw">let </span>layer = <span class="kw">unsafe </span>{
12071251
<span class="kw">crate</span>::metal::Surface::get_metal_layer(view <span class="kw">as </span><span class="kw-2">*mut </span>objc::runtime::Object, <span class="prelude-val">None</span>)
12081252
};
@@ -1217,7 +1261,7 @@
12171261
<span class="kw">unsafe </span>{ metal_loader.create_metal_surface(<span class="kw-2">&amp;</span>vk_info, <span class="prelude-val">None</span>).unwrap() }
12181262
};
12191263

1220-
<span class="self">self</span>.create_surface_from_vk_surface_khr(surface)
1264+
<span class="prelude-val">Ok</span>(<span class="self">self</span>.create_surface_from_vk_surface_khr(surface))
12211265
}
12221266

12231267
<span class="kw">fn </span>create_surface_from_vk_surface_khr(<span class="kw-2">&amp;</span><span class="self">self</span>, surface: vk::SurfaceKHR) -&gt; <span class="kw">super</span>::Surface {
@@ -1386,37 +1430,33 @@
13861430

13871431
<span class="kw">match </span>(window_handle, display_handle) {
13881432
(Rwh::Wayland(handle), Rdh::Wayland(display)) =&gt; {
1389-
<span class="prelude-val">Ok</span>(<span class="self">self</span>.create_surface_from_wayland(display.display, handle.surface))
1433+
<span class="self">self</span>.create_surface_from_wayland(display.display, handle.surface)
13901434
}
1391-
(Rwh::Xlib(handle), Rdh::Xlib(display))
1392-
<span class="kw">if </span><span class="self">self</span>.shared.extensions.contains(<span class="kw-2">&amp;</span>khr::XlibSurface::name()) =&gt;
1393-
{
1394-
<span class="prelude-val">Ok</span>(<span class="self">self</span>.create_surface_from_xlib(display.display <span class="kw">as </span><span class="kw-2">*mut </span><span class="kw">_</span>, handle.window))
1435+
(Rwh::Xlib(handle), Rdh::Xlib(display)) =&gt; {
1436+
<span class="self">self</span>.create_surface_from_xlib(display.display <span class="kw">as </span><span class="kw-2">*mut </span><span class="kw">_</span>, handle.window)
13951437
}
1396-
(Rwh::Xcb(handle), Rdh::Xcb(display))
1397-
<span class="kw">if </span><span class="self">self</span>.shared.extensions.contains(<span class="kw-2">&amp;</span>khr::XcbSurface::name()) =&gt;
1398-
{
1399-
<span class="prelude-val">Ok</span>(<span class="self">self</span>.create_surface_from_xcb(display.connection, handle.window))
1438+
(Rwh::Xcb(handle), Rdh::Xcb(display)) =&gt; {
1439+
<span class="self">self</span>.create_surface_from_xcb(display.connection, handle.window)
14001440
}
1401-
(Rwh::AndroidNdk(handle), <span class="kw">_</span>) =&gt; <span class="prelude-val">Ok</span>(<span class="self">self</span>.create_surface_android(handle.a_native_window)),
1441+
(Rwh::AndroidNdk(handle), <span class="kw">_</span>) =&gt; <span class="self">self</span>.create_surface_android(handle.a_native_window),
14021442
<span class="attribute">#[cfg(windows)]
14031443
</span>(Rwh::Win32(handle), <span class="kw">_</span>) =&gt; {
14041444
<span class="kw">use </span>winapi::um::libloaderapi::GetModuleHandleW;
14051445

14061446
<span class="kw">let </span>hinstance = GetModuleHandleW(std::ptr::null());
1407-
<span class="prelude-val">Ok</span>(<span class="self">self</span>.create_surface_from_hwnd(hinstance <span class="kw">as </span><span class="kw-2">*mut </span><span class="kw">_</span>, handle.hwnd))
1447+
<span class="self">self</span>.create_surface_from_hwnd(hinstance <span class="kw">as </span><span class="kw-2">*mut </span><span class="kw">_</span>, handle.hwnd)
14081448
}
14091449
<span class="attribute">#[cfg(target_os = <span class="string">&quot;macos&quot;</span>)]
14101450
</span>(Rwh::AppKit(handle), <span class="kw">_</span>)
14111451
<span class="kw">if </span><span class="self">self</span>.shared.extensions.contains(<span class="kw-2">&amp;</span>ext::MetalSurface::name()) =&gt;
14121452
{
1413-
<span class="prelude-val">Ok</span>(<span class="self">self</span>.create_surface_from_view(handle.ns_view))
1453+
<span class="self">self</span>.create_surface_from_view(handle.ns_view)
14141454
}
14151455
<span class="attribute">#[cfg(target_os = <span class="string">&quot;ios&quot;</span>)]
14161456
</span>(Rwh::UiKit(handle), <span class="kw">_</span>)
14171457
<span class="kw">if </span><span class="self">self</span>.shared.extensions.contains(<span class="kw-2">&amp;</span>ext::MetalSurface::name()) =&gt;
14181458
{
1419-
<span class="prelude-val">Ok</span>(<span class="self">self</span>.create_surface_from_view(handle.ui_view))
1459+
<span class="self">self</span>.create_surface_from_view(handle.ui_view)
14201460
}
14211461
(<span class="kw">_</span>, <span class="kw">_</span>) =&gt; <span class="prelude-val">Err</span>(<span class="kw">crate</span>::InstanceError),
14221462
}

0 commit comments

Comments
 (0)