Login  Register

MacOS Assistance - Shader Loading in Shared Context

classic Classic list List threaded Threaded
8 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

MacOS Assistance - Shader Loading in Shared Context

hharrison
238 posts
Looking for some guidance on a MacOS issue we've been seeing from Jaamsim users, all rendering is done from a dedicated render thread, initializing on windows works just fine, but after some (recentish) driver updates on MacOS we reliably get failures setting up the shared context. I've tried to boil down the code run in the render thread to the bare minimum to see if anyone can spot what I'm doing wrong, any suggestions welcome. This is the entire procedure run when the render thread starts, error occurs in loadShaders the first time the shared context is used with a call to:

gl.glCreateShader(GL2GL3.GL_VERTEX_SHADER);

Always throws: error 1286 which is FrameBuffer not ready...I think. But I can't figure out what I'm missing here...any suggestions?



                // GLProfile.initSingleton();
                GLProfile glp = GLProfile.get(GLProfile.GL2GL3);
                caps = new GLCapabilities(glp);
                caps.setSampleBuffers(true);
                caps.setNumSamples(4);
                caps.setDepthBits(24);

                final boolean createNewDevice = true;
                dummyDrawable = GLDrawableFactory.getFactory(glp).createDummyAutoDrawable(null, createNewDevice, caps, null);
                dummyDrawable.display(); // triggers GLContext object creation and native realization.

                sharedContext = dummyDrawable.getContext();

                GL gl = sharedContext.getGL();
                gl3Supported = gl.isGL3();
                gl4Supported = gl.isGL4();
                glVersion = sharedContext.getGLVersionNumber();
                indirectSupported = checkGLVersion(4, 3) && !safeGraphics;
               
                int res = sharedContext.makeCurrent();
                assert (res == GLContext.CONTEXT_CURRENT);

                if (USE_DEBUG_GL) {
                        sharedContext.setGL(new DebugGL4bc((GL4bc)sharedContext.getGL().getGL2GL3()));
                }

                LogBox.formatRenderLog("Found OpenGL version: %s", sharedContext.getGLVersion());
                LogBox.formatRenderLog("Found GLSL: %s", sharedContext.getGLSLVersionString());
                VersionNumber vn = sharedContext.getGLVersionNumber();
                boolean isCore = sharedContext.isGLCoreProfile();
                LogBox.formatRenderLog("OpenGL Major: %d Minor: %d IsCore:%s", vn.getMajor(), vn.getMinor(), isCore);
                if (vn.getMajor() < 2) {
                        throw new RenderException("OpenGL version is too low. OpenGL >= 2.1 is required.");
                }
                GL2GL3 gl23 = sharedContext.getGL().getGL2GL3();
                if (!isCore && (!gl3Supported || safeGraphics))
                        initShaders(gl23);
                else
                        initCoreShaders(gl23, sharedContext.getGLSLVersionString());

Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: MacOS Assistance - Shader Loading in Shared Context

hharrison
238 posts
And in case anyone wants to see the code in context: https://github.com/jaamsim/jaamsim

com.jaamsim.render.Renderer the entry point at the beginning of the render thread is mainRenderLoop....any assistence or advice on how to debug this greatly appreciated.

Harvey
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: MacOS Assistance - Shader Loading in Shared Context

gouessej
Administrator
6035 posts
In reply to this post by hharrison
Hello

It's caused by an invalid framebuffer operation for sure. Do you reproduce the problem with one of our unit tests?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: MacOS Assistance - Shader Loading in Shared Context

gouessej
Administrator
6035 posts
In reply to this post by hharrison
Do you call glCheckFramebufferStatus somewhere?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: MacOS Assistance - Shader Loading in Shared Context

hharrison
238 posts
I'm tracking down a MacOS machine to be able to reproduce locally, as and when I can reproduce I'll provide some more debug info to see if it trips anyone's memory....sorry for the vague report, was hoping someone might have seen something on MacOS and would point to a simple 'oh you forgot this' kinda suggestion.

Harvey
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: MacOS Assistance - Shader Loading in Shared Context

gouessej
Administrator
6035 posts
I'd say that multithreading + framebuffers + OS X = you're looking for troubles.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: MacOS Assistance - Shader Loading in Shared Context

hharrison
238 posts
There's not much multithreading when it comes to the graphics parts, all the OpenGL work is happening on a dedicated thread in this case....although obviously that's not working so well at the moment on MacOS...ha ha.

Harvey
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: MacOS Assistance - Shader Loading in Shared Context

Sven Gothel
Administrator
2933 posts
In reply to this post by hharrison
Hi Harvey, please attach the JogAmp version test log files, see
https://forum.jogamp.org/Bugreport-How-to-report-a-bug-td4042945.html