aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/GLContextImpl.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2019-12-28 04:16:18 +0100
committerSven Gothel <[email protected]>2019-12-28 04:16:18 +0100
commite2223107cc54e08031bd9505ce8a9ccc72673be0 (patch)
tree735fdd776ce7a4ad8db137bfcbc6a62d7c5877c5 /src/jogl/classes/jogamp/opengl/GLContextImpl.java
parent50f9c9e113b09ab54ba40abba6b2face27c9a139 (diff)
Bug 1347: Resolve Merged EGL/Desktop Profile Mapping
GLProfile.computeProfileImpl(..) as of Bug 1084 is not the culprit here and its hardware criteria filter works. The issue is commit 99a064327bf991318841c858d21d13e55d6b39db of Bug 1203, in particular the change in GLProfile re: "Merge computed EGL-Profile-Map (1) and Desktop-Profile-Map (2) per device, instead of just using the last computation, preserving and favoratizing the Desktop-Profile-Map." Here the Desktop-Profile-Map overwrites the EGL-Profile-Map and hence the software mapping gets used. Indeed, this is a regression cause by the work of Bug 1203. +++ Resolution is to revert the explicit 'union mapping' and rely on an enhanced 'GLContextImpl.remapAvailableGLVersions(fromDevice, toDevice)' function. Here the EGLDrawableFactory _already_ maps the EGL device's GL Versions to the 'host' device (e.g. X11). This has to be refined so that the remap will not overwrite the 'host' device's already detected GL Versions. That alone is enough, so that GLProfile can simply use the 'mappedEGLProfiles' of the 'host' device if detected, which already is a merged mapping of X11 host- and EGL sub-device. In case no 'mappedEGLProfiles' are available, we simply use the 'mappedDesktopProfiles'.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLContextImpl.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java39
1 files changed, 34 insertions, 5 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index 60a351fc2..11b155760 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -63,6 +63,7 @@ import com.jogamp.gluegen.runtime.opengl.GLNameResolver;
import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver;
import com.jogamp.opengl.GLExtensions;
import com.jogamp.opengl.GLRendererQuirks;
+
import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
import com.jogamp.nativewindow.AbstractGraphicsDevice;
import com.jogamp.nativewindow.NativeSurface;
@@ -1098,13 +1099,24 @@ public abstract class GLContextImpl extends GLContext {
}
- protected static void remapAvailableGLVersions(final AbstractGraphicsDevice fromDevice, final AbstractGraphicsDevice toDevice) {
+ /**
+ * Remaps all available GL Version from {@code fromDevice} to {@code toDevice}.
+ *
+ * @param fromDevice the required matching device key to be mapped
+ * @param toDevice mapped GL version target
+ * @param overwrite if {@code true} overwrites previous mapping, otherwise leaves it untouched
+ * @param ctpCriteria the given GL Version context profile required to map a {@code fromDevice} GL Version.
+ * To map all GL Versions, just pass {@link GLContext#CTX_PROFILE_ES} | {@link GLContext#CTX_PROFILE_CORE} | {@link GLContext#CTX_PROFILE_COMPAT}
+ */
+ protected static void remapAvailableGLVersions(final AbstractGraphicsDevice fromDevice, final AbstractGraphicsDevice toDevice,
+ final boolean overwrite, final int ctpCriteria) {
if( fromDevice == toDevice || fromDevice.getUniqueID() == toDevice.getUniqueID() ) {
return; // NOP
}
synchronized(deviceVersionAvailable) {
if(DEBUG) {
- System.err.println(getThreadName() + ": createContextARB-MapGLVersions REMAP "+fromDevice+" -> "+toDevice);
+ System.err.println(getThreadName() + ": createContextARB-MapGLVersions REMAP "+fromDevice+" -> "+toDevice+
+ ", overwrite "+overwrite+", ctpCriteria "+getGLProfile(new StringBuilder(), ctpCriteria).toString());
}
final IdentityHashMap<String, Integer> newDeviceVersionAvailable = new IdentityHashMap<String, Integer>();
final Set<String> keys = deviceVersionAvailable.keySet();
@@ -1115,7 +1127,7 @@ public abstract class GLContextImpl extends GLContext {
if(DEBUG) {
final int[] ctp = { 0 };
final VersionNumber version = decomposeBits(valI.intValue(), ctp);
- System.err.println(" MapGLVersions REMAP OLD "+origKey+" -> "+GLContext.getGLVersion(new StringBuilder(), version, ctp[0], null).toString());
+ System.err.println(" MapGLVersions REMAP VAL0 "+origKey+" == "+GLContext.getGLVersion(new StringBuilder(), version, ctp[0], null).toString());
}
newDeviceVersionAvailable.put(origKey, valI);
final int devSepIdx = origKey.lastIndexOf('-');
@@ -1124,12 +1136,29 @@ public abstract class GLContextImpl extends GLContext {
}
final String devUniqueID = origKey.substring(0, devSepIdx);
if( fromDevice.getUniqueID().equals(devUniqueID) ) {
+ // key/val pair from 'fromDevice' to be mapped to 'toDevice'
final String profileReq = origKey.substring(devSepIdx);
final String newKey = (toDevice.getUniqueID()+profileReq).intern();
+ final Integer preI = deviceVersionAvailable.get(newKey);
+ final int valCTP = getCTPFromBits(valI.intValue());
+ final boolean write = ( overwrite || null == preI ) && 0 != ( ctpCriteria & valCTP );
+ if( write ) {
+ newDeviceVersionAvailable.put(newKey, valI);
+ }
if(DEBUG) {
- System.err.println(" MapGLVersions REMAP NEW "+newKey+" -> (ditto)");
+ if( write ) {
+ System.err.println(" MapGLVersions REMAP NEW0 "+newKey+" -> (ditto)");
+ } else {
+ System.err.println(" MapGLVersions REMAP NEW0 "+newKey+" (unchanged)");
+ }
+ if( null != preI ) {
+ final int[] ctp = { 0 };
+ final VersionNumber version = decomposeBits(preI.intValue(), ctp);
+ System.err.println(" MapGLVersions REMAP OLD1 "+newKey+" :: "+GLContext.getGLVersion(new StringBuilder(), version, ctp[0], null).toString());
+ } else {
+ System.err.println(" MapGLVersions REMAP OLD1 "+newKey+" :: (nil)");
+ }
}
- newDeviceVersionAvailable.put(newKey, valI);
}
}
}