diff --git a/.cargo/config.in b/.cargo/config.in index 5b7e61f927a8d..848193a5a8fd5 100644 --- a/.cargo/config.in +++ b/.cargo/config.in @@ -292,7 +292,7 @@ wgpu ? rev = -767ac03245ee937d3dc552edc13fe7ab0a860eec +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 " ] git @@ -315,7 +315,7 @@ wgpu rev = " -767ac03245ee937d3dc552edc13fe7ab0a860eec +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 " replace - diff --git a/Cargo.lock b/Cargo.lock index 2cc9556856364..294c35414f459 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6686,9 +6686,9 @@ wgpu ? rev = -767ac03245ee937d3dc552edc13fe7ab0a860eec +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 # -767ac03245ee937d3dc552edc13fe7ab0a860eec +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 " dependencies = @@ -20906,9 +20906,9 @@ wgpu ? rev = -767ac03245ee937d3dc552edc13fe7ab0a860eec +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 # -767ac03245ee937d3dc552edc13fe7ab0a860eec +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 " dependencies = @@ -35406,9 +35406,9 @@ wgpu ? rev = -767ac03245ee937d3dc552edc13fe7ab0a860eec +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 # -767ac03245ee937d3dc552edc13fe7ab0a860eec +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 " dependencies = @@ -35521,9 +35521,9 @@ wgpu ? rev = -767ac03245ee937d3dc552edc13fe7ab0a860eec +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 # -767ac03245ee937d3dc552edc13fe7ab0a860eec +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 " dependencies = @@ -35694,9 +35694,9 @@ wgpu ? rev = -767ac03245ee937d3dc552edc13fe7ab0a860eec +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 # -767ac03245ee937d3dc552edc13fe7ab0a860eec +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 " dependencies = diff --git a/dom/webgpu/Adapter.cpp b/dom/webgpu/Adapter.cpp index ea0cb81aa3873..29c65dbba206c 100644 --- a/dom/webgpu/Adapter.cpp +++ b/dom/webgpu/Adapter.cpp @@ -455,23 +455,6 @@ case ffi : : -WGPUBackend_Dx11 -: -s -. -AssignLiteral -( -" -Dx11 -" -) -; -return -; -case -ffi -: -: WGPUBackend_Gl : s diff --git a/gfx/wgpu_bindings/Cargo.toml b/gfx/wgpu_bindings/Cargo.toml index d66d1b454d0bf..2536ad4d98dad 100644 --- a/gfx/wgpu_bindings/Cargo.toml +++ b/gfx/wgpu_bindings/Cargo.toml @@ -98,7 +98,7 @@ wgpu rev = " -767ac03245ee937d3dc552edc13fe7ab0a860eec +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 " # Note @@ -229,7 +229,7 @@ wgpu rev = " -767ac03245ee937d3dc552edc13fe7ab0a860eec +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 " features = @@ -291,7 +291,7 @@ wgpu rev = " -767ac03245ee937d3dc552edc13fe7ab0a860eec +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 " features = @@ -378,7 +378,7 @@ wgpu rev = " -767ac03245ee937d3dc552edc13fe7ab0a860eec +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 " features = @@ -419,7 +419,7 @@ wgpu rev = " -767ac03245ee937d3dc552edc13fe7ab0a860eec +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 " [ dependencies @@ -453,7 +453,7 @@ wgpu rev = " -767ac03245ee937d3dc552edc13fe7ab0a860eec +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 " [ target @@ -489,7 +489,7 @@ wgpu rev = " -767ac03245ee937d3dc552edc13fe7ab0a860eec +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 " [ target diff --git a/gfx/wgpu_bindings/moz.yaml b/gfx/wgpu_bindings/moz.yaml index 36aa974d62ad4..6d0fdcd7e4154 100644 --- a/gfx/wgpu_bindings/moz.yaml +++ b/gfx/wgpu_bindings/moz.yaml @@ -124,7 +124,7 @@ SSS release : commit -767ac03245ee937d3dc552edc13fe7ab0a860eec +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 # Revision to @@ -145,7 +145,7 @@ preferred ) revision : -767ac03245ee937d3dc552edc13fe7ab0a860eec +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 license : [ diff --git a/supply-chain/audits.toml b/supply-chain/audits.toml index 81e968cfe9667..23586940bfb00 100644 --- a/supply-chain/audits.toml +++ b/supply-chain/audits.toml @@ -11409,6 +11409,56 @@ delta 0 git : +767ac03245ee937d3dc552edc13fe7ab0a860eec +- +> +0 +. +7 +. +0 +git +: +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 +" +[ +[ +audits +. +d3d12 +] +] +who += +" +Nicolas +Silva +< +nical +fastmail +. +com +> +" +criteria += +" +safe +- +to +- +deploy +" +delta += +" +0 +. +7 +. +0 +git +: a820a3ffba468cbb87c2a7e7bbe37065ed5207ee - > @@ -24075,6 +24125,56 @@ delta 0 git : +767ac03245ee937d3dc552edc13fe7ab0a860eec +- +> +0 +. +14 +. +0 +git +: +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 +" +[ +[ +audits +. +naga +] +] +who += +" +Nicolas +Silva +< +nical +fastmail +. +com +> +" +criteria += +" +safe +- +to +- +deploy +" +delta += +" +0 +. +14 +. +0 +git +: a820a3ffba468cbb87c2a7e7bbe37065ed5207ee - > @@ -40593,6 +40693,58 @@ delta 0 git : +767ac03245ee937d3dc552edc13fe7ab0a860eec +- +> +0 +. +18 +. +0 +git +: +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 +" +[ +[ +audits +. +wgpu +- +core +] +] +who += +" +Nicolas +Silva +< +nical +fastmail +. +com +> +" +criteria += +" +safe +- +to +- +deploy +" +delta += +" +0 +. +18 +. +0 +git +: a820a3ffba468cbb87c2a7e7bbe37065ed5207ee - > @@ -41309,6 +41461,58 @@ delta 0 git : +767ac03245ee937d3dc552edc13fe7ab0a860eec +- +> +0 +. +18 +. +0 +git +: +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 +" +[ +[ +audits +. +wgpu +- +hal +] +] +who += +" +Nicolas +Silva +< +nical +fastmail +. +com +> +" +criteria += +" +safe +- +to +- +deploy +" +delta += +" +0 +. +18 +. +0 +git +: a820a3ffba468cbb87c2a7e7bbe37065ed5207ee - > @@ -42025,6 +42229,58 @@ delta 0 git : +767ac03245ee937d3dc552edc13fe7ab0a860eec +- +> +0 +. +18 +. +0 +git +: +ff7b2c399301cca9bcbc5b19a869feb3c29ef785 +" +[ +[ +audits +. +wgpu +- +types +] +] +who += +" +Nicolas +Silva +< +nical +fastmail +. +com +> +" +criteria += +" +safe +- +to +- +deploy +" +delta += +" +0 +. +18 +. +0 +git +: a820a3ffba468cbb87c2a7e7bbe37065ed5207ee - > diff --git a/third_party/rust/naga/.cargo-checksum.json b/third_party/rust/naga/.cargo-checksum.json index 82e5d6df9d4b8..23c9fa5ec2699 100644 --- a/third_party/rust/naga/.cargo-checksum.json +++ b/third_party/rust/naga/.cargo-checksum.json @@ -1043,7 +1043,7 @@ rs " : " -d1954f9845fd4fedbf688dbcff85310954eb69ac228a3e2a128bd5759ad8667d +59df2e00495e136eb59a0d3cb6c5990a31b914cd9f6e488355a597cd72cc0f01 " " src diff --git a/third_party/rust/naga/src/front/wgsl/lower/mod.rs b/third_party/rust/naga/src/front/wgsl/lower/mod.rs index 49136402c4127..7317aa613c98e 100644 --- a/third_party/rust/naga/src/front/wgsl/lower/mod.rs +++ b/third_party/rust/naga/src/front/wgsl/lower/mod.rs @@ -4158,36 +4158,142 @@ ctx ; let init +; +if +let +Some +( +init_ast +) = v . init +{ +let +mut +ectx += +ctx . -map +as_const ( -| -init -| +) +; +let +lowered += self . -expression +expression_for_abstract ( -init +init_ast & mut -ctx -. -as_const -( +ectx ) +? +; +let +ty_res += +crate +: +: +proc +: +: +TypeResolution +: +: +Handle +( +ty ) +; +let +converted += +ectx +. +try_automatic_conversions +( +lowered +& +ty_res +v +. +name +. +span ) . -transpose +map_err ( +| +error +| +match +error +{ +Error +: +: +AutoConversion +{ +dest_span +: +_ +dest_type +source_span +: +_ +source_type +} += +> +Error +: +: +InitializationTypeMismatch +{ +name +: +v +. +name +. +span +expected +: +dest_type +got +: +source_type +} +other += +> +other +} ) ? ; +init += +Some +( +converted +) +; +} +else +{ +init += +None +; +} let binding = @@ -5897,6 +6003,38 @@ v > { let +explicit_ty += +v +. +ty +. +map +( +| +ast +| +self +. +resolve_ast_type +( +ast +& +mut +ctx +. +as_global +( +) +) +) +. +transpose +( +) +? +; +let mut emitter = @@ -5920,28 +6058,9 @@ expressions ) ; let -initializer -= -match -v -. -init -{ -Some -( -init -) -= -> -Some -( -self -. -expression -( -init -& mut +ectx += ctx . as_expression @@ -5951,132 +6070,106 @@ block mut emitter ) -) -? -) -None -= -> -None -} ; let -explicit_ty -= -v -. ty -. -map -( -| -ty -| -self -. -resolve_ast_type -( -ty -& -mut -ctx -. -as_global -( -) -) -) -. -transpose -( -) -? ; let -ty -= +initializer +; match ( +v +. +init explicit_ty -initializer ) { ( Some ( -explicit +init ) Some ( -initializer +explicit_ty ) ) = > { let -mut -ctx +init = -ctx +self . -as_expression +expression_for_abstract ( -block +init & mut -emitter +ectx ) +? ; let -initializer_ty +ty_res = -resolve_inner -! +crate +: +: +proc +: +: +TypeResolution +: +: +Handle ( -ctx -initializer +explicit_ty ) ; -if -! -ctx -. -module -. -types -[ -explicit -] -. -inner +let +init += +ectx . -equivalent +try_automatic_conversions ( -initializer_ty +init & -ctx +ty_res +v . -module +name . -types +span ) -{ -let -gctx -= -& -ctx . -module -. -to_ctx -( -) -; -return -Err +map_err ( +| +error +| +match +error +{ +Error +: +: +AutoConversion +{ +dest_span +: +_ +dest_type +source_span +: +_ +source_type +} += +> Error : : @@ -6091,67 +6184,98 @@ name span expected : -explicit -. -to_wgsl -( -gctx -) +dest_type got : -initializer_ty -. -to_wgsl -( -gctx -) +source_type +} +other += +> +other } ) +? ; -} -explicit -} -( +ty += +explicit_ty +; +initializer += Some ( -explicit -) -None +init ) -= -> -explicit +; +} ( -None Some ( -initializer +init ) +None ) = > -ctx +{ +let +concretized += +self . -as_expression +expression ( -block +init & mut -emitter +ectx ) +? +; +ty += +ectx . register_type ( -initializer +concretized ) ? +; +initializer += +Some +( +concretized +) +; +} ( None -None +Some +( +explicit_ty +) ) = > { +ty += +explicit_ty +; +initializer += +None +; +} +( +None +None +) += +> return Err ( @@ -6167,10 +6291,7 @@ name span ) ) -; -} } -; let ( const_initializer diff --git a/third_party/rust/wgpu-core/.cargo-checksum.json b/third_party/rust/wgpu-core/.cargo-checksum.json index dbdb6f1a11c85..2483bec0627f6 100644 --- a/third_party/rust/wgpu-core/.cargo-checksum.json +++ b/third_party/rust/wgpu-core/.cargo-checksum.json @@ -11,7 +11,7 @@ toml " : " -5119648ea52e97ad3fa2f0f24cc30e0b305fe81f710a33396bdadaf7397d41b9 +7d8b06bcc217e1e9a23ad63e2e9d9403f2ef58ab257c222233403c3e57a642e7 " " LICENSE @@ -40,7 +40,7 @@ rs " : " -1afed4e5e2cc1726c9887bfbf8805f9141f859615c1eaf90f4ef3e49850caf06 +c5e961783be28548681c3c38579ea0b5724c5336848216a423e83a0db2208ece " " src @@ -51,7 +51,7 @@ rs " : " -b709658ed6b9af2ed07ff77b8da64912cd26a9d7caaecee26c77a92efdc615d4 +ba1849e89e7dae7cd29635b57dc3140e47389e7aa38732b03c4cad693444680c " " src @@ -218,7 +218,7 @@ rs " : " -33c47e5aaa44ad4a485a996af52247e765bedfa18724ab7662ce34c78754448b +634619218859faa1dbd789b79a9ae2186cef950c50e3f9b1c4850d36bd1c8f16 " " src @@ -231,7 +231,7 @@ rs " : " -bbda212777bf5156feb9ee4c46d7c7621888c11544903a26bf86e7b708590f5a +a3d52432d7aff41d9f5bcf3b2da70d73f28847516d5909894328b78d2867b7ee " " src @@ -244,7 +244,7 @@ rs " : " -4ec88e037307e597fc661c85c9fa28f2d70a82a222a5fec5c97c450d33224f37 +d6a8ce711b8891c469c4b47348a3ce48d84ea4a356c0b05ec7e128d21a440562 " " src @@ -270,7 +270,7 @@ rs " : " -a47f4d8b605c477fc6a63058e1340872590631c9a1a7f4e454bbbbe01aada757 +26f2681c2539b0fa6e242690ebafc6664e08a501a98bdf15e13555ac5f8769b1 " " src @@ -305,7 +305,7 @@ rs " : " -9aa9448791477007b850c5eb1584e7c74c14fe43ac47ab3b5f29373850f463ee +c0a590e0136bf19a63ddc87dd3f0bbfbe24bcb810d0ccfc6c5f26631750d63ea " " src @@ -316,7 +316,7 @@ rs " : " -bb380df266fa9754c93d55c24b1a3535629710eb04bc6858a40c38a5f02aae68 +3ee0f5e66b313fd1b8c79b3d73f0f1dbde88676b651d79518fa2dc5aff0ab856 " " src @@ -327,7 +327,7 @@ rs " : " -d9435f5b12f47e0b57599dce1d38e6eb4ef2477ab634806cfccefa4c1541f87b +4cec8de74a661bb628040ff457d38faf8c92d0824c4d5a4955834d56ebd25926 " " src @@ -338,7 +338,7 @@ rs " : " -0aa4258f93e05f6991385980a553e67892a0f1769e37624ae0466f83161af697 +76f6fbff7ac094b2d81e98e198b9d8785f11885e42015208fc362c368298c41f " " src @@ -399,7 +399,7 @@ rs " : " -46b13911e15310a7ced4e5f13eeaa5d2cde7762b8ffa282a28d0c812e7036458 +e1d4af51bb445850d9e2d7d12b239413bb555f07f95d3a1851cc73443c5c18f0 " " src @@ -410,7 +410,7 @@ rs " : " -9408b33250c7062599045cc11dd1f52d6036415f0e5c568b37c73348b330bb7c +a7c46d675920b64284bf0494b749a9ffd3661a8c3ce6d4e00c399e5414dbf12d " " src @@ -421,7 +421,7 @@ rs " : " -1d615e582254cfa108dd1925df7b6b0ae0c9845714b1351b8bcd4c7aa4b4dd69 +2ae1c803ba37d2114a31aa87a515555e7fc42b337f169f7a1cd7ce4568f92f30 " " src @@ -443,7 +443,7 @@ rs " : " -e93369ae372b133649b554a3d0338d74823cfded8b7e84d01bf1f000b670f471 +c259ca61dd5f2b632ff2ee871f82727921fa48dee15253872799af1dda77484b " " src @@ -454,7 +454,7 @@ rs " : " -be6b9b648911c2277d9f88ca9e9a2811ec28fdf8118e009a47de0c16179f28aa +f3ad01be1943793fa2a469056388d0e14b3cf869f610fac11f556f5bc7ee8f86 " " src diff --git a/third_party/rust/wgpu-core/Cargo.toml b/third_party/rust/wgpu-core/Cargo.toml index 3cbda4428ac34..614552651a0de 100644 --- a/third_party/rust/wgpu-core/Cargo.toml +++ b/third_party/rust/wgpu-core/Cargo.toml @@ -511,15 +511,6 @@ default link " ] -dx11 -= -[ -" -hal -/ -dx11 -" -] dx12 = [ diff --git a/third_party/rust/wgpu-core/src/any_surface.rs b/third_party/rust/wgpu-core/src/any_surface.rs index 2349723eaf5dd..ebdea02751ef8 100644 --- a/third_party/rust/wgpu-core/src/any_surface.rs +++ b/third_party/rust/wgpu-core/src/any_surface.rs @@ -260,50 +260,6 @@ Dx12 [ cfg ( -all -( -feature -= -" -dx11 -" -windows -) -) -] -if -self -. -downcast_ref -: -: -< -hal -: -: -api -: -: -Dx11 -> -( -) -. -is_some -( -) -{ -return -Backend -: -: -Dx11 -; -} -# -[ -cfg -( feature = " diff --git a/third_party/rust/wgpu-core/src/binding_model.rs b/third_party/rust/wgpu-core/src/binding_model.rs index 2e7c47086e7b5..b933196139a00 100644 --- a/third_party/rust/wgpu-core/src/binding_model.rs +++ b/third_party/rust/wgpu-core/src/binding_model.rs @@ -2304,6 +2304,19 @@ count ) ; } +wgt +: +: +BindingType +: +: +AccelerationStructure += +> +todo +! +( +) } } pub @@ -2936,13 +2949,6 @@ ResourceInfo < BindGroupLayoutId > -# -[ -cfg -( -debug_assertions -) -] pub ( crate @@ -3107,14 +3113,6 @@ self > String { -# -[ -cfg -( -debug_assertions -) -] -return self . label @@ -3122,25 +3120,6 @@ label clone ( ) -; -# -[ -cfg -( -not -( -debug_assertions -) -) -] -return -String -: -: -new -( -) -; } } impl diff --git a/third_party/rust/wgpu-core/src/device/global.rs b/third_party/rust/wgpu-core/src/device/global.rs index b2d0dba9182fd..a82554f37bd05 100644 --- a/third_party/rust/wgpu-core/src/device/global.rs +++ b/third_party/rust/wgpu-core/src/device/global.rs @@ -40,7 +40,7 @@ queue DeviceError DeviceLostClosure HostMap -IMPLICIT_FAILURE +IMPLICIT_BIND_GROUP_LAYOUT_ERROR_LABEL } global : @@ -3217,8 +3217,6 @@ buffer } : { -: -? } " buffer_id @@ -3547,10 +3545,9 @@ Device : create_texture error +: { error -: -? } " ) @@ -4007,10 +4004,9 @@ Device : create_texture error +: { error -: -? } " ) @@ -4349,10 +4345,9 @@ Device : create_buffer error +: { error -: -? } " ) @@ -4938,17 +4933,15 @@ wait for texture { +texture_id : ? } : { -: -? +e } " -texture_id -e ) } } @@ -5279,10 +5272,9 @@ texture_id } ) error +: { error -: -? } " ) @@ -5497,6 +5489,7 @@ e ) = > +{ log : : @@ -5511,21 +5504,20 @@ for texture view { +texture_view_id : ? } : { -: -? +e } " -texture_view_id -e ) } } } +} Ok ( ( @@ -8014,8 +8006,6 @@ error : { error -: -? } " ) @@ -8399,8 +8389,6 @@ error : { error -: -? } " ) @@ -10639,7 +10627,7 @@ insert_error ids . root_id -IMPLICIT_FAILURE +IMPLICIT_BIND_GROUP_LAYOUT_ERROR_LABEL ) ; for @@ -10675,7 +10663,7 @@ bgl_guard insert_error ( bgl_id -IMPLICIT_FAILURE +IMPLICIT_BIND_GROUP_LAYOUT_ERROR_LABEL ) ; } @@ -10692,10 +10680,9 @@ Device : create_render_pipeline error +: { error -: -? } " ) @@ -11499,7 +11486,7 @@ insert_error ids . root_id -IMPLICIT_FAILURE +IMPLICIT_BIND_GROUP_LAYOUT_ERROR_LABEL ) ; for @@ -11535,7 +11522,7 @@ bgl_guard insert_error ( bgl_id -IMPLICIT_FAILURE +IMPLICIT_BIND_GROUP_LAYOUT_ERROR_LABEL ) ; } @@ -14093,50 +14080,6 @@ all_queue_empty [ cfg ( -all -( -feature -= -" -dx11 -" -windows -) -) -] -{ -all_queue_empty -= -self -. -poll_device -: -: -< -hal -: -: -api -: -: -Dx11 -> -( -force_wait -& -mut -closures -) -? -& -& -all_queue_empty -; -} -# -[ -cfg -( feature = " @@ -14923,10 +14866,9 @@ Buffer : map_async error +: { err -: -? } " ) diff --git a/third_party/rust/wgpu-core/src/device/life.rs b/third_party/rust/wgpu-core/src/device/life.rs index 2782f87ff26d1..5793273614b6e 100644 --- a/third_party/rust/wgpu-core/src/device/life.rs +++ b/third_party/rust/wgpu-core/src/device/life.rs @@ -5294,12 +5294,11 @@ error " Mapping failed -{ : -? +{ +e } " -e ) ; Err diff --git a/third_party/rust/wgpu-core/src/device/mod.rs b/third_party/rust/wgpu-core/src/device/mod.rs index 9cf36632114cf..8a2fbc5ef2549 100644 --- a/third_party/rust/wgpu-core/src/device/mod.rs +++ b/third_party/rust/wgpu-core/src/device/mod.rs @@ -166,7 +166,10 @@ SHADER_STAGE_COUNT : usize = -3 +hal +: +: +MAX_CONCURRENT_SHADER_STAGES ; pub ( @@ -190,26 +193,32 @@ u32 5000 ; const -IMPLICIT_FAILURE +IMPLICIT_BIND_GROUP_LAYOUT_ERROR_LABEL : & str = " -failed -implicit +Implicit +BindGroupLayout +in +the +Error +State " ; const -EP_FAILURE +ENTRYPOINT_FAILURE_ERROR : & str = " -EP +The +given +EntryPoint is -invalid +Invalid " ; pub diff --git a/third_party/rust/wgpu-core/src/device/resource.rs b/third_party/rust/wgpu-core/src/device/resource.rs index 623244a291565..8ef79ab3947d2 100644 --- a/third_party/rust/wgpu-core/src/device/resource.rs +++ b/third_party/rust/wgpu-core/src/device/resource.rs @@ -249,8 +249,8 @@ DeviceDescriptor DeviceError ImplicitPipelineContext UserClosures -EP_FAILURE -IMPLICIT_FAILURE +ENTRYPOINT_FAILURE_ERROR +IMPLICIT_BIND_GROUP_LAYOUT_ERROR_LABEL ZERO_BUFFER_SIZE } ; @@ -1663,18 +1663,16 @@ trace in ' { +path : ? } ' : { -: -? +e } " -path -e ) ; None @@ -8101,13 +8099,6 @@ borrow_or_default ( ) ) -# -[ -cfg -( -debug_assertions -) -] label : desc @@ -8401,13 +8392,6 @@ borrow_or_default ( ) ) -# -[ -cfg -( -debug_assertions -) -] label : desc @@ -9385,6 +9369,16 @@ Yes } ) } +Bt +: +: +AccelerationStructure += +> +todo +! +( +) } ; if @@ -9849,7 +9843,7 @@ unwrap_or ( " < -BindGroupLayoyt +BindGroupLayout > " ) @@ -9883,13 +9877,6 @@ count_validator entries : entry_map -# -[ -cfg -( -debug_assertions -) -] label : label @@ -12131,6 +12118,11 @@ textures : & hal_textures +acceleration_structures +: +& +[ +] } ; let @@ -14256,7 +14248,7 @@ insert_error ids . root_id -IMPLICIT_FAILURE +IMPLICIT_BIND_GROUP_LAYOUT_ERROR_LABEL ) ; let @@ -14288,7 +14280,7 @@ bgl_guard insert_error ( bgl_id -IMPLICIT_FAILURE +IMPLICIT_BIND_GROUP_LAYOUT_ERROR_LABEL ) ; } @@ -14868,7 +14860,7 @@ CreateComputePipelineError : Internal ( -EP_FAILURE +ENTRYPOINT_FAILURE_ERROR . to_string ( @@ -15052,7 +15044,7 @@ insert_error ids . root_id -IMPLICIT_FAILURE +IMPLICIT_BIND_GROUP_LAYOUT_ERROR_LABEL ) ; for @@ -15072,7 +15064,7 @@ bgl_guard insert_error ( bgl_id -IMPLICIT_FAILURE +IMPLICIT_BIND_GROUP_LAYOUT_ERROR_LABEL ) ; } @@ -18214,7 +18206,7 @@ stage ) error : -EP_FAILURE +ENTRYPOINT_FAILURE_ERROR . to_string ( @@ -19453,11 +19445,9 @@ the device : { -: -? +error } " -error ) ; } diff --git a/third_party/rust/wgpu-core/src/global.rs b/third_party/rust/wgpu-core/src/global.rs index 46ad460993665..cdc453bb0aacf 100644 --- a/third_party/rust/wgpu-core/src/global.rs +++ b/third_party/rust/wgpu-core/src/global.rs @@ -170,28 +170,6 @@ HubReport [ cfg ( -all -( -feature -= -" -dx11 -" -windows -) -) -] -pub -dx11 -: -Option -< -HubReport -> -# -[ -cfg -( feature = " @@ -364,38 +342,6 @@ unwrap [ cfg ( -all -( -feature -= -" -dx11 -" -windows -) -) -] -Backend -: -: -Dx11 -= -> -self -. -dx11 -. -as_ref -( -) -. -unwrap -( -) -# -[ -cfg -( feature = " @@ -959,51 +905,6 @@ None [ cfg ( -all -( -feature -= -" -dx11 -" -windows -) -) -] -dx11 -: -if -self -. -instance -. -dx11 -. -is_some -( -) -{ -Some -( -self -. -hubs -. -dx11 -. -generate_report -( -) -) -} -else -{ -None -} -# -[ -cfg -( feature = " @@ -1215,36 +1116,6 @@ true [ cfg ( -all -( -feature -= -" -dx11 -" -windows -) -) -] -{ -self -. -hubs -. -dx11 -. -clear -( -& -surfaces_locked -true -) -; -} -# -[ -cfg -( feature = " diff --git a/third_party/rust/wgpu-core/src/hal_api.rs b/third_party/rust/wgpu-core/src/hal_api.rs index 9cef42b58424e..97353e7d62b53 100644 --- a/third_party/rust/wgpu-core/src/hal_api.rs +++ b/third_party/rust/wgpu-core/src/hal_api.rs @@ -794,171 +794,6 @@ downcast_ref [ cfg ( -all -( -feature -= -" -dx11 -" -windows -) -) -] -impl -HalApi -for -hal -: -: -api -: -: -Dx11 -{ -const -VARIANT -: -Backend -= -Backend -: -: -Dx11 -; -fn -create_instance_from_hal -( -name -: -& -str -hal_instance -: -Self -: -: -Instance -) -- -> -Instance -{ -Instance -{ -name -: -name -. -to_owned -( -) -dx11 -: -Some -( -hal_instance -) -. -. -Default -: -: -default -( -) -} -} -fn -instance_as_hal -( -instance -: -& -Instance -) -- -> -Option -< -& -Self -: -: -Instance -> -{ -instance -. -dx11 -. -as_ref -( -) -} -fn -hub -< -G -: -GlobalIdentityHandlerFactory -> -( -global -: -& -Global -< -G -> -) -- -> -& -Hub -< -Self -> -{ -& -global -. -hubs -. -dx11 -} -fn -get_surface -( -surface -: -& -Surface -) -- -> -Option -< -& -HalSurface -< -Self -> -> -{ -surface -. -raw -. -downcast_ref -( -) -} -} -# -[ -cfg -( feature = " diff --git a/third_party/rust/wgpu-core/src/hub.rs b/third_party/rust/wgpu-core/src/hub.rs index 0fc23f6c0ce67..841e881f7ed79 100644 --- a/third_party/rust/wgpu-core/src/hub.rs +++ b/third_party/rust/wgpu-core/src/hub.rs @@ -1422,37 +1422,6 @@ Dx12 [ cfg ( -all -( -feature -= -" -dx11 -" -windows -) -) -] -pub -( -crate -) -dx11 -: -Hub -< -hal -: -: -api -: -: -Dx11 -> -# -[ -cfg -( feature = " @@ -1539,18 +1508,6 @@ windows ) not ( -all -( -feature -= -" -dx11 -" -windows -) -) -not -( feature = " @@ -1698,30 +1655,6 @@ factory [ cfg ( -all -( -feature -= -" -dx11 -" -windows -) -) -] -dx11 -: -Hub -: -: -new -( -factory -) -# -[ -cfg -( feature = " @@ -1801,18 +1734,6 @@ windows ) not ( -all -( -feature -= -" -dx11 -" -windows -) -) -not -( feature = " diff --git a/third_party/rust/wgpu-core/src/id.rs b/third_party/rust/wgpu-core/src/id.rs index 3e8b91770cec8..0aff54aa7dd19 100644 --- a/third_party/rust/wgpu-core/src/id.rs +++ b/third_party/rust/wgpu-core/src/id.rs @@ -731,13 +731,6 @@ Dx12 Backend : : -Dx11 -5 -= -> -Backend -: -: Gl _ = @@ -861,38 +854,38 @@ backend Backend : : -Vulkan +Empty = > " -vk +_ " Backend : : -Metal +Vulkan = > " -mtl +vk " Backend : : -Dx12 +Metal = > " -d3d12 +mtl " Backend : : -Dx11 +Dx12 = > " -d3d11 +d3d12 " Backend : @@ -912,15 +905,6 @@ BrowserWebGpu " webgpu " -Backend -: -: -Empty -= -> -" -_ -" } ; write @@ -1792,10 +1776,6 @@ Dx12 Backend : : -Dx11 -Backend -: -: Gl ] { @@ -1935,10 +1915,6 @@ Dx12 Backend : : -Dx11 -Backend -: -: Gl ] ; diff --git a/third_party/rust/wgpu-core/src/instance.rs b/third_party/rust/wgpu-core/src/instance.rs index eef5dc4e0531b..c7d00ba0d1ef4 100644 --- a/third_party/rust/wgpu-core/src/instance.rs +++ b/third_party/rust/wgpu-core/src/instance.rs @@ -473,37 +473,6 @@ Dx12 [ cfg ( -all -( -feature -= -" -dx11 -" -windows -) -) -] -pub -dx11 -: -Option -< -HalInstance -< -hal -: -: -api -: -: -Dx11 -> -> -# -[ -cfg -( feature = " @@ -884,35 +853,6 @@ instance_desc [ cfg ( -all -( -feature -= -" -dx11 -" -windows -) -) -] -dx11 -: -init -( -hal -: -: -api -: -: -Dx11 -& -instance_desc -) -# -[ -cfg -( feature = " @@ -1237,44 +1177,6 @@ raw [ cfg ( -all -( -feature -= -" -dx11 -" -windows -) -) -] -Backend -: -: -Dx11 -= -> -destroy -( -hal -: -: -api -: -: -Dx11 -& -self -. -dx11 -surface -. -raw -) -# -[ -cfg -( feature = " @@ -3517,47 +3419,6 @@ window_handle [ cfg ( -all -( -feature -= -" -dx11 -" -windows -) -) -] -init -: -: -< -hal -: -: -api -: -: -Dx11 -> -( -& -mut -hal_surface -& -self -. -instance -. -dx11 -display_handle -window_handle -) -; -# -[ -cfg -( feature = " @@ -5149,44 +5010,6 @@ present [ cfg ( -all -( -feature -= -" -dx11 -" -windows -) -) -] -unconfigure -: -: -< -_ -hal -: -: -api -: -: -Dx11 -> -( -self -& -surface -. -raw -& -present -) -; -# -[ -cfg -( feature = " @@ -5668,45 +5491,6 @@ adapters [ cfg ( -all -( -feature -= -" -dx11 -" -windows -) -) -] -self -. -enumerate -( -hal -: -: -api -: -: -Dx11 -& -self -. -instance -. -dx11 -& -inputs -& -mut -adapters -) -; -# -[ -cfg -( feature = " @@ -6448,56 +6232,6 @@ device_types [ cfg ( -all -( -feature -= -" -dx11 -" -windows -) -) -] -let -( -id_dx11 -adapters_dx11 -) -= -gather -( -hal -: -: -api -: -: -Dx11 -self -. -instance -. -dx11 -. -as_ref -( -) -& -inputs -compatible_surface -desc -. -force_fallback_adapter -& -mut -device_types -) -; -# -[ -cfg -( feature = " @@ -7007,46 +6741,6 @@ id [ cfg ( -all -( -feature -= -" -dx11 -" -windows -) -) -] -if -let -Some -( -id -) -= -self -. -select -( -& -mut -selected -id_dx11 -adapters_dx11 -) -{ -return -Ok -( -id -) -; -} -# -[ -cfg -( feature = " @@ -7344,39 +7038,6 @@ hal_adapter [ cfg ( -all -( -feature -= -" -dx11 -" -windows -) -) -] -Backend -: -: -Dx11 -= -> -fid -. -assign -( -Adapter -: -: -new -( -hal_adapter -) -) -# -[ -cfg -( feature = " @@ -8767,19 +8428,6 @@ Backends : DX12 " -dx11 -" -| -" -d3d11 -" -= -> -Backends -: -: -DX11 -" metal " | diff --git a/third_party/rust/wgpu-core/src/lib.rs b/third_party/rust/wgpu-core/src/lib.rs index 0d18e631aa9bf..5485c53d64333 100644 --- a/third_party/rust/wgpu-core/src/lib.rs +++ b/third_party/rust/wgpu-core/src/lib.rs @@ -62,18 +62,6 @@ windows ) not ( -all -( -feature -= -" -dx11 -" -windows -) -) -not -( feature = " @@ -237,6 +225,7 @@ storage mod track ; +pub mod validation ; @@ -945,25 +934,6 @@ windows define_backend_caller ! { -gfx_if_dx11 -gfx_if_dx11_hidden -" -dx11 -" -if -all -( -feature -= -" -dx11 -" -windows -) -} -define_backend_caller -! -{ gfx_if_gles gfx_if_gles_hidden " @@ -1130,42 +1100,6 @@ wgt Backend : : -Dx11 -= -> -crate -: -: -gfx_if_dx11 -! -( -global -. -method -: -: -< -crate -: -: -api -: -: -Dx11 -> -( -( -param -) -* -) -) -wgt -: -: -Backend -: -: Gl = > diff --git a/third_party/rust/wgpu-core/src/pipeline.rs b/third_party/rust/wgpu-core/src/pipeline.rs index 1d9eba60a4c49..32c2d312871cf 100644 --- a/third_party/rust/wgpu-core/src/pipeline.rs +++ b/third_party/rust/wgpu-core/src/pipeline.rs @@ -356,13 +356,6 @@ ResourceInfo < ShaderModuleId > -# -[ -cfg -( -debug_assertions -) -] pub ( crate @@ -581,14 +574,6 @@ self > String { -# -[ -cfg -( -debug_assertions -) -] -return self . label @@ -596,25 +581,6 @@ label clone ( ) -; -# -[ -cfg -( -not -( -debug_assertions -) -) -] -return -String -: -: -new -( -) -; } } impl diff --git a/third_party/rust/wgpu-core/src/registry.rs b/third_party/rust/wgpu-core/src/registry.rs index 713e04dc7e2df..09838e9865a53 100644 --- a/third_party/rust/wgpu-core/src/registry.rs +++ b/third_party/rust/wgpu-core/src/registry.rs @@ -530,13 +530,6 @@ write ( ) ; -# -[ -cfg -( -debug_assertions -) -] debug_assert ! ( diff --git a/third_party/rust/wgpu-core/src/resource.rs b/third_party/rust/wgpu-core/src/resource.rs index a47e958876ac4..756dcf35df0ac 100644 --- a/third_party/rust/wgpu-core/src/resource.rs +++ b/third_party/rust/wgpu-core/src/resource.rs @@ -197,13 +197,6 @@ Id submission_index : AtomicUsize -# -[ -cfg -( -debug_assertions -) -] pub ( crate @@ -325,13 +318,6 @@ new ( 0 ) -# -[ -cfg -( -debug_assertions -) -] label : label @@ -341,13 +327,6 @@ to_string ) } } -# -[ -allow -( -unused_assignments -) -] pub ( crate @@ -366,27 +345,21 @@ Id : Debug { +if let -mut -label -= -String -: -: -new +Some ( +id ) -; -# -[ -cfg += +self +. +id +. +as_ref ( -debug_assertions ) -] { -label -= format ! ( @@ -395,51 +368,33 @@ format { } ] +{ +: +? +} " self . label -) -; -} -if -let -Some -( id ) -= -self -. -id -. -as_ref -( -) +} +else { -label -. -push_str -( format ! ( " +[ { -: -? } +] " -id -) +self . -as_str -( -) +label ) -; } -label } pub ( @@ -641,14 +596,6 @@ self > String { -# -[ -cfg -( -debug_assertions -) -] -return self . as_info @@ -660,25 +607,6 @@ label clone ( ) -; -# -[ -cfg -( -not -( -debug_assertions -) -) -] -return -String -: -: -new -( -) -; } fn ref_count diff --git a/third_party/rust/wgpu-hal/.cargo-checksum.json b/third_party/rust/wgpu-hal/.cargo-checksum.json index 1516276783241..da8cb07d0a93e 100644 --- a/third_party/rust/wgpu-hal/.cargo-checksum.json +++ b/third_party/rust/wgpu-hal/.cargo-checksum.json @@ -11,7 +11,7 @@ toml " : " -f472b730bbef76aa4770fd53b53535c1d0773145c8a40aac2deb6e7465ff70bc +e419deb948fdc43d0d9276096822ca6839b8e15b18561037369495879257cfd4 " " LICENSE @@ -51,7 +51,7 @@ rs " : " -c74696fd871200a46e3592ce5a662c42d9587c13b7def75c5cac4c34d9685ad5 +086554cc594cf7b8566bff515fb0cd7fb35d0f6c6e1433ccc96889a123a069b2 " " examples @@ -95,6 +95,40 @@ rs 81210e7603f5304fa1dc294f984eacf27e18df7d3f228063f6acb0d7985c37cd " " +examples +/ +ray +- +traced +- +triangle +/ +main +. +rs +" +: +" +7d31be49859dee1483ab42b9618af3b0093d5f08b3e6d5a2e7a750c1e132c826 +" +" +examples +/ +ray +- +traced +- +triangle +/ +shader +. +wgsl +" +: +" +cc10caf92746724a71f6dd0dbc3a71e57b37c7d1d83278556805a535c0728a9d +" +" src / auxil @@ -195,7 +229,7 @@ rs " : " -c38f0d3b10804d1c1d7e3b8e4a975fcb87271f8b1904f2f4a3153cceddafb56b +17505dc0a8247546bc1b97341c872f368a1f522e4ff51bb8844255e36b2b5186 " " src @@ -213,84 +247,6 @@ c2f849f70f576b0c9b0d32dd155b6a6353f74dff59cbeeaa994a12789d047c0f " src / -dx11 -/ -adapter -. -rs -" -: -" -173e99507610282a7858c142ffe2b9755dac0d61bcaed7ae69394002d476c4f6 -" -" -src -/ -dx11 -/ -command -. -rs -" -: -" -3a329369bbd9deeb2fbe3c274a5a5d5f0d2da9eeb64b76592e922446e52c5a51 -" -" -src -/ -dx11 -/ -device -. -rs -" -: -" -4ee1880b0d48ed054654e936c76b3e7b7e370fbf79c2f0af370f8de350fd94ff -" -" -src -/ -dx11 -/ -instance -. -rs -" -: -" -206b38346de245e315e762b8de81ca26c74d10aad26a488713945d0e1c802e2b -" -" -src -/ -dx11 -/ -library -. -rs -" -: -" -1b4c3575fd8fd30d07a61ce68ec3c930305c4df5aa5dcf54dd1fdd4edff590d4 -" -" -src -/ -dx11 -/ -mod -. -rs -" -: -" -1f2e7f04801b4e65aa27183bc0ddeee0dd3aa686bac4056649dbd97ddef142e1 -" -" -src -/ dx12 / adapter @@ -312,7 +268,7 @@ rs " : " -9c6b24f7a09c54b61ac36d0cbd74b2ff8e5c5474ee834f06f39cf18caf95b7d2 +1596ad0304eafbd7d69d2224329ce95dd7910c87faba8003b4e60dffb20d5596 " " src @@ -325,7 +281,7 @@ rs " : " -24d6ac9808f7534f3480ba2eb563f98f1441c8ad2b4c6e86b2700f5ac812e99a +94d35f117ae003b07049f3a0bc6c45a0ffda9fb8053233d39c173cfb1b644403 " " src @@ -351,7 +307,7 @@ rs " : " -6baf4b32df1f91a7d2060b00a14850530b857de1147c8cf1d85abd6f5e90e4c2 +811cfef5f08add77f14da1ca0e77791f867afa4a6b9e11424bcd15932c6b64fd " " src @@ -377,7 +333,7 @@ rs " : " -fe9e7ed1786c7142fa5bf04e9ad2ee729fdd92c926bb734afa75651206cf737d +d6b5e7b83997f33acc62b90a640621e3512302acf9519c01fa68c37447060bdd " " src @@ -440,7 +396,7 @@ rs " : " -de72a7dcbd2b562195a3a49a4065008cb4402381b8dbb83ef348398c3f9d920e +af290b508bc63590b40b94a8e3b163e32f1262f2e20995cab340cfd76386becd " " src @@ -453,7 +409,7 @@ rs " : " -32f658df60a226fb4f3ff242267f442945c9c9670d7a5692301c3f90cdd1f5cf +16bc0c9cc6987269841f7f12023ca12a14e0d746c4bab8d4770abb240a63ed84 " " src @@ -466,7 +422,7 @@ rs " : " -7d6a760c721e759c6c32998b5a42466fe35bcff5ecc109af42b2aaec85e444ea +a544456f3d3ed13bd695a604473af1758ee29b2386872f5663e5395088890177 " " src @@ -479,7 +435,7 @@ rs " : " -9cd65b70c1a2f92f22a83dda825e175f367cbb3d6201a31d90e84aaf63e63d9b +4c7ce6424cefc2b62b74f1f0f67c2d480f04412a16d27ca83b0471744d7fce96 " " src @@ -492,7 +448,7 @@ rs " : " -b19f2437e403e08511ff341efc63e55c78fcdeffa3785d02a892a743a26a3663 +ae7415a7ade56d499b28073492289907edbce13327392cc014812c35ed9effdc " " src @@ -531,7 +487,7 @@ rs " : " -e9a232ffb9331cd3873ea7afd4bd39e07503873d592bacd576efebd58e452323 +d02cefb55c78dd496f2eeceb55547b3032b50f31188d20994d90e4a049b2e6a0 " " src @@ -544,7 +500,7 @@ rs " : " -fe795add7b32ae4cd89e40db93e5bae62b6c7bc5741c71f21d292bd0a511de58 +53f7184c94f210dd4fb2a264c9a545eac3ccf4ef44e670ff7523a8e9a6c9dd1d " " src @@ -641,7 +597,7 @@ rs " : " -072e3f2a781b9cba47d17e7fe3954697d6328cb48ecd2dd0f0f2f500efefe51a +3d60e2c9bec5232a75d794f0436de8de53dbfbbb017eb2ce5c48c4c42435773e " " src @@ -667,7 +623,7 @@ rs " : " -702edebb7aff60acc67d6e183f2dad999f2528b0f00bccc25197fb01911a3b6e +661b38a75d4f4cd1b0d6957f1f09db0743ec3a13bbafba9baa931894ee193f48 " " src @@ -693,7 +649,7 @@ rs " : " -d2fb16e8d7cfc0c9e3141dcf1245a1f0ea8a891962c0cd83c0cd4450e7acaf36 +b37d718769134a71a522520ec299ba893435334f813e4386464b8aec241d96b2 " " src @@ -706,7 +662,7 @@ rs " : " -e248de570dddfad70a83ef1788d1a15b037b0e861937c8eff00dd0c09dfae82d +662518044d6464410facd58ff06a80a89e2c9c3cd3fdad69a956ed4546777d2a " " src @@ -745,7 +701,7 @@ rs " : " -5a8d9a2757c9ec86ba7f1ac7b79cf577830908c6fd9935ea1af7519457d85562 +690706eee5ddb5d9697e908c31980886446a63d64c944b9b2c7fb8d8fe55030e " " src @@ -758,7 +714,7 @@ rs " : " -5f0da371d3189ce42c141039a3a435717c12077f5d09226af61b5c51e4bde68c +7c6dd62b1d4a65f8c85b2fada925f9c50b46039ec862b5e700e05e0f546a3288 " " src @@ -771,7 +727,7 @@ rs " : " -ee41a6d5a17c9474296b8e850b5dcb10452c8077e3ff70a68351a374726115b6 +46e49c73ec3803996c4553174e7bd60ba621e333c70968f9e99a3f43b75a7c84 " " src @@ -784,7 +740,7 @@ rs " : " -c83be51f540e5a3294eb755ec8c787edc204aaea727d62b66887d7f88775a041 +2cbed6b4efdd6851e27cccb87f31f47cf22eb5f7bca05aaddefb5a57796d0db4 " " src @@ -810,7 +766,7 @@ rs " : " -7ed5c34156d70808e7845575d93a8c2a07bfa989d455c3848e93e8ae372b99ff +e69c99bc511567587734ffb16af3cbda8a29ec387c8183c930744cb489b3f492 " } " diff --git a/third_party/rust/wgpu-hal/Cargo.toml b/third_party/rust/wgpu-hal/Cargo.toml index 0f1083546e1de..119c6cd0d2d14 100644 --- a/third_party/rust/wgpu-hal/Cargo.toml +++ b/third_party/rust/wgpu-hal/Cargo.toml @@ -505,6 +505,15 @@ env_logger . 10 " +glam += +" +0 +. +24 +. +2 +" [ dev - @@ -575,53 +584,6 @@ default link " ] -dx11 -= -[ -" -naga -/ -hlsl -- -out -" -" -d3d12 -" -" -libloading -" -" -winapi -/ -d3d11 -" -" -winapi -/ -std -" -" -winapi -/ -d3d11_1 -" -" -winapi -/ -d3d11_2 -" -" -winapi -/ -d3d11sdklayers -" -" -winapi -/ -dxgi1_6 -" -] dx12 = [ diff --git a/third_party/rust/wgpu-hal/examples/halmark/main.rs b/third_party/rust/wgpu-hal/examples/halmark/main.rs index 19cab65e9761f..4d01a290c311a 100644 --- a/third_party/rust/wgpu-hal/examples/halmark/main.rs +++ b/third_party/rust/wgpu-hal/examples/halmark/main.rs @@ -2934,6 +2934,11 @@ textures [ texture_binding ] +acceleration_structures +: +& +[ +] entries : & @@ -3083,6 +3088,11 @@ textures & [ ] +acceleration_structures +: +& +[ +] entries : & diff --git a/third_party/rust/wgpu-hal/examples/ray-traced-triangle/main.rs b/third_party/rust/wgpu-hal/examples/ray-traced-triangle/main.rs new file mode 100644 index 0000000000000..9d42b93976a08 --- /dev/null +++ b/third_party/rust/wgpu-hal/examples/ray-traced-triangle/main.rs @@ -0,0 +1,6678 @@ +extern +crate +wgpu_hal +as +hal +; +use +hal +: +: +{ +Adapter +as +_ +CommandEncoder +as +_ +Device +as +_ +Instance +as +_ +Queue +as +_ +Surface +as +_ +} +; +use +raw_window_handle +: +: +{ +HasDisplayHandle +HasWindowHandle +} +; +use +glam +: +: +{ +Affine3A +Mat4 +Vec3 +} +; +use +std +: +: +{ +borrow +: +: +{ +Borrow +Cow +} +iter +mem +ptr +time +: +: +Instant +} +; +use +winit +: +: +window +: +: +WindowButtons +; +const +COMMAND_BUFFER_PER_CONTEXT +: +usize += +100 +; +const +DESIRED_FRAMES +: +u32 += +3 +; +# +[ +derive +( +Clone +) +] +# +[ +repr +( +C +) +] +struct +AccelerationStructureInstance +{ +transform +: +[ +f32 +; +12 +] +custom_index_and_mask +: +u32 +shader_binding_table_record_offset_and_flags +: +u32 +acceleration_structure_reference +: +u64 +} +impl +std +: +: +fmt +: +: +Debug +for +AccelerationStructureInstance +{ +fn +fmt +( +& +self +f +: +& +mut +std +: +: +fmt +: +: +Formatter +< +' +_ +> +) +- +> +std +: +: +fmt +: +: +Result +{ +f +. +debug_struct +( +" +Instance +" +) +. +field +( +" +transform +" +& +self +. +transform +) +. +field +( +" +custom_index +( +) +" +& +self +. +custom_index +( +) +) +. +field +( +" +mask +( +) +" +& +self +. +mask +( +) +) +. +field +( +" +shader_binding_table_record_offset +( +) +" +& +self +. +shader_binding_table_record_offset +( +) +) +. +field +( +" +flags +( +) +" +& +self +. +flags +( +) +) +. +field +( +" +acceleration_structure_reference +" +& +self +. +acceleration_structure_reference +) +. +finish +( +) +} +} +# +[ +allow +( +dead_code +) +] +impl +AccelerationStructureInstance +{ +const +LOW_24_MASK +: +u32 += +0x00ff_ffff +; +const +MAX_U24 +: +u32 += +( +1u32 +< +< +24u32 +) +- +1u32 +; +# +[ +inline +] +fn +affine_to_rows +( +mat +: +& +Affine3A +) +- +> +[ +f32 +; +12 +] +{ +let +row_0 += +mat +. +matrix3 +. +row +( +0 +) +; +let +row_1 += +mat +. +matrix3 +. +row +( +1 +) +; +let +row_2 += +mat +. +matrix3 +. +row +( +2 +) +; +let +translation += +mat +. +translation +; +[ +row_0 +. +x +row_0 +. +y +row_0 +. +z +translation +. +x +row_1 +. +x +row_1 +. +y +row_1 +. +z +translation +. +y +row_2 +. +x +row_2 +. +y +row_2 +. +z +translation +. +z +] +} +# +[ +inline +] +fn +rows_to_affine +( +rows +: +& +[ +f32 +; +12 +] +) +- +> +Affine3A +{ +Affine3A +: +: +from_cols_array +( +& +[ +rows +[ +0 +] +rows +[ +3 +] +rows +[ +6 +] +rows +[ +9 +] +rows +[ +1 +] +rows +[ +4 +] +rows +[ +7 +] +rows +[ +10 +] +rows +[ +2 +] +rows +[ +5 +] +rows +[ +8 +] +rows +[ +11 +] +] +) +} +pub +fn +transform_as_affine +( +& +self +) +- +> +Affine3A +{ +Self +: +: +rows_to_affine +( +& +self +. +transform +) +} +pub +fn +set_transform +( +& +mut +self +transform +: +& +Affine3A +) +{ +self +. +transform += +Self +: +: +affine_to_rows +( +transform +) +; +} +pub +fn +custom_index +( +& +self +) +- +> +u32 +{ +self +. +custom_index_and_mask +& +Self +: +: +LOW_24_MASK +} +pub +fn +mask +( +& +self +) +- +> +u8 +{ +( +self +. +custom_index_and_mask +> +> +24 +) +as +u8 +} +pub +fn +shader_binding_table_record_offset +( +& +self +) +- +> +u32 +{ +self +. +shader_binding_table_record_offset_and_flags +& +Self +: +: +LOW_24_MASK +} +pub +fn +flags +( +& +self +) +- +> +u8 +{ +( +self +. +shader_binding_table_record_offset_and_flags +> +> +24 +) +as +u8 +} +pub +fn +set_custom_index +( +& +mut +self +custom_index +: +u32 +) +{ +debug_assert +! +( +custom_index +< += +Self +: +: +MAX_U24 +" +custom_index +uses +more +than +24 +bits +! +{ +custom_index +} +> +{ +} +" +Self +: +: +MAX_U24 +) +; +self +. +custom_index_and_mask += +( +custom_index +& +Self +: +: +LOW_24_MASK +) +| +( +self +. +custom_index_and_mask +& +! +Self +: +: +LOW_24_MASK +) +} +pub +fn +set_mask +( +& +mut +self +mask +: +u8 +) +{ +self +. +custom_index_and_mask += +( +self +. +custom_index_and_mask +& +Self +: +: +LOW_24_MASK +) +| +( +u32 +: +: +from +( +mask +) +< +< +24 +) +} +pub +fn +set_shader_binding_table_record_offset +( +& +mut +self +shader_binding_table_record_offset +: +u32 +) +{ +debug_assert +! +( +shader_binding_table_record_offset +< += +Self +: +: +MAX_U24 +" +shader_binding_table_record_offset +uses +more +than +24 +bits +! +{ +shader_binding_table_record_offset +} +> +{ +} +" +Self +: +: +MAX_U24 +) +; +self +. +shader_binding_table_record_offset_and_flags += +( +shader_binding_table_record_offset +& +Self +: +: +LOW_24_MASK +) +| +( +self +. +shader_binding_table_record_offset_and_flags +& +! +Self +: +: +LOW_24_MASK +) +} +pub +fn +set_flags +( +& +mut +self +flags +: +u8 +) +{ +self +. +shader_binding_table_record_offset_and_flags += +( +self +. +shader_binding_table_record_offset_and_flags +& +Self +: +: +LOW_24_MASK +) +| +( +u32 +: +: +from +( +flags +) +< +< +24 +) +} +pub +fn +new +( +transform +: +& +Affine3A +custom_index +: +u32 +mask +: +u8 +shader_binding_table_record_offset +: +u32 +flags +: +u8 +acceleration_structure_reference +: +u64 +) +- +> +Self +{ +debug_assert +! +( +custom_index +< += +Self +: +: +MAX_U24 +" +custom_index +uses +more +than +24 +bits +! +{ +custom_index +} +> +{ +} +" +Self +: +: +MAX_U24 +) +; +debug_assert +! +( +shader_binding_table_record_offset +< += +Self +: +: +MAX_U24 +" +shader_binding_table_record_offset +uses +more +than +24 +bits +! +{ +shader_binding_table_record_offset +} +> +{ +} +" +Self +: +: +MAX_U24 +) +; +AccelerationStructureInstance +{ +transform +: +Self +: +: +affine_to_rows +( +transform +) +custom_index_and_mask +: +( +custom_index +& +Self +: +: +MAX_U24 +) +| +( +u32 +: +: +from +( +mask +) +< +< +24 +) +shader_binding_table_record_offset_and_flags +: +( +shader_binding_table_record_offset +& +Self +: +: +MAX_U24 +) +| +( +u32 +: +: +from +( +flags +) +< +< +24 +) +acceleration_structure_reference +} +} +} +struct +ExecutionContext +< +A +: +hal +: +: +Api +> +{ +encoder +: +A +: +: +CommandEncoder +fence +: +A +: +: +Fence +fence_value +: +hal +: +: +FenceValue +used_views +: +Vec +< +A +: +: +TextureView +> +used_cmd_bufs +: +Vec +< +A +: +: +CommandBuffer +> +frames_recorded +: +usize +} +impl +< +A +: +hal +: +: +Api +> +ExecutionContext +< +A +> +{ +unsafe +fn +wait_and_clear +( +& +mut +self +device +: +& +A +: +: +Device +) +{ +device +. +wait +( +& +self +. +fence +self +. +fence_value +! +0 +) +. +unwrap +( +) +; +self +. +encoder +. +reset_all +( +self +. +used_cmd_bufs +. +drain +( +. +. +) +) +; +for +view +in +self +. +used_views +. +drain +( +. +. +) +{ +device +. +destroy_texture_view +( +view +) +; +} +self +. +frames_recorded += +0 +; +} +} +# +[ +allow +( +dead_code +) +] +struct +Example +< +A +: +hal +: +: +Api +> +{ +instance +: +A +: +: +Instance +adapter +: +A +: +: +Adapter +surface +: +A +: +: +Surface +surface_format +: +wgt +: +: +TextureFormat +device +: +A +: +: +Device +queue +: +A +: +: +Queue +contexts +: +Vec +< +ExecutionContext +< +A +> +> +context_index +: +usize +extent +: +[ +u32 +; +2 +] +start +: +Instant +pipeline +: +A +: +: +ComputePipeline +bind_group +: +A +: +: +BindGroup +bgl +: +A +: +: +BindGroupLayout +shader_module +: +A +: +: +ShaderModule +texture_view +: +A +: +: +TextureView +uniform_buffer +: +A +: +: +Buffer +pipeline_layout +: +A +: +: +PipelineLayout +vertices_buffer +: +A +: +: +Buffer +indices_buffer +: +A +: +: +Buffer +texture +: +A +: +: +Texture +instances +: +[ +AccelerationStructureInstance +; +3 +] +instances_buffer +: +A +: +: +Buffer +blas +: +A +: +: +AccelerationStructure +tlas +: +A +: +: +AccelerationStructure +scratch_buffer +: +A +: +: +Buffer +time +: +f32 +} +impl +< +A +: +hal +: +: +Api +> +Example +< +A +> +{ +fn +init +( +window +: +& +winit +: +: +window +: +: +Window +) +- +> +Result +< +Self +Box +< +dyn +std +: +: +error +: +: +Error +> +> +{ +let +instance_desc += +hal +: +: +InstanceDescriptor +{ +name +: +" +example +" +flags +: +wgt +: +: +InstanceFlags +: +: +default +( +) +dx12_shader_compiler +: +wgt +: +: +Dx12Compiler +: +: +Dxc +{ +dxil_path +: +None +dxc_path +: +None +} +gles_minor_version +: +wgt +: +: +Gles3MinorVersion +: +: +default +( +) +} +; +let +instance += +unsafe +{ +A +: +: +Instance +: +: +init +( +& +instance_desc +) +? +} +; +let +surface += +{ +let +raw_window_handle += +window +. +window_handle +( +) +? +. +as_raw +( +) +; +let +raw_display_handle += +window +. +display_handle +( +) +? +. +as_raw +( +) +; +unsafe +{ +instance +. +create_surface +( +raw_display_handle +raw_window_handle +) +. +unwrap +( +) +} +} +; +let +( +adapter +features +) += +unsafe +{ +let +mut +adapters += +instance +. +enumerate_adapters +( +) +; +if +adapters +. +is_empty +( +) +{ +panic +! +( +" +No +adapters +found +" +) +; +} +let +exposed += +adapters +. +swap_remove +( +0 +) +; +dbg +! +( +exposed +. +features +) +; +( +exposed +. +adapter +exposed +. +features +) +} +; +let +surface_caps += +unsafe +{ +adapter +. +surface_capabilities +( +& +surface +) +} +. +expect +( +" +Surface +doesn +' +t +support +presentation +" +) +; +log +: +: +info +! +( +" +Surface +caps +: +{ +: +# +? +} +" +surface_caps +) +; +let +hal +: +: +OpenDevice +{ +device +queue +} += +unsafe +{ +adapter +. +open +( +features +& +wgt +: +: +Limits +: +: +default +( +) +) +. +unwrap +( +) +} +; +let +window_size +: +( +u32 +u32 +) += +window +. +inner_size +( +) +. +into +( +) +; +dbg +! +( +& +surface_caps +. +formats +) +; +let +surface_format += +if +surface_caps +. +formats +. +contains +( +& +wgt +: +: +TextureFormat +: +: +Rgba8Snorm +) +{ +wgt +: +: +TextureFormat +: +: +Rgba8Unorm +} +else +{ +* +surface_caps +. +formats +. +first +( +) +. +unwrap +( +) +} +; +let +surface_config += +hal +: +: +SurfaceConfiguration +{ +swap_chain_size +: +DESIRED_FRAMES +. +max +( +* +surface_caps +. +swap_chain_sizes +. +start +( +) +) +. +min +( +* +surface_caps +. +swap_chain_sizes +. +end +( +) +) +present_mode +: +wgt +: +: +PresentMode +: +: +Fifo +composite_alpha_mode +: +wgt +: +: +CompositeAlphaMode +: +: +Opaque +format +: +surface_format +extent +: +wgt +: +: +Extent3d +{ +width +: +window_size +. +0 +height +: +window_size +. +1 +depth_or_array_layers +: +1 +} +usage +: +hal +: +: +TextureUses +: +: +COLOR_TARGET +| +hal +: +: +TextureUses +: +: +COPY_DST +view_formats +: +vec +! +[ +surface_format +] +} +; +unsafe +{ +surface +. +configure +( +& +device +& +surface_config +) +. +unwrap +( +) +; +} +; +# +[ +allow +( +dead_code +) +] +struct +Uniforms +{ +view_inverse +: +glam +: +: +Mat4 +proj_inverse +: +glam +: +: +Mat4 +} +let +bgl_desc += +hal +: +: +BindGroupLayoutDescriptor +{ +label +: +None +flags +: +hal +: +: +BindGroupLayoutFlags +: +: +empty +( +) +entries +: +& +[ +wgt +: +: +BindGroupLayoutEntry +{ +binding +: +0 +visibility +: +wgt +: +: +ShaderStages +: +: +COMPUTE +ty +: +wgt +: +: +BindingType +: +: +Buffer +{ +ty +: +wgt +: +: +BufferBindingType +: +: +Uniform +has_dynamic_offset +: +false +min_binding_size +: +wgt +: +: +BufferSize +: +: +new +( +mem +: +: +size_of +: +: +< +Uniforms +> +( +) +as +_ +) +} +count +: +None +} +wgt +: +: +BindGroupLayoutEntry +{ +binding +: +1 +visibility +: +wgt +: +: +ShaderStages +: +: +COMPUTE +ty +: +wgt +: +: +BindingType +: +: +StorageTexture +{ +access +: +wgt +: +: +StorageTextureAccess +: +: +WriteOnly +format +: +wgt +: +: +TextureFormat +: +: +Rgba8Unorm +view_dimension +: +wgt +: +: +TextureViewDimension +: +: +D2 +} +count +: +None +} +wgt +: +: +BindGroupLayoutEntry +{ +binding +: +2 +visibility +: +wgt +: +: +ShaderStages +: +: +COMPUTE +ty +: +wgt +: +: +BindingType +: +: +AccelerationStructure +count +: +None +} +] +} +; +let +bgl += +unsafe +{ +device +. +create_bind_group_layout +( +& +bgl_desc +) +. +unwrap +( +) +} +; +let +naga_shader += +{ +let +shader_file += +std +: +: +path +: +: +PathBuf +: +: +from +( +env +! +( +" +CARGO_MANIFEST_DIR +" +) +) +. +join +( +" +examples +" +) +. +join +( +" +ray +- +traced +- +triangle +" +) +. +join +( +" +shader +. +wgsl +" +) +; +let +source += +std +: +: +fs +: +: +read_to_string +( +shader_file +) +. +unwrap +( +) +; +let +module += +naga +: +: +front +: +: +wgsl +: +: +Frontend +: +: +new +( +) +. +parse +( +& +source +) +. +unwrap +( +) +; +let +info += +naga +: +: +valid +: +: +Validator +: +: +new +( +naga +: +: +valid +: +: +ValidationFlags +: +: +all +( +) +naga +: +: +valid +: +: +Capabilities +: +: +RAY_QUERY +) +. +validate +( +& +module +) +. +unwrap +( +) +; +hal +: +: +NagaShader +{ +module +: +Cow +: +: +Owned +( +module +) +info +debug_source +: +None +} +} +; +let +shader_desc += +hal +: +: +ShaderModuleDescriptor +{ +label +: +None +runtime_checks +: +false +} +; +let +shader_module += +unsafe +{ +device +. +create_shader_module +( +& +shader_desc +hal +: +: +ShaderInput +: +: +Naga +( +naga_shader +) +) +. +unwrap +( +) +} +; +let +pipeline_layout_desc += +hal +: +: +PipelineLayoutDescriptor +{ +label +: +None +flags +: +hal +: +: +PipelineLayoutFlags +: +: +empty +( +) +bind_group_layouts +: +& +[ +& +bgl +] +push_constant_ranges +: +& +[ +] +} +; +let +pipeline_layout += +unsafe +{ +device +. +create_pipeline_layout +( +& +pipeline_layout_desc +) +. +unwrap +( +) +} +; +let +pipeline += +unsafe +{ +device +. +create_compute_pipeline +( +& +hal +: +: +ComputePipelineDescriptor +{ +label +: +Some +( +" +pipeline +" +) +layout +: +& +pipeline_layout +stage +: +hal +: +: +ProgrammableStage +{ +module +: +& +shader_module +entry_point +: +" +main +" +} +} +) +} +. +unwrap +( +) +; +let +vertices +: +[ +f32 +; +9 +] += +[ +1 +. +0 +1 +. +0 +0 +. +0 +- +1 +. +0 +1 +. +0 +0 +. +0 +0 +. +0 +- +1 +. +0 +0 +. +0 +] +; +let +vertices_size_in_bytes += +vertices +. +len +( +) +* +4 +; +let +indices +: +[ +u32 +; +3 +] += +[ +0 +1 +2 +] +; +let +indices_size_in_bytes += +indices +. +len +( +) +* +4 +; +let +vertices_buffer += +unsafe +{ +let +vertices_buffer += +device +. +create_buffer +( +& +hal +: +: +BufferDescriptor +{ +label +: +Some +( +" +vertices +buffer +" +) +size +: +vertices_size_in_bytes +as +u64 +usage +: +hal +: +: +BufferUses +: +: +MAP_WRITE +| +hal +: +: +BufferUses +: +: +BOTTOM_LEVEL_ACCELERATION_STRUCTURE_INPUT +memory_flags +: +hal +: +: +MemoryFlags +: +: +TRANSIENT +| +hal +: +: +MemoryFlags +: +: +PREFER_COHERENT +} +) +. +unwrap +( +) +; +let +mapping += +device +. +map_buffer +( +& +vertices_buffer +0 +. +. +vertices_size_in_bytes +as +u64 +) +. +unwrap +( +) +; +ptr +: +: +copy_nonoverlapping +( +vertices +. +as_ptr +( +) +as +* +const +u8 +mapping +. +ptr +. +as_ptr +( +) +vertices_size_in_bytes +) +; +device +. +unmap_buffer +( +& +vertices_buffer +) +. +unwrap +( +) +; +assert +! +( +mapping +. +is_coherent +) +; +vertices_buffer +} +; +let +indices_buffer += +unsafe +{ +let +indices_buffer += +device +. +create_buffer +( +& +hal +: +: +BufferDescriptor +{ +label +: +Some +( +" +indices +buffer +" +) +size +: +indices_size_in_bytes +as +u64 +usage +: +hal +: +: +BufferUses +: +: +MAP_WRITE +| +hal +: +: +BufferUses +: +: +BOTTOM_LEVEL_ACCELERATION_STRUCTURE_INPUT +memory_flags +: +hal +: +: +MemoryFlags +: +: +TRANSIENT +| +hal +: +: +MemoryFlags +: +: +PREFER_COHERENT +} +) +. +unwrap +( +) +; +let +mapping += +device +. +map_buffer +( +& +indices_buffer +0 +. +. +indices_size_in_bytes +as +u64 +) +. +unwrap +( +) +; +ptr +: +: +copy_nonoverlapping +( +indices +. +as_ptr +( +) +as +* +const +u8 +mapping +. +ptr +. +as_ptr +( +) +indices_size_in_bytes +) +; +device +. +unmap_buffer +( +& +indices_buffer +) +. +unwrap +( +) +; +assert +! +( +mapping +. +is_coherent +) +; +indices_buffer +} +; +let +blas_triangles += +vec +! +[ +hal +: +: +AccelerationStructureTriangles +{ +vertex_buffer +: +Some +( +& +vertices_buffer +) +first_vertex +: +0 +vertex_format +: +wgt +: +: +VertexFormat +: +: +Float32x3 +vertex_count +: +vertices +. +len +( +) +as +u32 +vertex_stride +: +3 +* +4 +indices +: +Some +( +hal +: +: +AccelerationStructureTriangleIndices +{ +buffer +: +Some +( +& +indices_buffer +) +format +: +wgt +: +: +IndexFormat +: +: +Uint32 +offset +: +0 +count +: +indices +. +len +( +) +as +u32 +} +) +transform +: +None +flags +: +hal +: +: +AccelerationStructureGeometryFlags +: +: +OPAQUE +} +] +; +let +blas_entries += +hal +: +: +AccelerationStructureEntries +: +: +Triangles +( +blas_triangles +) +; +let +mut +tlas_entries += +hal +: +: +AccelerationStructureEntries +: +: +Instances +( +hal +: +: +AccelerationStructureInstances +{ +buffer +: +None +count +: +3 +offset +: +0 +} +) +; +let +blas_sizes += +unsafe +{ +device +. +get_acceleration_structure_build_sizes +( +& +hal +: +: +GetAccelerationStructureBuildSizesDescriptor +{ +entries +: +& +blas_entries +flags +: +hal +: +: +AccelerationStructureBuildFlags +: +: +PREFER_FAST_TRACE +} +) +} +; +let +tlas_flags += +hal +: +: +AccelerationStructureBuildFlags +: +: +PREFER_FAST_TRACE +| +hal +: +: +AccelerationStructureBuildFlags +: +: +ALLOW_UPDATE +; +let +tlas_sizes += +unsafe +{ +device +. +get_acceleration_structure_build_sizes +( +& +hal +: +: +GetAccelerationStructureBuildSizesDescriptor +{ +entries +: +& +tlas_entries +flags +: +tlas_flags +} +) +} +; +let +blas += +unsafe +{ +device +. +create_acceleration_structure +( +& +hal +: +: +AccelerationStructureDescriptor +{ +label +: +Some +( +" +blas +" +) +size +: +blas_sizes +. +acceleration_structure_size +format +: +hal +: +: +AccelerationStructureFormat +: +: +BottomLevel +} +) +} +. +unwrap +( +) +; +let +tlas += +unsafe +{ +device +. +create_acceleration_structure +( +& +hal +: +: +AccelerationStructureDescriptor +{ +label +: +Some +( +" +tlas +" +) +size +: +tlas_sizes +. +acceleration_structure_size +format +: +hal +: +: +AccelerationStructureFormat +: +: +TopLevel +} +) +} +. +unwrap +( +) +; +let +uniforms += +{ +let +view += +Mat4 +: +: +look_at_rh +( +Vec3 +: +: +new +( +0 +. +0 +0 +. +0 +2 +. +5 +) +Vec3 +: +: +ZERO +Vec3 +: +: +Y +) +; +let +proj += +Mat4 +: +: +perspective_rh +( +59 +. +0_f32 +. +to_radians +( +) +1 +. +0 +0 +. +001 +1000 +. +0 +) +; +Uniforms +{ +view_inverse +: +view +. +inverse +( +) +proj_inverse +: +proj +. +inverse +( +) +} +} +; +let +uniforms_size += +std +: +: +mem +: +: +size_of +: +: +< +Uniforms +> +( +) +; +let +uniform_buffer += +unsafe +{ +let +uniform_buffer += +device +. +create_buffer +( +& +hal +: +: +BufferDescriptor +{ +label +: +Some +( +" +uniform +buffer +" +) +size +: +uniforms_size +as +u64 +usage +: +hal +: +: +BufferUses +: +: +MAP_WRITE +| +hal +: +: +BufferUses +: +: +UNIFORM +memory_flags +: +hal +: +: +MemoryFlags +: +: +PREFER_COHERENT +} +) +. +unwrap +( +) +; +let +mapping += +device +. +map_buffer +( +& +uniform_buffer +0 +. +. +uniforms_size +as +u64 +) +. +unwrap +( +) +; +ptr +: +: +copy_nonoverlapping +( +& +uniforms +as +* +const +Uniforms +as +* +const +u8 +mapping +. +ptr +. +as_ptr +( +) +uniforms_size +) +; +device +. +unmap_buffer +( +& +uniform_buffer +) +. +unwrap +( +) +; +assert +! +( +mapping +. +is_coherent +) +; +uniform_buffer +} +; +let +texture_desc += +hal +: +: +TextureDescriptor +{ +label +: +None +size +: +wgt +: +: +Extent3d +{ +width +: +512 +height +: +512 +depth_or_array_layers +: +1 +} +mip_level_count +: +1 +sample_count +: +1 +dimension +: +wgt +: +: +TextureDimension +: +: +D2 +format +: +wgt +: +: +TextureFormat +: +: +Rgba8Unorm +usage +: +hal +: +: +TextureUses +: +: +STORAGE_READ_WRITE +| +hal +: +: +TextureUses +: +: +COPY_SRC +memory_flags +: +hal +: +: +MemoryFlags +: +: +empty +( +) +view_formats +: +vec +! +[ +wgt +: +: +TextureFormat +: +: +Rgba8Unorm +] +} +; +let +texture += +unsafe +{ +device +. +create_texture +( +& +texture_desc +) +. +unwrap +( +) +} +; +let +view_desc += +hal +: +: +TextureViewDescriptor +{ +label +: +None +format +: +texture_desc +. +format +dimension +: +wgt +: +: +TextureViewDimension +: +: +D2 +usage +: +hal +: +: +TextureUses +: +: +STORAGE_READ_WRITE +| +hal +: +: +TextureUses +: +: +COPY_SRC +range +: +wgt +: +: +ImageSubresourceRange +: +: +default +( +) +plane +: +None +} +; +let +texture_view += +unsafe +{ +device +. +create_texture_view +( +& +texture +& +view_desc +) +. +unwrap +( +) +} +; +let +bind_group += +{ +let +buffer_binding += +hal +: +: +BufferBinding +{ +buffer +: +& +uniform_buffer +offset +: +0 +size +: +None +} +; +let +texture_binding += +hal +: +: +TextureBinding +{ +view +: +& +texture_view +usage +: +hal +: +: +TextureUses +: +: +STORAGE_READ_WRITE +} +; +let +group_desc += +hal +: +: +BindGroupDescriptor +{ +label +: +Some +( +" +bind +group +" +) +layout +: +& +bgl +buffers +: +& +[ +buffer_binding +] +samplers +: +& +[ +] +textures +: +& +[ +texture_binding +] +acceleration_structures +: +& +[ +& +tlas +] +entries +: +& +[ +hal +: +: +BindGroupEntry +{ +binding +: +0 +resource_index +: +0 +count +: +1 +} +hal +: +: +BindGroupEntry +{ +binding +: +1 +resource_index +: +0 +count +: +1 +} +hal +: +: +BindGroupEntry +{ +binding +: +2 +resource_index +: +0 +count +: +1 +} +] +} +; +unsafe +{ +device +. +create_bind_group +( +& +group_desc +) +. +unwrap +( +) +} +} +; +let +scratch_buffer += +unsafe +{ +device +. +create_buffer +( +& +hal +: +: +BufferDescriptor +{ +label +: +Some +( +" +scratch +buffer +" +) +size +: +blas_sizes +. +build_scratch_size +. +max +( +tlas_sizes +. +build_scratch_size +) +usage +: +hal +: +: +BufferUses +: +: +ACCELERATION_STRUCTURE_SCRATCH +memory_flags +: +hal +: +: +MemoryFlags +: +: +empty +( +) +} +) +. +unwrap +( +) +} +; +let +instances += +[ +AccelerationStructureInstance +: +: +new +( +& +Affine3A +: +: +from_translation +( +Vec3 +{ +x +: +0 +. +0 +y +: +0 +. +0 +z +: +0 +. +0 +} +) +0 +0xff +0 +0 +unsafe +{ +device +. +get_acceleration_structure_device_address +( +& +blas +) +} +) +AccelerationStructureInstance +: +: +new +( +& +Affine3A +: +: +from_translation +( +Vec3 +{ +x +: +- +1 +. +0 +y +: +- +1 +. +0 +z +: +- +2 +. +0 +} +) +0 +0xff +0 +0 +unsafe +{ +device +. +get_acceleration_structure_device_address +( +& +blas +) +} +) +AccelerationStructureInstance +: +: +new +( +& +Affine3A +: +: +from_translation +( +Vec3 +{ +x +: +1 +. +0 +y +: +- +1 +. +0 +z +: +- +2 +. +0 +} +) +0 +0xff +0 +0 +unsafe +{ +device +. +get_acceleration_structure_device_address +( +& +blas +) +} +) +] +; +let +instances_buffer_size += +instances +. +len +( +) +* +std +: +: +mem +: +: +size_of +: +: +< +AccelerationStructureInstance +> +( +) +; +let +instances_buffer += +unsafe +{ +let +instances_buffer += +device +. +create_buffer +( +& +hal +: +: +BufferDescriptor +{ +label +: +Some +( +" +instances_buffer +" +) +size +: +instances_buffer_size +as +u64 +usage +: +hal +: +: +BufferUses +: +: +MAP_WRITE +| +hal +: +: +BufferUses +: +: +TOP_LEVEL_ACCELERATION_STRUCTURE_INPUT +memory_flags +: +hal +: +: +MemoryFlags +: +: +TRANSIENT +| +hal +: +: +MemoryFlags +: +: +PREFER_COHERENT +} +) +. +unwrap +( +) +; +let +mapping += +device +. +map_buffer +( +& +instances_buffer +0 +. +. +instances_buffer_size +as +u64 +) +. +unwrap +( +) +; +ptr +: +: +copy_nonoverlapping +( +instances +. +as_ptr +( +) +as +* +const +u8 +mapping +. +ptr +. +as_ptr +( +) +instances_buffer_size +) +; +device +. +unmap_buffer +( +& +instances_buffer +) +. +unwrap +( +) +; +assert +! +( +mapping +. +is_coherent +) +; +instances_buffer +} +; +if +let +hal +: +: +AccelerationStructureEntries +: +: +Instances +( +ref +mut +i +) += +tlas_entries +{ +i +. +buffer += +Some +( +& +instances_buffer +) +; +assert +! +( +instances +. +len +( +) +< += +i +. +count +as +usize +" +Tlas +allocation +to +small +" +) +; +} +let +cmd_encoder_desc += +hal +: +: +CommandEncoderDescriptor +{ +label +: +None +queue +: +& +queue +} +; +let +mut +cmd_encoder += +unsafe +{ +device +. +create_command_encoder +( +& +cmd_encoder_desc +) +. +unwrap +( +) +} +; +unsafe +{ +cmd_encoder +. +begin_encoding +( +Some +( +" +init +" +) +) +. +unwrap +( +) +} +; +unsafe +{ +cmd_encoder +. +place_acceleration_structure_barrier +( +hal +: +: +AccelerationStructureBarrier +{ +usage +: +hal +: +: +AccelerationStructureUses +: +: +empty +( +) +. +. +hal +: +: +AccelerationStructureUses +: +: +BUILD_OUTPUT +} +) +; +cmd_encoder +. +build_acceleration_structures +( +1 +[ +hal +: +: +BuildAccelerationStructureDescriptor +{ +mode +: +hal +: +: +AccelerationStructureBuildMode +: +: +Build +flags +: +hal +: +: +AccelerationStructureBuildFlags +: +: +PREFER_FAST_TRACE +destination_acceleration_structure +: +& +blas +scratch_buffer +: +& +scratch_buffer +entries +: +& +blas_entries +source_acceleration_structure +: +None +scratch_buffer_offset +: +0 +} +] +) +; +let +scratch_buffer_barrier += +hal +: +: +BufferBarrier +{ +buffer +: +& +scratch_buffer +usage +: +hal +: +: +BufferUses +: +: +BOTTOM_LEVEL_ACCELERATION_STRUCTURE_INPUT +. +. +hal +: +: +BufferUses +: +: +TOP_LEVEL_ACCELERATION_STRUCTURE_INPUT +} +; +cmd_encoder +. +transition_buffers +( +iter +: +: +once +( +scratch_buffer_barrier +) +) +; +cmd_encoder +. +place_acceleration_structure_barrier +( +hal +: +: +AccelerationStructureBarrier +{ +usage +: +hal +: +: +AccelerationStructureUses +: +: +BUILD_OUTPUT +. +. +hal +: +: +AccelerationStructureUses +: +: +BUILD_INPUT +} +) +; +cmd_encoder +. +build_acceleration_structures +( +1 +[ +hal +: +: +BuildAccelerationStructureDescriptor +{ +mode +: +hal +: +: +AccelerationStructureBuildMode +: +: +Build +flags +: +tlas_flags +destination_acceleration_structure +: +& +tlas +scratch_buffer +: +& +scratch_buffer +entries +: +& +tlas_entries +source_acceleration_structure +: +None +scratch_buffer_offset +: +0 +} +] +) +; +cmd_encoder +. +place_acceleration_structure_barrier +( +hal +: +: +AccelerationStructureBarrier +{ +usage +: +hal +: +: +AccelerationStructureUses +: +: +BUILD_OUTPUT +. +. +hal +: +: +AccelerationStructureUses +: +: +SHADER_INPUT +} +) +; +let +texture_barrier += +hal +: +: +TextureBarrier +{ +texture +: +& +texture +range +: +wgt +: +: +ImageSubresourceRange +: +: +default +( +) +usage +: +hal +: +: +TextureUses +: +: +UNINITIALIZED +. +. +hal +: +: +TextureUses +: +: +STORAGE_READ_WRITE +} +; +cmd_encoder +. +transition_textures +( +iter +: +: +once +( +texture_barrier +) +) +; +} +let +init_fence_value += +1 +; +let +fence += +unsafe +{ +let +mut +fence += +device +. +create_fence +( +) +. +unwrap +( +) +; +let +init_cmd += +cmd_encoder +. +end_encoding +( +) +. +unwrap +( +) +; +queue +. +submit +( +& +[ +& +init_cmd +] +Some +( +( +& +mut +fence +init_fence_value +) +) +) +. +unwrap +( +) +; +device +. +wait +( +& +fence +init_fence_value +! +0 +) +. +unwrap +( +) +; +cmd_encoder +. +reset_all +( +iter +: +: +once +( +init_cmd +) +) +; +fence +} +; +Ok +( +Self +{ +instance +adapter +surface +surface_format +: +surface_config +. +format +device +queue +pipeline +contexts +: +vec +! +[ +ExecutionContext +{ +encoder +: +cmd_encoder +fence +fence_value +: +init_fence_value ++ +1 +used_views +: +Vec +: +: +new +( +) +used_cmd_bufs +: +Vec +: +: +new +( +) +frames_recorded +: +0 +} +] +context_index +: +0 +extent +: +[ +window_size +. +0 +window_size +. +1 +] +start +: +Instant +: +: +now +( +) +pipeline_layout +bind_group +texture +instances +instances_buffer +blas +tlas +scratch_buffer +time +: +0 +. +0 +indices_buffer +vertices_buffer +uniform_buffer +texture_view +bgl +shader_module +} +) +} +fn +update +( +& +mut +self +_event +: +winit +: +: +event +: +: +WindowEvent +) +{ +} +fn +render +( +& +mut +self +) +{ +let +ctx += +& +mut +self +. +contexts +[ +self +. +context_index +] +; +let +surface_tex += +unsafe +{ +self +. +surface +. +acquire_texture +( +None +) +. +unwrap +( +) +. +unwrap +( +) +. +texture +} +; +let +target_barrier0 += +hal +: +: +TextureBarrier +{ +texture +: +surface_tex +. +borrow +( +) +range +: +wgt +: +: +ImageSubresourceRange +: +: +default +( +) +usage +: +hal +: +: +TextureUses +: +: +UNINITIALIZED +. +. +hal +: +: +TextureUses +: +: +COPY_DST +} +; +let +instances_buffer_size += +self +. +instances +. +len +( +) +* +std +: +: +mem +: +: +size_of +: +: +< +AccelerationStructureInstance +> +( +) +; +let +tlas_flags += +hal +: +: +AccelerationStructureBuildFlags +: +: +PREFER_FAST_TRACE +| +hal +: +: +AccelerationStructureBuildFlags +: +: +ALLOW_UPDATE +; +self +. +time ++ += +1 +. +0 +/ +60 +. +0 +; +self +. +instances +[ +0 +] +. +set_transform +( +& +Affine3A +: +: +from_rotation_y +( +self +. +time +) +) +; +unsafe +{ +let +mapping += +self +. +device +. +map_buffer +( +& +self +. +instances_buffer +0 +. +. +instances_buffer_size +as +u64 +) +. +unwrap +( +) +; +ptr +: +: +copy_nonoverlapping +( +self +. +instances +. +as_ptr +( +) +as +* +const +u8 +mapping +. +ptr +. +as_ptr +( +) +instances_buffer_size +) +; +self +. +device +. +unmap_buffer +( +& +self +. +instances_buffer +) +. +unwrap +( +) +; +assert +! +( +mapping +. +is_coherent +) +; +} +unsafe +{ +ctx +. +encoder +. +begin_encoding +( +Some +( +" +frame +" +) +) +. +unwrap +( +) +; +let +instances += +hal +: +: +AccelerationStructureInstances +{ +buffer +: +Some +( +& +self +. +instances_buffer +) +count +: +self +. +instances +. +len +( +) +as +u32 +offset +: +0 +} +; +ctx +. +encoder +. +place_acceleration_structure_barrier +( +hal +: +: +AccelerationStructureBarrier +{ +usage +: +hal +: +: +AccelerationStructureUses +: +: +SHADER_INPUT +. +. +hal +: +: +AccelerationStructureUses +: +: +BUILD_INPUT +} +) +; +ctx +. +encoder +. +build_acceleration_structures +( +1 +[ +hal +: +: +BuildAccelerationStructureDescriptor +{ +mode +: +hal +: +: +AccelerationStructureBuildMode +: +: +Update +flags +: +tlas_flags +destination_acceleration_structure +: +& +self +. +tlas +scratch_buffer +: +& +self +. +scratch_buffer +entries +: +& +hal +: +: +AccelerationStructureEntries +: +: +Instances +( +instances +) +source_acceleration_structure +: +Some +( +& +self +. +tlas +) +scratch_buffer_offset +: +0 +} +] +) +; +ctx +. +encoder +. +place_acceleration_structure_barrier +( +hal +: +: +AccelerationStructureBarrier +{ +usage +: +hal +: +: +AccelerationStructureUses +: +: +BUILD_OUTPUT +. +. +hal +: +: +AccelerationStructureUses +: +: +SHADER_INPUT +} +) +; +let +scratch_buffer_barrier += +hal +: +: +BufferBarrier +{ +buffer +: +& +self +. +scratch_buffer +usage +: +hal +: +: +BufferUses +: +: +BOTTOM_LEVEL_ACCELERATION_STRUCTURE_INPUT +. +. +hal +: +: +BufferUses +: +: +TOP_LEVEL_ACCELERATION_STRUCTURE_INPUT +} +; +ctx +. +encoder +. +transition_buffers +( +iter +: +: +once +( +scratch_buffer_barrier +) +) +; +ctx +. +encoder +. +transition_textures +( +iter +: +: +once +( +target_barrier0 +) +) +; +} +let +surface_view_desc += +hal +: +: +TextureViewDescriptor +{ +label +: +None +format +: +self +. +surface_format +dimension +: +wgt +: +: +TextureViewDimension +: +: +D2 +usage +: +hal +: +: +TextureUses +: +: +COPY_DST +range +: +wgt +: +: +ImageSubresourceRange +: +: +default +( +) +plane +: +None +} +; +let +surface_tex_view += +unsafe +{ +self +. +device +. +create_texture_view +( +surface_tex +. +borrow +( +) +& +surface_view_desc +) +. +unwrap +( +) +} +; +unsafe +{ +ctx +. +encoder +. +begin_compute_pass +( +& +hal +: +: +ComputePassDescriptor +{ +label +: +None +timestamp_writes +: +None +} +) +; +ctx +. +encoder +. +set_compute_pipeline +( +& +self +. +pipeline +) +; +ctx +. +encoder +. +set_bind_group +( +& +self +. +pipeline_layout +0 +& +self +. +bind_group +& +[ +] +) +; +ctx +. +encoder +. +dispatch +( +[ +512 +/ +8 +512 +/ +8 +1 +] +) +; +} +ctx +. +frames_recorded ++ += +1 +; +let +do_fence += +ctx +. +frames_recorded +> +COMMAND_BUFFER_PER_CONTEXT +; +let +target_barrier1 += +hal +: +: +TextureBarrier +{ +texture +: +surface_tex +. +borrow +( +) +range +: +wgt +: +: +ImageSubresourceRange +: +: +default +( +) +usage +: +hal +: +: +TextureUses +: +: +COPY_DST +. +. +hal +: +: +TextureUses +: +: +PRESENT +} +; +let +target_barrier2 += +hal +: +: +TextureBarrier +{ +texture +: +& +self +. +texture +range +: +wgt +: +: +ImageSubresourceRange +: +: +default +( +) +usage +: +hal +: +: +TextureUses +: +: +STORAGE_READ_WRITE +. +. +hal +: +: +TextureUses +: +: +COPY_SRC +} +; +let +target_barrier3 += +hal +: +: +TextureBarrier +{ +texture +: +& +self +. +texture +range +: +wgt +: +: +ImageSubresourceRange +: +: +default +( +) +usage +: +hal +: +: +TextureUses +: +: +COPY_SRC +. +. +hal +: +: +TextureUses +: +: +STORAGE_READ_WRITE +} +; +unsafe +{ +ctx +. +encoder +. +end_compute_pass +( +) +; +ctx +. +encoder +. +transition_textures +( +iter +: +: +once +( +target_barrier2 +) +) +; +ctx +. +encoder +. +copy_texture_to_texture +( +& +self +. +texture +hal +: +: +TextureUses +: +: +COPY_SRC +surface_tex +. +borrow +( +) +std +: +: +iter +: +: +once +( +hal +: +: +TextureCopy +{ +src_base +: +hal +: +: +TextureCopyBase +{ +mip_level +: +0 +array_layer +: +0 +origin +: +wgt +: +: +Origin3d +: +: +ZERO +aspect +: +hal +: +: +FormatAspects +: +: +COLOR +} +dst_base +: +hal +: +: +TextureCopyBase +{ +mip_level +: +0 +array_layer +: +0 +origin +: +wgt +: +: +Origin3d +: +: +ZERO +aspect +: +hal +: +: +FormatAspects +: +: +COLOR +} +size +: +hal +: +: +CopyExtent +{ +width +: +512 +height +: +512 +depth +: +1 +} +} +) +) +; +ctx +. +encoder +. +transition_textures +( +iter +: +: +once +( +target_barrier1 +) +) +; +ctx +. +encoder +. +transition_textures +( +iter +: +: +once +( +target_barrier3 +) +) +; +} +unsafe +{ +let +cmd_buf += +ctx +. +encoder +. +end_encoding +( +) +. +unwrap +( +) +; +let +fence_param += +if +do_fence +{ +Some +( +( +& +mut +ctx +. +fence +ctx +. +fence_value +) +) +} +else +{ +None +} +; +self +. +queue +. +submit +( +& +[ +& +cmd_buf +] +fence_param +) +. +unwrap +( +) +; +self +. +queue +. +present +( +& +self +. +surface +surface_tex +) +. +unwrap +( +) +; +ctx +. +used_cmd_bufs +. +push +( +cmd_buf +) +; +ctx +. +used_views +. +push +( +surface_tex_view +) +; +} +; +if +do_fence +{ +log +: +: +info +! +( +" +Context +switch +from +{ +} +" +self +. +context_index +) +; +let +old_fence_value += +ctx +. +fence_value +; +if +self +. +contexts +. +len +( +) += += +1 +{ +let +hal_desc += +hal +: +: +CommandEncoderDescriptor +{ +label +: +None +queue +: +& +self +. +queue +} +; +self +. +contexts +. +push +( +unsafe +{ +ExecutionContext +{ +encoder +: +self +. +device +. +create_command_encoder +( +& +hal_desc +) +. +unwrap +( +) +fence +: +self +. +device +. +create_fence +( +) +. +unwrap +( +) +fence_value +: +0 +used_views +: +Vec +: +: +new +( +) +used_cmd_bufs +: +Vec +: +: +new +( +) +frames_recorded +: +0 +} +} +) +; +} +self +. +context_index += +( +self +. +context_index ++ +1 +) +% +self +. +contexts +. +len +( +) +; +let +next += +& +mut +self +. +contexts +[ +self +. +context_index +] +; +unsafe +{ +next +. +wait_and_clear +( +& +self +. +device +) +; +} +next +. +fence_value += +old_fence_value ++ +1 +; +} +} +fn +exit +( +mut +self +) +{ +unsafe +{ +{ +let +ctx += +& +mut +self +. +contexts +[ +self +. +context_index +] +; +self +. +queue +. +submit +( +& +[ +] +Some +( +( +& +mut +ctx +. +fence +ctx +. +fence_value +) +) +) +. +unwrap +( +) +; +} +for +mut +ctx +in +self +. +contexts +{ +ctx +. +wait_and_clear +( +& +self +. +device +) +; +self +. +device +. +destroy_command_encoder +( +ctx +. +encoder +) +; +self +. +device +. +destroy_fence +( +ctx +. +fence +) +; +} +self +. +device +. +destroy_bind_group +( +self +. +bind_group +) +; +self +. +device +. +destroy_buffer +( +self +. +scratch_buffer +) +; +self +. +device +. +destroy_buffer +( +self +. +instances_buffer +) +; +self +. +device +. +destroy_buffer +( +self +. +indices_buffer +) +; +self +. +device +. +destroy_buffer +( +self +. +vertices_buffer +) +; +self +. +device +. +destroy_buffer +( +self +. +uniform_buffer +) +; +self +. +device +. +destroy_acceleration_structure +( +self +. +tlas +) +; +self +. +device +. +destroy_acceleration_structure +( +self +. +blas +) +; +self +. +device +. +destroy_texture_view +( +self +. +texture_view +) +; +self +. +device +. +destroy_texture +( +self +. +texture +) +; +self +. +device +. +destroy_compute_pipeline +( +self +. +pipeline +) +; +self +. +device +. +destroy_pipeline_layout +( +self +. +pipeline_layout +) +; +self +. +device +. +destroy_bind_group_layout +( +self +. +bgl +) +; +self +. +device +. +destroy_shader_module +( +self +. +shader_module +) +; +self +. +surface +. +unconfigure +( +& +self +. +device +) +; +self +. +device +. +exit +( +self +. +queue +) +; +self +. +instance +. +destroy_surface +( +self +. +surface +) +; +drop +( +self +. +adapter +) +; +} +} +} +cfg_if +: +: +cfg_if +! +{ +/ +/ +Apple ++ +Metal +if +# +[ +cfg +( +all +( +any +( +target_os += +" +macos +" +target_os += +" +ios +" +) +feature += +" +metal +" +) +) +] +{ +type +Api += +hal +: +: +api +: +: +Metal +; +} +/ +/ +Wasm ++ +Vulkan +else +if +# +[ +cfg +( +all +( +not +( +target_arch += +" +wasm32 +" +) +feature += +" +vulkan +" +) +) +] +{ +type +Api += +hal +: +: +api +: +: +Vulkan +; +} +/ +/ +Windows ++ +DX12 +else +if +# +[ +cfg +( +all +( +windows +feature += +" +dx12 +" +) +) +] +{ +type +Api += +hal +: +: +api +: +: +Dx12 +; +} +/ +/ +Anything ++ +GLES +else +if +# +[ +cfg +( +feature += +" +gles +" +) +] +{ +type +Api += +hal +: +: +api +: +: +Gles +; +} +/ +/ +Fallback +else +{ +type +Api += +hal +: +: +api +: +: +Empty +; +} +} +fn +main +( +) +{ +env_logger +: +: +init +( +) +; +let +event_loop += +winit +: +: +event_loop +: +: +EventLoop +: +: +new +( +) +. +unwrap +( +) +; +let +window += +winit +: +: +window +: +: +WindowBuilder +: +: +new +( +) +. +with_title +( +" +hal +- +ray +- +traced +- +triangle +" +) +. +with_inner_size +( +winit +: +: +dpi +: +: +PhysicalSize +{ +width +: +512 +height +: +512 +} +) +. +with_resizable +( +false +) +. +with_enabled_buttons +( +WindowButtons +: +: +CLOSE +) +. +build +( +& +event_loop +) +. +unwrap +( +) +; +let +example_result += +Example +: +: +< +Api +> +: +: +init +( +& +window +) +; +let +mut +example += +Some +( +example_result +. +expect +( +" +Selected +backend +is +not +supported +" +) +) +; +event_loop +. +run +( +move +| +event +target +| +{ +let +_ += +& +window +; +target +. +set_control_flow +( +winit +: +: +event_loop +: +: +ControlFlow +: +: +Poll +) +; +match +event +{ +winit +: +: +event +: +: +Event +: +: +WindowEvent +{ +event +. +. +} += +> +match +event +{ +winit +: +: +event +: +: +WindowEvent +: +: +CloseRequested += +> +{ +target +. +exit +( +) +; +} +winit +: +: +event +: +: +WindowEvent +: +: +KeyboardInput +{ +event +. +. +} +if +event +. +physical_key += += +winit +: +: +keyboard +: +: +PhysicalKey +: +: +Code +( +winit +: +: +keyboard +: +: +KeyCode +: +: +Escape +) += +> +{ +target +. +exit +( +) +; +} +winit +: +: +event +: +: +WindowEvent +: +: +RedrawRequested += +> +{ +let +ex += +example +. +as_mut +( +) +. +unwrap +( +) +; +ex +. +render +( +) +; +} +_ += +> +{ +example +. +as_mut +( +) +. +unwrap +( +) +. +update +( +event +) +; +} +} +winit +: +: +event +: +: +Event +: +: +LoopExiting += +> +{ +example +. +take +( +) +. +unwrap +( +) +. +exit +( +) +; +} +winit +: +: +event +: +: +Event +: +: +AboutToWait += +> +{ +window +. +request_redraw +( +) +; +} +_ += +> +{ +} +} +} +) +. +unwrap +( +) +; +} diff --git a/third_party/rust/wgpu-hal/examples/ray-traced-triangle/shader.wgsl b/third_party/rust/wgpu-hal/examples/ray-traced-triangle/shader.wgsl new file mode 100644 index 0000000000000..837b0d810f767 --- /dev/null +++ b/third_party/rust/wgpu-hal/examples/ray-traced-triangle/shader.wgsl @@ -0,0 +1,337 @@ +struct +Uniforms +{ +view_inv +: +mat4x4 +< +f32 +> +proj_inv +: +mat4x4 +< +f32 +> +} +; +group +( +0 +) +binding +( +0 +) +var +< +uniform +> +uniforms +: +Uniforms +; +group +( +0 +) +binding +( +1 +) +var +output +: +texture_storage_2d +< +rgba8unorm +write +> +; +group +( +0 +) +binding +( +2 +) +var +acc_struct +: +acceleration_structure +; +compute +workgroup_size +( +8 +8 +) +fn +main +( +builtin +( +global_invocation_id +) +global_id +: +vec3 +< +u32 +> +) +{ +let +target_size += +textureDimensions +( +output +) +; +let +pixel_center += +vec2 +< +f32 +> +( +global_id +. +xy +) ++ +vec2 +< +f32 +> +( +0 +. +5 +) +; +let +in_uv += +pixel_center +/ +vec2 +< +f32 +> +( +target_size +. +xy +) +; +let +d += +in_uv +* +2 +. +0 +- +1 +. +0 +; +let +origin += +( +uniforms +. +view_inv +* +vec4 +< +f32 +> +( +0 +. +0 +0 +. +0 +0 +. +0 +1 +. +0 +) +) +. +xyz +; +let +temp += +uniforms +. +proj_inv +* +vec4 +< +f32 +> +( +d +. +x +d +. +y +1 +. +0 +1 +. +0 +) +; +let +direction += +( +uniforms +. +view_inv +* +vec4 +< +f32 +> +( +normalize +( +temp +. +xyz +) +0 +. +0 +) +) +. +xyz +; +var +rq +: +ray_query +; +rayQueryInitialize +( +& +rq +acc_struct +RayDesc +( +0u +0xFFu +0 +. +1 +200 +. +0 +origin +direction +) +) +; +rayQueryProceed +( +& +rq +) +; +var +color += +vec4 +< +f32 +> +( +0 +. +0 +0 +. +0 +0 +. +0 +1 +. +0 +) +; +let +intersection += +rayQueryGetCommittedIntersection +( +& +rq +) +; +if +intersection +. +kind +! += +RAY_QUERY_INTERSECTION_NONE +{ +color += +vec4 +< +f32 +> +( +intersection +. +barycentrics +1 +. +0 +- +intersection +. +barycentrics +. +x +- +intersection +. +barycentrics +. +y +1 +. +0 +) +; +} +textureStore +( +output +global_id +. +xy +color +) +; +} diff --git a/third_party/rust/wgpu-hal/src/auxil/mod.rs b/third_party/rust/wgpu-hal/src/auxil/mod.rs index 7b4afcfeb2916..255cabf103acf 100644 --- a/third_party/rust/wgpu-hal/src/auxil/mod.rs +++ b/third_party/rust/wgpu-hal/src/auxil/mod.rs @@ -4,19 +4,11 @@ cfg ( all ( -any -( -feature -= -" -dx11 -" feature = " dx12 " -) windows ) ) diff --git a/third_party/rust/wgpu-hal/src/dx11/adapter.rs b/third_party/rust/wgpu-hal/src/dx11/adapter.rs deleted file mode 100644 index 5fc95932ab1d6..0000000000000 --- a/third_party/rust/wgpu-hal/src/dx11/adapter.rs +++ /dev/null @@ -1,1391 +0,0 @@ -use -std -: -: -num -: -: -NonZeroU64 -; -use -winapi -: -: -um -: -: -{ -d3d11 -d3dcommon -} -; -impl -crate -: -: -Adapter -< -super -: -: -Api -> -for -super -: -: -Adapter -{ -unsafe -fn -open -( -& -self -features -: -wgt -: -: -Features -limits -: -& -wgt -: -: -Limits -) -- -> -Result -< -crate -: -: -OpenDevice -< -super -: -: -Api -> -crate -: -: -DeviceError -> -{ -todo -! -( -) -} -unsafe -fn -texture_format_capabilities -( -& -self -format -: -wgt -: -: -TextureFormat -) -- -> -crate -: -: -TextureFormatCapabilities -{ -todo -! -( -) -} -unsafe -fn -surface_capabilities -( -& -self -surface -: -& -super -: -: -Surface -) -- -> -Option -< -crate -: -: -SurfaceCapabilities -> -{ -todo -! -( -) -} -unsafe -fn -get_presentation_timestamp -( -& -self -) -- -> -wgt -: -: -PresentationTimestamp -{ -todo -! -( -) -} -} -impl -super -: -: -Adapter -{ -pub -( -super -) -fn -expose -( -instance -: -& -super -: -: -library -: -: -D3D11Lib -adapter -: -d3d12 -: -: -DxgiAdapter -) -- -> -Option -< -crate -: -: -ExposedAdapter -< -super -: -: -Api -> -> -{ -use -d3dcommon -: -: -{ -D3D_FEATURE_LEVEL_10_0 -as -FL10_0 -D3D_FEATURE_LEVEL_10_1 -as -FL10_1 -D3D_FEATURE_LEVEL_11_0 -as -FL11_0 -D3D_FEATURE_LEVEL_11_1 -as -FL11_1 -D3D_FEATURE_LEVEL_9_1 -as -FL9_1 -D3D_FEATURE_LEVEL_9_2 -as -FL9_2 -D3D_FEATURE_LEVEL_9_3 -as -FL9_3 -} -; -let -( -device -feature_level -) -= -instance -. -create_device -( -adapter -) -? -; -let -d3d9_features -= -unsafe -{ -device -. -check_feature_support -: -: -< -d3d11 -: -: -D3D11_FEATURE_DATA_D3D9_OPTIONS1 -> -( -d3d11 -: -: -D3D11_FEATURE_D3D9_OPTIONS1 -) -} -; -let -d3d10_features -= -unsafe -{ -device -. -check_feature_support -: -: -< -d3d11 -: -: -D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS -> -( -d3d11 -: -: -D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS -) -} -; -let -d3d11_features -= -unsafe -{ -device -. -check_feature_support -: -: -< -d3d11 -: -: -D3D11_FEATURE_DATA_D3D11_OPTIONS -> -( -d3d11 -: -: -D3D11_FEATURE_D3D11_OPTIONS -) -} -; -let -d3d11_features1 -= -unsafe -{ -device -. -check_feature_support -: -: -< -d3d11 -: -: -D3D11_FEATURE_DATA_D3D11_OPTIONS1 -> -( -d3d11 -: -: -D3D11_FEATURE_D3D11_OPTIONS1 -) -} -; -let -d3d11_features2 -= -unsafe -{ -device -. -check_feature_support -: -: -< -d3d11 -: -: -D3D11_FEATURE_DATA_D3D11_OPTIONS2 -> -( -d3d11 -: -: -D3D11_FEATURE_D3D11_OPTIONS2 -) -} -; -let -d3d11_features3 -= -unsafe -{ -device -. -check_feature_support -: -: -< -d3d11 -: -: -D3D11_FEATURE_DATA_D3D11_OPTIONS3 -> -( -d3d11 -: -: -D3D11_FEATURE_D3D11_OPTIONS3 -) -} -; -let -mut -features -= -wgt -: -: -Features -: -: -DEPTH_CLIP_CONTROL -| -wgt -: -: -Features -: -: -PUSH_CONSTANTS -| -wgt -: -: -Features -: -: -POLYGON_MODE_LINE -| -wgt -: -: -Features -: -: -CLEAR_TEXTURE -| -wgt -: -: -Features -: -: -TEXTURE_FORMAT_16BIT_NORM -| -wgt -: -: -Features -: -: -ADDRESS_MODE_CLAMP_TO_ZERO -| -wgt -: -: -Features -: -: -ADDRESS_MODE_CLAMP_TO_BORDER -; -let -mut -downlevel -= -wgt -: -: -DownlevelFlags -: -: -BASE_VERTEX -| -wgt -: -: -DownlevelFlags -: -: -READ_ONLY_DEPTH_STENCIL -| -wgt -: -: -DownlevelFlags -: -: -UNRESTRICTED_INDEX_BUFFER -| -wgt -: -: -DownlevelFlags -: -: -UNRESTRICTED_EXTERNAL_TEXTURE_COPIES -; -downlevel -. -set -( -wgt -: -: -DownlevelFlags -: -: -NON_POWER_OF_TWO_MIPMAPPED_TEXTURES -d3d9_features -. -FullNonPow2TextureSupported -= -= -1 -) -; -downlevel -. -set -( -wgt -: -: -DownlevelFlags -: -: -COMPUTE_SHADERS -d3d10_features -. -ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x -= -= -1 -) -; -if -feature_level -> -= -FL9_2 -{ -downlevel -| -= -wgt -: -: -DownlevelFlags -: -: -INDEPENDENT_BLEND -; -downlevel -| -= -wgt -: -: -DownlevelFlags -: -: -ANISOTROPIC_FILTERING -; -downlevel -| -= -wgt -: -: -DownlevelFlags -: -: -FULL_DRAW_INDEX_UINT32 -; -} -if -feature_level -> -= -FL9_3 -{ -downlevel -| -= -wgt -: -: -DownlevelFlags -: -: -COMPARISON_SAMPLERS -; -} -if -feature_level -> -= -FL10_0 -{ -downlevel -| -= -wgt -: -: -DownlevelFlags -: -: -FRAGMENT_STORAGE -; -downlevel -| -= -wgt -: -: -DownlevelFlags -: -: -FRAGMENT_WRITABLE_STORAGE -; -downlevel -| -= -wgt -: -: -DownlevelFlags -: -: -DEPTH_BIAS_CLAMP -; -downlevel -| -= -wgt -: -: -DownlevelFlags -: -: -VERTEX_STORAGE -; -features -| -= -wgt -: -: -Features -: -: -DEPTH_CLIP_CONTROL -; -features -| -= -wgt -: -: -Features -: -: -TIMESTAMP_QUERY -; -features -| -= -wgt -: -: -Features -: -: -PIPELINE_STATISTICS_QUERY -; -features -| -= -wgt -: -: -Features -: -: -SHADER_PRIMITIVE_INDEX -; -features -| -= -wgt -: -: -Features -: -: -DEPTH32FLOAT_STENCIL8 -; -features -| -= -wgt -: -: -Features -: -: -RG11B10UFLOAT_RENDERABLE -; -} -if -feature_level -> -= -FL10_1 -{ -downlevel -| -= -wgt -: -: -DownlevelFlags -: -: -CUBE_ARRAY_TEXTURES -; -downlevel -| -= -wgt -: -: -DownlevelFlags -: -: -MULTISAMPLED_SHADING -; -} -if -feature_level -> -= -FL11_0 -{ -downlevel -| -= -wgt -: -: -DownlevelFlags -: -: -INDIRECT_EXECUTION -; -downlevel -| -= -wgt -: -: -DownlevelFlags -: -: -WEBGPU_TEXTURE_FORMAT_SUPPORT -; -features -| -= -wgt -: -: -Features -: -: -TEXTURE_COMPRESSION_BC -; -} -if -feature_level -> -= -FL11_1 -{ -features -| -= -wgt -: -: -Features -: -: -VERTEX_WRITABLE_STORAGE -; -} -features -. -set -( -wgt -: -: -Features -: -: -FLOAT32_FILTERABLE -true -) -; -let -max_texture_dimension_2d -= -match -feature_level -{ -FL9_1 -| -FL9_2 -= -> -2048 -FL9_3 -= -> -4096 -FL10_0 -| -FL10_1 -= -> -8192 -_ -= -> -d3d11 -: -: -D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION -} -; -let -max_texture_dimension_3d -= -match -feature_level -{ -FL9_1 -. -. -= -FL9_3 -= -> -256 -_ -= -> -d3d11 -: -: -D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION -} -; -let -max_vertex_buffers -= -match -feature_level -{ -FL9_1 -. -. -= -FL9_3 -= -> -16 -_ -= -> -32 -} -. -min -( -crate -: -: -MAX_VERTEX_BUFFERS -as -u32 -) -; -let -max_compute_workgroup_storage_size -= -match -feature_level -{ -FL9_1 -. -. -= -FL9_3 -= -> -0 -FL10_0 -| -FL10_1 -= -> -4096 -* -4 -_ -= -> -d3d11 -: -: -D3D11_CS_TGSM_REGISTER_COUNT -* -4 -} -; -let -max_workgroup_size_xy -= -match -feature_level -{ -FL9_1 -. -. -= -FL9_3 -= -> -0 -FL10_0 -| -FL10_1 -= -> -d3d11 -: -: -D3D11_CS_4_X_THREAD_GROUP_MAX_X -_ -= -> -d3d11 -: -: -D3D11_CS_THREAD_GROUP_MAX_X -} -; -let -max_workgroup_size_z -= -match -feature_level -{ -FL9_1 -. -. -= -FL9_3 -= -> -0 -FL10_0 -| -FL10_1 -= -> -1 -_ -= -> -d3d11 -: -: -D3D11_CS_THREAD_GROUP_MAX_Z -} -; -let -max_sampled_textures -= -d3d11 -: -: -D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_COUNT -; -let -max_samplers -= -d3d11 -: -: -D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT -; -let -max_constant_buffers -= -d3d11 -: -: -D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT -- -1 -; -let -max_uavs -= -if -device -. -as_device1 -( -) -. -is_some -( -) -{ -d3d11 -: -: -D3D11_1_UAV_SLOT_COUNT -} -else -{ -d3d11 -: -: -D3D11_PS_CS_UAV_REGISTER_COUNT -} -; -let -max_output_registers -= -d3d11 -: -: -D3D11_VS_OUTPUT_REGISTER_COMPONENTS -; -let -max_compute_invocations_per_workgroup -= -d3d11 -: -: -D3D11_CS_THREAD_GROUP_MAX_THREADS_PER_GROUP -; -let -max_compute_workgroups_per_dimension -= -d3d11 -: -: -D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION -; -let -limits -= -wgt -: -: -Limits -{ -max_texture_dimension_1d -: -max_texture_dimension_2d -max_texture_dimension_2d -max_texture_dimension_3d -max_texture_array_layers -: -max_texture_dimension_3d -max_bind_groups -: -u32 -: -: -MAX -max_bindings_per_bind_group -: -65535 -max_dynamic_uniform_buffers_per_pipeline_layout -: -max_constant_buffers -max_dynamic_storage_buffers_per_pipeline_layout -: -0 -max_sampled_textures_per_shader_stage -: -max_sampled_textures -max_samplers_per_shader_stage -: -max_samplers -max_storage_buffers_per_shader_stage -: -max_uavs -max_storage_textures_per_shader_stage -: -max_uavs -max_uniform_buffers_per_shader_stage -: -max_constant_buffers -max_uniform_buffer_binding_size -: -1 -< -< -16 -max_storage_buffer_binding_size -: -u32 -: -: -MAX -max_vertex_buffers -max_vertex_attributes -: -max_vertex_buffers -max_vertex_buffer_array_stride -: -u32 -: -: -MAX -max_push_constant_size -: -1 -< -< -16 -min_uniform_buffer_offset_alignment -: -256 -min_storage_buffer_offset_alignment -: -1 -max_inter_stage_shader_components -: -max_output_registers -max_compute_workgroup_storage_size -max_compute_invocations_per_workgroup -max_compute_workgroup_size_x -: -max_workgroup_size_xy -max_compute_workgroup_size_y -: -max_workgroup_size_xy -max_compute_workgroup_size_z -: -max_workgroup_size_z -max_compute_workgroups_per_dimension -max_buffer_size -: -u32 -: -: -MAX -as -u64 -max_non_sampler_bindings -: -u32 -: -: -MAX -} -; -let -shader_model -= -match -feature_level -{ -FL9_1 -. -. -= -FL9_3 -= -> -wgt -: -: -ShaderModel -: -: -Sm2 -FL10_0 -| -FL10_1 -= -> -wgt -: -: -ShaderModel -: -: -Sm4 -_ -= -> -wgt -: -: -ShaderModel -: -: -Sm5 -} -; -let -device_info -= -wgt -: -: -AdapterInfo -{ -name -: -String -: -: -new -( -) -vendor -: -0 -device -: -0 -device_type -: -match -d3d11_features2 -. -UnifiedMemoryArchitecture -{ -0 -= -> -wgt -: -: -DeviceType -: -: -DiscreteGpu -1 -= -> -wgt -: -: -DeviceType -: -: -IntegratedGpu -_ -= -> -unreachable -! -( -) -} -driver -: -String -: -: -new -( -) -driver_info -: -String -: -: -new -( -) -backend -: -wgt -: -: -Backend -: -: -Dx11 -} -; -let -api_adapter -= -super -: -: -Adapter -{ -device -} -; -let -alignments -= -crate -: -: -Alignments -{ -buffer_copy_offset -: -NonZeroU64 -: -: -new -( -1 -) -. -unwrap -( -) -buffer_copy_pitch -: -NonZeroU64 -: -: -new -( -1 -) -. -unwrap -( -) -} -; -let -capabilities -= -crate -: -: -Capabilities -{ -limits -alignments -downlevel -: -wgt -: -: -DownlevelCapabilities -{ -flags -: -downlevel -limits -: -wgt -: -: -DownlevelLimits -{ -} -shader_model -} -} -; -Some -( -crate -: -: -ExposedAdapter -{ -adapter -: -api_adapter -info -: -device_info -features -capabilities -} -) -} -} diff --git a/third_party/rust/wgpu-hal/src/dx11/command.rs b/third_party/rust/wgpu-hal/src/dx11/command.rs deleted file mode 100644 index 54255ecfc593b..0000000000000 --- a/third_party/rust/wgpu-hal/src/dx11/command.rs +++ /dev/null @@ -1,1263 +0,0 @@ -impl -crate -: -: -CommandEncoder -< -super -: -: -Api -> -for -super -: -: -CommandEncoder -{ -unsafe -fn -begin_encoding -( -& -mut -self -label -: -crate -: -: -Label -) -- -> -Result -< -( -) -crate -: -: -DeviceError -> -{ -todo -! -( -) -} -unsafe -fn -discard_encoding -( -& -mut -self -) -{ -todo -! -( -) -} -unsafe -fn -end_encoding -( -& -mut -self -) -- -> -Result -< -super -: -: -CommandBuffer -crate -: -: -DeviceError -> -{ -todo -! -( -) -} -unsafe -fn -reset_all -< -I -> -( -& -mut -self -command_buffers -: -I -) -where -I -: -Iterator -< -Item -= -super -: -: -CommandBuffer -> -{ -todo -! -( -) -} -unsafe -fn -transition_buffers -< -' -a -T -> -( -& -mut -self -barriers -: -T -) -where -T -: -Iterator -< -Item -= -crate -: -: -BufferBarrier -< -' -a -super -: -: -Api -> -> -{ -todo -! -( -) -} -unsafe -fn -transition_textures -< -' -a -T -> -( -& -mut -self -barriers -: -T -) -where -T -: -Iterator -< -Item -= -crate -: -: -TextureBarrier -< -' -a -super -: -: -Api -> -> -{ -todo -! -( -) -} -unsafe -fn -clear_buffer -( -& -mut -self -buffer -: -& -super -: -: -Buffer -range -: -crate -: -: -MemoryRange -) -{ -todo -! -( -) -} -unsafe -fn -copy_buffer_to_buffer -< -T -> -( -& -mut -self -src -: -& -super -: -: -Buffer -dst -: -& -super -: -: -Buffer -regions -: -T -) -where -T -: -Iterator -< -Item -= -crate -: -: -BufferCopy -> -{ -todo -! -( -) -} -unsafe -fn -copy_texture_to_texture -< -T -> -( -& -mut -self -src -: -& -super -: -: -Texture -src_usage -: -crate -: -: -TextureUses -dst -: -& -super -: -: -Texture -regions -: -T -) -where -T -: -Iterator -< -Item -= -crate -: -: -TextureCopy -> -{ -todo -! -( -) -} -unsafe -fn -copy_buffer_to_texture -< -T -> -( -& -mut -self -src -: -& -super -: -: -Buffer -dst -: -& -super -: -: -Texture -regions -: -T -) -where -T -: -Iterator -< -Item -= -crate -: -: -BufferTextureCopy -> -{ -todo -! -( -) -} -unsafe -fn -copy_texture_to_buffer -< -T -> -( -& -mut -self -src -: -& -super -: -: -Texture -src_usage -: -crate -: -: -TextureUses -dst -: -& -super -: -: -Buffer -regions -: -T -) -where -T -: -Iterator -< -Item -= -crate -: -: -BufferTextureCopy -> -{ -todo -! -( -) -} -unsafe -fn -set_bind_group -( -& -mut -self -layout -: -& -super -: -: -PipelineLayout -index -: -u32 -group -: -& -super -: -: -BindGroup -dynamic_offsets -: -& -[ -wgt -: -: -DynamicOffset -] -) -{ -todo -! -( -) -} -unsafe -fn -set_push_constants -( -& -mut -self -layout -: -& -super -: -: -PipelineLayout -stages -: -wgt -: -: -ShaderStages -offset_bytes -: -u32 -data -: -& -[ -u32 -] -) -{ -todo -! -( -) -} -unsafe -fn -insert_debug_marker -( -& -mut -self -label -: -& -str -) -{ -todo -! -( -) -} -unsafe -fn -begin_debug_marker -( -& -mut -self -group_label -: -& -str -) -{ -todo -! -( -) -} -unsafe -fn -end_debug_marker -( -& -mut -self -) -{ -todo -! -( -) -} -unsafe -fn -begin_query -( -& -mut -self -set -: -& -super -: -: -QuerySet -index -: -u32 -) -{ -todo -! -( -) -} -unsafe -fn -end_query -( -& -mut -self -set -: -& -super -: -: -QuerySet -index -: -u32 -) -{ -todo -! -( -) -} -unsafe -fn -write_timestamp -( -& -mut -self -set -: -& -super -: -: -QuerySet -index -: -u32 -) -{ -todo -! -( -) -} -unsafe -fn -reset_queries -( -& -mut -self -set -: -& -super -: -: -QuerySet -range -: -std -: -: -ops -: -: -Range -< -u32 -> -) -{ -todo -! -( -) -} -unsafe -fn -copy_query_results -( -& -mut -self -set -: -& -super -: -: -QuerySet -range -: -std -: -: -ops -: -: -Range -< -u32 -> -buffer -: -& -super -: -: -Buffer -offset -: -wgt -: -: -BufferAddress -stride -: -wgt -: -: -BufferSize -) -{ -todo -! -( -) -} -unsafe -fn -begin_render_pass -( -& -mut -self -desc -: -& -crate -: -: -RenderPassDescriptor -< -super -: -: -Api -> -) -{ -todo -! -( -) -} -unsafe -fn -end_render_pass -( -& -mut -self -) -{ -todo -! -( -) -} -unsafe -fn -set_render_pipeline -( -& -mut -self -pipeline -: -& -super -: -: -RenderPipeline -) -{ -todo -! -( -) -} -unsafe -fn -set_index_buffer -< -' -a -> -( -& -mut -self -binding -: -crate -: -: -BufferBinding -< -' -a -super -: -: -Api -> -format -: -wgt -: -: -IndexFormat -) -{ -todo -! -( -) -} -unsafe -fn -set_vertex_buffer -< -' -a -> -( -& -mut -self -index -: -u32 -binding -: -crate -: -: -BufferBinding -< -' -a -super -: -: -Api -> -) -{ -todo -! -( -) -} -unsafe -fn -set_viewport -( -& -mut -self -rect -: -& -crate -: -: -Rect -< -f32 -> -depth_range -: -std -: -: -ops -: -: -Range -< -f32 -> -) -{ -todo -! -( -) -} -unsafe -fn -set_scissor_rect -( -& -mut -self -rect -: -& -crate -: -: -Rect -< -u32 -> -) -{ -todo -! -( -) -} -unsafe -fn -set_stencil_reference -( -& -mut -self -value -: -u32 -) -{ -todo -! -( -) -} -unsafe -fn -set_blend_constants -( -& -mut -self -color -: -& -[ -f32 -; -4 -] -) -{ -todo -! -( -) -} -unsafe -fn -draw -( -& -mut -self -first_vertex -: -u32 -vertex_count -: -u32 -first_instance -: -u32 -instance_count -: -u32 -) -{ -todo -! -( -) -} -unsafe -fn -draw_indexed -( -& -mut -self -first_index -: -u32 -index_count -: -u32 -base_vertex -: -i32 -first_instance -: -u32 -instance_count -: -u32 -) -{ -todo -! -( -) -} -unsafe -fn -draw_indirect -( -& -mut -self -buffer -: -& -super -: -: -Buffer -offset -: -wgt -: -: -BufferAddress -draw_count -: -u32 -) -{ -todo -! -( -) -} -unsafe -fn -draw_indexed_indirect -( -& -mut -self -buffer -: -& -super -: -: -Buffer -offset -: -wgt -: -: -BufferAddress -draw_count -: -u32 -) -{ -todo -! -( -) -} -unsafe -fn -draw_indirect_count -( -& -mut -self -buffer -: -& -super -: -: -Buffer -offset -: -wgt -: -: -BufferAddress -count_buffer -: -& -super -: -: -Buffer -count_offset -: -wgt -: -: -BufferAddress -max_count -: -u32 -) -{ -todo -! -( -) -} -unsafe -fn -draw_indexed_indirect_count -( -& -mut -self -buffer -: -& -super -: -: -Buffer -offset -: -wgt -: -: -BufferAddress -count_buffer -: -& -super -: -: -Buffer -count_offset -: -wgt -: -: -BufferAddress -max_count -: -u32 -) -{ -todo -! -( -) -} -unsafe -fn -begin_compute_pass -< -' -a -> -( -& -mut -self -desc -: -& -crate -: -: -ComputePassDescriptor -< -' -a -super -: -: -Api -> -) -{ -todo -! -( -) -} -unsafe -fn -end_compute_pass -( -& -mut -self -) -{ -todo -! -( -) -} -unsafe -fn -set_compute_pipeline -( -& -mut -self -pipeline -: -& -super -: -: -ComputePipeline -) -{ -todo -! -( -) -} -unsafe -fn -dispatch -( -& -mut -self -count -: -[ -u32 -; -3 -] -) -{ -todo -! -( -) -} -unsafe -fn -dispatch_indirect -( -& -mut -self -buffer -: -& -super -: -: -Buffer -offset -: -wgt -: -: -BufferAddress -) -{ -todo -! -( -) -} -} diff --git a/third_party/rust/wgpu-hal/src/dx11/device.rs b/third_party/rust/wgpu-hal/src/dx11/device.rs deleted file mode 100644 index e40f2ba6a7db8..0000000000000 --- a/third_party/rust/wgpu-hal/src/dx11/device.rs +++ /dev/null @@ -1,1264 +0,0 @@ -use -std -: -: -{ -ffi -: -: -c_void -mem -} -; -use -winapi -: -: -um -: -: -d3d11 -; -use -crate -: -: -auxil -: -: -dxgi -: -: -result -: -: -HResult -; -impl -crate -: -: -Device -< -super -: -: -Api -> -for -super -: -: -Device -{ -unsafe -fn -exit -( -self -queue -: -super -: -: -Queue -) -{ -todo -! -( -) -} -unsafe -fn -create_buffer -( -& -self -desc -: -& -crate -: -: -BufferDescriptor -) -- -> -Result -< -super -: -: -Buffer -crate -: -: -DeviceError -> -{ -todo -! -( -) -} -unsafe -fn -destroy_buffer -( -& -self -buffer -: -super -: -: -Buffer -) -{ -todo -! -( -) -} -unsafe -fn -map_buffer -( -& -self -buffer -: -& -super -: -: -Buffer -range -: -crate -: -: -MemoryRange -) -- -> -Result -< -crate -: -: -BufferMapping -crate -: -: -DeviceError -> -{ -todo -! -( -) -} -unsafe -fn -unmap_buffer -( -& -self -buffer -: -& -super -: -: -Buffer -) -- -> -Result -< -( -) -crate -: -: -DeviceError -> -{ -todo -! -( -) -} -unsafe -fn -flush_mapped_ranges -< -I -> -( -& -self -buffer -: -& -super -: -: -Buffer -ranges -: -I -) -where -I -: -Iterator -< -Item -= -crate -: -: -MemoryRange -> -{ -todo -! -( -) -} -unsafe -fn -invalidate_mapped_ranges -< -I -> -( -& -self -buffer -: -& -super -: -: -Buffer -ranges -: -I -) -where -I -: -Iterator -< -Item -= -crate -: -: -MemoryRange -> -{ -todo -! -( -) -} -unsafe -fn -create_texture -( -& -self -desc -: -& -crate -: -: -TextureDescriptor -) -- -> -Result -< -super -: -: -Texture -crate -: -: -DeviceError -> -{ -todo -! -( -) -} -unsafe -fn -destroy_texture -( -& -self -texture -: -super -: -: -Texture -) -{ -todo -! -( -) -} -unsafe -fn -create_texture_view -( -& -self -texture -: -& -super -: -: -Texture -desc -: -& -crate -: -: -TextureViewDescriptor -) -- -> -Result -< -super -: -: -TextureView -crate -: -: -DeviceError -> -{ -todo -! -( -) -} -unsafe -fn -destroy_texture_view -( -& -self -view -: -super -: -: -TextureView -) -{ -todo -! -( -) -} -unsafe -fn -create_sampler -( -& -self -desc -: -& -crate -: -: -SamplerDescriptor -) -- -> -Result -< -super -: -: -Sampler -crate -: -: -DeviceError -> -{ -todo -! -( -) -} -unsafe -fn -destroy_sampler -( -& -self -sampler -: -super -: -: -Sampler -) -{ -todo -! -( -) -} -unsafe -fn -create_command_encoder -( -& -self -desc -: -& -crate -: -: -CommandEncoderDescriptor -< -super -: -: -Api -> -) -- -> -Result -< -super -: -: -CommandEncoder -crate -: -: -DeviceError -> -{ -todo -! -( -) -} -unsafe -fn -destroy_command_encoder -( -& -self -pool -: -super -: -: -CommandEncoder -) -{ -todo -! -( -) -} -unsafe -fn -create_bind_group_layout -( -& -self -desc -: -& -crate -: -: -BindGroupLayoutDescriptor -) -- -> -Result -< -super -: -: -BindGroupLayout -crate -: -: -DeviceError -> -{ -todo -! -( -) -} -unsafe -fn -destroy_bind_group_layout -( -& -self -bg_layout -: -super -: -: -BindGroupLayout -) -{ -todo -! -( -) -} -unsafe -fn -create_pipeline_layout -( -& -self -desc -: -& -crate -: -: -PipelineLayoutDescriptor -< -super -: -: -Api -> -) -- -> -Result -< -super -: -: -PipelineLayout -crate -: -: -DeviceError -> -{ -todo -! -( -) -} -unsafe -fn -destroy_pipeline_layout -( -& -self -pipeline_layout -: -super -: -: -PipelineLayout -) -{ -todo -! -( -) -} -unsafe -fn -create_bind_group -( -& -self -desc -: -& -crate -: -: -BindGroupDescriptor -< -super -: -: -Api -> -) -- -> -Result -< -super -: -: -BindGroup -crate -: -: -DeviceError -> -{ -todo -! -( -) -} -unsafe -fn -destroy_bind_group -( -& -self -group -: -super -: -: -BindGroup -) -{ -todo -! -( -) -} -unsafe -fn -create_shader_module -( -& -self -desc -: -& -crate -: -: -ShaderModuleDescriptor -shader -: -crate -: -: -ShaderInput -) -- -> -Result -< -super -: -: -ShaderModule -crate -: -: -ShaderError -> -{ -todo -! -( -) -} -unsafe -fn -destroy_shader_module -( -& -self -module -: -super -: -: -ShaderModule -) -{ -todo -! -( -) -} -unsafe -fn -create_render_pipeline -( -& -self -desc -: -& -crate -: -: -RenderPipelineDescriptor -< -super -: -: -Api -> -) -- -> -Result -< -super -: -: -RenderPipeline -crate -: -: -PipelineError -> -{ -todo -! -( -) -} -unsafe -fn -destroy_render_pipeline -( -& -self -pipeline -: -super -: -: -RenderPipeline -) -{ -todo -! -( -) -} -unsafe -fn -create_compute_pipeline -( -& -self -desc -: -& -crate -: -: -ComputePipelineDescriptor -< -super -: -: -Api -> -) -- -> -Result -< -super -: -: -ComputePipeline -crate -: -: -PipelineError -> -{ -todo -! -( -) -} -unsafe -fn -destroy_compute_pipeline -( -& -self -pipeline -: -super -: -: -ComputePipeline -) -{ -todo -! -( -) -} -unsafe -fn -create_query_set -( -& -self -desc -: -& -wgt -: -: -QuerySetDescriptor -< -crate -: -: -Label -> -) -- -> -Result -< -super -: -: -QuerySet -crate -: -: -DeviceError -> -{ -todo -! -( -) -} -unsafe -fn -destroy_query_set -( -& -self -set -: -super -: -: -QuerySet -) -{ -todo -! -( -) -} -unsafe -fn -create_fence -( -& -self -) -- -> -Result -< -super -: -: -Fence -crate -: -: -DeviceError -> -{ -todo -! -( -) -} -unsafe -fn -destroy_fence -( -& -self -fence -: -super -: -: -Fence -) -{ -todo -! -( -) -} -unsafe -fn -get_fence_value -( -& -self -fence -: -& -super -: -: -Fence -) -- -> -Result -< -crate -: -: -FenceValue -crate -: -: -DeviceError -> -{ -todo -! -( -) -} -unsafe -fn -wait -( -& -self -fence -: -& -super -: -: -Fence -value -: -crate -: -: -FenceValue -timeout_ms -: -u32 -) -- -> -Result -< -bool -crate -: -: -DeviceError -> -{ -todo -! -( -) -} -unsafe -fn -start_capture -( -& -self -) -- -> -bool -{ -todo -! -( -) -} -unsafe -fn -stop_capture -( -& -self -) -{ -todo -! -( -) -} -} -impl -crate -: -: -Queue -< -super -: -: -Api -> -for -super -: -: -Queue -{ -unsafe -fn -submit -( -& -self -command_buffers -: -& -[ -& -super -: -: -CommandBuffer -] -signal_fence -: -Option -< -( -& -mut -super -: -: -Fence -crate -: -: -FenceValue -) -> -) -- -> -Result -< -( -) -crate -: -: -DeviceError -> -{ -todo -! -( -) -} -unsafe -fn -present -( -& -self -surface -: -& -super -: -: -Surface -texture -: -super -: -: -SurfaceTexture -) -- -> -Result -< -( -) -crate -: -: -SurfaceError -> -{ -todo -! -( -) -} -unsafe -fn -get_timestamp_period -( -& -self -) -- -> -f32 -{ -todo -! -( -) -} -} -impl -super -: -: -D3D11Device -{ -# -[ -allow -( -trivial_casts -) -] -pub -unsafe -fn -check_feature_support -< -T -> -( -& -self -feature -: -d3d11 -: -: -D3D11_FEATURE -) -- -> -T -{ -unsafe -{ -let -mut -value -= -mem -: -: -zeroed -: -: -< -T -> -( -) -; -let -ret -= -self -. -CheckFeatureSupport -( -feature -& -mut -value -as -* -mut -T -as -* -mut -c_void -mem -: -: -size_of -: -: -< -T -> -( -) -as -u32 -) -; -assert_eq -! -( -ret -. -into_result -( -) -Ok -( -( -) -) -) -; -value -} -} -} diff --git a/third_party/rust/wgpu-hal/src/dx11/instance.rs b/third_party/rust/wgpu-hal/src/dx11/instance.rs deleted file mode 100644 index a4e6cd4779dbd..0000000000000 --- a/third_party/rust/wgpu-hal/src/dx11/instance.rs +++ /dev/null @@ -1,374 +0,0 @@ -use -crate -: -: -auxil -; -impl -crate -: -: -Instance -< -super -: -: -Api -> -for -super -: -: -Instance -{ -unsafe -fn -init -( -desc -: -& -crate -: -: -InstanceDescriptor -) -- -> -Result -< -Self -crate -: -: -InstanceError -> -{ -profiling -: -: -scope -! -( -" -Init -DX11 -Backend -" -) -; -let -enable_dx11 -= -match -std -: -: -env -: -: -var -( -" -WGPU_UNSTABLE_DX11_BACKEND -" -) -{ -Ok -( -string -) -= -> -string -= -= -" -1 -" -| -| -string -= -= -" -true -" -Err -( -_ -) -= -> -false -} -; -if -! -enable_dx11 -{ -return -Err -( -crate -: -: -InstanceError -: -: -new -( -String -: -: -from -( -" -DX11 -support -is -unstable -; -set -WGPU_UNSTABLE_DX11_BACKEND -= -1 -to -enable -anyway -" -) -) -) -; -} -let -lib_d3d11 -= -super -: -: -library -: -: -D3D11Lib -: -: -new -( -) -. -ok_or_else -( -| -| -crate -: -: -InstanceError -: -: -new -( -String -: -: -from -( -" -failed -to -load -d3d11 -. -dll -" -) -) -) -? -; -let -( -lib_dxgi -factory -) -= -auxil -: -: -dxgi -: -: -factory -: -: -create_factory -( -auxil -: -: -dxgi -: -: -factory -: -: -DxgiFactoryType -: -: -Factory1 -desc -. -flags -) -? -; -Ok -( -super -: -: -Instance -{ -lib_d3d11 -lib_dxgi -factory -} -) -} -unsafe -fn -create_surface -( -& -self -display_handle -: -raw_window_handle -: -: -RawDisplayHandle -window_handle -: -raw_window_handle -: -: -RawWindowHandle -) -- -> -Result -< -super -: -: -Surface -crate -: -: -InstanceError -> -{ -todo -! -( -) -} -unsafe -fn -destroy_surface -( -& -self -surface -: -super -: -: -Surface -) -{ -todo -! -( -) -} -unsafe -fn -enumerate_adapters -( -& -self -) -- -> -Vec -< -crate -: -: -ExposedAdapter -< -super -: -: -Api -> -> -{ -let -adapters -= -auxil -: -: -dxgi -: -: -factory -: -: -enumerate_adapters -( -self -. -factory -. -clone -( -) -) -; -adapters -. -into_iter -( -) -. -filter_map -( -| -adapter -| -super -: -: -Adapter -: -: -expose -( -& -self -. -lib_d3d11 -adapter -) -) -. -collect -( -) -} -} diff --git a/third_party/rust/wgpu-hal/src/dx11/library.rs b/third_party/rust/wgpu-hal/src/dx11/library.rs deleted file mode 100644 index e257bef9c255f..0000000000000 --- a/third_party/rust/wgpu-hal/src/dx11/library.rs +++ /dev/null @@ -1,668 +0,0 @@ -use -std -: -: -ptr -; -use -winapi -: -: -{ -shared -: -: -{ -dxgi -minwindef -: -: -{ -HMODULE -UINT -} -winerror -} -um -: -: -{ -d3d11 -d3d11_1 -d3d11_2 -d3dcommon -} -} -; -use -crate -: -: -auxil -: -: -dxgi -: -: -result -: -: -HResult -; -type -D3D11CreateDeviceFun -= -unsafe -extern -" -system -" -fn -( -* -mut -dxgi -: -: -IDXGIAdapter -d3dcommon -: -: -D3D_DRIVER_TYPE -HMODULE -UINT -* -const -d3dcommon -: -: -D3D_FEATURE_LEVEL -UINT -UINT -* -mut -* -mut -d3d11 -: -: -ID3D11Device -* -mut -d3dcommon -: -: -D3D_FEATURE_LEVEL -* -mut -* -mut -d3d11 -: -: -ID3D11DeviceContext -) -- -> -d3d12 -: -: -HRESULT -; -pub -( -super -) -struct -D3D11Lib -{ -d3d11_create_device -: -libloading -: -: -os -: -: -windows -: -: -Symbol -< -D3D11CreateDeviceFun -> -lib -: -libloading -: -: -Library -} -impl -D3D11Lib -{ -pub -fn -new -( -) -- -> -Option -< -Self -> -{ -unsafe -{ -let -lib -= -libloading -: -: -Library -: -: -new -( -" -d3d11 -. -dll -" -) -. -ok -( -) -? -; -let -d3d11_create_device -= -lib -. -get -: -: -< -D3D11CreateDeviceFun -> -( -b -" -D3D11CreateDevice -" -) -. -ok -( -) -? -. -into_raw -( -) -; -Some -( -Self -{ -lib -d3d11_create_device -} -) -} -} -pub -fn -create_device -( -& -self -adapter -: -d3d12 -: -: -DxgiAdapter -) -- -> -Option -< -( -super -: -: -D3D11Device -d3dcommon -: -: -D3D_FEATURE_LEVEL -) -> -{ -let -feature_levels -= -[ -d3dcommon -: -: -D3D_FEATURE_LEVEL_11_1 -d3dcommon -: -: -D3D_FEATURE_LEVEL_11_0 -d3dcommon -: -: -D3D_FEATURE_LEVEL_10_1 -d3dcommon -: -: -D3D_FEATURE_LEVEL_10_0 -d3dcommon -: -: -D3D_FEATURE_LEVEL_9_3 -d3dcommon -: -: -D3D_FEATURE_LEVEL_9_2 -d3dcommon -: -: -D3D_FEATURE_LEVEL_9_1 -] -; -let -mut -device -= -d3d12 -: -: -ComPtr -: -: -< -d3d11 -: -: -ID3D11Device -> -: -: -null -( -) -; -let -mut -feature_level -: -d3dcommon -: -: -D3D_FEATURE_LEVEL -= -0 -; -let -mut -hr -= -unsafe -{ -( -self -. -d3d11_create_device -) -( -adapter -. -as_mut_ptr -( -) -as -* -mut -_ -d3dcommon -: -: -D3D_DRIVER_TYPE_UNKNOWN -ptr -: -: -null_mut -( -) -0 -feature_levels -. -as_ptr -( -) -feature_levels -. -len -( -) -as -u32 -d3d11 -: -: -D3D11_SDK_VERSION -device -. -mut_self -( -) -& -mut -feature_level -ptr -: -: -null_mut -( -) -) -} -; -if -hr -= -= -winerror -: -: -E_INVALIDARG -{ -hr -= -unsafe -{ -( -self -. -d3d11_create_device -) -( -adapter -. -as_mut_ptr -( -) -as -* -mut -_ -d3dcommon -: -: -D3D_DRIVER_TYPE_UNKNOWN -ptr -: -: -null_mut -( -) -0 -feature_levels -[ -1 -. -. -] -. -as_ptr -( -) -feature_levels -[ -1 -. -. -] -. -len -( -) -as -u32 -d3d11 -: -: -D3D11_SDK_VERSION -device -. -mut_self -( -) -& -mut -feature_level -ptr -: -: -null_mut -( -) -) -} -; -} -if -let -Err -( -err -) -= -hr -. -into_result -( -) -{ -log -: -: -error -! -( -" -Failed -to -make -a -D3D11 -device -: -{ -} -" -err -) -; -return -None -; -} -unsafe -{ -match -device -. -cast -: -: -< -d3d11_2 -: -: -ID3D11Device2 -> -( -) -. -into_result -( -) -{ -Ok -( -device2 -) -= -> -{ -return -Some -( -( -super -: -: -D3D11Device -: -: -Device2 -( -device2 -) -feature_level -) -) -; -} -Err -( -hr -) -= -> -{ -log -: -: -warn -! -( -" -Failed -to -cast -device -to -ID3D11Device2 -: -{ -} -" -hr -) -} -} -} -unsafe -{ -match -device -. -cast -: -: -< -d3d11_1 -: -: -ID3D11Device1 -> -( -) -. -into_result -( -) -{ -Ok -( -device1 -) -= -> -{ -return -Some -( -( -super -: -: -D3D11Device -: -: -Device1 -( -device1 -) -feature_level -) -) -; -} -Err -( -hr -) -= -> -{ -log -: -: -warn -! -( -" -Failed -to -cast -device -to -ID3D11Device1 -: -{ -} -" -hr -) -} -} -} -Some -( -( -super -: -: -D3D11Device -: -: -Device -( -device -) -feature_level -) -) -} -} diff --git a/third_party/rust/wgpu-hal/src/dx11/mod.rs b/third_party/rust/wgpu-hal/src/dx11/mod.rs deleted file mode 100644 index 6e0239b921fd8..0000000000000 --- a/third_party/rust/wgpu-hal/src/dx11/mod.rs +++ /dev/null @@ -1,641 +0,0 @@ -# -! -[ -allow -( -dead_code -) -] -# -! -[ -allow -( -unused_variables -) -] -use -winapi -: -: -um -: -: -{ -d3d11 -d3d11_1 -d3d11_2 -} -; -mod -adapter -; -mod -command -; -mod -device -; -mod -instance -; -mod -library -; -# -[ -derive -( -Clone -Debug -) -] -pub -struct -Api -; -impl -crate -: -: -Api -for -Api -{ -type -Instance -= -Instance -; -type -Surface -= -Surface -; -type -Adapter -= -Adapter -; -type -Device -= -Device -; -type -Queue -= -Queue -; -type -CommandEncoder -= -CommandEncoder -; -type -CommandBuffer -= -CommandBuffer -; -type -Buffer -= -Buffer -; -type -Texture -= -Texture -; -type -SurfaceTexture -= -SurfaceTexture -; -type -TextureView -= -TextureView -; -type -Sampler -= -Sampler -; -type -QuerySet -= -QuerySet -; -type -Fence -= -Fence -; -type -BindGroupLayout -= -BindGroupLayout -; -type -BindGroup -= -BindGroup -; -type -PipelineLayout -= -PipelineLayout -; -type -ShaderModule -= -ShaderModule -; -type -RenderPipeline -= -RenderPipeline -; -type -ComputePipeline -= -ComputePipeline -; -} -pub -struct -Instance -{ -lib_d3d11 -: -library -: -: -D3D11Lib -lib_dxgi -: -d3d12 -: -: -DxgiLib -factory -: -d3d12 -: -: -DxgiFactory -} -unsafe -impl -Send -for -Instance -{ -} -unsafe -impl -Sync -for -Instance -{ -} -pub -struct -Surface -{ -} -pub -struct -Adapter -{ -device -: -D3D11Device -} -unsafe -impl -Send -for -Adapter -{ -} -unsafe -impl -Sync -for -Adapter -{ -} -d3d12 -: -: -weak_com_inheritance_chain -! -{ -# -[ -derive -( -Debug -Clone -PartialEq -) -] -enum -D3D11Device -{ -Device -( -d3d11 -: -: -ID3D11Device -) -from_device -as_device -device -; -Device1 -( -d3d11_1 -: -: -ID3D11Device1 -) -from_device1 -as_device1 -unwrap_device1 -; -Device2 -( -d3d11_2 -: -: -ID3D11Device2 -) -from_device2 -as_device2 -unwrap_device2 -; -} -} -pub -struct -Device -{ -} -unsafe -impl -Send -for -Device -{ -} -unsafe -impl -Sync -for -Device -{ -} -pub -struct -Queue -{ -} -# -[ -derive -( -Debug -) -] -pub -struct -CommandEncoder -{ -} -# -[ -derive -( -Debug -) -] -pub -struct -CommandBuffer -{ -} -# -[ -derive -( -Debug -) -] -pub -struct -Buffer -{ -} -# -[ -derive -( -Debug -) -] -pub -struct -Texture -{ -} -# -[ -derive -( -Debug -) -] -pub -struct -SurfaceTexture -{ -} -impl -std -: -: -borrow -: -: -Borrow -< -Texture -> -for -SurfaceTexture -{ -fn -borrow -( -& -self -) -- -> -& -Texture -{ -todo -! -( -) -} -} -# -[ -derive -( -Debug -) -] -pub -struct -TextureView -{ -} -# -[ -derive -( -Debug -) -] -pub -struct -Sampler -{ -} -# -[ -derive -( -Debug -) -] -pub -struct -QuerySet -{ -} -# -[ -derive -( -Debug -) -] -pub -struct -Fence -{ -} -# -[ -derive -( -Debug -) -] -pub -struct -BindGroupLayout -{ -} -# -[ -derive -( -Debug -) -] -pub -struct -BindGroup -{ -} -# -[ -derive -( -Debug -) -] -pub -struct -PipelineLayout -{ -} -# -[ -derive -( -Debug -) -] -pub -struct -ShaderModule -{ -} -# -[ -derive -( -Debug -) -] -pub -struct -RenderPipeline -{ -} -# -[ -derive -( -Debug -) -] -pub -struct -ComputePipeline -{ -} -impl -crate -: -: -Surface -< -Api -> -for -Surface -{ -unsafe -fn -configure -( -& -self -device -: -& -Device -config -: -& -crate -: -: -SurfaceConfiguration -) -- -> -Result -< -( -) -crate -: -: -SurfaceError -> -{ -todo -! -( -) -} -unsafe -fn -unconfigure -( -& -self -device -: -& -Device -) -{ -todo -! -( -) -} -unsafe -fn -acquire_texture -( -& -self -_timeout -: -Option -< -std -: -: -time -: -: -Duration -> -) -- -> -Result -< -Option -< -crate -: -: -AcquiredSurfaceTexture -< -Api -> -> -crate -: -: -SurfaceError -> -{ -todo -! -( -) -} -unsafe -fn -discard_texture -( -& -self -texture -: -SurfaceTexture -) -{ -todo -! -( -) -} -} diff --git a/third_party/rust/wgpu-hal/src/dx12/command.rs b/third_party/rust/wgpu-hal/src/dx12/command.rs index 13535dcc94e5b..255a5e031df81 100644 --- a/third_party/rust/wgpu-hal/src/dx12/command.rs +++ b/third_party/rust/wgpu-hal/src/dx12/command.rs @@ -7527,4 +7527,76 @@ null_mut } ; } +unsafe +fn +build_acceleration_structures +< +' +a +T +> +( +& +mut +self +_descriptor_count +: +u32 +_descriptors +: +T +) +where +super +: +: +Api +: +' +a +T +: +IntoIterator +< +Item += +crate +: +: +BuildAccelerationStructureDescriptor +< +' +a +super +: +: +Api +> +> +{ +todo +! +( +) +} +unsafe +fn +place_acceleration_structure_barrier +( +& +mut +self +_barriers +: +crate +: +: +AccelerationStructureBarrier +) +{ +todo +! +( +) +} } diff --git a/third_party/rust/wgpu-hal/src/dx12/conv.rs b/third_party/rust/wgpu-hal/src/dx12/conv.rs index 74d6ab9d5f5cb..ec963efd88487 100644 --- a/third_party/rust/wgpu-hal/src/dx12/conv.rs +++ b/third_party/rust/wgpu-hal/src/dx12/conv.rs @@ -815,6 +815,16 @@ DescriptorRangeType : : UAV +Bt +: +: +AccelerationStructure += +> +todo +! +( +) } } pub diff --git a/third_party/rust/wgpu-hal/src/dx12/device.rs b/third_party/rust/wgpu-hal/src/dx12/device.rs index 1ccfb58f45ddd..12a385abec891 100644 --- a/third_party/rust/wgpu-hal/src/dx12/device.rs +++ b/third_party/rust/wgpu-hal/src/dx12/device.rs @@ -3989,6 +3989,19 @@ num_samplers + = count +wgt +: +: +BindingType +: +: +AccelerationStructure += +> +todo +! +( +) } } let @@ -7074,6 +7087,19 @@ raw ; } } +wgt +: +: +BindingType +: +: +AccelerationStructure += +> +todo +! +( +) } } let @@ -9488,4 +9514,120 @@ null_mut ) } } +unsafe +fn +get_acceleration_structure_build_sizes +< +' +a +> +( +& +self +_desc +: +& +crate +: +: +GetAccelerationStructureBuildSizesDescriptor +< +' +a +super +: +: +Api +> +) +- +> +crate +: +: +AccelerationStructureBuildSizes +{ +todo +! +( +) +} +unsafe +fn +get_acceleration_structure_device_address +( +& +self +_acceleration_structure +: +& +super +: +: +AccelerationStructure +) +- +> +wgt +: +: +BufferAddress +{ +todo +! +( +) +} +unsafe +fn +create_acceleration_structure +( +& +self +_desc +: +& +crate +: +: +AccelerationStructureDescriptor +) +- +> +Result +< +super +: +: +AccelerationStructure +crate +: +: +DeviceError +> +{ +todo +! +( +) +} +unsafe +fn +destroy_acceleration_structure +( +& +self +_acceleration_structure +: +super +: +: +AccelerationStructure +) +{ +todo +! +( +) +} } diff --git a/third_party/rust/wgpu-hal/src/dx12/mod.rs b/third_party/rust/wgpu-hal/src/dx12/mod.rs index 39bdcd4b6698d..b4e930d553a76 100644 --- a/third_party/rust/wgpu-hal/src/dx12/mod.rs +++ b/third_party/rust/wgpu-hal/src/dx12/mod.rs @@ -233,6 +233,11 @@ ComputePipeline = ComputePipeline ; +type +AccelerationStructure += +AccelerationStructure +; } const MAX_ROOT_ELEMENTS @@ -2682,6 +2687,18 @@ for ComputePipeline { } +# +[ +derive +( +Debug +) +] +pub +struct +AccelerationStructure +{ +} impl SwapChain { diff --git a/third_party/rust/wgpu-hal/src/empty.rs b/third_party/rust/wgpu-hal/src/empty.rs index 36f69a6db58c7..5a79f5c99804c 100644 --- a/third_party/rust/wgpu-hal/src/empty.rs +++ b/third_party/rust/wgpu-hal/src/empty.rs @@ -147,6 +147,11 @@ Fence Resource ; type +AccelerationStructure += +Resource +; +type BindGroupLayout = Resource @@ -1373,6 +1378,106 @@ self ) { } +unsafe +fn +create_acceleration_structure +( +& +self +desc +: +& +crate +: +: +AccelerationStructureDescriptor +) +- +> +DeviceResult +< +Resource +> +{ +Ok +( +Resource +) +} +unsafe +fn +get_acceleration_structure_build_sizes +< +' +a +> +( +& +self +_desc +: +& +crate +: +: +GetAccelerationStructureBuildSizesDescriptor +< +' +a +Api +> +) +- +> +crate +: +: +AccelerationStructureBuildSizes +{ +Default +: +: +default +( +) +} +unsafe +fn +get_acceleration_structure_device_address +( +& +self +_acceleration_structure +: +& +Resource +) +- +> +wgt +: +: +BufferAddress +{ +Default +: +: +default +( +) +} +unsafe +fn +destroy_acceleration_structure +( +& +self +_acceleration_structure +: +Resource +) +{ +} } impl crate @@ -2345,4 +2450,62 @@ BufferAddress ) { } +unsafe +fn +build_acceleration_structures +< +' +a +T +> +( +& +mut +self +_descriptor_count +: +u32 +descriptors +: +T +) +where +Api +: +' +a +T +: +IntoIterator +< +Item += +crate +: +: +BuildAccelerationStructureDescriptor +< +' +a +Api +> +> +{ +} +unsafe +fn +place_acceleration_structure_barrier +( +& +mut +self +_barriers +: +crate +: +: +AccelerationStructureBarrier +) +{ +} } diff --git a/third_party/rust/wgpu-hal/src/gles/adapter.rs b/third_party/rust/wgpu-hal/src/gles/adapter.rs index e6ddfd0719ad9..ba6eda3262e94 100644 --- a/third_party/rust/wgpu-hal/src/gles/adapter.rs +++ b/third_party/rust/wgpu-hal/src/gles/adapter.rs @@ -1280,20 +1280,9 @@ es_ver = full_ver . -is_none -( -) -. -then_some -( -( -) -) -. -and_then +map_or_else ( | -_ | Self : @@ -1307,6 +1296,10 @@ version ok ( ) +| +_ +| +None ) ; let @@ -3376,6 +3369,33 @@ OES_texture_float_linear ) ) ; +if +es_ver +. +is_none +( +) +{ +features +| += +wgt +: +: +Features +: +: +POLYGON_MODE_LINE +| +wgt +: +: +Features +: +: +POLYGON_MODE_POINT +; +} let mut private_caps diff --git a/third_party/rust/wgpu-hal/src/gles/command.rs b/third_party/rust/wgpu-hal/src/gles/command.rs index a42116cd87a04..46531e394f6a3 100644 --- a/third_party/rust/wgpu-hal/src/gles/command.rs +++ b/third_party/rust/wgpu-hal/src/gles/command.rs @@ -7380,4 +7380,76 @@ offset ) ; } +unsafe +fn +build_acceleration_structures +< +' +a +T +> +( +& +mut +self +_descriptor_count +: +u32 +_descriptors +: +T +) +where +super +: +: +Api +: +' +a +T +: +IntoIterator +< +Item += +crate +: +: +BuildAccelerationStructureDescriptor +< +' +a +super +: +: +Api +> +> +{ +unimplemented +! +( +) +} +unsafe +fn +place_acceleration_structure_barrier +( +& +mut +self +_barriers +: +crate +: +: +AccelerationStructureBarrier +) +{ +unimplemented +! +( +) +} } diff --git a/third_party/rust/wgpu-hal/src/gles/conv.rs b/third_party/rust/wgpu-hal/src/gles/conv.rs index 539619be469e1..722cfef6e7bb5 100644 --- a/third_party/rust/wgpu-hal/src/gles/conv.rs +++ b/third_party/rust/wgpu-hal/src/gles/conv.rs @@ -3012,87 +3012,6 @@ super : PrimitiveState { -match -state -. -polygon_mode -{ -wgt -: -: -PolygonMode -: -: -Fill -= -> -{ -} -wgt -: -: -PolygonMode -: -: -Line -= -> -panic -! -( -" -{ -: -? -} -is -not -enabled -for -this -backend -" -wgt -: -: -Features -: -: -POLYGON_MODE_LINE -) -wgt -: -: -PolygonMode -: -: -Point -= -> -panic -! -( -" -{ -: -? -} -is -not -enabled -for -this -backend -" -wgt -: -: -Features -: -: -POLYGON_MODE_POINT -) -} super : : @@ -3181,6 +3100,53 @@ unclipped_depth state . unclipped_depth +polygon_mode +: +match +state +. +polygon_mode +{ +wgt +: +: +PolygonMode +: +: +Fill += +> +glow +: +: +FILL +wgt +: +: +PolygonMode +: +: +Line += +> +glow +: +: +LINE +wgt +: +: +PolygonMode +: +: +Point += +> +glow +: +: +POINT +} } } pub diff --git a/third_party/rust/wgpu-hal/src/gles/device.rs b/third_party/rust/wgpu-hal/src/gles/device.rs index a19dcc3edd872..a981ed577e517 100644 --- a/third_party/rust/wgpu-hal/src/gles/device.rs +++ b/third_party/rust/wgpu-hal/src/gles/device.rs @@ -7076,6 +7076,19 @@ Storage & mut num_storage_buffers +wgt +: +: +BindingType +: +: +AccelerationStructure += +> +unimplemented +! +( +) } ; binding_to_slot @@ -7689,6 +7702,19 @@ internal } ) } +wgt +: +: +BindingType +: +: +AccelerationStructure += +> +unimplemented +! +( +) } ; contents @@ -9409,6 +9435,112 @@ null_mut ) } } +unsafe +fn +create_acceleration_structure +( +& +self +_desc +: +& +crate +: +: +AccelerationStructureDescriptor +) +- +> +Result +< +( +) +crate +: +: +DeviceError +> +{ +unimplemented +! +( +) +} +unsafe +fn +get_acceleration_structure_build_sizes +< +' +a +> +( +& +self +_desc +: +& +crate +: +: +GetAccelerationStructureBuildSizesDescriptor +< +' +a +super +: +: +Api +> +) +- +> +crate +: +: +AccelerationStructureBuildSizes +{ +unimplemented +! +( +) +} +unsafe +fn +get_acceleration_structure_device_address +( +& +self +_acceleration_structure +: +& +( +) +) +- +> +wgt +: +: +BufferAddress +{ +unimplemented +! +( +) +} +unsafe +fn +destroy_acceleration_structure +( +& +self +_acceleration_structure +: +( +) +) +{ +} } # [ diff --git a/third_party/rust/wgpu-hal/src/gles/mod.rs b/third_party/rust/wgpu-hal/src/gles/mod.rs index dd9c2b26e670f..44c1f2d3bffdd 100644 --- a/third_party/rust/wgpu-hal/src/gles/mod.rs +++ b/third_party/rust/wgpu-hal/src/gles/mod.rs @@ -483,6 +483,12 @@ Fence Fence ; type +AccelerationStructure += +( +) +; +type BindGroupLayout = BindGroupLayout @@ -3403,6 +3409,9 @@ u32 unclipped_depth : bool +polygon_mode +: +u32 } type InvalidatedAttachments diff --git a/third_party/rust/wgpu-hal/src/gles/queue.rs b/third_party/rust/wgpu-hal/src/gles/queue.rs index a9ee5d4cfde45..78d1f03393b16 100644 --- a/third_party/rust/wgpu-hal/src/gles/queue.rs +++ b/third_party/rust/wgpu-hal/src/gles/queue.rs @@ -7206,6 +7206,39 @@ DEPTH_CLAMP ; } } +if +self +. +features +. +contains +( +wgt +: +: +Features +: +: +POLYGON_MODE_LINE +) +{ +unsafe +{ +gl +. +polygon_mode +( +glow +: +: +FRONT_AND_BACK +state +. +polygon_mode +) +} +; +} } C : diff --git a/third_party/rust/wgpu-hal/src/lib.rs b/third_party/rust/wgpu-hal/src/lib.rs index 66089ba8b19c0..d1fb5c04382cb 100644 --- a/third_party/rust/wgpu-hal/src/lib.rs +++ b/third_party/rust/wgpu-hal/src/lib.rs @@ -88,25 +88,6 @@ all feature = " -dx11 -" -windows -) -) -] -pub -mod -dx11 -; -# -[ -cfg -( -all -( -feature -= -" dx12 " windows @@ -210,33 +191,6 @@ all feature = " -dx11 -" -windows -) -) -] -pub -use -super -: -: -dx11 -: -: -Api -as -Dx11 -; -# -[ -cfg -( -all -( -feature -= -" dx12 " windows @@ -1178,6 +1132,19 @@ Debug + WasmNotSendSync ; +type +AccelerationStructure +: +fmt +: +: +Debug ++ +WasmNotSendSync ++ +' +static +; } pub trait @@ -2163,6 +2130,81 @@ stop_capture self ) ; +unsafe +fn +create_acceleration_structure +( +& +self +desc +: +& +AccelerationStructureDescriptor +) +- +> +Result +< +A +: +: +AccelerationStructure +DeviceError +> +; +unsafe +fn +get_acceleration_structure_build_sizes +( +& +self +desc +: +& +GetAccelerationStructureBuildSizesDescriptor +< +A +> +) +- +> +AccelerationStructureBuildSizes +; +unsafe +fn +get_acceleration_structure_device_address +( +& +self +acceleration_structure +: +& +A +: +: +AccelerationStructure +) +- +> +wgt +: +: +BufferAddress +; +unsafe +fn +destroy_acceleration_structure +( +& +self +acceleration_structure +: +A +: +: +AccelerationStructure +) +; } pub trait @@ -3279,6 +3321,56 @@ wgt BufferAddress ) ; +unsafe +fn +build_acceleration_structures +< +' +a +T +> +( +& +mut +self +descriptor_count +: +u32 +descriptors +: +T +) +where +A +: +' +a +T +: +IntoIterator +< +Item += +BuildAccelerationStructureDescriptor +< +' +a +A +> +> +; +unsafe +fn +place_acceleration_structure_barrier +( +& +mut +self +barrier +: +AccelerationStructureBarrier +) +; } bitflags ! @@ -4443,6 +4535,30 @@ QUERY_RESOLVE < 10 ; +const +ACCELERATION_STRUCTURE_SCRATCH += +1 +< +< +11 +; +const +BOTTOM_LEVEL_ACCELERATION_STRUCTURE_INPUT += +1 +< +< +12 +; +const +TOP_LEVEL_ACCELERATION_STRUCTURE_INPUT += +1 +< +< +13 +; / / / @@ -4526,6 +4642,24 @@ INDIRECT bits ( ) +| +Self +: +: +BOTTOM_LEVEL_ACCELERATION_STRUCTURE_INPUT +. +bits +( +) +| +Self +: +: +TOP_LEVEL_ACCELERATION_STRUCTURE_INPUT +. +bits +( +) ; / / @@ -4571,6 +4705,15 @@ STORAGE_READ_WRITE bits ( ) +| +Self +: +: +ACCELERATION_STRUCTURE_SCRATCH +. +bits +( +) ; / / @@ -6255,6 +6398,21 @@ a [ BindGroupEntry ] +pub +acceleration_structures +: +& +' +a +[ +& +' +a +A +: +: +AccelerationStructure +] } # [ @@ -7737,3 +7895,648 @@ u32 ) ; } +# +[ +derive +( +Clone +Debug +) +] +pub +struct +AccelerationStructureDescriptor +< +' +a +> +{ +pub +label +: +Label +< +' +a +> +pub +size +: +wgt +: +: +BufferAddress +pub +format +: +AccelerationStructureFormat +} +# +[ +derive +( +Debug +Clone +Copy +Eq +PartialEq +) +] +pub +enum +AccelerationStructureFormat +{ +TopLevel +BottomLevel +} +# +[ +derive +( +Debug +Clone +Copy +Eq +PartialEq +) +] +pub +enum +AccelerationStructureBuildMode +{ +Build +Update +} +# +[ +derive +( +Copy +Clone +Debug +Default +Eq +PartialEq +) +] +pub +struct +AccelerationStructureBuildSizes +{ +pub +acceleration_structure_size +: +wgt +: +: +BufferAddress +pub +update_scratch_size +: +wgt +: +: +BufferAddress +pub +build_scratch_size +: +wgt +: +: +BufferAddress +} +# +[ +derive +( +Clone +Debug +) +] +pub +struct +BuildAccelerationStructureDescriptor +< +' +a +A +: +Api +> +{ +pub +entries +: +& +' +a +AccelerationStructureEntries +< +' +a +A +> +pub +mode +: +AccelerationStructureBuildMode +pub +flags +: +AccelerationStructureBuildFlags +pub +source_acceleration_structure +: +Option +< +& +' +a +A +: +: +AccelerationStructure +> +pub +destination_acceleration_structure +: +& +' +a +A +: +: +AccelerationStructure +pub +scratch_buffer +: +& +' +a +A +: +: +Buffer +pub +scratch_buffer_offset +: +wgt +: +: +BufferAddress +} +# +[ +derive +( +Clone +Debug +) +] +pub +struct +GetAccelerationStructureBuildSizesDescriptor +< +' +a +A +: +Api +> +{ +pub +entries +: +& +' +a +AccelerationStructureEntries +< +' +a +A +> +pub +flags +: +AccelerationStructureBuildFlags +} +# +[ +derive +( +Debug +) +] +pub +enum +AccelerationStructureEntries +< +' +a +A +: +Api +> +{ +Instances +( +AccelerationStructureInstances +< +' +a +A +> +) +Triangles +( +Vec +< +AccelerationStructureTriangles +< +' +a +A +> +> +) +AABBs +( +Vec +< +AccelerationStructureAABBs +< +' +a +A +> +> +) +} +# +[ +derive +( +Clone +Debug +) +] +pub +struct +AccelerationStructureTriangles +< +' +a +A +: +Api +> +{ +pub +vertex_buffer +: +Option +< +& +' +a +A +: +: +Buffer +> +pub +vertex_format +: +wgt +: +: +VertexFormat +pub +first_vertex +: +u32 +pub +vertex_count +: +u32 +pub +vertex_stride +: +wgt +: +: +BufferAddress +pub +indices +: +Option +< +AccelerationStructureTriangleIndices +< +' +a +A +> +> +pub +transform +: +Option +< +AccelerationStructureTriangleTransform +< +' +a +A +> +> +pub +flags +: +AccelerationStructureGeometryFlags +} +# +[ +derive +( +Clone +Debug +) +] +pub +struct +AccelerationStructureAABBs +< +' +a +A +: +Api +> +{ +pub +buffer +: +Option +< +& +' +a +A +: +: +Buffer +> +pub +offset +: +u32 +pub +count +: +u32 +pub +stride +: +wgt +: +: +BufferAddress +pub +flags +: +AccelerationStructureGeometryFlags +} +# +[ +derive +( +Clone +Debug +) +] +pub +struct +AccelerationStructureInstances +< +' +a +A +: +Api +> +{ +pub +buffer +: +Option +< +& +' +a +A +: +: +Buffer +> +pub +offset +: +u32 +pub +count +: +u32 +} +# +[ +derive +( +Clone +Debug +) +] +pub +struct +AccelerationStructureTriangleIndices +< +' +a +A +: +Api +> +{ +pub +format +: +wgt +: +: +IndexFormat +pub +buffer +: +Option +< +& +' +a +A +: +: +Buffer +> +pub +offset +: +u32 +pub +count +: +u32 +} +# +[ +derive +( +Clone +Debug +) +] +pub +struct +AccelerationStructureTriangleTransform +< +' +a +A +: +Api +> +{ +pub +buffer +: +& +' +a +A +: +: +Buffer +pub +offset +: +u32 +} +pub +use +wgt +: +: +AccelerationStructureFlags +as +AccelerationStructureBuildFlags +; +pub +use +wgt +: +: +AccelerationStructureGeometryFlags +; +bitflags +: +: +bitflags +! +{ +# +[ +derive +( +Clone +Copy +Debug +PartialEq +Eq +Hash +) +] +pub +struct +AccelerationStructureUses +: +u8 +{ +/ +/ +For +blas +used +as +input +for +tlas +const +BUILD_INPUT += +1 +< +< +0 +; +/ +/ +Target +for +acceleration +structure +build +const +BUILD_OUTPUT += +1 +< +< +1 +; +/ +/ +Tlas +used +in +a +shader +const +SHADER_INPUT += +1 +< +< +2 +; +} +} +# +[ +derive +( +Debug +Clone +) +] +pub +struct +AccelerationStructureBarrier +{ +pub +usage +: +Range +< +AccelerationStructureUses +> +} diff --git a/third_party/rust/wgpu-hal/src/metal/command.rs b/third_party/rust/wgpu-hal/src/metal/command.rs index 22341ab01a225..6d79549d6d0b2 100644 --- a/third_party/rust/wgpu-hal/src/metal/command.rs +++ b/third_party/rust/wgpu-hal/src/metal/command.rs @@ -7495,6 +7495,78 @@ raw_wg_size ) ; } +unsafe +fn +build_acceleration_structures +< +' +a +T +> +( +& +mut +self +_descriptor_count +: +u32 +_descriptors +: +T +) +where +super +: +: +Api +: +' +a +T +: +IntoIterator +< +Item += +crate +: +: +BuildAccelerationStructureDescriptor +< +' +a +super +: +: +Api +> +> +{ +unimplemented +! +( +) +} +unsafe +fn +place_acceleration_structure_barrier +( +& +mut +self +_barriers +: +crate +: +: +AccelerationStructureBarrier +) +{ +unimplemented +! +( +) +} } impl Drop diff --git a/third_party/rust/wgpu-hal/src/metal/device.rs b/third_party/rust/wgpu-hal/src/metal/device.rs index dc6a8dfa5e4b8..39a3afa65a3d7 100644 --- a/third_party/rust/wgpu-hal/src/metal/device.rs +++ b/third_party/rust/wgpu-hal/src/metal/device.rs @@ -4215,6 +4215,19 @@ true } ; } +wgt +: +: +BindingType +: +: +AccelerationStructure += +> +unimplemented +! +( +) } let br @@ -5051,6 +5064,19 @@ textures size ; } +wgt +: +: +BindingType +: +: +AccelerationStructure += +> +unimplemented +! +( +) } } } @@ -7806,4 +7832,114 @@ stop_capture ) ; } +unsafe +fn +get_acceleration_structure_build_sizes +( +& +self +_desc +: +& +crate +: +: +GetAccelerationStructureBuildSizesDescriptor +< +super +: +: +Api +> +) +- +> +crate +: +: +AccelerationStructureBuildSizes +{ +unimplemented +! +( +) +} +unsafe +fn +get_acceleration_structure_device_address +( +& +self +_acceleration_structure +: +& +super +: +: +AccelerationStructure +) +- +> +wgt +: +: +BufferAddress +{ +unimplemented +! +( +) +} +unsafe +fn +create_acceleration_structure +( +& +self +_desc +: +& +crate +: +: +AccelerationStructureDescriptor +) +- +> +Result +< +super +: +: +AccelerationStructure +crate +: +: +DeviceError +> +{ +unimplemented +! +( +) +} +unsafe +fn +destroy_acceleration_structure +( +& +self +_acceleration_structure +: +super +: +: +AccelerationStructure +) +{ +unimplemented +! +( +) +} } diff --git a/third_party/rust/wgpu-hal/src/metal/mod.rs b/third_party/rust/wgpu-hal/src/metal/mod.rs index ae9f3bfdce442..52b929527d304 100644 --- a/third_party/rust/wgpu-hal/src/metal/mod.rs +++ b/third_party/rust/wgpu-hal/src/metal/mod.rs @@ -202,6 +202,11 @@ ComputePipeline = ComputePipeline ; +type +AccelerationStructure += +AccelerationStructure +; } pub struct @@ -4090,3 +4095,14 @@ for CommandBuffer { } +# +[ +derive +( +Debug +) +] +pub +struct +AccelerationStructure +; diff --git a/third_party/rust/wgpu-hal/src/vulkan/adapter.rs b/third_party/rust/wgpu-hal/src/vulkan/adapter.rs index fc9c721d38449..cefeaf0bdf382 100644 --- a/third_party/rust/wgpu-hal/src/vulkan/adapter.rs +++ b/third_party/rust/wgpu-hal/src/vulkan/adapter.rs @@ -209,6 +209,33 @@ vk PhysicalDevice16BitStorageFeatures ) > +acceleration_structure +: +Option +< +vk +: +: +PhysicalDeviceAccelerationStructureFeaturesKHR +> +buffer_device_address +: +Option +< +vk +: +: +PhysicalDeviceBufferDeviceAddressFeaturesKHR +> +ray_query +: +Option +< +vk +: +: +PhysicalDeviceRayQueryFeaturesKHR +> zero_initialize_workgroup_memory : Option @@ -482,6 +509,75 @@ feature ) ; } +if +let +Some +( +ref +mut +feature +) += +self +. +acceleration_structure +{ +info += +info +. +push_next +( +feature +) +; +} +if +let +Some +( +ref +mut +feature +) += +self +. +buffer_device_address +{ +info += +info +. +push_next +( +feature +) +; +} +if +let +Some +( +ref +mut +feature +) += +self +. +ray_query +{ +info += +info +. +push_next +( +feature +) +; +} info } fn @@ -1508,6 +1604,141 @@ else { None } +acceleration_structure +: +if +enabled_extensions +. +contains +( +& +vk +: +: +KhrAccelerationStructureFn +: +: +name +( +) +) +{ +Some +( +vk +: +: +PhysicalDeviceAccelerationStructureFeaturesKHR +: +: +builder +( +) +. +acceleration_structure +( +true +) +. +build +( +) +) +} +else +{ +None +} +buffer_device_address +: +if +enabled_extensions +. +contains +( +& +vk +: +: +KhrBufferDeviceAddressFn +: +: +name +( +) +) +{ +Some +( +vk +: +: +PhysicalDeviceBufferDeviceAddressFeaturesKHR +: +: +builder +( +) +. +buffer_device_address +( +true +) +. +build +( +) +) +} +else +{ +None +} +ray_query +: +if +enabled_extensions +. +contains +( +& +vk +: +: +KhrRayQueryFn +: +: +name +( +) +) +{ +Some +( +vk +: +: +PhysicalDeviceRayQueryFeaturesKHR +: +: +builder +( +) +. +ray_query +( +true +) +. +build +( +) +) +} +else +{ +None +} zero_initialize_workgroup_memory : if @@ -2702,6 +2933,86 @@ DEPTH32FLOAT_STENCIL8 texture_d32_s8 ) ; +features +. +set +( +F +: +: +RAY_TRACING_ACCELERATION_STRUCTURE +caps +. +supports_extension +( +vk +: +: +KhrDeferredHostOperationsFn +: +: +name +( +) +) +& +& +caps +. +supports_extension +( +vk +: +: +KhrAccelerationStructureFn +: +: +name +( +) +) +& +& +caps +. +supports_extension +( +vk +: +: +KhrBufferDeviceAddressFn +: +: +name +( +) +) +) +; +features +. +set +( +F +: +: +RAY_QUERY +caps +. +supports_extension +( +vk +: +: +KhrRayQueryFn +: +: +name +( +) +) +) +; let rg11b10ufloat_renderable = @@ -2960,6 +3271,7 @@ support derive ( Default +Debug ) ] pub @@ -2999,6 +3311,15 @@ vk : PhysicalDeviceDescriptorIndexingPropertiesEXT > +acceleration_structure +: +Option +< +vk +: +: +PhysicalDeviceAccelerationStructurePropertiesKHR +> driver : Option @@ -3712,6 +4033,96 @@ wgt Features : : +RAY_TRACING_ACCELERATION_STRUCTURE +) +{ +extensions +. +push +( +vk +: +: +KhrDeferredHostOperationsFn +: +: +name +( +) +) +; +extensions +. +push +( +vk +: +: +KhrAccelerationStructureFn +: +: +name +( +) +) +; +extensions +. +push +( +vk +: +: +KhrBufferDeviceAddressFn +: +: +name +( +) +) +; +} +if +requested_features +. +contains +( +wgt +: +: +Features +: +: +RAY_QUERY +) +{ +extensions +. +push +( +vk +: +: +KhrRayQueryFn +: +: +name +( +) +) +; +} +if +requested_features +. +contains +( +wgt +: +: +Features +: +: CONSERVATIVE_RASTERIZATION ) { @@ -4404,6 +4815,24 @@ name ) ; let +supports_acceleration_structure += +capabilities +. +supports_extension +( +vk +: +: +KhrAccelerationStructureFn +: +: +name +( +) +) +; +let mut builder = @@ -4429,7 +4858,50 @@ Some vk : : -PhysicalDeviceMaintenance3Properties +PhysicalDeviceMaintenance3Properties +: +: +default +( +) +) +; +builder += +builder +. +push_next +( +capabilities +. +maintenance_3 +. +as_mut +( +) +. +unwrap +( +) +) +; +} +if +supports_descriptor_indexing +{ +let +next += +capabilities +. +descriptor_indexing +. +insert +( +vk +: +: +PhysicalDeviceDescriptorIndexingPropertiesEXT : : default @@ -4443,36 +4915,26 @@ builder . push_next ( -capabilities -. -maintenance_3 -. -as_mut -( -) -. -unwrap -( -) +next ) ; } if -supports_descriptor_indexing +supports_acceleration_structure { let next = capabilities . -descriptor_indexing +acceleration_structure . insert ( vk : : -PhysicalDeviceDescriptorIndexingPropertiesEXT +PhysicalDeviceAccelerationStructurePropertiesKHR : : default @@ -5036,6 +5498,52 @@ next if capabilities . +supports_extension +( +vk +: +: +KhrAccelerationStructureFn +: +: +name +( +) +) +{ +let +next += +features +. +acceleration_structure +. +insert +( +vk +: +: +PhysicalDeviceAccelerationStructureFeaturesKHR +: +: +default +( +) +) +; +builder += +builder +. +push_next +( +next +) +; +} +if +capabilities +. device_api_version > = @@ -5536,81 +6044,6 @@ empty ) ; { -let -_is_windows_intel_dual_src_bug -= -cfg -! -( -windows -) -& -& -phd_capabilities -. -properties -. -vendor_id -= -= -db -: -: -intel -: -: -VENDOR -& -& -( -phd_capabilities -. -properties -. -device_id -& -db -: -: -intel -: -: -DEVICE_KABY_LAKE_MASK -= -= -db -: -: -intel -: -: -DEVICE_KABY_LAKE_MASK -| -| -phd_capabilities -. -properties -. -device_id -& -db -: -: -intel -: -: -DEVICE_SKY_LAKE_MASK -= -= -db -: -: -intel -: -: -DEVICE_SKY_LAKE_MASK -) -; workarounds | = @@ -7098,6 +7531,96 @@ None } ; let +ray_tracing_fns += +if +enabled_extensions +. +contains +( +& +khr +: +: +AccelerationStructure +: +: +name +( +) +) +& +& +enabled_extensions +. +contains +( +& +khr +: +: +BufferDeviceAddress +: +: +name +( +) +) +{ +Some +( +super +: +: +RayTracingDeviceExtensionFunctions +{ +acceleration_structure +: +khr +: +: +AccelerationStructure +: +: +new +( +& +self +. +instance +. +raw +& +raw_device +) +buffer_device_address +: +khr +: +: +BufferDeviceAddress +: +: +new +( +& +self +. +instance +. +raw +& +raw_device +) +} +) +} +else +{ +None +} +; +let naga_options = { @@ -7348,6 +7871,34 @@ StorageImageWriteWithoutFormat ) ; } +if +features +. +contains +( +wgt +: +: +Features +: +: +RAY_QUERY +) +{ +capabilities +. +push +( +spv +: +: +Capability +: +: +RayQueryKHR +) +; +} let mut flags @@ -7708,6 +8259,9 @@ indirect_count_fn timeline_semaphore : timeline_semaphore_fn +ray_tracing +: +ray_tracing_fns } vendor_id : @@ -8033,7 +8587,21 @@ collect ) buffer_device_address : -false +enabled_extensions +. +contains +( +& +khr +: +: +BufferDeviceAddress +: +: +name +( +) +) } ; gpu_alloc diff --git a/third_party/rust/wgpu-hal/src/vulkan/command.rs b/third_party/rust/wgpu-hal/src/vulkan/command.rs index ec15be3192231..f39b7fdc92b55 100644 --- a/third_party/rust/wgpu-hal/src/vulkan/command.rs +++ b/third_party/rust/wgpu-hal/src/vulkan/command.rs @@ -2322,6 +2322,1468 @@ WAIT } unsafe fn +build_acceleration_structures +< +' +a +T +> +( +& +mut +self +descriptor_count +: +u32 +descriptors +: +T +) +where +super +: +: +Api +: +' +a +T +: +IntoIterator +< +Item += +crate +: +: +BuildAccelerationStructureDescriptor +< +' +a +super +: +: +Api +> +> +{ +const +CAPACITY_OUTER +: +usize += +8 +; +const +CAPACITY_INNER +: +usize += +1 +; +let +descriptor_count += +descriptor_count +as +usize +; +let +ray_tracing_functions += +self +. +device +. +extension_fns +. +ray_tracing +. +as_ref +( +) +. +expect +( +" +Feature +RAY_TRACING +not +enabled +" +) +; +let +get_device_address += +| +buffer +: +Option +< +& +super +: +: +Buffer +> +| +unsafe +{ +match +buffer +{ +Some +( +buffer +) += +> +ray_tracing_functions +. +buffer_device_address +. +get_buffer_device_address +( +& +vk +: +: +BufferDeviceAddressInfo +: +: +builder +( +) +. +buffer +( +buffer +. +raw +) +) +None += +> +panic +! +( +" +Buffers +are +required +to +build +acceleration +structures +" +) +} +} +; +let +mut +ranges_storage += +smallvec +: +: +SmallVec +: +: +< +[ +smallvec +: +: +SmallVec +< +[ +vk +: +: +AccelerationStructureBuildRangeInfoKHR +; +CAPACITY_INNER +] +> +; +CAPACITY_OUTER +] +> +: +: +with_capacity +( +descriptor_count +) +; +let +mut +geometries_storage += +smallvec +: +: +SmallVec +: +: +< +[ +smallvec +: +: +SmallVec +< +[ +vk +: +: +AccelerationStructureGeometryKHR +; +CAPACITY_INNER +] +> +; +CAPACITY_OUTER +] +> +: +: +with_capacity +( +descriptor_count +) +; +let +mut +geometry_infos += +smallvec +: +: +SmallVec +: +: +< +[ +vk +: +: +AccelerationStructureBuildGeometryInfoKHR +; +CAPACITY_OUTER +] +> +: +: +with_capacity +( +descriptor_count +) +; +let +mut +ranges_ptrs += +smallvec +: +: +SmallVec +: +: +< +[ +& +[ +vk +: +: +AccelerationStructureBuildRangeInfoKHR +] +; +CAPACITY_OUTER +] +> +: +: +with_capacity +( +descriptor_count +) +; +for +desc +in +descriptors +{ +let +( +geometries +ranges +) += +match +* +desc +. +entries +{ +crate +: +: +AccelerationStructureEntries +: +: +Instances +( +ref +instances +) += +> +{ +let +instance_data += +vk +: +: +AccelerationStructureGeometryInstancesDataKHR +: +: +builder +( +) +. +data +( +vk +: +: +DeviceOrHostAddressConstKHR +{ +device_address +: +get_device_address +( +instances +. +buffer +) +} +) +; +let +geometry += +vk +: +: +AccelerationStructureGeometryKHR +: +: +builder +( +) +. +geometry_type +( +vk +: +: +GeometryTypeKHR +: +: +INSTANCES +) +. +geometry +( +vk +: +: +AccelerationStructureGeometryDataKHR +{ +instances +: +* +instance_data +} +) +; +let +range += +vk +: +: +AccelerationStructureBuildRangeInfoKHR +: +: +builder +( +) +. +primitive_count +( +instances +. +count +) +. +primitive_offset +( +instances +. +offset +) +; +( +smallvec +: +: +smallvec +! +[ +* +geometry +] +smallvec +: +: +smallvec +! +[ +* +range +] +) +} +crate +: +: +AccelerationStructureEntries +: +: +Triangles +( +ref +in_geometries +) += +> +{ +let +mut +ranges += +smallvec +: +: +SmallVec +: +: +< +[ +vk +: +: +AccelerationStructureBuildRangeInfoKHR +; +CAPACITY_INNER +] +> +: +: +with_capacity +( +in_geometries +. +len +( +) +) +; +let +mut +geometries += +smallvec +: +: +SmallVec +: +: +< +[ +vk +: +: +AccelerationStructureGeometryKHR +; +CAPACITY_INNER +] +> +: +: +with_capacity +( +in_geometries +. +len +( +) +) +; +for +triangles +in +in_geometries +{ +let +mut +triangle_data += +vk +: +: +AccelerationStructureGeometryTrianglesDataKHR +: +: +builder +( +) +. +vertex_data +( +vk +: +: +DeviceOrHostAddressConstKHR +{ +device_address +: +get_device_address +( +triangles +. +vertex_buffer +) +} +) +. +vertex_format +( +conv +: +: +map_vertex_format +( +triangles +. +vertex_format +) +) +. +max_vertex +( +triangles +. +vertex_count +) +. +vertex_stride +( +triangles +. +vertex_stride +) +; +let +mut +range += +vk +: +: +AccelerationStructureBuildRangeInfoKHR +: +: +builder +( +) +; +if +let +Some +( +ref +indices +) += +triangles +. +indices +{ +triangle_data += +triangle_data +. +index_data +( +vk +: +: +DeviceOrHostAddressConstKHR +{ +device_address +: +get_device_address +( +indices +. +buffer +) +} +) +. +index_type +( +conv +: +: +map_index_format +( +indices +. +format +) +) +; +range += +range +. +primitive_count +( +indices +. +count +/ +3 +) +. +primitive_offset +( +indices +. +offset +) +. +first_vertex +( +triangles +. +first_vertex +) +; +} +else +{ +range += +range +. +primitive_count +( +triangles +. +vertex_count +) +. +first_vertex +( +triangles +. +first_vertex +) +; +} +if +let +Some +( +ref +transform +) += +triangles +. +transform +{ +let +transform_device_address += +unsafe +{ +ray_tracing_functions +. +buffer_device_address +. +get_buffer_device_address +( +& +vk +: +: +BufferDeviceAddressInfo +: +: +builder +( +) +. +buffer +( +transform +. +buffer +. +raw +) +) +} +; +triangle_data += +triangle_data +. +transform_data +( +vk +: +: +DeviceOrHostAddressConstKHR +{ +device_address +: +transform_device_address +} +) +; +range += +range +. +transform_offset +( +transform +. +offset +) +; +} +let +geometry += +vk +: +: +AccelerationStructureGeometryKHR +: +: +builder +( +) +. +geometry_type +( +vk +: +: +GeometryTypeKHR +: +: +TRIANGLES +) +. +geometry +( +vk +: +: +AccelerationStructureGeometryDataKHR +{ +triangles +: +* +triangle_data +} +) +. +flags +( +conv +: +: +map_acceleration_structure_geomety_flags +( +triangles +. +flags +) +) +; +geometries +. +push +( +* +geometry +) +; +ranges +. +push +( +* +range +) +; +} +( +geometries +ranges +) +} +crate +: +: +AccelerationStructureEntries +: +: +AABBs +( +ref +in_geometries +) += +> +{ +let +mut +ranges += +smallvec +: +: +SmallVec +: +: +< +[ +vk +: +: +AccelerationStructureBuildRangeInfoKHR +; +CAPACITY_INNER +] +> +: +: +with_capacity +( +in_geometries +. +len +( +) +) +; +let +mut +geometries += +smallvec +: +: +SmallVec +: +: +< +[ +vk +: +: +AccelerationStructureGeometryKHR +; +CAPACITY_INNER +] +> +: +: +with_capacity +( +in_geometries +. +len +( +) +) +; +for +aabb +in +in_geometries +{ +let +aabbs_data += +vk +: +: +AccelerationStructureGeometryAabbsDataKHR +: +: +builder +( +) +. +data +( +vk +: +: +DeviceOrHostAddressConstKHR +{ +device_address +: +get_device_address +( +aabb +. +buffer +) +} +) +. +stride +( +aabb +. +stride +) +; +let +range += +vk +: +: +AccelerationStructureBuildRangeInfoKHR +: +: +builder +( +) +. +primitive_count +( +aabb +. +count +) +. +primitive_offset +( +aabb +. +offset +) +; +let +geometry += +vk +: +: +AccelerationStructureGeometryKHR +: +: +builder +( +) +. +geometry_type +( +vk +: +: +GeometryTypeKHR +: +: +AABBS +) +. +geometry +( +vk +: +: +AccelerationStructureGeometryDataKHR +{ +aabbs +: +* +aabbs_data +} +) +. +flags +( +conv +: +: +map_acceleration_structure_geomety_flags +( +aabb +. +flags +) +) +; +geometries +. +push +( +* +geometry +) +; +ranges +. +push +( +* +range +) +; +} +( +geometries +ranges +) +} +} +; +ranges_storage +. +push +( +ranges +) +; +geometries_storage +. +push +( +geometries +) +; +let +scratch_device_address += +unsafe +{ +ray_tracing_functions +. +buffer_device_address +. +get_buffer_device_address +( +& +vk +: +: +BufferDeviceAddressInfo +: +: +builder +( +) +. +buffer +( +desc +. +scratch_buffer +. +raw +) +) +} +; +let +ty += +match +* +desc +. +entries +{ +crate +: +: +AccelerationStructureEntries +: +: +Instances +( +_ +) += +> +{ +vk +: +: +AccelerationStructureTypeKHR +: +: +TOP_LEVEL +} +_ += +> +vk +: +: +AccelerationStructureTypeKHR +: +: +BOTTOM_LEVEL +} +; +let +mut +geometry_info += +vk +: +: +AccelerationStructureBuildGeometryInfoKHR +: +: +builder +( +) +. +ty +( +ty +) +. +mode +( +conv +: +: +map_acceleration_structure_build_mode +( +desc +. +mode +) +) +. +flags +( +conv +: +: +map_acceleration_structure_flags +( +desc +. +flags +) +) +. +dst_acceleration_structure +( +desc +. +destination_acceleration_structure +. +raw +) +. +scratch_data +( +vk +: +: +DeviceOrHostAddressKHR +{ +device_address +: +scratch_device_address ++ +desc +. +scratch_buffer_offset +} +) +; +if +desc +. +mode += += +crate +: +: +AccelerationStructureBuildMode +: +: +Update +{ +geometry_info +. +src_acceleration_structure += +desc +. +source_acceleration_structure +. +unwrap_or +( +desc +. +destination_acceleration_structure +) +. +raw +; +} +geometry_infos +. +push +( +* +geometry_info +) +; +} +for +( +i +geometry_info +) +in +geometry_infos +. +iter_mut +( +) +. +enumerate +( +) +{ +geometry_info +. +geometry_count += +geometries_storage +[ +i +] +. +len +( +) +as +u32 +; +geometry_info +. +p_geometries += +geometries_storage +[ +i +] +. +as_ptr +( +) +; +ranges_ptrs +. +push +( +& +ranges_storage +[ +i +] +) +; +} +unsafe +{ +ray_tracing_functions +. +acceleration_structure +. +cmd_build_acceleration_structures +( +self +. +active +& +geometry_infos +& +ranges_ptrs +) +; +} +} +unsafe +fn +place_acceleration_structure_barrier +( +& +mut +self +barrier +: +crate +: +: +AccelerationStructureBarrier +) +{ +let +( +src_stage +src_access +) += +conv +: +: +map_acceleration_structure_usage_to_barrier +( +barrier +. +usage +. +start +) +; +let +( +dst_stage +dst_access +) += +conv +: +: +map_acceleration_structure_usage_to_barrier +( +barrier +. +usage +. +end +) +; +unsafe +{ +self +. +device +. +raw +. +cmd_pipeline_barrier +( +self +. +active +src_stage +| +vk +: +: +PipelineStageFlags +: +: +TOP_OF_PIPE +dst_stage +| +vk +: +: +PipelineStageFlags +: +: +BOTTOM_OF_PIPE +vk +: +: +DependencyFlags +: +: +empty +( +) +& +[ +vk +: +: +MemoryBarrier +: +: +builder +( +) +. +src_access_mask +( +src_access +) +. +dst_access_mask +( +dst_access +) +. +build +( +) +] +& +[ +] +& +[ +] +) +} +; +} +unsafe +fn begin_render_pass ( & diff --git a/third_party/rust/wgpu-hal/src/vulkan/conv.rs b/third_party/rust/wgpu-hal/src/vulkan/conv.rs index d627a6bace3d5..714548cf60d4c 100644 --- a/third_party/rust/wgpu-hal/src/vulkan/conv.rs +++ b/third_party/rust/wgpu-hal/src/vulkan/conv.rs @@ -4467,6 +4467,82 @@ BufferUsageFlags INDIRECT_BUFFER ; } +if +usage +. +contains +( +crate +: +: +BufferUses +: +: +ACCELERATION_STRUCTURE_SCRATCH +) +{ +flags +| += +vk +: +: +BufferUsageFlags +: +: +STORAGE_BUFFER +| +vk +: +: +BufferUsageFlags +: +: +SHADER_DEVICE_ADDRESS +; +} +if +usage +. +intersects +( +crate +: +: +BufferUses +: +: +BOTTOM_LEVEL_ACCELERATION_STRUCTURE_INPUT +| +crate +: +: +BufferUses +: +: +TOP_LEVEL_ACCELERATION_STRUCTURE_INPUT +) +{ +flags +| += +vk +: +: +BufferUsageFlags +: +: +ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_KHR +| +vk +: +: +BufferUsageFlags +: +: +SHADER_DEVICE_ADDRESS +; +} flags } pub @@ -4908,6 +4984,67 @@ AccessFlags INDIRECT_COMMAND_READ ; } +if +usage +. +intersects +( +crate +: +: +BufferUses +: +: +BOTTOM_LEVEL_ACCELERATION_STRUCTURE_INPUT +| +crate +: +: +BufferUses +: +: +TOP_LEVEL_ACCELERATION_STRUCTURE_INPUT +| +crate +: +: +BufferUses +: +: +ACCELERATION_STRUCTURE_SCRATCH +) +{ +stages +| += +vk +: +: +PipelineStageFlags +: +: +ACCELERATION_STRUCTURE_BUILD_KHR +; +access +| += +vk +: +: +AccessFlags +: +: +ACCELERATION_STRUCTURE_READ_KHR +| +vk +: +: +AccessFlags +: +: +ACCELERATION_STRUCTURE_WRITE_KHR +; +} ( stages access @@ -6040,6 +6177,22 @@ DescriptorType : : STORAGE_IMAGE +wgt +: +: +BindingType +: +: +AccelerationStructure += +> +vk +: +: +DescriptorType +: +: +ACCELERATION_STRUCTURE_KHR } } pub @@ -7091,3 +7244,552 @@ COMPUTE_SHADER_INVOCATIONS } flags } +pub +fn +map_acceleration_structure_format +( +format +: +crate +: +: +AccelerationStructureFormat +) +- +> +vk +: +: +AccelerationStructureTypeKHR +{ +match +format +{ +crate +: +: +AccelerationStructureFormat +: +: +TopLevel += +> +vk +: +: +AccelerationStructureTypeKHR +: +: +TOP_LEVEL +crate +: +: +AccelerationStructureFormat +: +: +BottomLevel += +> +{ +vk +: +: +AccelerationStructureTypeKHR +: +: +BOTTOM_LEVEL +} +} +} +pub +fn +map_acceleration_structure_build_mode +( +format +: +crate +: +: +AccelerationStructureBuildMode +) +- +> +vk +: +: +BuildAccelerationStructureModeKHR +{ +match +format +{ +crate +: +: +AccelerationStructureBuildMode +: +: +Build += +> +{ +vk +: +: +BuildAccelerationStructureModeKHR +: +: +BUILD +} +crate +: +: +AccelerationStructureBuildMode +: +: +Update += +> +{ +vk +: +: +BuildAccelerationStructureModeKHR +: +: +UPDATE +} +} +} +pub +fn +map_acceleration_structure_flags +( +flags +: +crate +: +: +AccelerationStructureBuildFlags +) +- +> +vk +: +: +BuildAccelerationStructureFlagsKHR +{ +let +mut +vk_flags += +vk +: +: +BuildAccelerationStructureFlagsKHR +: +: +empty +( +) +; +if +flags +. +contains +( +crate +: +: +AccelerationStructureBuildFlags +: +: +PREFER_FAST_TRACE +) +{ +vk_flags +| += +vk +: +: +BuildAccelerationStructureFlagsKHR +: +: +PREFER_FAST_TRACE +; +} +if +flags +. +contains +( +crate +: +: +AccelerationStructureBuildFlags +: +: +PREFER_FAST_BUILD +) +{ +vk_flags +| += +vk +: +: +BuildAccelerationStructureFlagsKHR +: +: +PREFER_FAST_BUILD +; +} +if +flags +. +contains +( +crate +: +: +AccelerationStructureBuildFlags +: +: +ALLOW_UPDATE +) +{ +vk_flags +| += +vk +: +: +BuildAccelerationStructureFlagsKHR +: +: +ALLOW_UPDATE +; +} +if +flags +. +contains +( +crate +: +: +AccelerationStructureBuildFlags +: +: +LOW_MEMORY +) +{ +vk_flags +| += +vk +: +: +BuildAccelerationStructureFlagsKHR +: +: +LOW_MEMORY +; +} +if +flags +. +contains +( +crate +: +: +AccelerationStructureBuildFlags +: +: +ALLOW_COMPACTION +) +{ +vk_flags +| += +vk +: +: +BuildAccelerationStructureFlagsKHR +: +: +ALLOW_COMPACTION +} +vk_flags +} +pub +fn +map_acceleration_structure_geomety_flags +( +flags +: +crate +: +: +AccelerationStructureGeometryFlags +) +- +> +vk +: +: +GeometryFlagsKHR +{ +let +mut +vk_flags += +vk +: +: +GeometryFlagsKHR +: +: +empty +( +) +; +if +flags +. +contains +( +crate +: +: +AccelerationStructureGeometryFlags +: +: +OPAQUE +) +{ +vk_flags +| += +vk +: +: +GeometryFlagsKHR +: +: +OPAQUE +; +} +if +flags +. +contains +( +crate +: +: +AccelerationStructureGeometryFlags +: +: +NO_DUPLICATE_ANY_HIT_INVOCATION +) +{ +vk_flags +| += +vk +: +: +GeometryFlagsKHR +: +: +NO_DUPLICATE_ANY_HIT_INVOCATION +; +} +vk_flags +} +pub +fn +map_acceleration_structure_usage_to_barrier +( +usage +: +crate +: +: +AccelerationStructureUses +) +- +> +( +vk +: +: +PipelineStageFlags +vk +: +: +AccessFlags +) +{ +let +mut +stages += +vk +: +: +PipelineStageFlags +: +: +empty +( +) +; +let +mut +access += +vk +: +: +AccessFlags +: +: +empty +( +) +; +if +usage +. +contains +( +crate +: +: +AccelerationStructureUses +: +: +BUILD_INPUT +) +{ +stages +| += +vk +: +: +PipelineStageFlags +: +: +ACCELERATION_STRUCTURE_BUILD_KHR +; +access +| += +vk +: +: +AccessFlags +: +: +ACCELERATION_STRUCTURE_READ_KHR +; +} +if +usage +. +contains +( +crate +: +: +AccelerationStructureUses +: +: +BUILD_OUTPUT +) +{ +stages +| += +vk +: +: +PipelineStageFlags +: +: +ACCELERATION_STRUCTURE_BUILD_KHR +; +access +| += +vk +: +: +AccessFlags +: +: +ACCELERATION_STRUCTURE_WRITE_KHR +; +} +if +usage +. +contains +( +crate +: +: +AccelerationStructureUses +: +: +SHADER_INPUT +) +{ +stages +| += +vk +: +: +PipelineStageFlags +: +: +VERTEX_SHADER +| +vk +: +: +PipelineStageFlags +: +: +FRAGMENT_SHADER +| +vk +: +: +PipelineStageFlags +: +: +COMPUTE_SHADER +; +access +| += +vk +: +: +AccessFlags +: +: +ACCELERATION_STRUCTURE_READ_KHR +; +} +( +stages +access +) +} diff --git a/third_party/rust/wgpu-hal/src/vulkan/device.rs b/third_party/rust/wgpu-hal/src/vulkan/device.rs index 85da26a3f48ed..c71e36b70f4fd 100644 --- a/third_party/rust/wgpu-hal/src/vulkan/device.rs +++ b/third_party/rust/wgpu-hal/src/vulkan/device.rs @@ -5532,6 +5532,44 @@ TRANSIENT ) ; let +alignment_mask += +if +desc +. +usage +. +intersects +( +crate +: +: +BufferUses +: +: +TOP_LEVEL_ACCELERATION_STRUCTURE_INPUT +| +crate +: +: +BufferUses +: +: +BOTTOM_LEVEL_ACCELERATION_STRUCTURE_INPUT +) +{ +16 +} +else +{ +req +. +alignment +} +- +1 +; +let block = unsafe @@ -5563,11 +5601,7 @@ req size align_mask : -req -. -alignment -- -1 +alignment_mask usage : alloc_usage @@ -6284,6 +6318,16 @@ shared private_caps . image_format_list +& +& +! +desc +. +format +. +is_multi_planar_format +( +) { vk_view_formats = @@ -8125,6 +8169,24 @@ storage_image count ; } +wgt +: +: +BindingType +: +: +AccelerationStructure += +> +{ +desc_count +. +acceleration_structure ++ += +count +; +} } } let @@ -9080,6 +9142,42 @@ len ) ) ; +let +mut +acceleration_structure_infos += +Vec +: +: +with_capacity +( +desc +. +acceleration_structures +. +len +( +) +) +; +let +mut +raw_acceleration_structures += +Vec +: +: +with_capacity +( +desc +. +acceleration_structures +. +len +( +) +) +; for entry in @@ -9151,6 +9249,12 @@ descriptor_type ty ) ; +let +mut +extra_descriptor_count += +0 +; write = match @@ -9546,24 +9650,195 @@ index ] ) } -_ +vk +: +: +DescriptorType +: +: +ACCELERATION_STRUCTURE_KHR = > -unreachable +{ +let +index += +acceleration_structure_infos +. +len +( +) +; +let +start += +entry +. +resource_index +; +let +end += +start ++ +entry +. +count +; +let +raw_start += +raw_acceleration_structures +. +len +( +) +; +raw_acceleration_structures +. +extend +( +desc +. +acceleration_structures +[ +start +as +usize +. +. +end +as +usize +] +. +iter +( +) +. +map +( +| +acceleration_structure +| +acceleration_structure +. +raw +) +) +; +let +acceleration_structure_info += +vk +: +: +WriteDescriptorSetAccelerationStructureKHR +: +: +builder +( +) +. +acceleration_structures +( +& +raw_acceleration_structures +[ +raw_start +. +. +] +) +; +let +acceleration_structure_info +: +vk +: +: +WriteDescriptorSetAccelerationStructureKHR += +* +acceleration_structure_info +; +assert ! ( +index +< +desc +. +acceleration_structures +. +len +( +) +" +Encountered +more +acceleration +structures +then +expected +" ) -} ; -writes +acceleration_structure_infos . push ( +acceleration_structure_info +) +; +extra_descriptor_count ++ += +1 +; +write +. +push_next +( +& +mut +acceleration_structure_infos +[ +index +] +) +} +_ += +> +unreachable +! +( +) +} +; +let +mut +write += write . build ( ) +; +write +. +descriptor_count ++ += +extra_descriptor_count +; +writes +. +push +( +write ) ; } @@ -13083,6 +13358,1222 @@ null_mut } } } +unsafe +fn +get_acceleration_structure_build_sizes +< +' +a +> +( +& +self +desc +: +& +crate +: +: +GetAccelerationStructureBuildSizesDescriptor +< +' +a +super +: +: +Api +> +) +- +> +crate +: +: +AccelerationStructureBuildSizes +{ +const +CAPACITY +: +usize += +8 +; +let +ray_tracing_functions += +self +. +shared +. +extension_fns +. +ray_tracing +. +as_ref +( +) +. +expect +( +" +Feature +RAY_TRACING +not +enabled +" +) +; +let +( +geometries +primitive_counts +) += +match +* +desc +. +entries +{ +crate +: +: +AccelerationStructureEntries +: +: +Instances +( +ref +instances +) += +> +{ +let +instance_data += +vk +: +: +AccelerationStructureGeometryInstancesDataKHR +: +: +default +( +) +; +let +geometry += +vk +: +: +AccelerationStructureGeometryKHR +: +: +builder +( +) +. +geometry_type +( +vk +: +: +GeometryTypeKHR +: +: +INSTANCES +) +. +geometry +( +vk +: +: +AccelerationStructureGeometryDataKHR +{ +instances +: +instance_data +} +) +; +( +smallvec +: +: +smallvec +! +[ +* +geometry +] +smallvec +: +: +smallvec +! +[ +instances +. +count +] +) +} +crate +: +: +AccelerationStructureEntries +: +: +Triangles +( +ref +in_geometries +) += +> +{ +let +mut +primitive_counts += +smallvec +: +: +SmallVec +: +: +< +[ +u32 +; +CAPACITY +] +> +: +: +with_capacity +( +in_geometries +. +len +( +) +) +; +let +mut +geometries += +smallvec +: +: +SmallVec +: +: +< +[ +vk +: +: +AccelerationStructureGeometryKHR +; +CAPACITY +] +> +: +: +with_capacity +( +in_geometries +. +len +( +) +) +; +for +triangles +in +in_geometries +{ +let +mut +triangle_data += +vk +: +: +AccelerationStructureGeometryTrianglesDataKHR +: +: +builder +( +) +. +vertex_format +( +conv +: +: +map_vertex_format +( +triangles +. +vertex_format +) +) +. +max_vertex +( +triangles +. +vertex_count +) +. +vertex_stride +( +triangles +. +vertex_stride +) +; +let +pritive_count += +if +let +Some +( +ref +indices +) += +triangles +. +indices +{ +triangle_data += +triangle_data +. +index_type +( +conv +: +: +map_index_format +( +indices +. +format +) +) +; +indices +. +count +/ +3 +} +else +{ +triangles +. +vertex_count +} +; +let +geometry += +vk +: +: +AccelerationStructureGeometryKHR +: +: +builder +( +) +. +geometry_type +( +vk +: +: +GeometryTypeKHR +: +: +TRIANGLES +) +. +geometry +( +vk +: +: +AccelerationStructureGeometryDataKHR +{ +triangles +: +* +triangle_data +} +) +. +flags +( +conv +: +: +map_acceleration_structure_geomety_flags +( +triangles +. +flags +) +) +; +geometries +. +push +( +* +geometry +) +; +primitive_counts +. +push +( +pritive_count +) +; +} +( +geometries +primitive_counts +) +} +crate +: +: +AccelerationStructureEntries +: +: +AABBs +( +ref +in_geometries +) += +> +{ +let +mut +primitive_counts += +smallvec +: +: +SmallVec +: +: +< +[ +u32 +; +CAPACITY +] +> +: +: +with_capacity +( +in_geometries +. +len +( +) +) +; +let +mut +geometries += +smallvec +: +: +SmallVec +: +: +< +[ +vk +: +: +AccelerationStructureGeometryKHR +; +CAPACITY +] +> +: +: +with_capacity +( +in_geometries +. +len +( +) +) +; +for +aabb +in +in_geometries +{ +let +aabbs_data += +vk +: +: +AccelerationStructureGeometryAabbsDataKHR +: +: +builder +( +) +. +stride +( +aabb +. +stride +) +; +let +geometry += +vk +: +: +AccelerationStructureGeometryKHR +: +: +builder +( +) +. +geometry_type +( +vk +: +: +GeometryTypeKHR +: +: +AABBS +) +. +geometry +( +vk +: +: +AccelerationStructureGeometryDataKHR +{ +aabbs +: +* +aabbs_data +} +) +. +flags +( +conv +: +: +map_acceleration_structure_geomety_flags +( +aabb +. +flags +) +) +; +geometries +. +push +( +* +geometry +) +; +primitive_counts +. +push +( +aabb +. +count +) +; +} +( +geometries +primitive_counts +) +} +} +; +let +ty += +match +* +desc +. +entries +{ +crate +: +: +AccelerationStructureEntries +: +: +Instances +( +_ +) += +> +{ +vk +: +: +AccelerationStructureTypeKHR +: +: +TOP_LEVEL +} +_ += +> +vk +: +: +AccelerationStructureTypeKHR +: +: +BOTTOM_LEVEL +} +; +let +geometry_info += +vk +: +: +AccelerationStructureBuildGeometryInfoKHR +: +: +builder +( +) +. +ty +( +ty +) +. +flags +( +conv +: +: +map_acceleration_structure_flags +( +desc +. +flags +) +) +. +geometries +( +& +geometries +) +; +let +raw += +unsafe +{ +ray_tracing_functions +. +acceleration_structure +. +get_acceleration_structure_build_sizes +( +vk +: +: +AccelerationStructureBuildTypeKHR +: +: +DEVICE +& +geometry_info +& +primitive_counts +) +} +; +crate +: +: +AccelerationStructureBuildSizes +{ +acceleration_structure_size +: +raw +. +acceleration_structure_size +update_scratch_size +: +raw +. +update_scratch_size +build_scratch_size +: +raw +. +build_scratch_size +} +} +unsafe +fn +get_acceleration_structure_device_address +( +& +self +acceleration_structure +: +& +super +: +: +AccelerationStructure +) +- +> +wgt +: +: +BufferAddress +{ +let +ray_tracing_functions += +self +. +shared +. +extension_fns +. +ray_tracing +. +as_ref +( +) +. +expect +( +" +Feature +RAY_TRACING +not +enabled +" +) +; +unsafe +{ +ray_tracing_functions +. +acceleration_structure +. +get_acceleration_structure_device_address +( +& +vk +: +: +AccelerationStructureDeviceAddressInfoKHR +: +: +builder +( +) +. +acceleration_structure +( +acceleration_structure +. +raw +) +) +} +} +unsafe +fn +create_acceleration_structure +( +& +self +desc +: +& +crate +: +: +AccelerationStructureDescriptor +) +- +> +Result +< +super +: +: +AccelerationStructure +crate +: +: +DeviceError +> +{ +let +ray_tracing_functions += +self +. +shared +. +extension_fns +. +ray_tracing +. +as_ref +( +) +. +expect +( +" +Feature +RAY_TRACING +not +enabled +" +) +; +let +vk_buffer_info += +vk +: +: +BufferCreateInfo +: +: +builder +( +) +. +size +( +desc +. +size +) +. +usage +( +vk +: +: +BufferUsageFlags +: +: +ACCELERATION_STRUCTURE_STORAGE_KHR +) +. +sharing_mode +( +vk +: +: +SharingMode +: +: +EXCLUSIVE +) +; +unsafe +{ +let +raw_buffer += +self +. +shared +. +raw +. +create_buffer +( +& +vk_buffer_info +None +) +? +; +let +req += +self +. +shared +. +raw +. +get_buffer_memory_requirements +( +raw_buffer +) +; +let +block += +self +. +mem_allocator +. +lock +( +) +. +alloc +( +& +* +self +. +shared +gpu_alloc +: +: +Request +{ +size +: +req +. +size +align_mask +: +req +. +alignment +- +1 +usage +: +gpu_alloc +: +: +UsageFlags +: +: +FAST_DEVICE_ACCESS +memory_types +: +req +. +memory_type_bits +& +self +. +valid_ash_memory_types +} +) +? +; +self +. +shared +. +raw +. +bind_buffer_memory +( +raw_buffer +* +block +. +memory +( +) +block +. +offset +( +) +) +? +; +if +let +Some +( +label +) += +desc +. +label +{ +self +. +shared +. +set_object_name +( +vk +: +: +ObjectType +: +: +BUFFER +raw_buffer +label +) +; +} +let +vk_info += +vk +: +: +AccelerationStructureCreateInfoKHR +: +: +builder +( +) +. +buffer +( +raw_buffer +) +. +offset +( +0 +) +. +size +( +desc +. +size +) +. +ty +( +conv +: +: +map_acceleration_structure_format +( +desc +. +format +) +) +; +let +raw_acceleration_structure += +ray_tracing_functions +. +acceleration_structure +. +create_acceleration_structure +( +& +vk_info +None +) +? +; +if +let +Some +( +label +) += +desc +. +label +{ +self +. +shared +. +set_object_name +( +vk +: +: +ObjectType +: +: +ACCELERATION_STRUCTURE_KHR +raw_acceleration_structure +label +) +; +} +Ok +( +super +: +: +AccelerationStructure +{ +raw +: +raw_acceleration_structure +buffer +: +raw_buffer +block +: +Mutex +: +: +new +( +block +) +} +) +} +} +unsafe +fn +destroy_acceleration_structure +( +& +self +acceleration_structure +: +super +: +: +AccelerationStructure +) +{ +let +ray_tracing_functions += +self +. +shared +. +extension_fns +. +ray_tracing +. +as_ref +( +) +. +expect +( +" +Feature +RAY_TRACING +not +enabled +" +) +; +unsafe +{ +ray_tracing_functions +. +acceleration_structure +. +destroy_acceleration_structure +( +acceleration_structure +. +raw +None +) +; +self +. +shared +. +raw +. +destroy_buffer +( +acceleration_structure +. +buffer +None +) +; +self +. +mem_allocator +. +lock +( +) +. +dealloc +( +& +* +self +. +shared +acceleration_structure +. +block +. +into_inner +( +) +) +; +} +} } impl From diff --git a/third_party/rust/wgpu-hal/src/vulkan/mod.rs b/third_party/rust/wgpu-hal/src/vulkan/mod.rs index f584af0792950..ebe9b9ce4d1f8 100644 --- a/third_party/rust/wgpu-hal/src/vulkan/mod.rs +++ b/third_party/rust/wgpu-hal/src/vulkan/mod.rs @@ -188,6 +188,11 @@ Fence Fence ; type +AccelerationStructure += +AccelerationStructure +; +type BindGroupLayout = BindGroupLayout @@ -583,6 +588,28 @@ khr TimelineSemaphore > > +ray_tracing +: +Option +< +RayTracingDeviceExtensionFunctions +> +} +struct +RayTracingDeviceExtensionFunctions +{ +acceleration_structure +: +khr +: +: +AccelerationStructure +buffer_device_address +: +khr +: +: +BufferDeviceAddress } # [ @@ -1426,6 +1453,45 @@ Debug ] pub struct +AccelerationStructure +{ +raw +: +vk +: +: +AccelerationStructureKHR +buffer +: +vk +: +: +Buffer +block +: +Mutex +< +gpu_alloc +: +: +MemoryBlock +< +vk +: +: +DeviceMemory +> +> +} +# +[ +derive +( +Debug +) +] +pub +struct Texture { raw diff --git a/third_party/rust/wgpu-types/.cargo-checksum.json b/third_party/rust/wgpu-types/.cargo-checksum.json index 6fa2b850914bf..c0e842d222493 100644 --- a/third_party/rust/wgpu-types/.cargo-checksum.json +++ b/third_party/rust/wgpu-types/.cargo-checksum.json @@ -51,7 +51,7 @@ rs " : " -61f4f46533468f82e3d22e42d6e8b3d8b68504ccd4f9b4b9ea67b0664c42a34e +b115dcd6a14eac6fe5a2a13ede5c7becdfd741e25695c4cc2c12cfa1202887fd " " src diff --git a/third_party/rust/wgpu-types/src/lib.rs b/third_party/rust/wgpu-types/src/lib.rs index 675899e240955..8e51bca81687f 100644 --- a/third_party/rust/wgpu-types/src/lib.rs +++ b/third_party/rust/wgpu-types/src/lib.rs @@ -487,15 +487,12 @@ Metal Dx12 = 3 -Dx11 -= -4 Gl = -5 +4 BrowserWebGpu = -6 +5 } impl Backend @@ -555,15 +552,6 @@ dx12 Backend : : -Dx11 -= -> -" -dx11 -" -Backend -: -: Gl = > @@ -832,27 +820,6 @@ u32 / / Supported -on -Windows -7 -+ -const -DX11 -= -1 -< -< -Backend -: -: -Dx11 -as -u32 -; -/ -/ -/ -Supported when targeting the @@ -973,8 +940,6 @@ experimental / / OpenGL -+ -DX11 const SECONDARY = @@ -986,15 +951,6 @@ GL bits ( ) -| -Self -: -: -DX11 -. -bits -( -) ; } } @@ -5253,16 +5209,6 @@ Metal / / - -DX11 -( -emulated -with -uniforms -) -/ -/ -/ -- OpenGL ( emulated @@ -5407,11 +5353,6 @@ Metal / / - -DX11 -/ -/ -/ -- OpenGL / / @@ -5499,11 +5440,6 @@ only / / - -DX11 -/ -/ -/ -- OpenGL / / @@ -6232,10 +6168,57 @@ TEXTURE_FORMAT_NV12 ; / / -55 +/ +Allows +for +the +creation +of +ray +- +tracing +acceleration +structures . +/ +/ +/ +/ +/ +/ +Supported +platforms +: +/ +/ +/ +- +Vulkan +/ +/ +/ +/ +/ +/ +This +is +a +native +- +only +feature . -59 +const +RAY_TRACING_ACCELERATION_STRUCTURE += +1 +< +< +56 +; +/ +/ +57 available / / @@ -6244,6 +6227,57 @@ Shader / / / +Allows +for +the +creation +of +ray +- +tracing +queries +within +shaders +. +/ +/ +/ +/ +/ +/ +Supported +platforms +: +/ +/ +/ +- +Vulkan +/ +/ +/ +/ +/ +/ +This +is +a +native +- +only +feature +. +const +RAY_QUERY += +1 +< +< +58 +; +/ +/ +/ Enables 64 - @@ -6459,17 +6493,6 @@ Vulkan / / - -DX11 -( -feature -level -10 -+ -) -/ -/ -/ -- DX12 / / @@ -8547,11 +8570,6 @@ shaders / / / -DX11 -on -FL10 -level -hardware WebGL2 and GLES3 @@ -8607,11 +8625,6 @@ dispatching / / / -DX11 -on -FL10 -level -hardware WebGL2 GLES 3 @@ -15556,6 +15569,28 @@ false } pub fn +is_multi_planar_format +( +& +self +) +- +> +bool +{ +matches +! +( +* +self +Self +: +: +NV12 +) +} +pub +fn has_color_aspect ( & @@ -31183,6 +31218,7 @@ view_dimension : TextureViewDimension } +AccelerationStructure } impl BindingType @@ -33619,6 +33655,209 @@ default } } } +bitflags +: +: +bitflags +! +( +/ +/ +/ +Flags +for +acceleration +structures +# +[ +derive +( +Clone +Copy +Debug +PartialEq +Eq +Hash +) +] +pub +struct +AccelerationStructureFlags +: +u8 +{ +/ +/ +/ +Allow +for +incremental +updates +( +no +change +in +size +) +const +ALLOW_UPDATE += +1 +< +< +0 +; +/ +/ +/ +Allow +the +acceleration +structure +to +be +compacted +in +a +copy +operation +const +ALLOW_COMPACTION += +1 +< +< +1 +; +/ +/ +/ +Optimize +for +fast +ray +tracing +performance +const +PREFER_FAST_TRACE += +1 +< +< +2 +; +/ +/ +/ +Optimize +for +fast +build +time +const +PREFER_FAST_BUILD += +1 +< +< +3 +; +/ +/ +/ +Optimize +for +low +memory +footprint +( +scratch +and +output +) +const +LOW_MEMORY += +1 +< +< +4 +; +} +) +; +impl_bitflags +! +( +AccelerationStructureFlags +) +; +bitflags +: +: +bitflags +! +( +/ +/ +/ +Flags +for +acceleration +structure +geometries +# +[ +derive +( +Clone +Copy +Debug +PartialEq +Eq +Hash +) +] +pub +struct +AccelerationStructureGeometryFlags +: +u8 +{ +/ +/ +/ +Is +OPAQUE +const +OPAQUE += +1 +< +< +0 +; +/ +/ +/ +NO_DUPLICATE_ANY_HIT_INVOCATION +const +NO_DUPLICATE_ANY_HIT_INVOCATION += +1 +< +< +1 +; +} +) +; +impl_bitflags +! +( +AccelerationStructureGeometryFlags +) +; pub use send_sync