Improve egui_glow debug prints
This commit is contained in:
parent
105cb57050
commit
89700dfbbb
3 changed files with 13 additions and 8 deletions
|
@ -80,12 +80,12 @@ pub(crate) unsafe fn as_u8_slice<T>(s: &[T]) -> &[u8] {
|
|||
}
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
pub(crate) fn glow_debug_print(s: impl Into<JsValue>) {
|
||||
web_sys::console::log_1(&s.into());
|
||||
pub(crate) fn glow_debug_print(s: impl std::fmt::Display) {
|
||||
web_sys::console::log_1(&format!("egui_glow: {}", s).into());
|
||||
}
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub(crate) fn glow_debug_print(s: impl std::fmt::Display) {
|
||||
println!("{}", s);
|
||||
eprintln!("egui_glow: {}", s);
|
||||
}
|
||||
|
||||
pub(crate) unsafe fn compile_shader(
|
||||
|
@ -218,7 +218,7 @@ pub(crate) fn supports_vao(gl: &glow::Context) -> bool {
|
|||
true
|
||||
}
|
||||
} else {
|
||||
glow_debug_print(format!("detected OpenGL:{}", version_string));
|
||||
glow_debug_print(format!("detected OpenGL: {:?}", version_string));
|
||||
//from OpenGL 3 vao into core
|
||||
if version_string.starts_with('2') {
|
||||
// I found APPLE_vertex_array_object , GL_ATI_vertex_array_object ,ARB_vertex_array_object
|
||||
|
|
|
@ -79,7 +79,7 @@ impl Painter {
|
|||
let shader_version = ShaderVersion::get(gl);
|
||||
let is_webgl_1 = shader_version == ShaderVersion::Es100;
|
||||
let header = shader_version.version();
|
||||
glow_debug_print(header);
|
||||
glow_debug_print(format!("Shader header: {:?}", header));
|
||||
let srgb_support = gl.supported_extensions().contains("EXT_sRGB");
|
||||
|
||||
let (post_process, srgb_support_define) = match (shader_version, srgb_support) {
|
||||
|
|
|
@ -14,9 +14,14 @@ pub(crate) enum ShaderVersion {
|
|||
|
||||
impl ShaderVersion {
|
||||
pub(crate) fn get(gl: &glow::Context) -> Self {
|
||||
let shading_lang = unsafe { gl.get_parameter_string(glow::SHADING_LANGUAGE_VERSION) };
|
||||
glow_debug_print(&shading_lang);
|
||||
Self::parse(&shading_lang)
|
||||
let shading_lang_string =
|
||||
unsafe { gl.get_parameter_string(glow::SHADING_LANGUAGE_VERSION) };
|
||||
let shader_version = Self::parse(&shading_lang_string);
|
||||
glow_debug_print(format!(
|
||||
"Shader version: {:?} ({:?})",
|
||||
shader_version, shading_lang_string
|
||||
));
|
||||
shader_version
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
Loading…
Reference in a new issue