summaryrefslogtreecommitdiff
path: root/src/gallium/frontends/rusticl/mesa/pipe/fence.rs
blob: d3e14eae934996351652e007d5f63faf42706e40 (plain)
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
use crate::pipe::screen::*;

use mesa_rust_gen::*;

use std::sync::Arc;

pub struct PipeFence {
    fence: *mut pipe_fence_handle,
    screen: Arc<PipeScreen>,
}

impl PipeFence {
    pub fn new(fence: *mut pipe_fence_handle, screen: &Arc<PipeScreen>) -> Self {
        Self {
            fence: fence,
            screen: screen.clone(),
        }
    }

    pub fn wait(&self) {
        self.screen.fence_finish(self.fence);
    }
}

impl Drop for PipeFence {
    fn drop(&mut self) {
        self.screen.unref_fence(self.fence);
    }
}