1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-03 15:20:05 -04:00

Disable custom 3D painting example in the egui demo app for Es100 (#1945)

Closes https://github.com/emilk/egui/issues/1944
This commit is contained in:
Emil Ernerfeldt
2022-08-20 19:54:18 +02:00
committed by GitHub
parent 97ce103209
commit bd5250f85d
9 changed files with 68 additions and 36 deletions

View File

@@ -2,9 +2,10 @@
use std::convert::TryInto;
/// Helper for parsing and interpreting the OpenGL shader version.
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[allow(dead_code)]
pub(crate) enum ShaderVersion {
pub enum ShaderVersion {
Gl120,
Gl140,
Es100,
@@ -12,7 +13,7 @@ pub(crate) enum ShaderVersion {
}
impl ShaderVersion {
pub(crate) fn get(gl: &glow::Context) -> Self {
pub fn get(gl: &glow::Context) -> Self {
use glow::HasContext as _;
let shading_lang_string =
unsafe { gl.get_parameter_string(glow::SHADING_LANGUAGE_VERSION) };
@@ -52,7 +53,8 @@ impl ShaderVersion {
}
}
pub(crate) fn version(&self) -> &'static str {
/// Goes on top of the shader.
pub fn version_declaration(&self) -> &'static str {
match self {
Self::Gl120 => "#version 120\n",
Self::Gl140 => "#version 140\n",
@@ -61,10 +63,11 @@ impl ShaderVersion {
}
}
pub(crate) fn is_new_shader_interface(&self) -> &'static str {
/// If true, use `in/out`. If `false`, use `varying` and `gl_FragColor`.
pub fn is_new_shader_interface(&self) -> bool {
match self {
ShaderVersion::Es300 | ShaderVersion::Gl140 => "#define NEW_SHADER_INTERFACE\n",
_ => "",
Self::Gl120 | Self::Es100 => false,
Self::Es300 | Self::Gl140 => true,
}
}
}