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
//! `CommandBuffer` methods for compute operations.

use std::borrow::Borrow;

use super::{CommandBuffer, DescriptorSetOffset, Level, RawCommandBuffer, Shot};
use crate::buffer::Offset;
use crate::queue::capability::{Compute, Supports};
use crate::{Backend, WorkGroupCount};

impl<B: Backend, C: Supports<Compute>, S: Shot, L: Level> CommandBuffer<B, C, S, L> {
    /// Identical to the `RawCommandBuffer` method of the same name.
    pub unsafe fn bind_compute_pipeline(&mut self, pipeline: &B::ComputePipeline) {
        self.raw.bind_compute_pipeline(pipeline)
    }

    /// Identical to the `RawCommandBuffer` method of the same name.
    pub unsafe fn bind_compute_descriptor_sets<I, J>(
        &mut self,
        layout: &B::PipelineLayout,
        first_set: usize,
        sets: I,
        offsets: J,
    ) where
        I: IntoIterator,
        I::Item: Borrow<B::DescriptorSet>,
        J: IntoIterator,
        J::Item: Borrow<DescriptorSetOffset>,
    {
        self.raw
            .bind_compute_descriptor_sets(layout, first_set, sets, offsets)
    }

    /// Identical to the `RawCommandBuffer` method of the same name.
    pub unsafe fn dispatch(&mut self, count: WorkGroupCount) {
        self.raw.dispatch(count)
    }

    /// Identical to the `RawCommandBuffer` method of the same name.
    pub unsafe fn dispatch_indirect(&mut self, buffer: &B::Buffer, offset: Offset) {
        self.raw.dispatch_indirect(buffer, offset)
    }

    /// Identical to the `RawCommandBuffer` method of the same name.
    pub unsafe fn push_compute_constants(
        &mut self,
        layout: &B::PipelineLayout,
        offset: u32,
        constants: &[u32],
    ) {
        self.raw.push_compute_constants(layout, offset, constants);
    }
}