Bug 1038

Summary: Allow skipping detection of certain GLProfiles, i.e. core profiles, >= 4.0, EGL, etc
Product: [JogAmp] Jogl Reporter: Sven Gothel <sgothel>
Component: coreAssignee: Sven Gothel <sgothel>
Status: RESOLVED FIXED    
Severity: enhancement CC: askinner, gouessej, sgothel
Priority: ---    
Version: 2   
Hardware: All   
OS: all   
Type: --- SCM Refs:
d55f1061a64f92d702a7f218d2f866fa4d5fa9dc c8b99d197769eaec53c2def562c0ef3fc0e6a9d2 e5a55ede324ce500f50991d56491758803063a58 7314b47ae1e42997e9e6974b84709640f0ac2a1b 830feb65f4c3d0c633556fd39787328834ee51d2 cbdd310351f2eda837e707ba7fa9ac18ff9473e4 3471ee732ab1b642a37066c70acbb749eb696d21
Workaround: ---
Attachments: logs with "JOGL Version Information" applet
logs with "JOGL Version Information" applet, second file
Logs 1 ATI 4350 Catalyst 10.3
Logs 2 ATI 4350 Catalyst 10.3

Description Sven Gothel 2014-07-29 22:19:13 CEST
To provide a workaround for buggy drivers,
allow skipping detection of certain GLProfiles, 
i.e. core profiles, >= 4.0, EGL, etc.

We already means to disable EGL/ES based profiles
via the system property 'jogl.disable.opengles'

We shall add one property to disable core profiles.

We shall add a GLProfile.initSingleton() variant
passing certing SKIP mode flags, like
  SKIP_EGLES_PROFILES
  SKIP_CORE_PROFILES
  SKIP_4_0_OR_GREATER (?)
Comment 1 Sven Gothel 2014-07-29 22:56:51 CEST
d55f1061a64f92d702a7f218d2f866fa4d5fa9dc:
  Skip native core profiles via property 'jogl.disable.openglcore'

  Also moved all GL profile properties to GLProfile class 
  and made them public for better documentation.
Comment 2 Sven Gothel 2014-07-30 03:08:41 CEST
c8b99d197769eaec53c2def562c0ef3fc0e6a9d2:
    
GLContext shall not map compatibility profiles to core profile if the latter is are not available (restrict profile aliasing).
    
If a user requests a straight GL3 core profile, don't answer with a compatibility profile, e.g. GL4bc.
    
Hence this patch exposes the true GL profile situation more honestly the the user!
    
User can already query profile mappings via GLProfile, i.e.
  - GL2GL3,
  - GL4ES3, or via
  - getMaximum
  - getMaxFixedFunc
  - getMaxProgrammable
  - getMaxProgrammableCore
    
This also fixes an issue when a user requests 'getMaxProgrammableCore'
but would receive a GL4bc profile.
Comment 3 Sven Gothel 2014-07-30 03:09:22 CEST
e5a55ede324ce500f50991d56491758803063a58

Skip 'ARB_create_context' context creation extension 
via property 'jogl.disable.openglarbcontext'; ...
    
Only allow the exclusions if platform OS is not OSX:
  - jogl.disable.openglcore
  - jogl.disable.openglarbcontext
    
Since on OSX they are known to work reliable and there is not other method
if receiving a higher GL profile than core and ARB.
    
This also removes the restrictions on X11 and Windows,
where profiles >= GL3 must be created using ARB_create_context.
Hence this is allowed now.
Comment 4 Sven Gothel 2014-07-30 03:10:47 CEST
Dropping the idea of adding an API (other than the properties) 
to skip profile detection.

We may reopen this bug and enhance as needed.
Comment 5 Sven Gothel 2014-07-30 04:55:37 CEST
commit 830feb65f4c3d0c633556fd39787328834ee51d2:

Commit e5a55ede324ce500f50991d56491758803063a58 was incomplete,
i.e. it lacked the required mappings for the non ARB profile, i.e.:
    GL4bc -> GL3bc, etc.

These profile mappings have been added now.

+++

Further more, GLContext's profile queries, isGL*()
test the ctxOptions for CTX_IS_ARB_CREATED.
This has to be removed to properly work w/ Skip 'ARB_create_context'.

To remove the risk of inconcistency, i.e. context created via ARB and non-ARB,
the 'GLX/WGL profile >= GL3 via non ARB' validation removed
in commit e5a55ede324ce500f50991d56491758803063a58 has been brought back
and refined. Note:
    if( glp.isGL3() && createContextARBTried ) {
    // We shall not allow context creation >= GL3 w/ non ARB methods if ARB is used,
    // otherwise context of similar profile but different creation method may not be share-able.
    .. THROW EXCEPTON ..
    }
This limited validation removes the possibility of such having a context
of same profile, one created via ARB and one without.
Hence also validates the isGL*() change, where the CTX_IS_ARB_CREATED criteria is removed.

+++

Note regarding commit 7314b47ae1e42997e9e6974b84709640f0ac2a1b,
which reverts c8b99d197769eaec53c2def562c0ef3fc0e6a9d2, see Comment 2:

While analyzing the mapping, it turns out that commit c8b99d197769eaec53c2def562c0ef3fc0e6a9d2
    "Don't map compatibility profiles to core profile if the latter are not available (restrict profile aliasing)"
is not fully consistent with GLProfile's and GLContext's profile queries, i.e. isGL*().
We may reiterate over this change .. but have it be reverted for now.
Comment 6 Julien Gouesse 2014-10-20 18:11:34 CEST
I get the following exception:
javax.media.opengl.GLException: AWT-EventQueue-0: WindowsWGLContex.createContextImpl ctx !ARB, profile > GL2 requested (OpenGL >= 3.0.1). Requested: GLProfile[GL3bc/GL3bc.hw], current: 2.1 (Compat profile, FBO, hardware) - 2.1.8787
	at jogamp.opengl.windows.wgl.WindowsWGLContext.createImpl(WindowsWGLContext.java:366)
	at jogamp.opengl.GLContextImpl.makeCurrentWithinLock(GLContextImpl.java:663)
	at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:562)
	at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:519)
	at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1105)
	at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:994)
	at jogamp.opengl.GLAutoDrawableBase.defaultDisplay(GLAutoDrawableBase.java:423)
	at com.jogamp.opengl.GLAutoDrawableDelegate.display(GLAutoDrawableDelegate.java:167)

Windows 7, Oracle Java 1.7 update 60, ATI Radeon 3100, ATI Technologies Inc., 8.632.1.2000, 2.1.8787.

Should the following test concern only GL3 core?
https://github.com/sgothel/jogl/blob/master/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java#L366

Should we blacklist and silently skip some "unable" profiles?

I use GLProfile.getMaxFixedFunc(true).
Comment 7 Sven Gothel 2014-10-21 11:45:13 CEST
(In reply to comment #6)
> I get the following exception:
> javax.media.opengl.GLException: AWT-EventQueue-0:
> WindowsWGLContex.createContextImpl ctx !ARB, profile > GL2 requested (OpenGL
> >= 3.0.1). Requested: GLProfile[GL3bc/GL3bc.hw], current: 2.1 (Compat
> profile, FBO, hardware) - 2.1.8787

For some reason, the user has requested a GL3bc profile
which seems to be available since it has been mapped
in GLProfile's initialization: GL3bc -> GL3bc.hw

Now, suddenly, the ARB create context method seems to fail in this branch
  <https://github.com/sgothel/jogl/blob/master/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java#L366>

[ARB method had been tried, and the temp context (2.1) is not sufficient]

This is a driver bug!

> Windows 7, Oracle Java 1.7 update 60, ATI Radeon 3100, ATI Technologies
> Inc., 8.632.1.2000, 2.1.8787.
> 
> 
> Should we blacklist and silently skip some "unable" profiles?
> 
> I use GLProfile.getMaxFixedFunc(true).

A quirk comes to mind, disabling ARB context creation, yes.

We would need to have details, i.e. range of GL_RENDERER and GL_VERSION,
the vendor version for the latter.

+++

> Should the following test concern only GL3 core?
> https://github.com/sgothel/jogl/blob/master/src/jogl/classes/jogamp/opengl/
> windows/wgl/WindowsWGLContext.java#L366

No, there should be no GL3 nor GL3bc being returned via non ARB context 
creation methods - or in other words:
  If there is the ability to create an OpenGL 3.1 context,
  ARB context creation methods should function.

See GL API inclusion criteria:
  <https://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/overview-summary.html#GLAPIInclusionCriteria>

We define GL3:
  - OpenGL [ 3.1 .. 3.3 ] 
  - <https://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GL3.html>

We define GL3bc:
  - OpenGL [ 3.1 .. 3.3 ] compatibility 
  - <https://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GL3bc.html>
Comment 8 Julien Gouesse 2014-10-21 12:44:13 CEST
GL_VENDOR      ATI Technologies Inc.
GL_RENDERER    ATI Radeon 3100 Graphics
GL_VERSION     3.1.8787 BETA
Comment 9 Julien Gouesse 2014-10-21 12:47:50 CEST
Created attachment 657 [details]
logs with "JOGL Version Information" applet
Comment 10 Julien Gouesse 2014-10-21 12:48:12 CEST
Created attachment 658 [details]
logs with "JOGL Version Information" applet, second file
Comment 11 Julien Gouesse 2014-10-21 13:27:41 CEST
I don't understand what happened, it was rather GL_VERSION 2.1.8787 yesterday, maybe the driver has been updated.
Comment 12 Julien Gouesse 2014-10-23 16:29:39 CEST
Not reproducible with ATI Radeon 4350.
Comment 13 Julien Gouesse 2014-10-23 16:30:22 CEST
Created attachment 659 [details]
Logs 1 ATI 4350 Catalyst 10.3
Comment 14 Julien Gouesse 2014-10-23 16:30:48 CEST
Created attachment 660 [details]
Logs 2 ATI 4350 Catalyst 10.3
Comment 15 Julien Gouesse 2014-10-24 10:17:37 CEST
Same results with ATI Radeon HD 4350 and ATI Radeon 3100 with the driver 3.1.8787 BETA. It works.
Comment 16 Julien Gouesse 2014-10-24 11:01:33 CEST
3.0.8664 (Catalyst 9.5) works too with ATI Radeon HD 4350.
Comment 17 Sven Gothel 2015-01-23 15:02:04 CET
cbdd310351f2eda837e707ba7fa9ac18ff9473e4
  Resolve merge conflict GLRendererQuirks

3471ee732ab1b642a37066c70acbb749eb696d21
  Refine handling of GLRendererQuirks.NoARBCreateContext

  - GLRendererQuirks.NoARBCreateContext is set static per device
  - Property GLProfile.disableOpenGLARBContext sets 
    static GLRendererQuirks.NoARBCreateContext
  - Centralize handling in GLContextImpl.createContextARB(..)