blade icon indicating copy to clipboard operation
blade copied to clipboard

Support opengl 3.3

Open theoparis opened this issue 1 year ago • 7 comments

I have a older thinkpad and I cannot run the Zed editor because blade requires newer opengl features (BUFFER_STORAGE and DYNAMIC_ARRAY_SIZE)... Is there any chance these can be made optional?

Thread "main" panicked with "called `Result::unwrap()` on an `Err` value: MissingFeatures(Features(BUFFER_STORAGE | DYNAMIC_ARRAY_SIZE))" at /home/theo/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/7f54ddf/blade-graphics/src/gles/pipeline.rs:158:14

theoparis avatar Aug 26 '24 20:08 theoparis

Thank you for filing! Could you attach the outputs of glxinfo and eglinfo here? Rewriting GPU layer without having buffer storage or dynamic array size is possible but quite a lot of work.

kvark avatar Aug 27 '24 05:08 kvark

Here is the output from those commands:

glxinfo: glxinfo.txt eglinfo: eglinfo.txt

I do have other computers and I can use Neovim however it'd be nice if Zed/blade worked on this laptop as well. I didn't realize it would take a lot of work. I also tried Zed with Vulkan but unfortunately its unusable with lavapipe.

theoparis avatar Aug 27 '24 20:08 theoparis

I took another look at the code. It doesn't seem as bad. Something isn't right here, though, it should be working right away.

MissingFeatures(Features(BUFFER_STORAGE | DYNAMIC_ARRAY_SIZE))

This is an error from Naga, and it reports Naga backend capabilities. On Blade side we have a similarly named BUFFER_STORAGE, which should be true given your EGL extension list:

capabilities.set(
            super::Capabilities::BUFFER_STORAGE,
            extensions.contains("GL_EXT_buffer_storage"),
        );

This should make our Naga configuration to use GLES-3.20 version:

let force_explicit_bindings = self
            .capabilities
            .contains(super::Capabilities::BUFFER_STORAGE);
        let mut naga_options = glsl::Options {
            version: glsl::Version::Embedded {
                version: if force_explicit_bindings { 320 } else { 300 },
                is_webgl: cfg!(target_arch = "wasm32"),
            },
            writer_flags: extra_flags | glsl::WriterFlags::ADJUST_COORDINATE_SPACE,
            binding_map: Default::default(),
            zero_initialize_workgroup_memory: false,
        };

And that should unlock both features that the error is talking about on Naga side:

check_feature!(BUFFER_STORAGE, 400, 310);
check_feature!(DYNAMIC_ARRAY_SIZE, 430, 310);

I wonder if you'd be interested in running this through rust-gdb and stepping through this code to see what's going on?

kvark avatar Aug 28 '24 06:08 kvark

Alright, I'll try debugging it further. Also, I just ran the blade bunnymark demo with GLES and it worked fine 🤔

theoparis avatar Aug 28 '24 21:08 theoparis

I just bumped into this. I'm also running an old thinkpad.

dan-da avatar Nov 23 '24 13:11 dan-da

@dan-da could you share outputs of glxinfo and eglinfo here, also debug log from bunnymark example?

kvark avatar Nov 24 '24 17:11 kvark

glxinfo.txt

eglinfo.txt

Sorry, I don't seem to have bunnymark installed. If its part of this crate, I haven't built the crate... I just tried building zed and that led me here.

$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.3 LTS"

dan-da avatar Dec 01 '24 04:12 dan-da