Win32GraphicsDevice.java revision 0
0N/A/*
0N/A * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation. Sun designates this
0N/A * particular file as subject to the "Classpath" exception as provided
0N/A * by Sun in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
0N/A * CA 95054 USA or visit www.sun.com if you need additional information or
0N/A * have any questions.
0N/A */
0N/A
0N/Apackage sun.awt;
0N/A
0N/Aimport java.awt.AWTPermission;
0N/Aimport java.awt.GraphicsDevice;
0N/Aimport java.awt.GraphicsConfiguration;
0N/Aimport java.awt.GraphicsEnvironment;
0N/Aimport java.awt.DisplayMode;
0N/Aimport java.awt.Frame;
0N/Aimport java.awt.Rectangle;
0N/Aimport java.awt.Window;
0N/Aimport java.awt.image.ColorModel;
0N/Aimport java.util.ArrayList;
0N/Aimport java.util.Vector;
0N/Aimport java.awt.peer.WindowPeer;
0N/Aimport sun.awt.windows.WWindowPeer;
0N/Aimport sun.java2d.d3d.D3DContext;
0N/Aimport sun.java2d.opengl.WGLGraphicsConfig;
0N/Aimport sun.java2d.windows.WindowsFlags;
0N/A
0N/A/**
0N/A * This is an implementation of a GraphicsDevice object for a single
0N/A * Win32 screen.
0N/A *
0N/A * @see GraphicsEnvironment
0N/A * @see GraphicsConfiguration
0N/A */
0N/Apublic class Win32GraphicsDevice extends GraphicsDevice implements
0N/A DisplayChangedListener {
0N/A int screen;
0N/A ColorModel dynamicColorModel; // updated with dev changes
0N/A ColorModel colorModel; // static for device
0N/A GraphicsConfiguration[] configs;
0N/A GraphicsConfiguration defaultConfig;
0N/A boolean offscreenAccelerationEnabled = true;
0N/A private D3DContext d3dContext;
0N/A
0N/A private final String idString;
0N/A private final String descString;
0N/A // Note that we do not synchronize access to this variable - it doesn't
0N/A // really matter if a thread does an operation on graphics device which is
0N/A // about to become invalid (or already become) - we are prepared to deal
0N/A // with this on the native level.
0N/A private boolean valid;
0N/A
0N/A // keep track of top-level windows on this display
0N/A private SunDisplayChanger topLevels = new SunDisplayChanger();
0N/A private static boolean pfDisabled;
0N/A private static AWTPermission fullScreenExclusivePermission;
0N/A private Rectangle ownerWindowedModeBounds = null;
0N/A // the original display mode we had before entering the fullscreen
0N/A // mode
0N/A private DisplayMode defaultDisplayMode;
0N/A
0N/A static {
0N/A
0N/A // 4455041 - Even when ddraw is disabled, ddraw.dll is loaded when
0N/A // pixel format calls are made. This causes problems when a Java app
0N/A // is run as an NT service. To prevent the loading of ddraw.dll
0N/A // completely, sun.awt.nopixfmt should be set as well. Apps which use
0N/A // OpenGL w/ Java probably don't want to set this.
0N/A String nopixfmt = (String)java.security.AccessController.doPrivileged(
0N/A new sun.security.action.GetPropertyAction("sun.awt.nopixfmt"));
0N/A pfDisabled = (nopixfmt != null);
0N/A initIDs();
0N/A }
0N/A
0N/A private static native void initIDs();
0N/A
0N/A /**
0N/A * Acceleration can be disabled due to capabilities of the display
0N/A * device discovered during ddraw initialization. This is not the
0N/A * same as isDDEnabledOnDevice(), which returns false when ddraw
0N/A * was disabled by the user or had problems initializing.
0N/A */
0N/A public boolean isOffscreenAccelerationEnabled() {
0N/A return offscreenAccelerationEnabled;
0N/A }
0N/A
0N/A native void initDevice(int screen);
0N/A
0N/A public Win32GraphicsDevice(int screennum) {
0N/A this.screen = screennum;
0N/A // we cache the strings because we want toString() and getIDstring
0N/A // to reflect the original screen number (which may change if the
0N/A // device is removed)
0N/A idString = "\\Display"+screen;
0N/A descString = "Win32GraphicsDevice[screen=" + screen;
0N/A valid = true;
0N/A
0N/A initDevice(screennum);
0N/A }
0N/A
0N/A /**
0N/A * Returns the type of the graphics device.
0N/A * @see #TYPE_RASTER_SCREEN
0N/A * @see #TYPE_PRINTER
0N/A * @see #TYPE_IMAGE_BUFFER
0N/A */
0N/A public int getType() {
0N/A return TYPE_RASTER_SCREEN;
0N/A }
0N/A
0N/A /**
0N/A * Returns the Win32 screen of the device.
0N/A */
0N/A public int getScreen() {
0N/A return screen;
0N/A }
0N/A
0N/A /**
0N/A * Returns whether this is a valid devicie. Device can become
0N/A * invalid as a result of device removal event.
0N/A */
0N/A boolean isValid() {
0N/A return valid;
0N/A }
0N/A
0N/A /**
0N/A * Called from native code when the device was removed.
0N/A *
0N/A * @param defaultScreen the current default screen
0N/A */
0N/A void invalidate(int defaultScreen) {
0N/A valid = false;
0N/A screen = defaultScreen;
0N/A }
0N/A
0N/A /**
0N/A * Returns the identification string associated with this graphics
0N/A * device.
0N/A */
0N/A public String getIDstring() {
0N/A return idString;
0N/A }
0N/A
0N/A
0N/A /**
0N/A * Returns all of the graphics
0N/A * configurations associated with this graphics device.
0N/A */
0N/A public GraphicsConfiguration[] getConfigurations() {
0N/A if (configs==null) {
0N/A if (WindowsFlags.isOGLEnabled() && isDefaultDevice()) {
0N/A defaultConfig = getDefaultConfiguration();
0N/A if (defaultConfig != null) {
0N/A configs = new GraphicsConfiguration[1];
0N/A configs[0] = defaultConfig;
0N/A return configs;
0N/A }
0N/A }
0N/A
0N/A int max = getMaxConfigs(screen);
0N/A int defaultPixID = getDefaultPixID(screen);
0N/A Vector v = new Vector( max );
0N/A if (defaultPixID == 0) {
0N/A // Workaround for failing GDI calls, or if DirectDraw
0N/A // is disabled
0N/A defaultConfig = Win32GraphicsConfig.getConfig(this,
0N/A defaultPixID);
0N/A v.addElement(defaultConfig);
0N/A }
0N/A else {
0N/A for (int i = 1; i <= max; i++) {
0N/A if (isPixFmtSupported(i, screen)) {
0N/A if (i == defaultPixID) {
0N/A defaultConfig = Win32GraphicsConfig.getConfig(
0N/A this, i);
0N/A v.addElement(defaultConfig);
0N/A }
0N/A else {
0N/A v.addElement(Win32GraphicsConfig.getConfig(
0N/A this, i));
0N/A }
0N/A }
0N/A }
0N/A }
0N/A configs = new GraphicsConfiguration[v.size()];
0N/A v.copyInto(configs);
0N/A }
0N/A return configs;
0N/A }
0N/A
0N/A /**
0N/A * Returns the maximum number of graphics configurations available, or 1
0N/A * if PixelFormat calls fail or are disabled.
0N/A * This number is less than or equal to the number of graphics
0N/A * configurations supported.
0N/A */
0N/A protected int getMaxConfigs(int screen) {
0N/A if (pfDisabled) {
0N/A return 1;
0N/A } else {
0N/A return getMaxConfigsImpl(screen);
0N/A }
0N/A }
0N/A
0N/A private native int getMaxConfigsImpl(int screen);
0N/A
0N/A /**
0N/A * Returns whether or not the PixelFormat indicated by index is
0N/A * supported. Supported PixelFormats support drawing to a Window
0N/A * (PFD_DRAW_TO_WINDOW), support GDI (PFD_SUPPORT_GDI), and in the
0N/A * case of an 8-bit format (cColorBits <= 8) uses indexed colors
0N/A * (iPixelType == PFD_TYPE_COLORINDEX).
0N/A * We use the index 0 to indicate that PixelFormat calls don't work, or
0N/A * are disabled. Do not call this function with an index of 0.
0N/A * @param index a PixelFormat index
0N/A */
0N/A protected native boolean isPixFmtSupported(int index, int screen);
0N/A
0N/A /**
0N/A * Returns the PixelFormatID of the default graphics configuration
0N/A * associated with this graphics device, or 0 if PixelFormats calls fail or
0N/A * are disabled.
0N/A */
0N/A protected int getDefaultPixID(int screen) {
0N/A if (pfDisabled) {
0N/A return 0;
0N/A } else {
0N/A return getDefaultPixIDImpl(screen);
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * Returns the default PixelFormat ID from GDI. Do not call if PixelFormats
0N/A * are disabled.
0N/A */
0N/A private native int getDefaultPixIDImpl(int screen);
0N/A
0N/A /**
0N/A * Returns the default graphics configuration
0N/A * associated with this graphics device.
0N/A */
0N/A public GraphicsConfiguration getDefaultConfiguration() {
0N/A if (defaultConfig == null) {
0N/A // first try to create a WGLGraphicsConfig if OGL is enabled
0N/A // REMIND: the WGL code does not yet work properly in multimon
0N/A // situations, so we will fallback on GDI if we are not on the
0N/A // default device...
0N/A if (WindowsFlags.isOGLEnabled() && isDefaultDevice()) {
0N/A int defPixID = WGLGraphicsConfig.getDefaultPixFmt(screen);
0N/A defaultConfig = WGLGraphicsConfig.getConfig(this, defPixID);
0N/A if (WindowsFlags.isOGLVerbose()) {
0N/A if (defaultConfig != null) {
0N/A System.out.print("OpenGL pipeline enabled");
0N/A } else {
0N/A System.out.print("Could not enable OpenGL pipeline");
0N/A }
0N/A System.out.println(" for default config on screen " +
0N/A screen);
0N/A }
0N/A }
0N/A
0N/A // Fix for 4669614. Most apps are not concerned with PixelFormats,
0N/A // yet we ALWAYS used them for determining ColorModels and such.
0N/A // By passing in 0 as the PixelFormatID here, we signal that
0N/A // PixelFormats should not be used, thus avoid loading the opengl
0N/A // library. Apps concerned with PixelFormats can still use
0N/A // GraphicsConfiguration.getConfigurations().
0N/A // Note that calling native pixel format functions tends to cause
0N/A // problems between those functions (which are OpenGL-related)
0N/A // and our use of DirectX. For example, some Matrox boards will
0N/A // crash or hang calling these functions when any app is running
0N/A // in DirectX fullscreen mode. So avoiding these calls unless
0N/A // absolutely necessary is preferable.
0N/A if (defaultConfig == null) {
0N/A defaultConfig = Win32GraphicsConfig.getConfig(this, 0);
0N/A }
0N/A }
0N/A return defaultConfig;
0N/A }
0N/A
0N/A public String toString() {
0N/A return valid ? descString + "]" : descString + ", removed]";
0N/A }
0N/A
0N/A /**
0N/A * Returns true if this is the default GraphicsDevice for the
0N/A * GraphicsEnvironment.
0N/A */
0N/A private boolean isDefaultDevice() {
0N/A return (this ==
0N/A GraphicsEnvironment.
0N/A getLocalGraphicsEnvironment().getDefaultScreenDevice());
0N/A }
0N/A
0N/A private native boolean isDDEnabledOnDeviceNative(int screen);
0N/A
0N/A public D3DContext getD3DContext() {
0N/A if (d3dContext == null) {
0N/A d3dContext = new D3DContext(this);
0N/A }
0N/A return d3dContext;
0N/A }
0N/A
0N/A
0N/A public boolean isDDEnabledOnDevice() {
0N/A return (WindowsFlags.isDDEnabled() && isValid() &&
0N/A isDDEnabledOnDeviceNative(screen));
0N/A }
0N/A
0N/A public boolean isD3DEnabledOnDevice() {
0N/A // The conditions under which we enable the D3D pipeline for the device:
0N/A // - d3d is not disabled via a flag
0N/A // - either d3d is forced via property or we're in fullscreen mode
0N/A // - the hardware/drivers meet our requirements
0N/A return (WindowsFlags.isD3DEnabled() && isValid() &&
0N/A (WindowsFlags.isD3DSet() || getFullScreenWindow() != null) &&
0N/A ((getD3DContext().getDeviceCaps() &
0N/A D3DContext.J2D_D3D_ENABLED_OK) != 0));
0N/A }
0N/A
0N/A private static boolean isFSExclusiveModeAllowed() {
0N/A SecurityManager security = System.getSecurityManager();
0N/A if (security != null) {
0N/A if (fullScreenExclusivePermission == null) {
0N/A fullScreenExclusivePermission =
0N/A new AWTPermission("fullScreenExclusive");
0N/A }
0N/A try {
0N/A security.checkPermission(fullScreenExclusivePermission);
0N/A } catch (SecurityException e) {
0N/A return false;
0N/A }
0N/A }
0N/A return true;
0N/A }
0N/A
0N/A /**
0N/A * We support the exclusive fullscreen mode in both ddraw and
0N/A * noddraw modes, so we return true unless we're not allowed to use
0N/A * fullscreen mode.
0N/A */
0N/A public boolean isFullScreenSupported() {
0N/A return isFSExclusiveModeAllowed();
0N/A }
0N/A
0N/A /**
0N/A * Return the owning Frame for a given Window. Used in setFSWindow below
0N/A * to set the properties of the owning Frame when a Window goes
0N/A * into fullscreen mode.
0N/A */
0N/A private Frame getToplevelOwner(Window w) {
0N/A Window owner = w;
0N/A while (owner != null) {
0N/A owner = owner.getOwner();
0N/A if (owner instanceof Frame) {
0N/A return (Frame) owner;
0N/A }
0N/A }
0N/A // Should not get here, but return something intelligent just in case
0N/A return null;
0N/A }
0N/A
0N/A public synchronized void setFullScreenWindow(Window w) {
0N/A Window old = getFullScreenWindow();
0N/A if (w == old) {
0N/A return;
0N/A }
0N/A if (!isFullScreenSupported()) {
0N/A super.setFullScreenWindow(w);
0N/A return;
0N/A }
0N/A
0N/A // Enter windowed mode.
0N/A if (old != null) {
0N/A // restore the original display mode
0N/A if (defaultDisplayMode != null) {
0N/A setDisplayMode(defaultDisplayMode);
0N/A // we set the default display mode to null here
0N/A // because the default mode could change during
0N/A // the life of the application (user can change it through
0N/A // the desktop properties dialog, for example), so
0N/A // we need to record it every time prior to
0N/A // entering the fullscreen mode.
0N/A defaultDisplayMode = null;
0N/A }
0N/A WWindowPeer peer = (WWindowPeer)old.getPeer();
0N/A if (peer != null) {
0N/A synchronized(peer) {
0N/A peer.destroyBuffers();
0N/A exitFullScreenExclusive(isDDEnabledOnDevice(),
0N/A screen, peer);
0N/A }
0N/A }
0N/A /**
0N/A * Bug 4933099: There is some funny-business to deal with when this
0N/A * method is called with a Window instead of a Frame. See 4836744
0N/A * for more information on this. One side-effect of our workaround
0N/A * for the problem is that the owning Frame of a Window may end
0N/A * up getting resized during the fullscreen process. When we
0N/A * return from fullscreen mode, we should resize the Frame to
0N/A * its original size (just like the Window is being resized
0N/A * to its original size in GraphicsDevice).
0N/A */
0N/A if (!(old instanceof Frame)) {
0N/A Frame owner = getToplevelOwner(old);
0N/A if (owner != null && ownerWindowedModeBounds != null) {
0N/A owner.setBounds(ownerWindowedModeBounds);
0N/A }
0N/A ownerWindowedModeBounds = null;
0N/A }
0N/A }
0N/A super.setFullScreenWindow(w);
0N/A if (w != null) {
0N/A // always record the default display mode prior to going
0N/A // fullscreen
0N/A defaultDisplayMode = getDisplayMode();
0N/A // Bug 4933099
0N/A if (!(w instanceof Frame)) {
0N/A Frame owner = getToplevelOwner(w);
0N/A if (owner != null) {
0N/A ownerWindowedModeBounds = owner.getBounds();
0N/A // These will get set for the native window in
0N/A // any case. Set them here so that resetting them
0N/A // later actually does the right thing
0N/A owner.setBounds(w.getBounds());
0N/A }
0N/A }
0N/A // Enter full screen exclusive mode.
0N/A WWindowPeer peer = (WWindowPeer)w.getPeer();
0N/A synchronized(peer) {
0N/A enterFullScreenExclusive(isDDEnabledOnDevice(),
0N/A screen, peer);
0N/A // Note: removed replaceSurfaceData() call because
0N/A // changing the window size or making it visible
0N/A // will cause this anyway, and both of these events happen
0N/A // as part of switching into fullscreen mode.
0N/A }
0N/A
0N/A // fix for 4868278
0N/A peer.updateGC();
0N/A peer.resetTargetGC();
0N/A }
0N/A }
0N/A
0N/A // Entering and exiting full-screen mode are done within a
0N/A // tree-lock and should never lock on any resources which are
0N/A // required by other threads which may have them and may require
0N/A // the tree-lock.
0N/A private native void enterFullScreenExclusive(boolean useDD,
0N/A int screen, WindowPeer w);
0N/A private native void exitFullScreenExclusive(boolean useDD,
0N/A int screen, WindowPeer w);
0N/A
0N/A public boolean isDisplayChangeSupported() {
0N/A return (isFullScreenSupported() && getFullScreenWindow() != null);
0N/A }
0N/A
0N/A public synchronized void setDisplayMode(DisplayMode dm) {
0N/A if (!isDisplayChangeSupported()) {
0N/A super.setDisplayMode(dm);
0N/A return;
0N/A }
0N/A if (dm == null || (dm = getMatchingDisplayMode(dm)) == null) {
0N/A throw new IllegalArgumentException("Invalid display mode");
0N/A }
0N/A if (getDisplayMode().equals(dm)) {
0N/A return;
0N/A }
0N/A Window w = getFullScreenWindow();
0N/A if (w != null) {
0N/A WWindowPeer peer = (WWindowPeer)w.getPeer();
0N/A configDisplayMode(screen, peer, dm.getWidth(), dm.getHeight(),
0N/A dm.getBitDepth(), dm.getRefreshRate());
0N/A // resize the fullscreen window to the dimensions of the new
0N/A // display mode
0N/A Rectangle screenBounds = getDefaultConfiguration().getBounds();
0N/A w.setBounds(screenBounds.x, screenBounds.y,
0N/A dm.getWidth(), dm.getHeight());
0N/A // Note: no call to replaceSurfaceData is required here since
0N/A // replacement will be caused by an upcoming display change event
0N/A } else {
0N/A throw new IllegalStateException("Must be in fullscreen mode " +
0N/A "in order to set display mode");
0N/A }
0N/A }
0N/A
0N/A private native DisplayMode getCurrentDisplayMode(int screen);
0N/A private native void configDisplayMode(int screen, WindowPeer w, int width,
0N/A int height, int bitDepth,
0N/A int refreshRate);
0N/A private native void enumDisplayModes(int screen, ArrayList modes);
0N/A // This function is only available if DirectDraw is enabled, otherwise we
0N/A // have to do the work the hard way (enumerating all of the display modes
0N/A // and checking each one)
0N/A private native boolean isDisplayModeAvailable(int screen, int width, int height,
0N/A int bitDepth, int refreshRate);
0N/A
0N/A public synchronized DisplayMode getDisplayMode() {
0N/A DisplayMode res = getCurrentDisplayMode(screen);
0N/A return res;
0N/A }
0N/A
0N/A public synchronized DisplayMode[] getDisplayModes() {
0N/A ArrayList modes = new ArrayList();
0N/A enumDisplayModes(screen, modes);
0N/A int listSize = modes.size();
0N/A DisplayMode[] retArray = new DisplayMode[listSize];
0N/A for (int i = 0; i < listSize; i++) {
0N/A retArray[i] = (DisplayMode)modes.get(i);
0N/A }
0N/A return retArray;
0N/A }
0N/A
0N/A private synchronized DisplayMode getMatchingDisplayMode(DisplayMode dm) {
0N/A if (!isDisplayChangeSupported()) {
0N/A return null;
0N/A }
0N/A if (isDDEnabledOnDevice()) {
0N/A return
0N/A isDisplayModeAvailable(screen, dm.getWidth(), dm.getHeight(),
0N/A dm.getBitDepth(), dm.getRefreshRate())
0N/A ? dm : null;
0N/A } else {
0N/A // The function isDisplayModeAvailable is only available if
0N/A // DirectDraw is enabled, otherwise we have to do the work the
0N/A // hard way (enumerating all of the display modes
0N/A // and checking each one)
0N/A DisplayMode[] modes = getDisplayModes();
0N/A for (DisplayMode mode : modes) {
0N/A if (dm.equals(mode) ||
0N/A (dm.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN &&
0N/A dm.getWidth() == mode.getWidth() &&
0N/A dm.getHeight() == mode.getHeight() &&
0N/A dm.getBitDepth() == mode.getBitDepth()))
0N/A {
0N/A return mode;
0N/A }
0N/A }
0N/A return null;
0N/A }
0N/A }
0N/A
0N/A /*
0N/A * From the DisplayChangeListener interface.
0N/A * Called from Win32GraphicsEnvironment when the display settings have
0N/A * changed.
0N/A */
0N/A public void displayChanged() {
0N/A d3dContext = null;
0N/A dynamicColorModel = null;
0N/A defaultConfig = null;
0N/A configs = null;
0N/A // pass on to all top-level windows on this display
0N/A topLevels.notifyListeners();
0N/A }
0N/A
0N/A /**
0N/A * Part of the DisplayChangedListener interface: devices
0N/A * do not need to react to this event
0N/A */
0N/A public void paletteChanged() {
0N/A }
0N/A
0N/A /*
0N/A * Add a DisplayChangeListener to be notified when the display settings
0N/A * are changed. Typically, only top-level containers need to be added
0N/A * to Win32GraphicsDevice.
0N/A */
0N/A public void addDisplayChangedListener(DisplayChangedListener client) {
0N/A topLevels.add(client);
0N/A }
0N/A
0N/A /*
0N/A * Remove a DisplayChangeListener from this Win32GraphicsDevice
0N/A */
0N/A public void removeDisplayChangedListener(DisplayChangedListener client) {
0N/A topLevels.remove(client);
0N/A }
0N/A
0N/A /**
0N/A * Creates and returns the color model associated with this device
0N/A */
0N/A private native ColorModel makeColorModel (int screen,
0N/A boolean dynamic);
0N/A
0N/A /**
0N/A * Returns a dynamic ColorModel which is updated when there
0N/A * are any changes (e.g., palette changes) in the device
0N/A */
0N/A public ColorModel getDynamicColorModel() {
0N/A if (dynamicColorModel == null) {
0N/A dynamicColorModel = makeColorModel(screen, true);
0N/A }
0N/A return dynamicColorModel;
0N/A }
0N/A
0N/A /**
0N/A * Returns the non-dynamic ColorModel associated with this device
0N/A */
0N/A public ColorModel getColorModel() {
0N/A if (colorModel == null) {
0N/A colorModel = makeColorModel(screen, false);
0N/A }
0N/A return colorModel;
0N/A }
0N/A
0N/A private native int getDeviceMemoryNative(int screen);
0N/A
0N/A /**
0N/A * Returns number of bytes available in VRAM on this device.
0N/A */
0N/A public int getAvailableAcceleratedMemory() {
0N/A if (getDefaultConfiguration() instanceof WGLGraphicsConfig) {
0N/A // when OGL is enabled, there is no way to determine the amount
0N/A // of accelerated memory, so just return the default value
0N/A return super.getAvailableAcceleratedMemory();
0N/A }
0N/A return getDeviceMemoryNative(screen);
0N/A }
0N/A}