diff options
author | 2021-11-11 01:10:47 -0300 | |
---|---|---|
committer | 2022-01-19 17:40:17 -0300 | |
commit | e31566d430093fb084da2e7f4f4ed1b66326edef (patch) | |
tree | 328c599dd2d62a32e17e95e792c74054d822537e /glow/src/quad.rs | |
parent | afdf3e799a7610444208c9568a7cf7531d0c2ef3 (diff) | |
download | iced-e31566d430093fb084da2e7f4f4ed1b66326edef.tar.gz iced-e31566d430093fb084da2e7f4f4ed1b66326edef.tar.bz2 iced-e31566d430093fb084da2e7f4f4ed1b66326edef.zip |
Improve shader version selection
Diffstat (limited to 'glow/src/quad.rs')
-rw-r--r-- | glow/src/quad.rs | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/glow/src/quad.rs b/glow/src/quad.rs index 75740c7e..e965f3c9 100644 --- a/glow/src/quad.rs +++ b/glow/src/quad.rs @@ -13,14 +13,22 @@ pub enum Pipeline { } impl Pipeline { - pub fn new(gl: &glow::Context) -> Pipeline { + pub fn new( + gl: &glow::Context, + shader_version: &(String, String), + ) -> Pipeline { let version = gl.version(); - if version.is_embedded || version.major == 2 { - log::info!("Mode: compatibility"); - Pipeline::Compatibility(compatibility::Pipeline::new(gl)) - } else { + + // OpenGL 3.0+ and OpenGL ES 3.0+ have instancing (which is what separates `core` from `compatibility`) + if version.major >= 3 { log::info!("Mode: core"); - Pipeline::Core(core::Pipeline::new(gl)) + Pipeline::Core(core::Pipeline::new(gl, shader_version)) + } else { + log::info!("Mode: compatibility"); + Pipeline::Compatibility(compatibility::Pipeline::new( + gl, + shader_version, + )) } } |