diff options
author | Sven Gothel <[email protected]> | 2014-12-07 04:03:02 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-12-07 04:03:02 +0100 |
commit | 35622a7cef4a28ce7e32bf008ef331d9a0d9e3e2 (patch) | |
tree | e688b4fcb141c0b6b026d20379fb0ba6dd60a256 /src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java | |
parent | 9ea218a5990b908e04235c407c0951c60df6ffba (diff) |
Bug 1068 - Allow GLContext creation and makeCurrent without default framebuffer (Part 2); Bug 896: EGL_KHR_create_context (Part 1)
Bug 1068 - Allow GLContext creation and makeCurrent without default framebuffer (Part 2)
Implement surfaceless context on EGL and GLX/X11
utilizing *UpstreamSurfacelessHook as introduced in
commit 9ea218a5990b908e04235c407c0951c60df6ffba.
Surfaceless context is probed during GL profile probing by default.
If available, it will be used for offscreen FBO drawables.
If probing fails, or is disabled,
the new GLRendererQuirks.NoSurfacelessCtx is set.
- GLProfile.disableSurfacelessContext disables
surfaceless context probing, set property 'jogl.disable.surfacelesscontext'
Tested:
- Mesa/EGL works,
- Mesa + NVidia w/ GLX fail on GNU/Linux): Fails NoSurfacelessCtx
- TODO: Windows impl. and more tests
+++
Bug 896: EGL_KHR_create_context (Part 1)
- Detect EGL_KHR_create_context capability and utilize if available.
- Implement EGLContext.createContextARBImpl(..),
allowing native DEBUG context usage, where available.
- EGL implements SharedResourceRunner, i.e. probing profiles
on dedicated thread using common interface.
- Probe desktop profile/context ability
in EGLDrawableFactory SharedResourceRunner,
Where EGLGLnDynamicLibraryBundleInfo covers EGL + desktop GL.
- TODO: Tests w/ capable implementation
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java index e3382e5b0..ee984b74a 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java @@ -129,16 +129,16 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { protected final boolean createSharedResourceImpl(final AbstractGraphicsDevice device) { final SharedResourceRunner.Resource sr = getOrCreateSharedResource( device ); if(null!=sr) { - return sr.isValid(); + return sr.isAvailable(); } return false; } @Override - public final GLRendererQuirks getRendererQuirks(final AbstractGraphicsDevice device) { + public final GLRendererQuirks getRendererQuirks(final AbstractGraphicsDevice device, final GLProfile glp) { final SharedResourceRunner.Resource sr = getOrCreateSharedResource( device ); if(null!=sr) { - return sr.getRendererQuirks(); + return sr.getRendererQuirks(glp); } return null; } @@ -272,9 +272,9 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { @Override public final GLOffscreenAutoDrawable createOffscreenAutoDrawable(final AbstractGraphicsDevice deviceReq, - final GLCapabilitiesImmutable capsRequested, - final GLCapabilitiesChooser chooser, - final int width, final int height) { + final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, + final int width, final int height) { final GLDrawable drawable = createOffscreenDrawable( deviceReq, capsRequested, chooser, width, height ); try { drawable.setRealized(true); @@ -307,24 +307,32 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { @Override public final GLDrawable createOffscreenDrawable(final AbstractGraphicsDevice deviceReq, - final GLCapabilitiesImmutable capsRequested, - final GLCapabilitiesChooser chooser, - final int width, final int height) { + final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, + final int width, final int height) { if(width<=0 || height<=0) { throw new GLException("initial size must be positive (were (" + width + " x " + height + "))"); } - final AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq); - if(null == device) { + final SharedResourceRunner.Resource sr = getOrCreateSharedResource( deviceReq ); + if( null == sr ) { throw new GLException("No shared device for requested: "+deviceReq); } - + final AbstractGraphicsDevice device = sr.getDevice(); final GLCapabilitiesImmutable capsChosen = GLGraphicsConfigurationUtil.fixOffscreenGLCapabilities(capsRequested, this, device); if( capsChosen.isFBO() ) { // Use minimum GLCapabilities for the dummy surface w/ same profile - final ProxySurface dummySurface = createDummySurfaceImpl(device, true, new GLCapabilities(capsChosen.getGLProfile()), capsRequested, null, width, height); - final GLDrawableImpl dummyDrawable = createOnscreenDrawableImpl(dummySurface); - return new GLFBODrawableImpl.ResizeableImpl(this, dummyDrawable, dummySurface, capsChosen, 0); + final GLProfile glp = capsChosen.getGLProfile(); + final GLCapabilitiesImmutable glCapsMin = new GLCapabilities(glp); + final GLRendererQuirks glrq = sr.getRendererQuirks(glp); + final ProxySurface surface; + if( null != glrq && !glrq.exist(GLRendererQuirks.NoSurfacelessCtx) ) { + surface = createSurfacelessImpl(device, true, glCapsMin, capsRequested, null, width, height); + } else { + surface = createDummySurfaceImpl(device, true, glCapsMin, capsRequested, null, width, height); + } + final GLDrawableImpl drawable = createOnscreenDrawableImpl(surface); + return new GLFBODrawableImpl.ResizeableImpl(this, drawable, surface, capsChosen, 0); } return createOffscreenDrawableImpl( createMutableSurfaceImpl(device, true, capsChosen, capsRequested, chooser, new UpstreamSurfaceHookMutableSize(width, height) ) ); |