jdk/src/share/classes/sun/java2d/opengl/OGLContext.java
author dxu
Thu, 04 Apr 2013 15:39:17 -0700
changeset 16734 da1901d79073
parent 12813 c10ab96dcf41
child 16739 018660b0c613
permissions -rw-r--r--
8000406: change files using @GenerateNativeHeader to use @Native Summary: Use @Native annotation to mark constants interested by native codes Reviewed-by: alanb, anthony, prr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
     2
 * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
2
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
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 888
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 888
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
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
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 888
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 888
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 888
diff changeset
    23
 * questions.
2
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.opengl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import sun.java2d.pipe.BufferedContext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import sun.java2d.pipe.RenderBuffer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import sun.java2d.pipe.RenderQueue;
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    31
import sun.java2d.pipe.hw.ContextCapabilities;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import static sun.java2d.pipe.BufferedOpCodes.*;
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    33
import static sun.java2d.pipe.hw.ContextCapabilities.*;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
    35
import java.lang.annotation.Native;
12813
c10ab96dcf41 7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI
erikj
parents: 5506
diff changeset
    36
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * Note that the RenderQueue lock must be acquired before calling any of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * the methods in this class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 */
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    41
public class OGLContext extends BufferedContext {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    42
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    43
    private final OGLGraphicsConfig config;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    45
    OGLContext(RenderQueue rq, OGLGraphicsConfig config) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
        super(rq);
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    47
        this.config = config;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
     * Convenience method that delegates to setScratchSurface() below.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    static void setScratchSurface(OGLGraphicsConfig gc) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
        setScratchSurface(gc.getNativeConfigInfo());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * Makes the given GraphicsConfig's context current to its associated
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * "scratch surface".  Each GraphicsConfig maintains a native context
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * (GLXContext on Unix, HGLRC on Windows) as well as a native pbuffer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * known as the "scratch surface".  By making the context current to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * scratch surface, we are assured that we have a current context for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * the relevant GraphicsConfig, and can therefore perform operations
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * depending on the capabilities of that GraphicsConfig.  For example,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * if the GraphicsConfig supports the GL_ARB_texture_non_power_of_two
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * extension, then we should be able to make a non-pow2 texture for this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * GraphicsConfig once we make the context current to the scratch surface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * This method should be used for operations with an OpenGL texture
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * as the destination surface (e.g. a sw->texture blit loop), or in those
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * situations where we may not otherwise have a current context (e.g.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * when disposing a texture-based surface).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    static void setScratchSurface(long pConfigInfo) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        // assert OGLRenderQueue.getInstance().lock.isHeldByCurrentThread();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        // invalidate the current context
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        currentContext = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        // set the scratch context
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        OGLRenderQueue rq = OGLRenderQueue.getInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        RenderBuffer buf = rq.getBuffer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        rq.ensureCapacityAndAlignment(12, 4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        buf.putInt(SET_SCRATCH_SURFACE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        buf.putLong(pConfigInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * Invalidates the currentContext field to ensure that we properly
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * revalidate the OGLContext (make it current, etc.) next time through
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * the validate() method.  This is typically invoked from methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * that affect the current context state (e.g. disposing a context or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * surface).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    static void invalidateCurrentContext() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        // assert OGLRenderQueue.getInstance().lock.isHeldByCurrentThread();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    98
        // invalidate the current Java-level context so that we
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    99
        // revalidate everything the next time around
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   100
        if (currentContext != null) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   101
            currentContext.invalidateContext();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   102
            currentContext = null;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   103
        }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   104
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   105
        // invalidate the context reference at the native level, and
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        // then flush the queue so that we have no pending operations
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        // dependent on the current context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        OGLRenderQueue rq = OGLRenderQueue.getInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        rq.ensureCapacity(4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        rq.getBuffer().putInt(INVALIDATE_CONTEXT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        rq.flushNow();
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   112
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   114
    public RenderQueue getRenderQueue() {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   115
        return OGLRenderQueue.getInstance();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   116
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   117
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   118
    /**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   119
     * Returns a string representing adapter id (vendor, renderer, version).
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   120
     * Must be called on the rendering thread.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   121
     *
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   122
     * @return an id string for the adapter
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   123
     */
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   124
    static final native String getOGLIdString();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   125
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   126
    @Override
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   127
    public void saveState() {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   128
        // assert rq.lock.isHeldByCurrentThread();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   129
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   130
        // reset all attributes of this and current contexts
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   131
        invalidateContext();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   132
        invalidateCurrentContext();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   133
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   134
        setScratchSurface(config);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   135
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   136
        // save the state on the native level
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   137
        rq.ensureCapacity(4);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   138
        buf.putInt(SAVE_STATE);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   139
        rq.flushNow();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   140
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   141
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   142
    @Override
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   143
    public void restoreState() {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   144
        // assert rq.lock.isHeldByCurrentThread();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   145
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   146
        // reset all attributes of this and current contexts
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   147
        invalidateContext();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   148
        invalidateCurrentContext();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   149
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   150
        setScratchSurface(config);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   151
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   152
        // restore the state on the native level
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   153
        rq.ensureCapacity(4);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   154
        buf.putInt(RESTORE_STATE);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   155
        rq.flushNow();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   156
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   157
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   158
    static class OGLContextCaps extends ContextCapabilities {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   159
        /**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   160
         * Indicates the presence of the GL_EXT_framebuffer_object extension.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   161
         * This cap will only be set if the fbobject system property has been
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   162
         * enabled and we are able to create an FBO with depth buffer.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   163
         */
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
   164
    @Native static final int CAPS_EXT_FBOBJECT     =
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   165
                (CAPS_RT_TEXTURE_ALPHA | CAPS_RT_TEXTURE_OPAQUE);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   166
        /** Indicates that the context supports a stored alpha channel. */
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
   167
    @Native static final int CAPS_STORED_ALPHA     = CAPS_RT_PLAIN_ALPHA;
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   168
        /** Indicates that the context is doublebuffered. */
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
   169
    @Native static final int CAPS_DOUBLEBUFFERED   = (FIRST_PRIVATE_CAP << 0);
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   170
        /**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   171
         * Indicates the presence of the GL_ARB_fragment_shader extension.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   172
         * This cap will only be set if the lcdshader system property has been
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   173
         * enabled and the hardware supports the minimum number of texture units
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   174
         */
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
   175
    @Native static final int CAPS_EXT_LCD_SHADER   = (FIRST_PRIVATE_CAP << 1);
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   176
        /**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   177
         * Indicates the presence of the GL_ARB_fragment_shader extension.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   178
         * This cap will only be set if the biopshader system property has been
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   179
         * enabled and the hardware meets our minimum requirements.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   180
         */
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
   181
    @Native static final int CAPS_EXT_BIOP_SHADER  = (FIRST_PRIVATE_CAP << 2);
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   182
        /**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   183
         * Indicates the presence of the GL_ARB_fragment_shader extension.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   184
         * This cap will only be set if the gradshader system property has been
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   185
         * enabled and the hardware meets our minimum requirements.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   186
         */
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
   187
    @Native static final int CAPS_EXT_GRAD_SHADER  = (FIRST_PRIVATE_CAP << 3);
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   188
        /** Indicates the presence of the GL_ARB_texture_rectangle extension. */
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
   189
    @Native static final int CAPS_EXT_TEXRECT      = (FIRST_PRIVATE_CAP << 4);
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   190
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   191
        OGLContextCaps(int caps, String adapterId) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   192
            super(caps, adapterId);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   193
        }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   194
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   195
        @Override
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   196
        public String toString() {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   197
            StringBuffer buf = new StringBuffer(super.toString());
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   198
            if ((caps & CAPS_EXT_FBOBJECT) != 0) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   199
                buf.append("CAPS_EXT_FBOBJECT|");
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   200
            }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   201
            if ((caps & CAPS_STORED_ALPHA) != 0) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   202
                buf.append("CAPS_STORED_ALPHA|");
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   203
            }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   204
            if ((caps & CAPS_DOUBLEBUFFERED) != 0) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   205
                buf.append("CAPS_DOUBLEBUFFERED|");
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   206
            }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   207
            if ((caps & CAPS_EXT_LCD_SHADER) != 0) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   208
                buf.append("CAPS_EXT_LCD_SHADER|");
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   209
            }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   210
            if ((caps & CAPS_EXT_BIOP_SHADER) != 0) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   211
                buf.append("CAPS_BIOP_SHADER|");
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   212
            }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   213
            if ((caps & CAPS_EXT_GRAD_SHADER) != 0) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   214
                buf.append("CAPS_EXT_GRAD_SHADER|");
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   215
            }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   216
            if ((caps & CAPS_EXT_TEXRECT) != 0) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   217
                buf.append("CAPS_EXT_TEXRECT|");
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   218
            }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   219
            return buf.toString();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
}