Skip to main content

CubeTask

Trait CubeTask 

Source
pub trait CubeTask<C>:
    KernelMetadata
    + Send
    + Sync
where C: Compiler,
{ // Required methods fn define(&self) -> KernelDefinition; fn compile( &self, definition: KernelDefinition, compiler: &mut C, compilation_options: &<C as Compiler>::CompilationOptions, mode: ExecutionMode, address_type: StorageType, ) -> Result<CompiledKernel<C>, CompilationError>; }
Expand description

Kernel trait with the ComputeShader that will be compiled and cached based on the provided id.

Required Methods§

Source

fn define(&self) -> KernelDefinition

Expand the kernel into its definition.

Kept separate from CubeTask::compile so a server can hash the definition to key the compilation cache, then hand the same definition back on a miss instead of expanding twice.

Source

fn compile( &self, definition: KernelDefinition, compiler: &mut C, compilation_options: &<C as Compiler>::CompilationOptions, mode: ExecutionMode, address_type: StorageType, ) -> Result<CompiledKernel<C>, CompilationError>

Compile a kernel definition and return the compiled form with an optional non-text representation.

Trait Implementations§

Source§

impl<C> KernelMetadata for Box<dyn CubeTask<C>>
where C: Compiler,

Source§

fn id(&self) -> KernelId

Identifier for the kernel, used for caching kernel compilation.
Source§

fn name(&self) -> &'static str

Name of the kernel for debugging.
Source§

fn address_type(&self) -> StorageType

Type of addresses in this kernel

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<C, K> CubeTask<C> for KernelTask<C, K>
where C: Compiler, K: CubeKernel,