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

allow MacOS OpenGL software renderer? #2080

Open
jjYBdx4IL opened this issue Apr 12, 2022 · 8 comments · May be fixed by #2571
Open

allow MacOS OpenGL software renderer? #2080

jjYBdx4IL opened this issue Apr 12, 2022 · 8 comments · May be fixed by #2571
Labels

Comments

@jjYBdx4IL
Copy link

jjYBdx4IL commented Apr 12, 2022

Seems to work by simply replacing:

ADD_ATTRIB(NSOpenGLPFAAccelerated);

with

ADD_ATTRIB(NSOpenGLPFARendererID);ADD_ATTRIB(kCGLRendererGenericFloatID);

in src/nsgl_context.m.

An automatic (optional?) fallback would be the best option.

Would be useful for debugging OpenGL apps inside a VM. Or as a fallback for incompatible hardware. For that purpose it would then also be great to have a way to check whether hardware acceleration is in use or not.

@Khrysys
Copy link

Khrysys commented Apr 13, 2022

Was it throwing a specific error?

@jjYBdx4IL
Copy link
Author

jjYBdx4IL commented Apr 13, 2022

error (65545): NSGL: Failed to find a suitable pixel format

when calling initWithAttributes. After "#undef SET_ATTRIB".

@iTrooz
Copy link

iTrooz commented Aug 27, 2022

I agree that this would be a great feature, I need it for the same reason (testing an app on a MacOS virtual machine)

@ikus060
Copy link

ikus060 commented Mar 18, 2024

Is that something that is working today ? Is it possible to of this project in order to run openGL application on MacOS running within a VM ?

@iTrooz
Copy link

iTrooz commented Mar 19, 2024

Idk on upstream, but if you check my linked PR (WerWolv/ImHex#708) we've been using it in ImHex for a while now

@HinTak
Copy link

HinTak commented Jun 3, 2024

I can answer the last question - when the software renderer is in use, glGetString(GL_RENDERER) after obtaining a valid GL context, reports itself as b'Apple Software Renderer' . On genuine Mac os desktops, we have seen b'Apple M3 Pro' and b'Apple M1' for that field (reported by some skia python users in one of our mac os x specific issues, 214) . So you can read that field to see what actual hardware/software is in use. There is probably a more convenient way.

HinTak added a commit to HinTak/glfw that referenced this issue Jun 3, 2024
@HinTak
Copy link

HinTak commented Jun 3, 2024

My interests in this is github's own CI testing (which is headless), and I have no apple hardware nor VM. Looking at the code, I think it is possible to add automatic fall-back? The is no simple way of doing DELETE_ATTRIB, but it seems to be possible to do a REPLACE_ATTRIB. Slight complications of replacing 1 with 2 - I guess if we are sure it was added earlier, we can everything upward by 1, then insert the two in the middle overwriting the previous one.

HinTak added a commit to HinTak/glfw that referenced this issue Jun 4, 2024
I found that I needed to do a special DELETE_TERMINATING_NULL, because
SET_ATTRIB(x, 0) are present elsewhere, and DELETE_ATTRIB(0) is not
the reverse of ADD_ATTRIB(0).

The DELETE_ATTRIB macro is not robust enough - there should be an
UNSET_ATTRIB(a,v).

fixes glfw#2570
fixes glfw#2080
@HinTak HinTak linked a pull request Jun 4, 2024 that will close this issue
@HinTak
Copy link

HinTak commented Jun 4, 2024

I have added automatic software renderer retry if the accelerated request fails: #2571 - can somebody with genuine mac hardware gives it a try to check that accelerated opengl still works?

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

Successfully merging a pull request may close this issue.

6 participants