mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 06:10:06 -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:
@@ -19,6 +19,8 @@ mod post_process;
|
||||
mod shader_version;
|
||||
mod vao;
|
||||
|
||||
pub use shader_version::ShaderVersion;
|
||||
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "winit"))]
|
||||
pub mod winit;
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "winit"))]
|
||||
|
||||
@@ -114,7 +114,7 @@ impl Painter {
|
||||
|
||||
let shader_version = ShaderVersion::get(&gl);
|
||||
let is_webgl_1 = shader_version == ShaderVersion::Es100;
|
||||
let header = shader_version.version();
|
||||
let header = shader_version.version_declaration();
|
||||
tracing::debug!("Shader header: {:?}.", header);
|
||||
let srgb_support = gl.supported_extensions().contains("EXT_sRGB");
|
||||
|
||||
@@ -155,7 +155,11 @@ impl Painter {
|
||||
"{}\n{}\n{}\n{}",
|
||||
header,
|
||||
shader_prefix,
|
||||
shader_version.is_new_shader_interface(),
|
||||
if shader_version.is_new_shader_interface() {
|
||||
"#define NEW_SHADER_INTERFACE\n"
|
||||
} else {
|
||||
""
|
||||
},
|
||||
VERT_SRC
|
||||
),
|
||||
)?;
|
||||
@@ -167,7 +171,11 @@ impl Painter {
|
||||
header,
|
||||
shader_prefix,
|
||||
srgb_support_define,
|
||||
shader_version.is_new_shader_interface(),
|
||||
if shader_version.is_new_shader_interface() {
|
||||
"#define NEW_SHADER_INTERFACE\n"
|
||||
} else {
|
||||
""
|
||||
},
|
||||
FRAG_SRC
|
||||
),
|
||||
)?;
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user