File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4393,6 +4393,18 @@ pub enum LoadOp<V> {
43934393}
43944394
43954395impl < V > LoadOp < V > {
4396+ /// Map this operation's type to another, migrating the [`Self::Clear`] value via `f`, if
4397+ /// necessary.
4398+ pub fn map_clear_value < T , F > ( self , f : F ) -> LoadOp < T >
4399+ where
4400+ F : FnOnce ( V ) -> T ,
4401+ {
4402+ match self {
4403+ Self :: Clear ( value) => LoadOp :: Clear ( f ( value) ) ,
4404+ Self :: Load => LoadOp :: Load ,
4405+ }
4406+ }
4407+
43964408 /// Returns true if variants are same (ignoring clear value)
43974409 pub fn eq_variant < T > ( & self , other : LoadOp < T > ) -> bool {
43984410 matches ! (
@@ -4457,6 +4469,21 @@ impl<V: Default> Default for Operations<V> {
44574469 }
44584470}
44594471
4472+ impl < V > Operations < V > {
4473+ /// Map these operations' type to another, migrating the clear value of [`Self::load`], if
4474+ /// necessary, using `f`.
4475+ pub fn map_clear_value < T , F > ( self , f : F ) -> Operations < T >
4476+ where
4477+ F : FnOnce ( V ) -> T ,
4478+ {
4479+ let Self { load, store } = self ;
4480+ Operations {
4481+ load : load. map_clear_value ( f) ,
4482+ store,
4483+ }
4484+ }
4485+ }
4486+
44604487/// Describes the depth/stencil state in a render pipeline.
44614488///
44624489/// Corresponds to [WebGPU `GPUDepthStencilState`](
You can’t perform that action at this time.
0 commit comments