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

Support OpenGL 3.x on Mac/Linux/etc. using Core Profile #8277

Closed
unknownbrackets opened this issue Dec 19, 2015 · 7 comments · Fixed by #10113
Closed

Support OpenGL 3.x on Mac/Linux/etc. using Core Profile #8277

unknownbrackets opened this issue Dec 19, 2015 · 7 comments · Fixed by #10113

Comments

@unknownbrackets
Copy link
Collaborator

Intel's Mac drivers only support 3.x and higher when using a Core Profile without deprecated features (such as #8276.) It also requires some other things: #versions on all shaders, for example.

The open source AMD driver for Linux Mint has a similar restriction to use Core.

Supporting this would allow Mac users to take more advantage of newer OpenGL features.

Some work was done in #8270 to move toward this goal, but it's still not drawing correctly.

-[Unknown]

@Joelgp83
Copy link

Will this also allow for the core profile to be used when using open source drivers on linux, or will we still be stuck on 3.0?

@unknownbrackets
Copy link
Collaborator Author

@Joelgp83 it could potentially already work (setting that flag and changing the way the context is created.) But yes, the intention is to be able to generically support OpenGL Core Profile targets, including Mac and Linux (I didn't realize this was an issue on Linux.)

Will probably need help debugging and testing the issues on Linux, though, if they're still present. In fact, that might help both Linux and Mac.

-[Unknown]

@Joelgp83
Copy link

Indeed, this has been an issue on linux. I myself logged the issue in #7570.

Upon checking the latest revision in the testing PPA on linux mint, the issue is still there -- I'm locked to using version 3.0.2 with shader language version 1.3.

@unknownbrackets
Copy link
Collaborator Author

Oh, oops, I guess this is a duplicate of #7570 sorta. I think I forgot about that one, although I saw it. I think I remembered that as only a postshader issue, which I don't really worry much about since I'm not very interested in.

Anyway, basically you want to try this:

https://github.com/hrydgard/ppsspp/blob/master/ext/native/base/PCMain.cpp#L428

Uncomment it and remove the ifdefs. This will switch to Core. You can use a different number than 3.2 if you want, but maybe try 3.2 first just to see if it draws things.

If it does not draw things, what errors does it log? Mac logs errors about missing glsl versions (we also need fragColor0 specifiers), I have a hacked together patch for that if you hit that... but wondering if it logs any other errors. I couldn't tell from Mac what else was wrong, and on Windows it drew just fine.

-[Unknown]

@unknownbrackets unknownbrackets changed the title Support OpenGL 3.x on Mac using Core Profile Support OpenGL 3.x on Mac/Linux/etc. using Core Profile Dec 21, 2015
@unknownbrackets
Copy link
Collaborator Author

unknownbrackets commented Mar 7, 2016

Notes:

  • IsCoreProfile gets cleared of course, so it needs to be set differently to be preserved.
  • glew requires glewExperimental = true; before glewInit(), ugh.
  • Some extensions, such as GL_ARB_vertex_array_object, are elided - list from Dolphin.

With those and a few changes to shader declarations, it displays the UI on a Mac. Also shows 4.x OpenGL.

Unfortunately, there's more shader stuff to fix in the game parts, but at least that's the "it's not drawing for some reason" problem solved.

-[Unknown]

@mrcmunir
Copy link
Contributor

mrcmunir commented Feb 16, 2017

Not sure if related with this is unfinished

I use with SDL2

SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
glewExperimental = GL_TRUE; 
GLenum glewError = glewInit();

But I returned 00000502 error (black screen)

: gpu_features.cpp:126: GPU Vendor : Intel Open Source Technology Center ; renderer: Mesa DRI Intel(R) Ivybridge Mobile version str: 3.3 (Core Profile) Mesa 17.1.0-devel (git-124d9dd57f) ; GLSL version str: 3.30
E: gpu_features.cpp:396: GL error in init: 1280
E: PCMain.cpp:669: Output audio samples: 1024 (requested: 2048)
loading control pad mappings from /run/media/mrc/C0D47D0DD47D0746/psp/myppsspp/build/assets/gamecontrollerdb.txt: SUCCESS!
E: thin3d_gl.cpp:786: Thin3D GL: Error loading texture: 00000502
E: thin3d_gl.cpp:786: Thin3D GL: Error loading texture: 00000502

I only solved with manual variable by mesa3d export MESA_GL_VERSION_OVERRIDE=3.3COMPAT https://github.com/hrydgard/ppsspp/blob/master/tesselationhwON-mesa3drun.sh

So Only work fine with COMPATIBILITY context? I.e 3.1COMPAT , 3.2COMPAT 3.3COMPAT etc.

@unknownbrackets how status for this in the actual code?

@unknownbrackets
Copy link
Collaborator Author

@mrcmunir see #9976 for code changes needed to actually support core profiles. The SetGLCoreContext(true); line is important as well.

Would be nice if that can avoid using that sh. That PR also includes some elided extensions which might affect hw tessellation being available.

-[Unknown]

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

Successfully merging a pull request may close this issue.

3 participants