sun.java2d.opengl.OGLContext.OGLContextCaps Java Examples

The following examples show how to use sun.java2d.opengl.OGLContext.OGLContextCaps. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WGLGraphicsConfig.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static WGLGraphicsConfig getConfig(Win32GraphicsDevice device,
                                          int pixfmt)
{
    if (!wglAvailable) {
        return null;
    }

    long cfginfo = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // getWGLConfigInfo() creates and destroys temporary
        // surfaces/contexts, so we should first invalidate the current
        // Java-level context and flush the queue...
        OGLContext.invalidateCurrentContext();
        WGLGetConfigInfo action =
            new WGLGetConfigInfo(device.getScreen(), pixfmt);
        rq.flushAndInvokeNow(action);
        cfginfo = action.getConfigInfo();
        if (cfginfo != 0L) {
            OGLContext.setScratchSurface(cfginfo);
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    ids[0] = OGLContext.getOGLIdString();
                }
            });
        }
    } finally {
        rq.unlock();
    }
    if (cfginfo == 0) {
        return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);

    return new WGLGraphicsConfig(device, pixfmt, cfginfo, caps);
}
 
Example #2
Source File: WGLGraphicsConfig.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static WGLGraphicsConfig getConfig(Win32GraphicsDevice device,
                                          int pixfmt)
{
    if (!wglAvailable) {
        return null;
    }

    long cfginfo = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // getWGLConfigInfo() creates and destroys temporary
        // surfaces/contexts, so we should first invalidate the current
        // Java-level context and flush the queue...
        OGLContext.invalidateCurrentContext();
        WGLGetConfigInfo action =
            new WGLGetConfigInfo(device.getScreen(), pixfmt);
        rq.flushAndInvokeNow(action);
        cfginfo = action.getConfigInfo();
        if (cfginfo != 0L) {
            OGLContext.setScratchSurface(cfginfo);
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    ids[0] = OGLContext.getOGLIdString();
                }
            });
        }
    } finally {
        rq.unlock();
    }
    if (cfginfo == 0) {
        return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);

    return new WGLGraphicsConfig(device, pixfmt, cfginfo, caps);
}
 
Example #3
Source File: WGLGraphicsConfig.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static WGLGraphicsConfig getConfig(Win32GraphicsDevice device,
                                          int pixfmt)
{
    if (!wglAvailable) {
        return null;
    }

    long cfginfo = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // getWGLConfigInfo() creates and destroys temporary
        // surfaces/contexts, so we should first invalidate the current
        // Java-level context and flush the queue...
        OGLContext.invalidateCurrentContext();
        WGLGetConfigInfo action =
            new WGLGetConfigInfo(device.getScreen(), pixfmt);
        rq.flushAndInvokeNow(action);
        cfginfo = action.getConfigInfo();
        if (cfginfo != 0L) {
            OGLContext.setScratchSurface(cfginfo);
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    ids[0] = OGLContext.getOGLIdString();
                }
            });
        }
    } finally {
        rq.unlock();
    }
    if (cfginfo == 0) {
        return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);

    return new WGLGraphicsConfig(device, pixfmt, cfginfo, caps);
}
 
Example #4
Source File: WGLGraphicsConfig.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static WGLGraphicsConfig getConfig(Win32GraphicsDevice device,
                                          int pixfmt)
{
    if (!wglAvailable) {
        return null;
    }

    long cfginfo = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // getWGLConfigInfo() creates and destroys temporary
        // surfaces/contexts, so we should first invalidate the current
        // Java-level context and flush the queue...
        OGLContext.invalidateCurrentContext();
        WGLGetConfigInfo action =
            new WGLGetConfigInfo(device.getScreen(), pixfmt);
        rq.flushAndInvokeNow(action);
        cfginfo = action.getConfigInfo();
        if (cfginfo != 0L) {
            OGLContext.setScratchSurface(cfginfo);
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    ids[0] = OGLContext.getOGLIdString();
                }
            });
        }
    } finally {
        rq.unlock();
    }
    if (cfginfo == 0) {
        return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);

    return new WGLGraphicsConfig(device, pixfmt, cfginfo, caps);
}
 
Example #5
Source File: WGLGraphicsConfig.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static WGLGraphicsConfig getConfig(Win32GraphicsDevice device,
                                          int pixfmt)
{
    if (!wglAvailable) {
        return null;
    }

    long cfginfo = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // getWGLConfigInfo() creates and destroys temporary
        // surfaces/contexts, so we should first invalidate the current
        // Java-level context and flush the queue...
        OGLContext.invalidateCurrentContext();
        WGLGetConfigInfo action =
            new WGLGetConfigInfo(device.getScreen(), pixfmt);
        rq.flushAndInvokeNow(action);
        cfginfo = action.getConfigInfo();
        if (cfginfo != 0L) {
            OGLContext.setScratchSurface(cfginfo);
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    ids[0] = OGLContext.getOGLIdString();
                }
            });
        }
    } finally {
        rq.unlock();
    }
    if (cfginfo == 0) {
        return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);

    return new WGLGraphicsConfig(device, pixfmt, cfginfo, caps);
}
 
Example #6
Source File: CGLGraphicsConfig.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static CGLGraphicsConfig getConfig(CGraphicsDevice device,
                                          int pixfmt)
{
    if (!cglAvailable) {
        return null;
    }

    long cfginfo = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // getCGLConfigInfo() creates and destroys temporary
        // surfaces/contexts, so we should first invalidate the current
        // Java-level context and flush the queue...
        OGLContext.invalidateCurrentContext();

        cfginfo = getCGLConfigInfo(device.getCGDisplayID(), pixfmt,
                                   kOpenGLSwapInterval);
        if (cfginfo != 0L) {
            OGLContext.setScratchSurface(cfginfo);
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    ids[0] = OGLContext.getOGLIdString();
                }
            });
        }
    } finally {
        rq.unlock();
    }
    if (cfginfo == 0) {
        return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);

    return new CGLGraphicsConfig(device, pixfmt, cfginfo, caps);
}
 
Example #7
Source File: WGLGraphicsConfig.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static WGLGraphicsConfig getConfig(Win32GraphicsDevice device,
                                          int pixfmt)
{
    if (!wglAvailable) {
        return null;
    }

    long cfginfo = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // getWGLConfigInfo() creates and destroys temporary
        // surfaces/contexts, so we should first invalidate the current
        // Java-level context and flush the queue...
        OGLContext.invalidateCurrentContext();
        WGLGetConfigInfo action =
            new WGLGetConfigInfo(device.getScreen(), pixfmt);
        rq.flushAndInvokeNow(action);
        cfginfo = action.getConfigInfo();
        if (cfginfo != 0L) {
            OGLContext.setScratchSurface(cfginfo);
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    ids[0] = OGLContext.getOGLIdString();
                }
            });
        }
    } finally {
        rq.unlock();
    }
    if (cfginfo == 0) {
        return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);

    return new WGLGraphicsConfig(device, pixfmt, cfginfo, caps);
}
 
Example #8
Source File: CGLGraphicsConfig.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static CGLGraphicsConfig getConfig(CGraphicsDevice device,
                                          int pixfmt)
{
    if (!cglAvailable) {
        return null;
    }

    long cfginfo = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // getCGLConfigInfo() creates and destroys temporary
        // surfaces/contexts, so we should first invalidate the current
        // Java-level context and flush the queue...
        OGLContext.invalidateCurrentContext();

        cfginfo = getCGLConfigInfo(device.getCGDisplayID(), pixfmt,
                                   kOpenGLSwapInterval);
        if (cfginfo != 0L) {
            OGLContext.setScratchSurface(cfginfo);
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    ids[0] = OGLContext.getOGLIdString();
                }
            });
        }
    } finally {
        rq.unlock();
    }
    if (cfginfo == 0) {
        return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);

    return new CGLGraphicsConfig(device, pixfmt, cfginfo, caps);
}
 
Example #9
Source File: WGLGraphicsConfig.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static WGLGraphicsConfig getConfig(Win32GraphicsDevice device,
                                          int pixfmt)
{
    if (!wglAvailable) {
        return null;
    }

    long cfginfo = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // getWGLConfigInfo() creates and destroys temporary
        // surfaces/contexts, so we should first invalidate the current
        // Java-level context and flush the queue...
        OGLContext.invalidateCurrentContext();
        WGLGetConfigInfo action =
            new WGLGetConfigInfo(device.getScreen(), pixfmt);
        rq.flushAndInvokeNow(action);
        cfginfo = action.getConfigInfo();
        if (cfginfo != 0L) {
            OGLContext.setScratchSurface(cfginfo);
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    ids[0] = OGLContext.getOGLIdString();
                }
            });
        }
    } finally {
        rq.unlock();
    }
    if (cfginfo == 0) {
        return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);

    return new WGLGraphicsConfig(device, pixfmt, cfginfo, caps);
}
 
Example #10
Source File: WGLGraphicsConfig.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static WGLGraphicsConfig getConfig(Win32GraphicsDevice device,
                                          int pixfmt)
{
    if (!wglAvailable) {
        return null;
    }

    long cfginfo = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // getWGLConfigInfo() creates and destroys temporary
        // surfaces/contexts, so we should first invalidate the current
        // Java-level context and flush the queue...
        OGLContext.invalidateCurrentContext();
        WGLGetConfigInfo action =
            new WGLGetConfigInfo(device.getScreen(), pixfmt);
        rq.flushAndInvokeNow(action);
        cfginfo = action.getConfigInfo();
        if (cfginfo != 0L) {
            OGLContext.setScratchSurface(cfginfo);
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    ids[0] = OGLContext.getOGLIdString();
                }
            });
        }
    } finally {
        rq.unlock();
    }
    if (cfginfo == 0) {
        return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);

    return new WGLGraphicsConfig(device, pixfmt, cfginfo, caps);
}
 
Example #11
Source File: WGLGraphicsConfig.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static WGLGraphicsConfig getConfig(Win32GraphicsDevice device,
                                          int pixfmt)
{
    if (!wglAvailable) {
        return null;
    }

    long cfginfo = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // getWGLConfigInfo() creates and destroys temporary
        // surfaces/contexts, so we should first invalidate the current
        // Java-level context and flush the queue...
        OGLContext.invalidateCurrentContext();
        WGLGetConfigInfo action =
            new WGLGetConfigInfo(device.getScreen(), pixfmt);
        rq.flushAndInvokeNow(action);
        cfginfo = action.getConfigInfo();
        if (cfginfo != 0L) {
            OGLContext.setScratchSurface(cfginfo);
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    ids[0] = OGLContext.getOGLIdString();
                }
            });
        }
    } finally {
        rq.unlock();
    }
    if (cfginfo == 0) {
        return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);

    return new WGLGraphicsConfig(device, pixfmt, cfginfo, caps);
}
 
Example #12
Source File: WGLGraphicsConfig.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static WGLGraphicsConfig getConfig(Win32GraphicsDevice device,
                                          int pixfmt)
{
    if (!wglAvailable) {
        return null;
    }

    long cfginfo = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // getWGLConfigInfo() creates and destroys temporary
        // surfaces/contexts, so we should first invalidate the current
        // Java-level context and flush the queue...
        OGLContext.invalidateCurrentContext();
        WGLGetConfigInfo action =
            new WGLGetConfigInfo(device.getScreen(), pixfmt);
        rq.flushAndInvokeNow(action);
        cfginfo = action.getConfigInfo();
        if (cfginfo != 0L) {
            OGLContext.setScratchSurface(cfginfo);
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    ids[0] = OGLContext.getOGLIdString();
                }
            });
        }
    } finally {
        rq.unlock();
    }
    if (cfginfo == 0) {
        return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);

    return new WGLGraphicsConfig(device, pixfmt, cfginfo, caps);
}
 
Example #13
Source File: WGLGraphicsConfig.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static WGLGraphicsConfig getConfig(Win32GraphicsDevice device,
                                          int pixfmt)
{
    if (!wglAvailable) {
        return null;
    }

    long cfginfo = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // getWGLConfigInfo() creates and destroys temporary
        // surfaces/contexts, so we should first invalidate the current
        // Java-level context and flush the queue...
        OGLContext.invalidateCurrentContext();
        WGLGetConfigInfo action =
            new WGLGetConfigInfo(device.getScreen(), pixfmt);
        rq.flushAndInvokeNow(action);
        cfginfo = action.getConfigInfo();
        if (cfginfo != 0L) {
            OGLContext.setScratchSurface(cfginfo);
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    ids[0] = OGLContext.getOGLIdString();
                }
            });
        }
    } finally {
        rq.unlock();
    }
    if (cfginfo == 0) {
        return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);

    return new WGLGraphicsConfig(device, pixfmt, cfginfo, caps);
}
 
Example #14
Source File: WGLGraphicsConfig.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static WGLGraphicsConfig getConfig(Win32GraphicsDevice device,
                                          int pixfmt)
{
    if (!wglAvailable) {
        return null;
    }

    long cfginfo = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // getWGLConfigInfo() creates and destroys temporary
        // surfaces/contexts, so we should first invalidate the current
        // Java-level context and flush the queue...
        OGLContext.invalidateCurrentContext();
        WGLGetConfigInfo action =
            new WGLGetConfigInfo(device.getScreen(), pixfmt);
        rq.flushAndInvokeNow(action);
        cfginfo = action.getConfigInfo();
        if (cfginfo != 0L) {
            OGLContext.setScratchSurface(cfginfo);
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    ids[0] = OGLContext.getOGLIdString();
                }
            });
        }
    } finally {
        rq.unlock();
    }
    if (cfginfo == 0) {
        return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);

    return new WGLGraphicsConfig(device, pixfmt, cfginfo, caps);
}
 
Example #15
Source File: WGLGraphicsConfig.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static WGLGraphicsConfig getConfig(Win32GraphicsDevice device,
                                          int pixfmt)
{
    if (!wglAvailable) {
        return null;
    }

    long cfginfo = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // getWGLConfigInfo() creates and destroys temporary
        // surfaces/contexts, so we should first invalidate the current
        // Java-level context and flush the queue...
        OGLContext.invalidateCurrentContext();
        WGLGetConfigInfo action =
            new WGLGetConfigInfo(device.getScreen(), pixfmt);
        rq.flushAndInvokeNow(action);
        cfginfo = action.getConfigInfo();
        if (cfginfo != 0L) {
            OGLContext.setScratchSurface(cfginfo);
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    ids[0] = OGLContext.getOGLIdString();
                }
            });
        }
    } finally {
        rq.unlock();
    }
    if (cfginfo == 0) {
        return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);

    return new WGLGraphicsConfig(device, pixfmt, cfginfo, caps);
}
 
Example #16
Source File: CGLGraphicsConfig.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public static CGLGraphicsConfig getConfig(CGraphicsDevice device,
                                          int pixfmt)
{
    if (!cglAvailable) {
        return null;
    }

    long cfginfo = 0;
    int textureSize = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // getCGLConfigInfo() creates and destroys temporary
        // surfaces/contexts, so we should first invalidate the current
        // Java-level context and flush the queue...
        OGLContext.invalidateCurrentContext();

        cfginfo = getCGLConfigInfo(device.getCGDisplayID(), pixfmt,
                                   kOpenGLSwapInterval);
        if (cfginfo != 0L) {
            textureSize = nativeGetMaxTextureSize();
            // 7160609: GL still fails to create a square texture of this
            // size. Half should be safe enough.
            // Explicitly not support a texture more than 2^14, see 8010999.
            textureSize = textureSize <= 16384 ? textureSize / 2 : 8192;
            OGLContext.setScratchSurface(cfginfo);
            rq.flushAndInvokeNow(() -> {
                ids[0] = OGLContext.getOGLIdString();
            });
        }
    } finally {
        rq.unlock();
    }
    if (cfginfo == 0) {
        return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);
    return new CGLGraphicsConfig(device, pixfmt, cfginfo, textureSize, caps);
}
 
Example #17
Source File: CGLGraphicsConfig.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static CGLGraphicsConfig getConfig(CGraphicsDevice device,
                                          int pixfmt)
{
    if (!cglAvailable) {
        return null;
    }

    long cfginfo = 0;
    int textureSize = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // getCGLConfigInfo() creates and destroys temporary
        // surfaces/contexts, so we should first invalidate the current
        // Java-level context and flush the queue...
        OGLContext.invalidateCurrentContext();

        cfginfo = getCGLConfigInfo(device.getCGDisplayID(), pixfmt,
                                   kOpenGLSwapInterval);
        if (cfginfo != 0L) {
            textureSize = nativeGetMaxTextureSize();
            // 7160609: GL still fails to create a square texture of this
            // size. Half should be safe enough.
            // Explicitly not support a texture more than 2^14, see 8010999.
            textureSize = textureSize <= 16384 ? textureSize / 2 : 8192;
            OGLContext.setScratchSurface(cfginfo);
            rq.flushAndInvokeNow(() -> {
                ids[0] = OGLContext.getOGLIdString();
            });
        }
    } finally {
        rq.unlock();
    }
    if (cfginfo == 0) {
        return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);
    return new CGLGraphicsConfig(device, pixfmt, cfginfo, textureSize, caps);
}
 
Example #18
Source File: CGLGraphicsConfig.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static CGLGraphicsConfig getConfig(CGraphicsDevice device,
                                          int pixfmt)
{
    if (!cglAvailable) {
        return null;
    }

    long cfginfo = 0;
    int textureSize = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // getCGLConfigInfo() creates and destroys temporary
        // surfaces/contexts, so we should first invalidate the current
        // Java-level context and flush the queue...
        OGLContext.invalidateCurrentContext();

        cfginfo = getCGLConfigInfo(device.getCGDisplayID(), pixfmt,
                                   kOpenGLSwapInterval);
        if (cfginfo != 0L) {
            textureSize = nativeGetMaxTextureSize();
            // 7160609: GL still fails to create a square texture of this
            // size. Half should be safe enough.
            // Explicitly not support a texture more than 2^14, see 8010999.
            textureSize = textureSize <= 16384 ? textureSize / 2 : 8192;
            OGLContext.setScratchSurface(cfginfo);
            rq.flushAndInvokeNow(() -> {
                ids[0] = OGLContext.getOGLIdString();
            });
        }
    } finally {
        rq.unlock();
    }
    if (cfginfo == 0) {
        return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);
    return new CGLGraphicsConfig(device, pixfmt, cfginfo, textureSize, caps);
}
 
Example #19
Source File: CGLGraphicsConfig.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public static CGLGraphicsConfig getConfig(CGraphicsDevice device,
                                          int pixfmt)
{
    if (!cglAvailable) {
        return null;
    }

    long cfginfo = 0;
    int textureSize = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // getCGLConfigInfo() creates and destroys temporary
        // surfaces/contexts, so we should first invalidate the current
        // Java-level context and flush the queue...
        OGLContext.invalidateCurrentContext();

        cfginfo = getCGLConfigInfo(device.getCGDisplayID(), pixfmt,
                                   kOpenGLSwapInterval);
        if (cfginfo != 0L) {
            textureSize = nativeGetMaxTextureSize();
            // 7160609: GL still fails to create a square texture of this
            // size. Half should be safe enough.
            // Explicitly not support a texture more than 2^14, see 8010999.
            textureSize = textureSize <= 16384 ? textureSize / 2 : 8192;
            OGLContext.setScratchSurface(cfginfo);
            rq.flushAndInvokeNow(() -> {
                ids[0] = OGLContext.getOGLIdString();
            });
        }
    } finally {
        rq.unlock();
    }
    if (cfginfo == 0) {
        return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);
    return new CGLGraphicsConfig(device, pixfmt, cfginfo, textureSize, caps);
}
 
Example #20
Source File: CGLGraphicsConfig.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public static CGLGraphicsConfig getConfig(CGraphicsDevice device,
                                          int pixfmt)
{
    if (!cglAvailable) {
        return null;
    }

    long cfginfo = 0;
    int textureSize = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // getCGLConfigInfo() creates and destroys temporary
        // surfaces/contexts, so we should first invalidate the current
        // Java-level context and flush the queue...
        OGLContext.invalidateCurrentContext();

        cfginfo = getCGLConfigInfo(device.getCGDisplayID(), pixfmt,
                                   kOpenGLSwapInterval);
        if (cfginfo != 0L) {
            textureSize = nativeGetMaxTextureSize();
            // 7160609: GL still fails to create a square texture of this
            // size. Half should be safe enough.
            // Explicitly not support a texture more than 2^14, see 8010999.
            textureSize = textureSize <= 16384 ? textureSize / 2 : 8192;
            OGLContext.setScratchSurface(cfginfo);
            rq.flushAndInvokeNow(() -> {
                ids[0] = OGLContext.getOGLIdString();
            });
        }
    } finally {
        rq.unlock();
    }
    if (cfginfo == 0) {
        return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);
    return new CGLGraphicsConfig(device, pixfmt, cfginfo, textureSize, caps);
}
 
Example #21
Source File: CGLGraphicsConfig.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public static CGLGraphicsConfig getConfig(CGraphicsDevice device,
                                          int pixfmt)
{
    if (!cglAvailable) {
        return null;
    }

    long cfginfo = 0;
    int textureSize = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // getCGLConfigInfo() creates and destroys temporary
        // surfaces/contexts, so we should first invalidate the current
        // Java-level context and flush the queue...
        OGLContext.invalidateCurrentContext();

        cfginfo = getCGLConfigInfo(device.getCGDisplayID(), pixfmt,
                                   kOpenGLSwapInterval);
        if (cfginfo != 0L) {
            textureSize = nativeGetMaxTextureSize();
            // 7160609: GL still fails to create a square texture of this
            // size. Half should be safe enough.
            // Explicitly not support a texture more than 2^14, see 8010999.
            textureSize = textureSize <= 16384 ? textureSize / 2 : 8192;
            OGLContext.setScratchSurface(cfginfo);
            rq.flushAndInvokeNow(() -> {
                ids[0] = OGLContext.getOGLIdString();
            });
        }
    } finally {
        rq.unlock();
    }
    if (cfginfo == 0) {
        return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);
    return new CGLGraphicsConfig(device, pixfmt, cfginfo, textureSize, caps);
}
 
Example #22
Source File: CGLGraphicsConfig.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public static CGLGraphicsConfig getConfig(CGraphicsDevice device,
                                          int pixfmt)
{
    if (!cglAvailable) {
        return null;
    }

    long cfginfo = 0;
    int textureSize = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // getCGLConfigInfo() creates and destroys temporary
        // surfaces/contexts, so we should first invalidate the current
        // Java-level context and flush the queue...
        OGLContext.invalidateCurrentContext();

        cfginfo = getCGLConfigInfo(device.getCGDisplayID(), pixfmt,
                                   kOpenGLSwapInterval);
        if (cfginfo != 0L) {
            textureSize = nativeGetMaxTextureSize();
            // 7160609: GL still fails to create a square texture of this
            // size. Half should be safe enough.
            // Explicitly not support a texture more than 2^14, see 8010999.
            textureSize = textureSize <= 16384 ? textureSize / 2 : 8192;
            OGLContext.setScratchSurface(cfginfo);
            rq.flushAndInvokeNow(() -> {
                ids[0] = OGLContext.getOGLIdString();
            });
        }
    } finally {
        rq.unlock();
    }
    if (cfginfo == 0) {
        return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);
    return new CGLGraphicsConfig(device, pixfmt, cfginfo, textureSize, caps);
}
 
Example #23
Source File: CGLGraphicsConfig.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static CGLGraphicsConfig getConfig(CGraphicsDevice device,
                                          int pixfmt)
{
    if (!cglAvailable) {
        return null;
    }

    // Move CGLGraphicsConfig creation code to AppKit thread in order to avoid the
    // following deadlock:
    // 1) CGLGraphicsConfig.getCGLConfigInfo (called from EDT) takes RenderQueue.lock
    // 2) CGLLayer.drawInCGLContext is invoked on AppKit thread and
    //    blocked on RenderQueue.lock
    // 1) invokes native block on AppKit and wait

    Callable<CGLGraphicsConfig> command = () -> {
        long cfginfo;
        int textureSize = 0;
        final String ids[] = new String[1];
        OGLRenderQueue rq = OGLRenderQueue.getInstance();
        rq.lock();
        try {
            // getCGLConfigInfo() creates and destroys temporary
            // surfaces/contexts, so we should first invalidate the current
            // Java-level context and flush the queue...
            OGLContext.invalidateCurrentContext();

            cfginfo = getCGLConfigInfo(device.getCGDisplayID(), pixfmt,
                    kOpenGLSwapInterval);
            if (cfginfo != 0L) {
                textureSize = nativeGetMaxTextureSize();
                // 7160609: GL still fails to create a square texture of this
                // size. Half should be safe enough.
                // Explicitly not support a texture more than 2^14, see 8010999.
                textureSize = textureSize <= 16384 ? textureSize / 2 : 8192;
                OGLContext.setScratchSurface(cfginfo);
                rq.flushAndInvokeNow(() -> ids[0] = OGLContext.getOGLIdString());
            }
        } finally {
            rq.unlock();
        }
        if (cfginfo == 0) {
            return null;
        }

        int oglCaps = getOGLCapabilities(cfginfo);
        ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);
        return new CGLGraphicsConfig(
                device, pixfmt, cfginfo, textureSize, caps);
    };

    return java.security.AccessController.doPrivileged(
            (PrivilegedAction<CGLGraphicsConfig>) () -> {
                try {
                    return CThreading.executeOnAppKit(command);
                } catch (Throwable throwable) {
                    throw new AWTError(throwable.getMessage());
                }
            });
}
 
Example #24
Source File: CGLGraphicsConfig.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static CGLGraphicsConfig getConfig(CGraphicsDevice device,
                                          int pixfmt)
{
    if (!cglAvailable) {
        return null;
    }

    long cfginfo = 0;
    int textureSize = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // getCGLConfigInfo() creates and destroys temporary
        // surfaces/contexts, so we should first invalidate the current
        // Java-level context and flush the queue...
        OGLContext.invalidateCurrentContext();

        cfginfo = getCGLConfigInfo(device.getCGDisplayID(), pixfmt,
                                   kOpenGLSwapInterval);
        if (cfginfo != 0L) {
            textureSize = nativeGetMaxTextureSize();
            // 7160609: GL still fails to create a square texture of this
            // size. Half should be safe enough.
            // Explicitly not support a texture more than 2^14, see 8010999.
            textureSize = textureSize <= 16384 ? textureSize / 2 : 8192;
            OGLContext.setScratchSurface(cfginfo);
            rq.flushAndInvokeNow(() -> {
                ids[0] = OGLContext.getOGLIdString();
            });
        }
    } finally {
        rq.unlock();
    }
    if (cfginfo == 0) {
        return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);
    return new CGLGraphicsConfig(device, pixfmt, cfginfo, textureSize, caps);
}
 
Example #25
Source File: CGLGraphicsConfig.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public static CGLGraphicsConfig getConfig(CGraphicsDevice device,
                                          int pixfmt)
{
    if (!cglAvailable) {
        return null;
    }

    long cfginfo = 0;
    int textureSize = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // getCGLConfigInfo() creates and destroys temporary
        // surfaces/contexts, so we should first invalidate the current
        // Java-level context and flush the queue...
        OGLContext.invalidateCurrentContext();

        cfginfo = getCGLConfigInfo(device.getCGDisplayID(), pixfmt,
                                   kOpenGLSwapInterval);
        if (cfginfo != 0L) {
            textureSize = nativeGetMaxTextureSize();
            // 7160609: GL still fails to create a square texture of this
            // size. Half should be safe enough.
            // Explicitly not support a texture more than 2^14, see 8010999.
            textureSize = textureSize <= 16384 ? textureSize / 2 : 8192;
            OGLContext.setScratchSurface(cfginfo);
            rq.flushAndInvokeNow(() -> {
                ids[0] = OGLContext.getOGLIdString();
            });
        }
    } finally {
        rq.unlock();
    }
    if (cfginfo == 0) {
        return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);
    return new CGLGraphicsConfig(device, pixfmt, cfginfo, textureSize, caps);
}
 
Example #26
Source File: CGLGraphicsConfig.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static CGLGraphicsConfig getConfig(CGraphicsDevice device,
                                          int pixfmt)
{
    if (!cglAvailable) {
        return null;
    }

    long cfginfo = 0;
    int textureSize = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
        // getCGLConfigInfo() creates and destroys temporary
        // surfaces/contexts, so we should first invalidate the current
        // Java-level context and flush the queue...
        OGLContext.invalidateCurrentContext();

        cfginfo = getCGLConfigInfo(device.getCGDisplayID(), pixfmt,
                                   kOpenGLSwapInterval);
        if (cfginfo != 0L) {
            textureSize = nativeGetMaxTextureSize();
            // 7160609: GL still fails to create a square texture of this
            // size. Half should be safe enough.
            // Explicitly not support a texture more than 2^14, see 8010999.
            textureSize = textureSize <= 16384 ? textureSize / 2 : 8192;
            OGLContext.setScratchSurface(cfginfo);
            rq.flushAndInvokeNow(() -> {
                ids[0] = OGLContext.getOGLIdString();
            });
        }
    } finally {
        rq.unlock();
    }
    if (cfginfo == 0) {
        return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);
    return new CGLGraphicsConfig(device, pixfmt, cfginfo, textureSize, caps);
}