Make GL/GLES decisions based on the API in use.

This commit is contained in:
Josh Matthews 2019-07-10 17:34:16 -04:00
parent 812bf8d816
commit dbaed5ed92
13 changed files with 83 additions and 52 deletions

View file

@ -76,6 +76,12 @@ pub enum WebGLMsg {
Exit,
}
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum GlType {
Gl,
Gles,
}
/// Contains the WebGLCommand sender and information about a WebGLContext
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct WebGLCreateContextResult {
@ -87,6 +93,8 @@ pub struct WebGLCreateContextResult {
pub share_mode: WebGLContextShareMode,
/// The GLSL version supported by the context.
pub glsl_version: WebGLSLVersion,
/// The GL API used by the context.
pub api_type: GlType,
}
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, Serialize)]
@ -761,12 +769,6 @@ parameters! {
}
}
pub fn is_gles() -> bool {
// TODO: align this with the actual kind of graphics context in use, rather than
// making assumptions based on platform
cfg!(any(target_os = "android", target_os = "ios"))
}
#[macro_export]
macro_rules! gl_enums {
($(pub enum $name:ident { $($variant:ident = $mod:ident::$constant:ident,)+ })*) => {