I'm not sure exactly what Homebrew provides, and I'm not able to investigate it 
now.

Yes, using Mesa software rendering to fill the void left by Opengl deprecation 
makes some sense.   But note is still software rendering, not GPU accelerated.  
And one needs to consider the x86 -> arm.

You could consider somehow integrating jogl with osmesa -- offscreen rendering 
-Mesa -- which builds and runs pretty much anywhere Mesa builds -- thereby 
bypassing the headaches of integrating with mac specifics technologies such as 
CGL and Cocoa

There are also other alternatives with considering, such as 
https://moltengl.com/moltengl/


Jose

Get Outlook for Android<https://aka.ms/AAb9ysg>
________________________________
From: Martin Pernollet <martin.pernol...@protonmail.com>
Sent: Monday, May 2, 2022 1:31:43 AM
To: Jose Fonseca <jfons...@vmware.com>
Cc: mesa-dev@lists.freedesktop.org <mesa-dev@lists.freedesktop.org>
Subject: Re: Enable OpenGL software rendering on macOS


⚠ External Email

Hi Jose,

Many thanks for your answer.

JOGL classes enabling GL binding macOS all refer to CGL, so yes, I think I want 
to rely on CGL (there is however in JOGL a couple of classes allowing to work 
with X11, but they're used on Linux only).

I can't access the Apple M1 on which I built Mesa right now, but homebrew on 
another macOS provides libGL and not libGLX.


ls /usr/local/Cellar/mesa/21.1.2/lib

dri libGL.dylib libGLESv1_CM.dylib libGLESv2.dylib libglapi.dylib

libGL.1.dylib libGLESv1_CM.1.dylib libGLESv2.2.dylib libglapi.0.dylib pkgconfig


One motivation for enabling Mesa on macOS is actually the deprecated status of 
OpenGL. I would expect this software implementation of GL to simply provide an 
image to be copied to a native window/frame, without having to rely on CGL. 
Hence, one could continue working with simple OpenGL even if macOS doesn't 
provide such API.

Does it sound reasonable?

Martin




Envoyé avec la messagerie sécurisée 
ProtonMail<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fprotonmail.com%2F&data=05%7C01%7Cjfonseca%40vmware.com%7Ccf822d69b6584b99c2cf08da2c163472%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637870771135623243%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=6Z%2F57xR0N3IsaozWf4yw1m26WsR9%2BgZthncH5LSlDqA%3D&reserved=0>.

------- Original Message -------
Le vendredi 29 avril 2022 à 16:08, Jose Fonseca <jfons...@vmware.com> a écrit :

The difficulty with OpenGL on macOS is that all driver interfaces are both 
undocumented and deprecated.


If you want to override the system OpenGL, you can use apitrace code as 
reference.  There are two approaches:

  1.  DYLD_FRAMEWORK_PATH  
https://github.com/apitrace/apitrace/blob/master/cli/cli_trace.cpp<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapitrace%2Fapitrace%2Fblob%2Fmaster%2Fcli%2Fcli_trace.cpp&data=05%7C01%7Cjfonseca%40vmware.com%7Ccf822d69b6584b99c2cf08da2c163472%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637870771135623243%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=waB1FKc7Gn18GlUCLfMdD6Nz4wLebDjWx4Yie3JOKHc%3D&reserved=0>
  2.  DYLD_INSERT_LIBRARIES 
https://github.com/apitrace/apitrace/tree/dyld-interpose<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapitrace%2Fapitrace%2Ftree%2Fdyld-interpose&data=05%7C01%7Cjfonseca%40vmware.com%7Ccf822d69b6584b99c2cf08da2c163472%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637870771135623243%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=BTTHs0fiFhz0NYc3UGY2rd9R25Ak%2FFwZ8paNMOFUBfQ%3D&reserved=0>
 (experimental branch)


AFAIK, Mesa build for macOS generates a ibGLX which depends on X11, which is 
probably not what you want.  You want to use Mesa for macOS apps which use CGL 
as opposed to GLX, right?


So, if one wants to have a SW renderer on macOS with llvmpipe without depending 
on X11, then one would need to implement:

  *   a new Gallium 
frontend<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fmesa%2Fmesa%2F-%2Ftree%2Fmain%2Fsrc%2Fgallium%2Ffrontends&data=05%7C01%7Cjfonseca%40vmware.com%7Ccf822d69b6584b99c2cf08da2c163472%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637870771135623243%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ZwSCisd3BxsnoFrHoB5HiWC4FSNf%2BZoooSIUZtCA8us%3D&reserved=0>
 that implements CGL API (equivalent to the WGL frontend that exists for 
Windows)
  *   a new SW renderer 
winsys<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fmesa%2Fmesa%2F-%2Ftree%2Fmain%2Fsrc%2Fgallium%2Fwinsys&data=05%7C01%7Cjfonseca%40vmware.com%7Ccf822d69b6584b99c2cf08da2c163472%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637870771135623243%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=LbCV6VokVNeXv8g3%2BzYI6oZWZ0Esq3GomTfuZC0pV0Y%3D&reserved=0>
 that draws pixels to Cocoa window somehow (equivalent to the GDI winsys that 
draws to a Windows GDI surface)

It's not a matter of just integrating existing components together -- there's 
lot of new code that would be need here -- I'd reckon 2 months for somebody 
familiar with Mesa/macOS, 6 - 12 months for somebody more novice.  And let's be 
frank, given mac deprecation of OpenGL and migration away from Intel to Arm, 
the usefulness of this in the long term is dubious.


Jose

________________________________
From: mesa-dev <mesa-dev-boun...@lists.freedesktop.org> on behalf of Martin 
Pernollet <martin.pernol...@protonmail.com>
Sent: Friday, April 29, 2022 12:32
To: mesa-dev@lists.freedesktop.org <mesa-dev@lists.freedesktop.org>
Subject: Enable OpenGL software rendering on macOS


⚠ External Email

TLDR : I failed using Mesa software rendering on macOS. I am looking for advice 
to invoke mesa's libGL.dylib without relying on macOS's system GL.


Hi everyone,

I am building (java) software involving Mesa for CPU rendering. I use CPU 
rendering as fallback when JOGL (OpenGL binding for Java) fail to use the GPU 
natively. This is sometime the case for old Linux distributions, this will 
certainly be frequent on macOS in the future due to Apple's OpenGL deprecation.

Mesa CPU rendering is working great on Ubuntu (by enabling 
LIBGL_ALWAYS_SOFTWARE=true) and Windows (by simply loading Mesa's DLL instead 
of system DLL, no need to ask for software mode).

I however thrive to use Mesa's software rendering on macOS for the following 
reasons

  *   Spying dynamic library load sequence shows that whenever Mesa's 
libGL.dylib is loaded, Apple Metal and libGL.dylib are loaded before, even when 
using DYLD tricks to ensure Mesa get loaded before any other library (except 
the Java VM) [1] Someone says that Mesa's macOS implementation relies on system 
GL [4]. I noticed that when enabling LIBGL_ALWAYS_SOFTWARE=true, this activates 
Apple software rendering but not Mesa's software rendering [5]. I wonder how I 
could avoid this and use a pure Mesa's OpenGL implementation in this situation.
  *   When getting out of the java World
     *   Running a pre-built glxgear/glxinfo installed through MacPorts only 
allows using Apple's libGL.dylib but not Mesa's libGL.dylib [2].
     *   Building glxinfo myself by linking explicitely to Mesa's GL + X11 lead 
to an X11 error that I am not able to depict [3].

This has been discussed already on Khronos community [1] but I have no clue how 
to go further. I hope some experts here can help me solve this!

Thanks in advance,

Martin

[1] 
https://community.khronos.org/t/failing-to-load-mesa3d-on-macos-instead-of-macos-provided-opengl-library/108408<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.khronos.org%2Ft%2Ffailing-to-load-mesa3d-on-macos-instead-of-macos-provided-opengl-library%2F108408&data=05%7C01%7Cjfonseca%40vmware.com%7Ccf822d69b6584b99c2cf08da2c163472%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637870771135623243%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=0wHMo5S1MIAAizfD2%2BQ88ihk6uUSjfftZ37dVnLmnBg%3D&reserved=0>
[2] 
https://community.khronos.org/t/failing-to-load-mesa3d-on-macos-instead-of-macos-provided-opengl-library/108408/14<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.khronos.org%2Ft%2Ffailing-to-load-mesa3d-on-macos-instead-of-macos-provided-opengl-library%2F108408%2F14&data=05%7C01%7Cjfonseca%40vmware.com%7Ccf822d69b6584b99c2cf08da2c163472%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637870771135623243%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=VRQpXUHfDEMs%2BI1A%2F%2FIt%2Ft7cFKQKb6zsA5duCBohMCk%3D&reserved=0>
[3] 
https://community.khronos.org/t/failing-to-load-mesa3d-on-macos-instead-of-macos-provided-opengl-library/108408/19<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.khronos.org%2Ft%2Ffailing-to-load-mesa3d-on-macos-instead-of-macos-provided-opengl-library%2F108408%2F19&data=05%7C01%7Cjfonseca%40vmware.com%7Ccf822d69b6584b99c2cf08da2c163472%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637870771135623243%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=mc0yfv8UnDCEK2cPjmU%2FNrMR3Feu7igjVUBHfOQwjbU%3D&reserved=0>
[4] 
https://community.khronos.org/t/how-to-use-opengl-on-zink-mesa-moltenvk-and-macos/108160/18<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.khronos.org%2Ft%2Fhow-to-use-opengl-on-zink-mesa-moltenvk-and-macos%2F108160%2F18&data=05%7C01%7Cjfonseca%40vmware.com%7Ccf822d69b6584b99c2cf08da2c163472%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637870771135623243%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=voq5povQwSM9yrBohZUjAImIQIaRHuvtvMlMHP1peNY%3D&reserved=0>
[5] 
https://community.khronos.org/t/failing-to-load-mesa3d-on-macos-instead-of-macos-provided-opengl-library/108408/17<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.khronos.org%2Ft%2Ffailing-to-load-mesa3d-on-macos-instead-of-macos-provided-opengl-library%2F108408%2F17&data=05%7C01%7Cjfonseca%40vmware.com%7Ccf822d69b6584b99c2cf08da2c163472%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637870771135623243%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=WEN0ZqmrOOLpUBcfcadKt9ZwSu%2FL%2FQW0etOsmk47ock%3D&reserved=0>





________________________________

⚠ External Email: This email originated from outside of the organization. Do 
not click links or open attachments unless you recognize the sender.

Reply via email to