jdk/src/windows/classes/sun/java2d/d3d/D3DSurfaceData.java
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 2 90ce3da70b43
child 887 0aab8d3fa11a
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 2005-2007 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.java2d.d3d;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.AlphaComposite;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.awt.GraphicsConfiguration;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.awt.Image;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.awt.Transparency;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.awt.image.ColorModel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.awt.image.DirectColorModel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import sun.awt.SunHints;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import sun.awt.Win32GraphicsConfig;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import sun.awt.Win32GraphicsDevice;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import sun.awt.image.SurfaceManager;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import sun.java2d.InvalidPipeException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import sun.java2d.SunGraphics2D;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import sun.java2d.SurfaceData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import sun.java2d.SurfaceDataProxy;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
import sun.java2d.loops.GraphicsPrimitive;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
import sun.java2d.loops.SurfaceType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
import sun.java2d.pipe.PixelToShapeConverter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
import sun.java2d.pipe.TextPipe;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
import sun.java2d.windows.Win32OffScreenSurfaceData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
import sun.java2d.windows.Win32SurfaceData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
import sun.java2d.windows.WinVolatileSurfaceManager;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
import sun.java2d.windows.WindowsFlags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
import static sun.java2d.windows.Win32SurfaceData.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
public class D3DSurfaceData extends Win32OffScreenSurfaceData {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    // properties of a surface
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * This property is used for a back-buffer surface
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    public static final int D3D_ATTACHED_SURFACE = (1 << 15);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * A surface with this property can be used as a Direct3D rendering
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * destination.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    public static final int D3D_RENDER_TARGET    = (1 << 16);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    public static final int
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
        D3D_INVALID_SURFACE    = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * Surface is a Direct3D plain surface (not a texture).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * Plain surface can be used as render target.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * VolatileImages typically use plain surfaces as their hardware
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * accelerated surfaces.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    public static final int
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        D3D_PLAIN_SURFACE      = (1 << 0) | D3D_RENDER_TARGET;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * Direct3D texture. Mostly used for cached accelerated surfaces.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * Surfaces of this type can be copied from using hardware acceleration
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * by using texture mapping.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    public static final int
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        D3D_TEXTURE_SURFACE    = (1 << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * Direct3D Backbuffer surface - an attached surface. Used for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * multibuffered BufferStrategies.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    public static final int
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        D3D_BACKBUFFER_SURFACE = D3D_PLAIN_SURFACE | D3D_ATTACHED_SURFACE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * Render-to-texture. A texture which can also be a render target.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * Combines the benefits of textures (fast copies-from) and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * backbuffers or plain surfaces (hw-accelerated rendering to the surface)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    public static final int
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        D3D_RTT_SURFACE        = D3D_TEXTURE_SURFACE | D3D_RENDER_TARGET;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    // supported texture pixel formats
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    public static final int PF_INVALID         =  0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    public static final int PF_INT_ARGB        =  1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    public static final int PF_INT_RGB         =  2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    public static final int PF_INT_RGBX        =  3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    public static final int PF_INT_BGR         =  4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    public static final int PF_USHORT_565_RGB  =  5;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    public static final int PF_USHORT_555_RGB  =  6;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    public static final int PF_USHORT_555_RGBX =  7;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    public static final int PF_INT_ARGB_PRE    =  8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    public static final int PF_USHORT_4444_ARGB=  9;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        DESC_INT_ARGB_D3D         = "Integer ARGB D3D with translucency";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        DESC_USHORT_4444_ARGB_D3D = "UShort 4444 ARGB D3D with translucency";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * Surface type for texture destination.  We cannot render textures to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * the screen because Direct3D is not clipped by the window's clip list,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * so we only enable the texture blit loops for copies to offscreen
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * accelerated surfaces.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        DESC_DEST_D3D           = "D3D render target";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    public static final SurfaceType D3DSurface =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        SurfaceType.Any.deriveSubType("Direct3D Surface");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    public static final SurfaceType D3DTexture =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        D3DSurface.deriveSubType("Direct3D Texture");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * D3D destination surface types (derive from offscreen dd surfaces).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * Note that all of these surfaces have the same surface description;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * we do not care about the depth of the surface since texture ops
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * support multiple depths.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    public static final SurfaceType IntRgbD3D =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        IntRgbDD.deriveSubType(DESC_DEST_D3D);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    public static final SurfaceType IntRgbxD3D =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        IntRgbxDD.deriveSubType(DESC_DEST_D3D);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    public static final SurfaceType Ushort565RgbD3D =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        Ushort565RgbDD.deriveSubType(DESC_DEST_D3D);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    public static final SurfaceType Ushort555RgbxD3D =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        Ushort555RgbxDD.deriveSubType(DESC_DEST_D3D);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    public static final SurfaceType Ushort555RgbD3D =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        Ushort555RgbDD.deriveSubType(DESC_DEST_D3D);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    // REMIND: Is it possible to have d3d accelerated on this type of surface?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    public static final SurfaceType ThreeByteBgrD3D =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        ThreeByteBgrDD.deriveSubType(DESC_DEST_D3D);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    public static final SurfaceType IntArgbD3D =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        SurfaceType.IntArgb.deriveSubType(DESC_INT_ARGB_D3D);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    public static final SurfaceType Ushort4444ArgbD3D =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        SurfaceType.Ushort4444Argb.deriveSubType(DESC_USHORT_4444_ARGB_D3D);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    // Textures we can render to using d3d
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    public static final SurfaceType IntRgbD3D_RTT =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        IntRgbD3D.deriveSubType(DESC_DEST_D3D);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    public static final SurfaceType IntRgbxD3D_RTT =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        IntRgbxD3D.deriveSubType(DESC_DEST_D3D);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    public static final SurfaceType Ushort565RgbD3D_RTT =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        Ushort565RgbD3D.deriveSubType(DESC_DEST_D3D);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    public static final SurfaceType Ushort555RgbxD3D_RTT =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        Ushort555RgbxD3D.deriveSubType(DESC_DEST_D3D);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    public static final SurfaceType Ushort555RgbD3D_RTT =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        Ushort555RgbD3D.deriveSubType(DESC_DEST_D3D);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    public static final SurfaceType Ushort4444ArgbD3D_RTT =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        Ushort4444ArgbD3D.deriveSubType(DESC_DEST_D3D);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    public static final SurfaceType IntArgbD3D_RTT =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        IntArgbD3D.deriveSubType(DESC_DEST_D3D);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    public static final SurfaceType ThreeByteBgrD3D_RTT =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        ThreeByteBgrD3D.deriveSubType(DESC_DEST_D3D);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    // the type of this surface - texture, plain, back-buffer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    protected int type;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    protected int pixelFormat;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    private D3DContext d3dContext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    protected static D3DRenderer d3dPipe;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    protected static PixelToShapeConverter d3dTxPipe;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    protected static D3DTextRenderer d3dTextPipe;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    protected static D3DDrawImage d3dDrawImagePipe;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    private native void initOps(int depth, int transparency);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        if (WindowsFlags.isD3DEnabled()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
            D3DBlitLoops.register();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
            D3DMaskFill.register();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        d3dPipe = new D3DRenderer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        d3dTxPipe = new PixelToShapeConverter(d3dPipe);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        d3dTextPipe = new D3DTextRenderer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        d3dDrawImagePipe = new D3DDrawImage();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        if (GraphicsPrimitive.tracingEnabled()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
            d3dPipe = d3dPipe.traceWrapD3D();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
            d3dTextPipe = d3dTextPipe.traceWrap();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    @Override
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    public SurfaceDataProxy makeProxyFor(SurfaceData srcData) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        //D3D may be eliminated soon so no Proxy was created for it...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        //return D3DSurfaceDataProxy.createProxy(srcData, graphicsConfig);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        return SurfaceDataProxy.UNCACHED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * Non-public constructor.  Use createData() to create an object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * This constructor is used to house the common construction
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * code shared between the creation of D3DSurfaceData objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * and subclasses of D3DSurfaceData (such as D3DBackBufferSD).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * It calls the common constructor in the parent, and then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * initializes other shared D3D data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    protected D3DSurfaceData(int width, int height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
                             int d3dSurfaceType,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
                             SurfaceType sType, ColorModel cm,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
                             GraphicsConfiguration gc,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
                             Image image, int transparency)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        super(width, height, sType, cm, gc, image, transparency);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        this.type = d3dSurfaceType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * Private constructor.  Use createData() to create an object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * This constructor calls the common constructor above and then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * performs the specific initialization of the D3DSurface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    private D3DSurfaceData(int width, int height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
                           int d3dSurfaceType,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
                           SurfaceType sType, ColorModel cm,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
                           GraphicsConfiguration gc,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
                           Image image, int transparency,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
                           int screen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
        this(width, height, d3dSurfaceType, sType, cm, gc, image, transparency);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
        pixelFormat = initSurface(width, height, screen,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
                                  null /*parent SurfaceData*/);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    public static D3DSurfaceData createData(int width, int height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
                                            int d3dSurfaceType,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
                                            ColorModel cm,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
                                            GraphicsConfiguration gc,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
                                            Image image)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
        Win32GraphicsDevice gd = (Win32GraphicsDevice)gc.getDevice();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
        // After a display change ddInstance may not be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
        // recreated yet, and in this case isD3DEnabledOnDevice will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
        // return false, until someone attempted to recreate the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
        // primary.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
        if (!gd.isD3DEnabledOnDevice()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
        return new D3DSurfaceData(width, height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
                                  d3dSurfaceType,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
                                  getSurfaceType(gc, cm, d3dSurfaceType),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
                                  cm, gc, image,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
                                  cm.getTransparency(), gd.getScreen());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    int getPixelFormat() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
        return pixelFormat;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    static SurfaceType getSurfaceType(GraphicsConfiguration gc,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
                                      ColorModel cm,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
                                      int d3dSurfaceType)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
        if (d3dSurfaceType == D3D_TEXTURE_SURFACE) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
            // for non-rtt textures we have only one surface type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
            return D3DTexture;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
            int pixelSize = cm.getPixelSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
            Win32GraphicsDevice gd = (Win32GraphicsDevice)gc.getDevice();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
            int transparency = cm.getTransparency();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
            // We'll attempt to use render-to-texture if render target is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
            // requested, but it's not a back-buffer and we support RTT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
            // for this configuration.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
            boolean useRTT =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
                ((d3dSurfaceType & D3D_RENDER_TARGET) != 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
                ((d3dSurfaceType & D3D_BACKBUFFER_SURFACE) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
                gd.getD3DContext().isRTTSupported();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
            // if there's no RTT available, we can't accelerate non-opaque
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
            // surfaces, so we return null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
            if (transparency == Transparency.TRANSLUCENT ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
                transparency == Transparency.BITMASK)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
            {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
                if (pixelSize == 16) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
                    return useRTT ? Ushort4444ArgbD3D_RTT :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
                        null/*Ushort4444ArgbD3D*/;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
                    return useRTT ? IntArgbD3D_RTT : null/*IntArgbD3D*/;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
                // it's an opaque surface, either a VI or a back-buffer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
                switch (pixelSize) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
                case 32:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
                case 24:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
                    if (cm instanceof DirectColorModel) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
                        if (((DirectColorModel)cm).getRedMask() == 0xff0000) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
                            return useRTT ? IntRgbD3D_RTT : IntRgbD3D;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
                        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
                            return useRTT ? IntRgbxD3D_RTT : IntRgbxD3D;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
                    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
                        return useRTT ? ThreeByteBgrD3D_RTT : ThreeByteBgrD3D;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
                case 15:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
                    return useRTT ? Ushort555RgbD3D_RTT : Ushort555RgbD3D;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
                case 16:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
                    if ((cm instanceof DirectColorModel) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
                        (((DirectColorModel)cm).getBlueMask() == 0x3e))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
                    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
                        return useRTT ? Ushort555RgbxD3D_RTT : Ushort555RgbxD3D;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
                    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
                        return useRTT ? Ushort565RgbD3D_RTT : Ushort565RgbD3D;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
                case 8: // not supported
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
                default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
                    throw new sun.java2d.InvalidPipeException("Unsupported bit " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
                                                              "depth: " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
                                                              cm.getPixelSize());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
    private native int initOffScreenSurface(long pCtx,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
                                            long pData, long parentPdata,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
                                            int width, int height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
                                            int type, int screen);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
    protected int initSurface(int width, int height, int screen,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
                              Win32SurfaceData parentData)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
        int pFormat = PF_INVALID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
        synchronized (D3DContext.LOCK) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
            long pData = getNativeOps();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
            long pDataParent = 0L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
            if (parentData != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
                pDataParent = parentData.getNativeOps();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
            D3DContext d3dContext = getContext();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
            long pCtx = d3dContext.getNativeContext();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
            // native context could be 0 if the context is currently invalid,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
            // so attempt to revalidate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
            if (pCtx == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
                d3dContext.reinitNativeContext();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
                pCtx = d3dContext.getNativeContext();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
            if (pData != 0 && pCtx != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
                pFormat = initOffScreenSurface(pCtx,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
                                               pData, pDataParent,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
                                               width, height, type, screen);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
                // if the context can't be restored, give up for now.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
                throw new InvalidPipeException("D3DSD.initSurface: pData " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
                                               "or pCtx is null");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
        return pFormat;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
    @Override
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
    public void validatePipe(SunGraphics2D sg2d) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
        // we don't support COMP_XOR yet..
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
        if (sg2d.compositeState < sg2d.COMP_XOR) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
            TextPipe textpipe;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
            boolean validated = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
            if (((sg2d.compositeState <= sg2d.COMP_ISCOPY &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
                  sg2d.paintState <= sg2d.PAINT_ALPHACOLOR) ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
                 (sg2d.compositeState == sg2d.COMP_ALPHA &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
                  sg2d.paintState <= sg2d.PAINT_ALPHACOLOR &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
                  (((AlphaComposite)sg2d.composite).getRule() ==
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
                   AlphaComposite.SRC_OVER))) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
                sg2d.textAntialiasHint <= SunHints.INTVAL_TEXT_ANTIALIAS_GASP)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
            {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
                // D3DTextRenderer handles both AA and non-AA text, but
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
                // only works if composite is SrcNoEa or SrcOver
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
                textpipe = d3dTextPipe;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
                // do this to initialize textpipe correctly; we will attempt
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
                // to override the non-text pipes below
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
                super.validatePipe(sg2d);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
                textpipe = sg2d.textpipe;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
                validated = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
            if (sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
                sg2d.paintState <= sg2d.PAINT_ALPHACOLOR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
            {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
                sg2d.drawpipe =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
                    sg2d.strokeState == sg2d.STROKE_THIN ? d3dPipe : d3dTxPipe;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
                sg2d.fillpipe = d3dPipe;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
                sg2d.shapepipe = d3dPipe;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
            } else if (!validated) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
                super.validatePipe(sg2d);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
            // install the text pipe based on our earlier decision
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
            sg2d.textpipe = textpipe;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
            super.validatePipe(sg2d);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
        // always override the image pipe with the specialized D3D pipe
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
        sg2d.imagepipe = d3dDrawImagePipe;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
     * Disables D3D acceleration on the surface manager of this surfaceData
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     * object. This can happen when we encounter a hard error in rendering a D3D
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
     * primitive (for example, if we were unable to set a surface as D3D target
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
     * surface).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
     * Upon next validation the SurfaceManager will create a non-D3D surface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
    public void disableD3D() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
        markSurfaceLost();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
        SurfaceManager sMgr = SurfaceManager.getManager(image);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
        if (sMgr instanceof WinVolatileSurfaceManager) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
            ((WinVolatileSurfaceManager)sMgr).setD3DAccelerationEnabled(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
    @Override
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
    public boolean surfacePunted() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
        // Punting is disabled for D3D surfaces
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
        return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
    D3DContext getContext() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
        return ((Win32GraphicsDevice)graphicsConfig.getDevice()).getD3DContext();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
}