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

Use OpenGL ES 3.0 in qemu_egl_init_ctx #35

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rinsuki
Copy link

@rinsuki rinsuki commented Jul 20, 2021

in ANGLE Metal backend (you can enable with ANGLE_DEFAULT_PLATFORM=metal), qemu-system-x86_64 shows this error:

qemu_gl_create_compile_shader: compile vertex error
ERROR: unsupported shader version

qemu_gl_create_compile_shader: compile fragment error
ERROR: unsupported shader version

qemu_gl_create_compile_shader: compile vertex error
ERROR: unsupported shader version

qemu_gl_create_compile_shader: compile fragment error
ERROR: unsupported shader version

because these shaders (at https://github.com/qemu/qemu/tree/266469947161aa10b1d36843580d369d5aa38589/ui/shader ) are marked as #version 300 es, that means it requires OpenGL ES 3.0. but qemu_egl_init_ctx initializes EGL with OpenGL ES 2.0, then shader compile will fails.

in this pull-request, modify qemu_egl_init_ctx to use OpenGL ES 3.0.

but even after this patch applied, many parts are broken and not suitable for general-use currently. e.g. Android-x86 but text and other components are gone 😝

image

NOTE: this pull-request not adding patches to qemu-virgl.rb because I can't get https://raw.githubusercontent.com/knazarov/homebrew-qemu-virgl/... URL before merge it.

@knazarov
Copy link
Owner

Thanks for the patch!
I’ll add it after I rebase the code to the latest version from Akihiko Odaki. I’m on my way to doing that, checking that it compiles.

And this is probably something you may want to let him know as well here: https://gist.github.com/akihikodaki/87df4149e7ca87f18dc56807ec5a1bc5

@knazarov
Copy link
Owner

The problems you see may also be because I use libangle from a few months ago. It’s possible that they’ve caught up with the metal backend.

@knazarov knazarov force-pushed the master branch 2 times, most recently from cdd3aca to 8f364ec Compare July 25, 2021 12:58
@DUOLabs333
Copy link

I'm going to build this today and see if it's been improved (need 3.0 for Dolphin-emu).

@DUOLabs333
Copy link

Hmmm... after manually upgrading, I'm still on OpenGL 2.

@DUOLabs333
Copy link

For some reason, the patch didn't apply. Is there a way to force it to apply?

@rinsuki
Copy link
Author

rinsuki commented Sep 28, 2021

you can test this patch with open /usr/local/Cellar/qemu-virgl/*/bin/qemu-system-(your arch) in hex editor (like Hex Fiend) and modify 98 30 00 00 02 00 00 00 to 98 30 00 00 03 00 00 00 (98 30 00 00 = 32bit little endian int of EGL_CONTEXT_CLIENT_VERSION a.k.a. 0x3098)

@DUOLabs333
Copy link

DUOLabs333 commented Sep 28, 2021 via email

@rinsuki
Copy link
Author

rinsuki commented Sep 28, 2021

humm, it should work... (you can retry with brew reinstall qemu-virgl)

btw, why you want to run Linux version of Dolphin Emulator in macOS? Dolphin Emulator already have a macOS native version (even arm64), and it works great for me.

@DUOLabs333
Copy link

DUOLabs333 commented Sep 28, 2021 via email

@DUOLabs333
Copy link

DUOLabs333 commented Sep 29, 2021 via email

@DUOLabs333
Copy link

DUOLabs333 commented Sep 29, 2021 via email

@DUOLabs333
Copy link

DUOLabs333 commented Sep 29, 2021 via email

@rinsuki
Copy link
Author

rinsuki commented Sep 29, 2021

humm, I'm still using Intel Mac, then I can't help problem about M1 Mac...

@DUOLabs333
Copy link

DUOLabs333 commented Sep 29, 2021 via email

@rinsuki
Copy link
Author

rinsuki commented Sep 29, 2021

  1. brew edit qemu-virgl
  2. Add new patch section with patch https://raw.githubusercontent.com/knazarov/homebrew-qemu-virgl/02464311b4cca56f400132f4993488f10e5928e7/Patches/qemu-usegles3-v01.diff
  3. brew reinstall --build-from-source qemu-virgl

it should work, but I'm not tested.

@DUOLabs333
Copy link

DUOLabs333 commented Sep 29, 2021 via email

@rinsuki
Copy link
Author

rinsuki commented Sep 29, 2021

uuh sorry, diff requires LF in last line of patch. can you retry with this patch https://raw.githubusercontent.com/knazarov/homebrew-qemu-virgl/ebbc42bb0c0ce8c4604d67ad28b40603c5b62507/Patches/qemu-usegles3-v01.diff ?

@DUOLabs333
Copy link

Now it says, "Hunk #1 succeeded at 474 (offset 12 lines).", but the file didn't update.

@DUOLabs333
Copy link

After building, it still says OpenGL 2.1.

@rinsuki
Copy link
Author

rinsuki commented Sep 29, 2021

what about OpenGL ES version? (OpenGL without ES and OpenGL ES is different things)

@DUOLabs333
Copy link

"OpenGL ES profile version string: OpenGL ES 3.0 Mesa 21.2.1". So, I think it worked.

@rinsuki
Copy link
Author

rinsuki commented Sep 29, 2021

currently, OpenGL 3.0 backend for OpenGL ES 3.x is not exists (gl4es only supports OpenGL 2.x).

if you want to use OpenGL 3.x in VM, currently option are use gl=core instead of gl=es, but akihikodai says "Unstable" in gist, and I don't know it works or not.

and I think, for dolphin emulator, native macOS version are good choice, because it has a Metal support w/ MoltenVK.

@DUOLabs333
Copy link

Yeah, but is there any way to share a MacOS window to Linux, so it could be more integrated?

@DUOLabs333
Copy link

Also, gl=core just froze the VM.

@rinsuki
Copy link
Author

rinsuki commented Sep 29, 2021

in my knowledge, there is a no way to share macOS window to Linux in same machine.

If you can accept proprietary things, Parallels or VMware Fusion may good choice because they have hardware-accelerated OpenGL Desktop in VM even M1 Mac. VMware Fusion for M1 is currently Tech Preview and free for several months (but it requires register to VMware ID), also Parallels provides free-trial.

@DUOLabs333
Copy link

DUOLabs333 commented Sep 29, 2021 via email

@DUOLabs333
Copy link

Will this be merged soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants