#![allow(unused_imports)]
use crate::gl;
use crate::info::GLVersion;
use crate::Gl;
use std::ffi::CStr;
use std::os::raw::c_char;
use std::sync::Mutex;
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub struct ContextID(pub u64);
#[doc(hidden)]
pub static CREATE_CONTEXT_MUTEX: Mutex<ContextID> = Mutex::new(ContextID(0));
bitflags! {
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct ContextAttributeFlags: u8 {
const ALPHA = 0x01;
const DEPTH = 0x02;
const STENCIL = 0x04;
const COMPATIBILITY_PROFILE = 0x08;
}
}
#[derive(Clone, Copy, PartialEq, Debug)]
pub struct ContextAttributes {
pub version: GLVersion,
pub flags: ContextAttributeFlags,
}
impl ContextAttributes {
#[allow(dead_code)]
pub(crate) fn zeroed() -> ContextAttributes {
ContextAttributes {
version: GLVersion::new(0, 0),
flags: ContextAttributeFlags::empty(),
}
}
}
#[cfg(any(target_os = "android", target_env = "ohos"))]
pub(crate) fn current_context_uses_compatibility_profile(_gl: &Gl) -> bool {
false
}
#[cfg(not(any(target_os = "android", target_env = "ohos")))]
#[allow(dead_code)]
pub(crate) fn current_context_uses_compatibility_profile(gl: &Gl) -> bool {
use glow::HasContext;
unsafe {
let context_profile_mask = gl.get_parameter_i32(gl::CONTEXT_PROFILE_MASK);
if gl.get_error() == gl::NO_ERROR
&& (context_profile_mask & gl::CONTEXT_COMPATIBILITY_PROFILE_BIT as i32) != 0
{
return true;
}
gl.supported_extensions().contains("GL_ARB_compatibility")
}
}