summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-03-04 19:57:39 +0100
committerSven Gothel <[email protected]>2023-03-04 19:57:39 +0100
commitead8651394c792950025114cfcb6476e8b82bf50 (patch)
tree28d3ff3c78d95c8c6d85512335a1f8c613cde10b /src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
parent0b796fe6963705a231bc1f24a5b4e6651b7e928f (diff)
GLDrawableFactoryImpl:createDummyDrawable(): Similar to createOffscreenDrawable() prefer createSurfacelessImpl() over createDummySurfaceImpl() to reduce resources (no actual window)
This enhances the 'dummy drawable' use-case implementation, i.e. for shared context.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
index 28ecd1029..b165f3b77 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
@@ -537,8 +537,8 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
* @param height
*/
protected final GLDrawableImpl createSurfacelessDrawable(final AbstractGraphicsDevice device2Use,
- final GLCapabilitiesImmutable capsRequested,
- final int width, final int height) {
+ final GLCapabilitiesImmutable capsRequested,
+ final int width, final int height) {
if(width<=0 || height<=0) {
throw new GLException("initial size must be positive (were (" + width + " x " + height + "))");
}
@@ -551,8 +551,12 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
@Override
public final GLDrawable createDummyDrawable(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser) {
final AbstractGraphicsDevice device;
+ final SharedResourceRunner.Resource sr = getOrCreateSharedResource( deviceReq );
+ if( null == sr ) {
+ throw new GLException("No shared resource for requested: "+deviceReq);
+ }
if( createNewDevice ) {
- device = getOrCreateSharedDevice(deviceReq);
+ device = sr.getDevice();
if(null == device) {
throw new GLException("No shared device for requested: "+deviceReq+", createNewDevice "+createNewDevice);
}
@@ -561,8 +565,14 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
deviceReq.lock();
}
try {
- final ProxySurface dummySurface = createDummySurfaceImpl(deviceReq, device, createNewDevice, capsRequested, capsRequested, chooser, 64, 64);
- return createOnscreenDrawableImpl(dummySurface);
+ final GLRendererQuirks glrq = sr.getRendererQuirks(capsRequested.getGLProfile());
+ final ProxySurface surface;
+ if( null != glrq && !glrq.exist(GLRendererQuirks.NoSurfacelessCtx) ) {
+ surface = createSurfacelessImpl(deviceReq, device, createNewDevice, capsRequested, capsRequested, chooser, 64, 64);
+ } else {
+ surface = createDummySurfaceImpl(deviceReq, device, createNewDevice, capsRequested, capsRequested, chooser, 64, 64);
+ }
+ return createOnscreenDrawableImpl(surface);
} finally {
if( !createNewDevice ) {
deviceReq.unlock();