Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLES panic on Intel Gen7 #155

Open
eyelash opened this issue Aug 6, 2024 · 4 comments
Open

GLES panic on Intel Gen7 #155

eyelash opened this issue Aug 6, 2024 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@eyelash
Copy link

eyelash commented Aug 6, 2024

I'm trying to run blade on an Intel HD Graphics 4000 (Gen7, Ivy Bridge). When I run it using Vulkan with the following command everything seems to work:

cargo run --release --example particle

even though I get the following warning:

MESA-INTEL: warning: Ivy Bridge Vulkan support is incomplete

However, if I try to run it with GLES using the following command, it panics:

RUSTFLAGS="--cfg gles" CARGO_TARGET_DIR=./target-gl cargo run --release --example particle
     Running `target-gl/release/examples/particle`
thread 'main' panicked at blade-graphics/src/gles/pipeline.rs:158:14:
called `Result::unwrap()` on an `Err` value: MissingFeatures(Features(BUFFER_STORAGE | DYNAMIC_ARRAY_SIZE))
stack backtrace:
   0:     0x64efb2321505 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h3692694645b1bb6a
   1:     0x64efb234bedb - core::fmt::write::h5131d80b4c69b88d
   2:     0x64efb231da5f - std::io::Write::write_fmt::h1fb327a7d8b0eb36
   3:     0x64efb23212de - std::sys_common::backtrace::print::h998d75b840f75a73
   4:     0x64efb23226f9 - std::panicking::default_hook::{{closure}}::h18ec7fe6a38b9da0
   5:     0x64efb232249a - std::panicking::default_hook::hfb3f22c2e4075a6a
   6:     0x64efb2322b93 - std::panicking::rust_panic_with_hook::h51af00bcb4660c4e
   7:     0x64efb2322a74 - std::panicking::begin_panic_handler::{{closure}}::h39f76aa863fbe8ce
   8:     0x64efb23219c9 - std::sys_common::backtrace::__rust_end_short_backtrace::h4d10fc2251b89840
   9:     0x64efb23227a7 - rust_begin_unwind
  10:     0x64efb1de6993 - core::panicking::panic_fmt::h319840fcbcd912ef
  11:     0x64efb1de6e26 - core::result::unwrap_failed::haccb9aaa604e1e21
  12:     0x64efb21bc534 - blade_graphics::hal::pipeline::<impl blade_graphics::hal::platform::Context>::create_pipeline::h23efc58eb9d7f16c
  13:     0x64efb21bcedf - blade_graphics::hal::pipeline::<impl blade_graphics::hal::platform::Context>::create_render_pipeline::hbc6d4a9fa1de7390
  14:     0x64efb20f85b7 - blade_egui::GuiPainter::new::he3306cce3c5306c0
  15:     0x64efb1e418ef - particle::main::h17ca0d3f4033c455
  16:     0x64efb1e2fc43 - std::sys_common::backtrace::__rust_begin_short_backtrace::ha56c95d70789d053
  17:     0x64efb1e4d1e9 - std::rt::lang_start::{{closure}}::h8326bf82038edd38
  18:     0x64efb231691d - std::rt::lang_start_internal::h63a185b0ddd212e9
  19:     0x64efb1e422e5 - main
  20:     0x7416e422a1ca - __libc_start_call_main
                               at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  21:     0x7416e422a28b - __libc_start_main_impl
                               at ./csu/../csu/libc-start.c:360:3
  22:     0x64efb1de71a5 - _start
  23:                0x0 - <unknown>

I'm using Ubuntu 24.04 with Mesa 24.0.9 on Wayland.

eglinfo

vulkaninfo

I'm guessing the problem here is that my hardware only supports GLES 3.0 but blade requires GLES 3.1. I'm assuming it's the missing GL_ARB_shader_storage_buffer_object extension, which interestingly is supported on my machine when using desktop GL but not when using GLES. Might this be a Mesa bug?

Given that my hardware is able to run the Vulkan version and GLES is supposed to be a fallback, it would be great if the GLES version would work as well.

@kvark
Copy link
Owner

kvark commented Aug 9, 2024

Yeah, it's very weird that your Mesa's GLES implementation is behind. I see no reason why it can't support the shader storage buffers.

@kvark kvark added the help wanted Extra attention is needed label Aug 9, 2024
@eyelash
Copy link
Author

eyelash commented Aug 9, 2024

I did some more digging. First off, here's the output when running in debug mode with logging enabled:

RUST_BACKTRACE=1 RUST_LOG=blade_graphics=debug RUSTFLAGS="--cfg gles" CARGO_TARGET_DIR=./target-gl cargo run --example particle
     Running `target-gl/debug/examples/particle`
[2024-08-09T07:24:41Z DEBUG blade_graphics::hal::platform] Client extensions: [
        "EGL_EXT_device_base",
        "EGL_EXT_device_enumeration",
        "EGL_EXT_device_query",
        "EGL_EXT_platform_base",
        "EGL_KHR_client_get_all_proc_addresses",
        "EGL_EXT_client_extensions",
        "EGL_KHR_debug",
        "EGL_EXT_platform_device",
        "EGL_EXT_explicit_device",
        "EGL_EXT_platform_wayland",
        "EGL_KHR_platform_wayland",
        "EGL_EXT_platform_x11",
        "EGL_KHR_platform_x11",
        "EGL_EXT_platform_xcb",
        "EGL_MESA_platform_gbm",
        "EGL_KHR_platform_gbm",
        "EGL_MESA_platform_surfaceless",
    ]
[2024-08-09T07:24:41Z INFO  blade_graphics::hal::platform] Enabling EGL debug output
[2024-08-09T07:24:41Z INFO  blade_graphics::hal::platform] Using Wayland platform
[2024-08-09T07:24:41Z INFO  blade_graphics::hal::platform] Display vendor "Mesa Project", version (1, 5)
[2024-08-09T07:24:41Z DEBUG blade_graphics::hal::platform] Display extensions: [
        "EGL_ANDROID_blob_cache",
        "EGL_ANDROID_native_fence_sync",
        "EGL_EXT_buffer_age",
        "EGL_EXT_create_context_robustness",
        "EGL_EXT_image_dma_buf_import",
        "EGL_EXT_image_dma_buf_import_modifiers",
        "EGL_EXT_present_opaque",
        "EGL_EXT_query_reset_notification_strategy",
        "EGL_EXT_swap_buffers_with_damage",
        "EGL_IMG_context_priority",
        "EGL_KHR_cl_event2",
        "EGL_KHR_config_attribs",
        "EGL_KHR_context_flush_control",
        "EGL_KHR_create_context",
        "EGL_KHR_create_context_no_error",
        "EGL_KHR_fence_sync",
        "EGL_KHR_get_all_proc_addresses",
        "EGL_KHR_gl_colorspace",
        "EGL_KHR_gl_renderbuffer_image",
        "EGL_KHR_gl_texture_2D_image",
        "EGL_KHR_gl_texture_3D_image",
        "EGL_KHR_gl_texture_cubemap_image",
        "EGL_KHR_image_base",
        "EGL_KHR_no_config_context",
        "EGL_KHR_reusable_sync",
        "EGL_KHR_surfaceless_context",
        "EGL_KHR_swap_buffers_with_damage",
        "EGL_EXT_pixel_format_float",
        "EGL_KHR_wait_sync",
        "EGL_MESA_configless_context",
        "EGL_MESA_drm_image",
        "EGL_MESA_gl_interop",
        "EGL_MESA_image_dma_buf_export",
        "EGL_MESA_query_driver",
        "EGL_WL_bind_wayland_display",
        "EGL_WL_create_wayland_buffer_from_image",
    ]
[2024-08-09T07:24:41Z INFO  blade_graphics::hal::platform] 	EGL surface: +srgb
[2024-08-09T07:24:41Z INFO  blade_graphics::hal::platform] 	Trying native-render
[2024-08-09T07:24:41Z INFO  blade_graphics::hal::platform] 	EGL context: +debug
[2024-08-09T07:24:41Z INFO  blade_graphics::hal::platform] 	EGL context: +surfaceless
[2024-08-09T07:24:41Z INFO  blade_graphics::hal::platform] Enabling GLES debug output
[2024-08-09T07:24:41Z DEBUG blade_graphics::hal::platform] Extensions: {
        "GL_OES_texture_npot",
        "GL_EXT_texture_border_clamp",
        "GL_NV_draw_buffers",
        "GL_OES_depth24",
        "GL_EXT_instanced_arrays",
        "GL_EXT_separate_shader_objects",
        "GL_EXT_clip_cull_distance",
        "GL_EXT_render_snorm",
        "GL_EXT_texture_format_BGRA8888",
        "GL_EXT_draw_elements_base_vertex",
        "GL_NV_conditional_render",
        "GL_NV_shader_noperspective_interpolation",
        "GL_OES_EGL_image_external_essl3",
        "GL_EXT_texture_query_lod",
        "GL_OES_standard_derivatives",
        "GL_OES_EGL_sync",
        "GL_NV_pack_subimage",
        "GL_OES_required_internalformat",
        "GL_EXT_semaphore_fd",
        "GL_KHR_blend_equation_advanced",
        "GL_EXT_copy_image",
        "GL_OES_draw_buffers_indexed",
        "GL_APPLE_texture_max_level",
        "GL_NV_fbo_color_attachments",
        "GL_OES_sample_shading",
        "GL_EXT_frag_depth",
        "GL_EXT_texture_rg",
        "GL_OES_element_index_uint",
        "GL_OES_texture_float_linear",
        "GL_OES_draw_elements_base_vertex",
        "GL_KHR_texture_compression_astc_ldr",
        "GL_EXT_EGL_image_storage",
        "GL_EXT_texture_type_2_10_10_10_REV",
        "GL_NV_read_buffer",
        "GL_OES_EGL_image",
        "GL_OES_surfaceless_context",
        "GL_NV_read_depth",
        "GL_MESA_shader_integer_functions",
        "GL_EXT_multi_draw_arrays",
        "GL_EXT_draw_instanced",
        "GL_NV_alpha_to_coverage_dither_control",
        "GL_OES_depth_texture",
        "GL_NV_texture_barrier",
        "GL_OES_sample_variables",
        "GL_EXT_depth_clamp",
        "GL_INTEL_performance_query",
        "GL_OES_texture_half_float",
        "GL_MESA_framebuffer_flip_y",
        "GL_OES_get_program_binary",
        "GL_EXT_texture_compression_s3tc",
        "GL_EXT_map_buffer_range",
        "GL_EXT_shader_integer_mix",
        "GL_INTEL_blackhole_render",
        "GL_OES_compressed_ETC1_RGB8_texture",
        "GL_OES_vertex_half_float",
        "GL_OES_mapbuffer",
        "GL_EXT_blend_minmax",
        "GL_EXT_texture_sRGB_decode",
        "GL_EXT_shader_framebuffer_fetch_non_coherent",
        "GL_KHR_context_flush_control",
        "GL_OES_vertex_array_object",
        "GL_EXT_compressed_ETC1_RGB8_sub_texture",
        "GL_OES_rgb8_rgba8",
        "GL_EXT_color_buffer_half_float",
        "GL_MESA_bgra",
        "GL_EXT_texture_mirror_clamp_to_edge",
        "GL_ANGLE_texture_compression_dxt5",
        "GL_EXT_semaphore",
        "GL_OES_fbo_render_mipmap",
        "GL_EXT_texture_compression_dxt1",
        "GL_OES_EGL_image_external",
        "GL_OES_copy_image",
        "GL_EXT_shader_group_vote",
        "GL_EXT_draw_buffers",
        "GL_EXT_demote_to_helper_invocation",
        "GL_EXT_texture_compression_bptc",
        "GL_EXT_base_instance",
        "GL_EXT_float_blend",
        "GL_EXT_memory_object_fd",
        "GL_EXT_occlusion_query_boolean",
        "GL_EXT_unpack_subimage",
        "GL_OES_texture_half_float_linear",
        "GL_EXT_texture_sRGB_R8",
        "GL_EXT_clip_control",
        "GL_NV_read_depth_stencil",
        "GL_OES_texture_float",
        "GL_OES_texture_3D",
        "GL_EXT_read_format_bgra",
        "GL_OES_stencil8",
        "GL_EXT_disjoint_timer_query",
        "GL_ANGLE_texture_compression_dxt3",
        "GL_OES_texture_border_clamp",
        "GL_EXT_blend_func_extended",
        "GL_EXT_texture_compression_s3tc_srgb",
        "GL_MESA_sampler_objects",
        "GL_EXT_color_buffer_float",
        "GL_EXT_texture_filter_anisotropic",
        "GL_NV_generate_mipmap_sRGB",
        "GL_KHR_parallel_shader_compile",
        "GL_OES_packed_depth_stencil",
        "GL_OES_depth_texture_cube_map",
        "GL_EXT_memory_object",
        "GL_EXT_draw_buffers_indexed",
        "GL_EXT_polygon_offset_clamp",
        "GL_KHR_debug",
        "GL_KHR_texture_compression_astc_sliced_3d",
        "GL_NV_read_stencil",
        "GL_KHR_no_error",
        "GL_AMD_performance_monitor",
        "GL_EXT_debug_label",
        "GL_EXT_texture_compression_rgtc",
        "GL_EXT_discard_framebuffer",
        "GL_NV_pixel_buffer_object",
        "GL_OES_shader_multisample_interpolation",
        "GL_EXT_sRGB_write_control",
        "GL_EXT_texture_shadow_lod",
        "GL_APPLE_sync",
        "GL_ANGLE_pack_reverse_row_order",
    }
[2024-08-09T07:24:41Z INFO  blade_graphics::hal::platform] Vendor: Intel
[2024-08-09T07:24:41Z INFO  blade_graphics::hal::platform] Renderer: Mesa Intel(R) HD Graphics 4000 (IVB GT2)
[2024-08-09T07:24:41Z INFO  blade_graphics::hal::platform] Version: OpenGL ES 3.0 Mesa 24.0.9-0ubuntu0.1
[2024-08-09T07:24:41Z WARN  blade_graphics::hal::platform] Unable to forbid exclusive full screen
thread 'main' panicked at blade-graphics/src/gles/pipeline.rs:158:14:
called `Result::unwrap()` on an `Err` value: MissingFeatures(Features(BUFFER_STORAGE | DYNAMIC_ARRAY_SIZE))
stack backtrace:
   0: rust_begin_unwind
             at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/panicking.rs:652:5
   1: core::panicking::panic_fmt
             at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/core/src/panicking.rs:72:14
   2: core::result::unwrap_failed
             at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/core/src/result.rs:1679:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/core/src/result.rs:1102:23
   4: blade_graphics::hal::pipeline::<impl blade_graphics::hal::platform::Context>::create_pipeline
             at ./blade-graphics/src/gles/pipeline.rs:150:30
   5: blade_graphics::hal::pipeline::<impl blade_graphics::hal::platform::Context>::create_render_pipeline
             at ./blade-graphics/src/gles/pipeline.rs:324:13
   6: blade_egui::GuiPainter::new
             at ./blade-egui/src/lib.rs:129:24
   7: particle::Example::new
             at ./examples/particle/main.rs:40:27
   8: particle::main
             at ./examples/particle/main.rs:128:23
   9: core::ops::function::FnOnce::call_once
             at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

The panic seems to happen here, so the error originates inside naga. Indeed, BUFFER_STORAGE | DYNAMIC_ARRAY_SIZE seems to be from features.rs. My current understanding is that blade tells naga to compile the shaders with GLSL version 300 and naga then errors because the features BUFFER_STORAGE and DYNAMIC_ARRAY_SIZE require version 310.

A few questions here:

Is blade supposed to be working with GLSL version 300? AFAIK version 310 is only enabled for hardware that fully supports GLES 3.1, which would mean that the GLES backend requires GLES 3.1. Or does it all depend on the user of blade and what shaders they use?

I tried to run the bunnymark and particle demos in WebGL mode but they didn't run (bunnymark was a runtime panic and the particle demo didn't even compile). Are they working for you?

@eyelash
Copy link
Author

eyelash commented Aug 9, 2024

I just noticed that the bunnymark example actually runs on my hardware with GLES, so I guess the problem here is that the particle example uses features in its shaders that are not supported by GLES 3.0.

@kvark
Copy link
Owner

kvark commented Aug 10, 2024

Yes, Blade supports GLES-3.0 because that matches WebGL2. You just can't use any storage buffers on that platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants