1- <!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 ="Source of the Rust file `wgpu/src/backend/direct.rs`. "> < meta name ="keywords " content ="rust, rustlang, rust-lang "> < title > direct.rs - source</ title > < link rel ="preload " as ="font " type ="font/woff2 " crossorigin href ="../../../SourceSerif4-Regular.ttf.woff2 "> < link rel ="preload " as ="font " type ="font/woff2 " crossorigin href ="../../../FiraSans-Regular.woff2 "> < link rel ="preload " as ="font " type ="font/woff2 " crossorigin href ="../../../FiraSans-Medium.woff2 "> < link rel ="preload " as ="font " type ="font/woff2 " crossorigin href ="../../../SourceCodePro-Regular.ttf.woff2 "> < link rel ="preload " as ="font " type ="font/woff2 " crossorigin href ="../../../SourceSerif4-Bold.ttf.woff2 "> < link rel ="preload " as ="font " type ="font/woff2 " crossorigin href ="../../../SourceCodePro-Semibold.ttf.woff2 "> < link rel ="stylesheet " href ="../../../normalize.css "> < link rel ="stylesheet " href ="../../../rustdoc.css " id ="mainThemeStyle "> < link rel ="stylesheet " href ="../../../ayu.css " disabled > < link rel ="stylesheet " href ="../../../dark.css " disabled > < link rel ="stylesheet " href ="../../../light.css " id ="themeStyle "> < script id ="default-settings " > </ script > < script src ="../../../storage.js "> </ script > < script defer src ="../../../source-script.js "> </ script > < script defer src ="../../../source-files.js "> </ script > < script defer src ="../../../main.js "> </ script > < noscript > < link rel ="stylesheet " href ="../../../noscript.css "> </ noscript > < link rel ="alternate icon " type ="image/png " href ="../../../favicon-16x16.png "> < link rel ="alternate icon " type ="image/png " href ="../../../favicon-32x32.png "> < link rel ="icon " type ="image/svg+xml " href ="../../../favicon.svg "> </ head > < body class ="rustdoc source "> <!--[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 "> ☰</ button > < a class ="sidebar-logo " href ="../../../wgpu/index.html "> < div class ="logo-container "> < img src ="https://raw.githubusercontent.com/gfx-rs/wgpu/master/logo.png " alt ="logo "> </ div > </ a > < h2 class ="location "> </ h2 > </ nav > < nav class ="sidebar "> < a class ="sidebar-logo " href ="../../../wgpu/index.html "> < div class ="logo-container ">
1+ <!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 ="Source of the Rust file `wgpu/src/backend/direct.rs`. "> < meta name ="keywords " content ="rust, rustlang, rust-lang "> < title > direct.rs - source</ title > < link rel ="preload " as ="font " type ="font/woff2 " crossorigin href ="../../../SourceSerif4-Regular.ttf.woff2 "> < link rel ="preload " as ="font " type ="font/woff2 " crossorigin href ="../../../FiraSans-Regular.woff2 "> < link rel ="preload " as ="font " type ="font/woff2 " crossorigin href ="../../../FiraSans-Medium.woff2 "> < link rel ="preload " as ="font " type ="font/woff2 " crossorigin href ="../../../SourceCodePro-Regular.ttf.woff2 "> < link rel ="preload " as ="font " type ="font/woff2 " crossorigin href ="../../../SourceSerif4-Bold.ttf.woff2 "> < link rel ="preload " as ="font " type ="font/woff2 " crossorigin href ="../../../SourceCodePro-Semibold.ttf.woff2 "> < link rel ="stylesheet " href ="../../../normalize.css "> < link rel ="stylesheet " href ="../../../rustdoc.css " id ="mainThemeStyle "> < link rel ="stylesheet " href ="../../../ayu.css " disabled > < link rel ="stylesheet " href ="../../../dark.css " disabled > < link rel ="stylesheet " href ="../../../light.css " id ="themeStyle "> < script id ="default-settings " > </ script > < script src ="../../../storage.js "> </ script > < script defer src ="../../../source-script.js "> </ script > < script defer src ="../../../source-files.js "> </ script > < script defer src ="../../../main.js "> </ script > < noscript > < link rel ="stylesheet " href ="../../../noscript.css "> </ noscript > < link rel ="alternate icon " type ="image/png " href ="../../../favicon-16x16.png "> < link rel ="alternate icon " type ="image/png " href ="../../../favicon-32x32.png "> < link rel ="icon " type ="image/svg+xml " href ="../../../favicon.svg "> </ head > < body class ="rustdoc source "> <!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--> < nav class ="sidebar "> < a class ="sidebar-logo " href ="../../../wgpu/index.html "> < div class ="logo-container ">
22 < img src ="https://raw.githubusercontent.com/gfx-rs/wgpu/master/logo.png " alt ="logo "> </ div > </ a > </ nav > < main > < div class ="width-limiter "> < div class ="sub-container "> < a class ="sub-logo-container " href ="../../../wgpu/index.html ">
33 < img src ="https://raw.githubusercontent.com/gfx-rs/wgpu/master/logo.png " alt ="logo "> </ a > < nav class ="sub "> < form class ="search-form "> < div class ="search-container "> < span > </ span > < input class ="search-input " name ="search " autocomplete ="off " spellcheck ="false " placeholder ="Click or press ‘S’ to search, ‘?’ for more options… " type ="search "> < div id ="help-button " title ="help " tabindex ="-1 "> < button type ="button "> ?</ button > </ div > < div id ="settings-menu " tabindex ="-1 "> < a href ="../../../settings.html " title ="settings "> < img width ="22 " height ="22 " alt ="Change settings " src ="../../../wheel.svg "> </ a > </ div > </ div > </ form > </ nav > </ div > < section id ="main-content " class ="content "> < div class ="example-wrap "> < pre class ="src-line-numbers "> < span id ="1 "> 1</ span >
44< span id ="2 "> 2</ span >
24552455< span id ="2453 "> 2453</ span >
24562456< span id ="2454 "> 2454</ span >
24572457< span id ="2455 "> 2455</ span >
2458- < span id ="2456 "> 2456</ span >
2459- < span id ="2457 "> 2457</ span >
2460- < span id ="2458 "> 2458</ span >
2461- < span id ="2459 "> 2459</ span >
2462- < span id ="2460 "> 2460</ span >
2463- < span id ="2461 "> 2461</ span >
2464- < span id ="2462 "> 2462</ span >
24652458</ pre > < pre class ="rust "> < code > < span class ="kw "> use crate</ span > ::{
24662459 AdapterInfo, BindGroupDescriptor, BindGroupLayoutDescriptor, BindingResource, BufferBinding,
24672460 CommandEncoderDescriptor, ComputePassDescriptor, ComputePipelineDescriptor,
42544247 }
42554248
42564249 < span class ="kw "> fn </ span > buffer_destroy(< span class ="kw-2 "> &</ span > < span class ="self "> self</ span > , buffer: < span class ="kw-2 "> &</ span > < span class ="self "> Self</ span > ::BufferId) {
4257- < span class ="kw "> let </ span > global = < span class ="kw-2 "> &</ span > < span class ="self "> self</ span > .< span class ="number "> 0</ span > ;
4258- < span class ="kw "> match </ span > < span class ="macro "> wgc::gfx_select!</ span > (buffer.id => global.buffer_destroy(buffer.id)) {
4259- < span class ="prelude-val "> Ok</ span > (()) => (),
4260- < span class ="prelude-val "> Err</ span > (err) => < span class ="self "> self</ span > .handle_error_fatal(err, < span class ="string "> "Buffer::destroy"</ span > ),
4261- }
4250+ < span class ="comment "> // Per spec, no error to report. Even calling destroy multiple times is valid.
4251+ </ span > < span class ="kw "> let </ span > global = < span class ="kw-2 "> &</ span > < span class ="self "> self</ span > .< span class ="number "> 0</ span > ;
4252+ < span class ="kw "> let _ </ span > = < span class ="macro "> wgc::gfx_select!</ span > (buffer.id => global.buffer_destroy(buffer.id));
42624253 }
42634254 < span class ="kw "> fn </ span > buffer_drop(< span class ="kw-2 "> &</ span > < span class ="self "> self</ span > , buffer: < span class ="kw-2 "> &</ span > < span class ="self "> Self</ span > ::BufferId) {
42644255 < span class ="kw "> let </ span > global = < span class ="kw-2 "> &</ span > < span class ="self "> self</ span > .< span class ="number "> 0</ span > ;
42654256 < span class ="macro "> wgc::gfx_select!</ span > (buffer.id => global.buffer_drop(buffer.id, < span class ="bool-val "> false</ span > ))
42664257 }
42674258 < span class ="kw "> fn </ span > texture_destroy(< span class ="kw-2 "> &</ span > < span class ="self "> self</ span > , texture: < span class ="kw-2 "> &</ span > < span class ="self "> Self</ span > ::TextureId) {
4268- < span class ="kw "> let </ span > global = < span class ="kw-2 "> &</ span > < span class ="self "> self</ span > .< span class ="number "> 0</ span > ;
4269- < span class ="kw "> match </ span > < span class ="macro "> wgc::gfx_select!</ span > (texture.id => global.texture_destroy(texture.id)) {
4270- < span class ="prelude-val "> Ok</ span > (()) => (),
4271- < span class ="prelude-val "> Err</ span > (err) => < span class ="self "> self</ span > .handle_error_fatal(err, < span class ="string "> "Texture::destroy"</ span > ),
4272- }
4259+ < span class ="comment "> // Per spec, no error to report. Even calling destroy multiple times is valid.
4260+ </ span > < span class ="kw "> let </ span > global = < span class ="kw-2 "> &</ span > < span class ="self "> self</ span > .< span class ="number "> 0</ span > ;
4261+ < span class ="kw "> let _ </ span > = < span class ="macro "> wgc::gfx_select!</ span > (texture.id => global.texture_destroy(texture.id));
42734262 }
42744263 < span class ="kw "> fn </ span > texture_drop(< span class ="kw-2 "> &</ span > < span class ="self "> self</ span > , texture: < span class ="kw-2 "> &</ span > < span class ="self "> Self</ span > ::TextureId) {
42754264 < span class ="kw "> let </ span > global = < span class ="kw-2 "> &</ span > < span class ="self "> self</ span > .< span class ="number "> 0</ span > ;
42764265 < span class ="macro "> wgc::gfx_select!</ span > (texture.id => global.texture_drop(texture.id, < span class ="bool-val "> false</ span > ))
42774266 }
42784267 < span class ="kw "> fn </ span > texture_view_drop(< span class ="kw-2 "> &</ span > < span class ="self "> self</ span > , texture_view: < span class ="kw-2 "> &</ span > < span class ="self "> Self</ span > ::TextureViewId) {
42794268 < span class ="kw "> let </ span > global = < span class ="kw-2 "> &</ span > < span class ="self "> self</ span > .< span class ="number "> 0</ span > ;
4280- < span class ="kw "> match </ span > < span class ="macro "> wgc::gfx_select!</ span > (< span class ="kw-2 "> *</ span > texture_view => global.texture_view_drop(< span class ="kw-2 "> *</ span > texture_view, < span class ="bool-val "> false</ span > )) {
4281- < span class ="prelude-val "> Ok</ span > (()) => (),
4282- < span class ="prelude-val "> Err</ span > (err) => < span class ="self "> self</ span > .handle_error_fatal(err, < span class ="string "> "TextureView::drop"</ span > ),
4283- }
4269+ < span class ="kw "> let _ </ span > = < span class ="macro "> wgc::gfx_select!</ span > (< span class ="kw-2 "> *</ span > texture_view => global.texture_view_drop(< span class ="kw-2 "> *</ span > texture_view, < span class ="bool-val "> false</ span > ));
42844270 }
42854271 < span class ="kw "> fn </ span > sampler_drop(< span class ="kw-2 "> &</ span > < span class ="self "> self</ span > , sampler: < span class ="kw-2 "> &</ span > < span class ="self "> Self</ span > ::SamplerId) {
42864272 < span class ="kw "> let </ span > global = < span class ="kw-2 "> &</ span > < span class ="self "> self</ span > .< span class ="number "> 0</ span > ;
49254911 </ span > }
49264912}
49274913</ code > </ pre > </ div >
4928- </ section > </ div > </ main > < div id ="rustdoc-vars " data-root-path ="../../../ " data-current-crate ="wgpu " data-themes ="ayu,dark,light " data-resource-suffix ="" data-rustdoc-version ="1.66.0-nightly (8796e7a9c 2022-10-08 ) " > </ div > </ body > </ html >
4914+ </ section > </ div > </ main > < div id ="rustdoc-vars " data-root-path ="../../../ " data-current-crate ="wgpu " data-themes ="ayu,dark,light " data-resource-suffix ="" data-rustdoc-version ="1.66.0-nightly (a6b7274a4 2022-10-10 ) " > </ div > </ body > </ html >
0 commit comments