     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58

    use crate::canvas::canvas_state::{Drawable};
    use std::sync::Arc;
    use crate::compute::compu_sprite::CompuSprite;
    use crate::compute::compu_kernel::{CompuKernel, CompuKernelHandle};
    use crate::compute::compu_buffer::{CompuBuffers};
    use crate::canvas::{CompuBufferHandle, CanvasImageHandle};

    pub struct CompuFrame {
        // Vec<(Buffer, Kernel)>
        pub pure_compute: Vec<(
            Arc<CompuBufferHandle>,
            Arc<CompuKernelHandle>)>,

        // Vec<(Buffer, Image, Kernel)>
        pub swapped_to_image: Vec<(
            Arc<CompuBufferHandle>,
            Arc<CanvasImageHandle>,
            Arc<CompuKernelHandle>)>,

        // Vec<(Input Buffer, Output Buffer, Kernel)>
        pub swapped_to_buffer: Vec<(
            Arc<CompuBufferHandle>,
            Arc<CompuBufferHandle>,
            Arc<CompuKernelHandle>)>,
    }

    impl CompuFrame {
        pub fn new() -> CompuFrame {
            CompuFrame {
                pure_compute: vec![],
                swapped_to_image: vec![],
                swapped_to_buffer: vec![],
            }
        }

        pub fn add(&mut self, buffer: Arc<CompuBufferHandle>, kernel: Arc<CompuKernelHandle>) {
            self.pure_compute.push((buffer, kernel));
        }

        /*
           INPUT_BUFFER -> input -> kernel -> output
                               v------------------^
           OUTPUT_BUFFER -> input X kernel X output
        */
        pub fn add_chained(&mut self,
                           input_buffer: Arc<CompuBufferHandle>,
                           output_buffer: Arc<CompuBufferHandle>,
                           kernel: Arc<CompuKernelHandle>) {
            self.swapped_to_buffer.push((input_buffer, output_buffer, kernel));
        }

        pub fn add_with_image_swap(&mut self,
                                   buffer: Arc<CompuBufferHandle>,
                                   kernel: Arc<CompuKernelHandle>,
                                   sprite: &CompuSprite) {
            self.swapped_to_image.push((buffer, sprite.get_image_handle().unwrap().clone(), kernel))
        }
    }

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)