wgpu::dispatch

Macro dispatch_types_inner

source
macro_rules! dispatch_types_inner {
    (
        wgpu_core = $wgpu_core_context:ty;
        webgpu = $webgpu_context:ty;
        {ref type $name:ident = InterfaceTypes::$subtype:ident: $trait:ident};
    ) => { ... };
    (
        wgpu_core = $wgpu_core_context:ty;
        webgpu = $webgpu_context:ty;
        {mut type $name:ident = InterfaceTypes::$subtype:ident: $trait:ident};
    ) => { ... };
}
Expand description

Generates Dispatch types for each of the interfaces. Each type is a wrapper around the wgpu_core and webgpu types, and derefs to the appropriate interface trait-object.

When there is only one backend, deviritualization fires and all dispatches should turn into direct calls. If there are multiple, some dispatching will occur.

This also provides as_* methods so that the backend implementations can dereference other arguments. These are similarly free when there is only one backend.

In the future, we may want a truly generic backend, which could be extended from this enum.