static { AccessController.doPrivileged( (PrivilegedAction<Void>) () -> { String libName = "prism_es2"; String eglType = PlatformUtil.getEmbeddedType(); if ("eglfb".equals(eglType)) { isEglfb = true; libName = "prism_es2_eglfb"; } else if ("monocle".equals(eglType)) { isEglfb = true; libName = "prism_es2_monocle"; } else if ("eglx11".equals(eglType)) libName = "prism_es2_eglx11"; if (PrismSettings.verbose) { System.out.println("Loading ES2 native library ... " + libName); } NativeLibLoader.loadLibrary(libName); if (PrismSettings.verbose) { System.out.println("\tsucceeded."); } return null; }); // Initialize the prism-es2 pipe and a handler of it glFactory = GLFactory.getFactory(); creator = Thread.currentThread(); if (glFactory != null) { es2Enabled = glFactory.initialize(PrismSettings.class, pixelFormatAttributes); } else { es2Enabled = false; } if (es2Enabled) { theInstance = new ES2Pipeline(); factories = new ES2ResourceFactory[glFactory.getAdapterCount()]; msaa = glFactory.isGLExtensionSupported("GL_ARB_multisample"); npotSupported = glFactory.isNPOTSupported(); } else { theInstance = null; msaa = false; npotSupported = false; } }
private static ES2ResourceFactory findDefaultResourceFactory(List<Screen> screens) { for (int adapter = 0, n = glFactory.getAdapterCount(); adapter != n; ++adapter) { ES2ResourceFactory rf = getES2ResourceFactory(adapter, getScreenForAdapter(screens, adapter)); if (rf != null) { if (PrismSettings.verbose) { glFactory.printDriverInformation(adapter); } return rf; } else { if (!PrismSettings.disableBadDriverWarning) { System.err.println("disableBadDriverWarning is unsupported on prism-es2"); // printDriverWarning(adapter); } } } return null; }
@Override public boolean init() { if (es2Enabled) { HashMap devDetails = new HashMap(); glFactory.updateDeviceDetails(devDetails); setDeviceDetails(devDetails); if (!PrismSettings.forceGPU) { es2Enabled = glFactory.isGLGPUQualify(); if (PrismSettings.verbose) { if (!es2Enabled) { System.err.println( "Failed Graphics Hardware Qualifier check." + "\nSystem GPU doesn't meet the es2 pipe requirement"); } } } } else if (PrismSettings.verbose) { System.err.println("Failed to initialize ES2 backend: "); } return es2Enabled; }
@Override public int getAdapterOrdinal(Screen screen) { return glFactory.getAdapterOrdinal(screen.getNativeScreen()); }