fyrox_graphics/
query.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use crate::core::Downcast;
use std::fmt::Debug;

#[repr(u32)]
#[derive(Copy, Clone, Debug)]
pub enum QueryKind {
    SamplesPassed = glow::SAMPLES_PASSED,
    AnySamplesPassed = glow::ANY_SAMPLES_PASSED,
}

#[derive(Debug)]
pub enum QueryResult {
    SamplesPassed(u32),
    AnySamplesPassed(bool),
}

pub trait Query: Downcast + Debug {
    fn begin(&self, kind: QueryKind);
    fn end(&self);
    fn try_get_result(&self) -> Option<QueryResult>;
}