use gl::types::GLint; use librashader_reflect::reflect::semantics::BindingStage; #[derive(Debug)] pub enum VariableLocation { Ubo(UniformLocation), Push(UniformLocation), } impl VariableLocation { pub fn location(&self) -> UniformLocation { match self { VariableLocation::Ubo(l) | VariableLocation::Push(l) => *l, } } } #[derive(Debug, Copy, Clone)] pub struct UniformLocation { pub vertex: T, pub fragment: T, } impl UniformLocation { pub fn is_valid(&self, stage: BindingStage) -> bool { let mut validity = false; if stage.contains(BindingStage::FRAGMENT) { validity = validity || self.fragment >= 0; } if stage.contains(BindingStage::VERTEX) { validity = validity || self.vertex >= 0; } validity } }