jdk/src/share/native/sun/java2d/opengl/OGLContext.h
author tdv
Tue, 22 Jul 2008 11:24:32 -0700
changeset 888 c7009cf0001f
parent 887 0aab8d3fa11a
child 5506 202f599c92aa
permissions -rw-r--r--
6728492: typo in copyrights in some files touched by the d3d pipeline port Reviewed-by: prr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
888
c7009cf0001f 6728492: typo in copyrights in some files touched by the d3d pipeline port
tdv
parents: 887
diff changeset
     2
 * Copyright 2004-2008 Sun Microsystems, Inc.  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
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
#ifndef OGLContext_h_Included
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#define OGLContext_h_Included
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include "sun_java2d_pipe_BufferedContext.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
#include "sun_java2d_opengl_OGLContext.h"
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    31
#include "sun_java2d_opengl_OGLContext_OGLContextCaps.h"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
#include "j2d_md.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
#include "J2D_GL/gl.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
#include "OGLSurfaceData.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * The OGLBlendRule structure encapsulates the two enumerated values that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * comprise a given Porter-Duff blending (compositing) rule.  For example,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * the "SrcOver" rule can be represented by:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 *     rule.src = GL_ONE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *     rule.dst = GL_ONE_MINUS_SRC_ALPHA;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *     GLenum src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * The constant representing the source factor in this Porter-Duff rule.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *     GLenum dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * The constant representing the destination factor in this Porter-Duff rule.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
typedef struct {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    GLenum src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    GLenum dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
} OGLBlendRule;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * The OGLContext structure contains cached state relevant to the native
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * OpenGL context stored within the native ctxInfo field.  Each Java-level
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * OGLContext object is associated with a native-level OGLContext structure.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * The caps field is a bitfield that expresses the capabilities of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * GraphicsConfig associated with this context (see OGLContext.java for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * the definitions of each capability bit).  The other fields are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * simply cached values of various elements of the context state, typically
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * used in the OGLContext.set*() methods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * Note that the textureFunction field is implicitly set to zero when the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * OGLContext is created.  The acceptable values (e.g. GL_MODULATE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * GL_REPLACE) for this field are never zero, which means we will always
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * validate the texture function state upon the first call to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * OGLC_UPDATE_TEXTURE_FUNCTION() macro.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
typedef struct {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    void       *ctxInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    jint       caps;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    jint       compState;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    jfloat     extraAlpha;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    jint       xorPixel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    jint       pixel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    jubyte     r;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    jubyte     g;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    jubyte     b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    jubyte     a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    jint       paintState;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    jboolean   useMask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    GLdouble   *xformMatrix;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    GLuint     blitTextureID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    GLint      textureFunction;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
} OGLContext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 * See BufferedContext.java for more on these flags...
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
#define OGLC_NO_CONTEXT_FLAGS \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    sun_java2d_pipe_BufferedContext_NO_CONTEXT_FLAGS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
#define OGLC_SRC_IS_OPAQUE    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    sun_java2d_pipe_BufferedContext_SRC_IS_OPAQUE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
#define OGLC_USE_MASK         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    sun_java2d_pipe_BufferedContext_USE_MASK
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
/**
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   100
 * See OGLContext.java for more on these flags.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   101
 */
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   102
#define CAPS_EMPTY           \
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   103
    sun_java2d_opengl_OGLContext_OGLContextCaps_CAPS_EMPTY
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   104
#define CAPS_RT_PLAIN_ALPHA  \
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   105
    sun_java2d_opengl_OGLContext_OGLContextCaps_CAPS_RT_PLAIN_ALPHA
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   106
#define CAPS_RT_TEXTURE_ALPHA       \
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   107
    sun_java2d_opengl_OGLContext_OGLContextCaps_CAPS_RT_TEXTURE_ALPHA
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   108
#define CAPS_RT_TEXTURE_OPAQUE      \
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   109
    sun_java2d_opengl_OGLContext_OGLContextCaps_CAPS_RT_TEXTURE_OPAQUE
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   110
#define CAPS_MULTITEXTURE    \
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   111
    sun_java2d_opengl_OGLContext_OGLContextCaps_CAPS_MULTITEXTURE
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   112
#define CAPS_TEXNONPOW2      \
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   113
    sun_java2d_opengl_OGLContext_OGLContextCaps_CAPS_TEXNONPOW2
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   114
#define CAPS_TEXNONSQUARE    \
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   115
    sun_java2d_opengl_OGLContext_OGLContextCaps_CAPS_TEXNONSQUARE
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   116
#define CAPS_PS20            \
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   117
    sun_java2d_opengl_OGLContext_OGLContextCaps_CAPS_PS20
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   118
#define CAPS_PS30            \
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   119
    sun_java2d_opengl_OGLContext_OGLContextCaps_CAPS_PS30
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   120
#define LAST_SHARED_CAP      \
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   121
    sun_java2d_opengl_OGLContext_OGLContextCaps_LAST_SHARED_CAP
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   122
#define CAPS_EXT_FBOBJECT    \
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   123
    sun_java2d_opengl_OGLContext_OGLContextCaps_CAPS_EXT_FBOBJECT
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   124
#define CAPS_STORED_ALPHA    \
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   125
    sun_java2d_opengl_OGLContext_OGLContextCaps_CAPS_STORED_ALPHA
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   126
#define CAPS_DOUBLEBUFFERED  \
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   127
    sun_java2d_opengl_OGLContext_OGLContextCaps_CAPS_DOUBLEBUFFERED
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   128
#define CAPS_EXT_LCD_SHADER  \
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   129
    sun_java2d_opengl_OGLContext_OGLContextCaps_CAPS_EXT_LCD_SHADER
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   130
#define CAPS_EXT_BIOP_SHADER \
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   131
    sun_java2d_opengl_OGLContext_OGLContextCaps_CAPS_EXT_BIOP_SHADER
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   132
#define CAPS_EXT_GRAD_SHADER \
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   133
    sun_java2d_opengl_OGLContext_OGLContextCaps_CAPS_EXT_GRAD_SHADER
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   134
#define CAPS_EXT_TEXRECT     \
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   135
    sun_java2d_opengl_OGLContext_OGLContextCaps_CAPS_EXT_TEXRECT
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   136
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   137
/**
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
 * Evaluates to true if the given capability bitmask is present for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
 * given OGLContext.  Note that only the constant name needs to be passed as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
 * a parameter, as this macro will automatically prepend the full package
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
 * and class name to the constant name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
 */
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   143
#define OGLC_IS_CAP_PRESENT(oglc, cap) (((oglc)->caps & (cap)) != 0)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
 * At startup we will embed one of the following values in the caps field
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
 * of OGLContext.  Later we can use this information to select
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
 * the codepath that offers the best performance for that vendor's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
 * hardware and/or drivers.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
#define OGLC_VENDOR_OTHER  0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
#define OGLC_VENDOR_ATI    1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
#define OGLC_VENDOR_NVIDIA 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
#define OGLC_VENDOR_SUN    3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
#define OGLC_VCAP_MASK     0x3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
#define OGLC_VCAP_OFFSET   24
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
#define OGLC_GET_VENDOR(oglc) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    (((oglc)->caps >> OGLC_VCAP_OFFSET) & OGLC_VCAP_MASK)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
 * This constant determines the size of the shared tile texture used
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
 * by a number of image rendering methods.  For example, the blit tile texture
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
 * will have dimensions with width OGLC_BLIT_TILE_SIZE and height
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
 * OGLC_BLIT_TILE_SIZE (the tile will always be square).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
#define OGLC_BLIT_TILE_SIZE 128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
 * Helper macros that update the current texture function state only when
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
 * it needs to be changed, which helps reduce overhead for small texturing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
 * operations.  The filter state is set on a per-context (not per-texture)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
 * basis; for example, if we apply one texture using GL_MODULATE followed by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
 * another texture using GL_MODULATE (under the same context), there is no
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
 * need to set the texture function the second time, as that would be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
 * redundant.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
#define OGLC_INIT_TEXTURE_FUNCTION(oglc, func)                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    do {                                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        j2d_glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, (func)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        (oglc)->textureFunction = (func);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
#define OGLC_UPDATE_TEXTURE_FUNCTION(oglc, func)    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    do {                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        if ((oglc)->textureFunction != (func)) {    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
            OGLC_INIT_TEXTURE_FUNCTION(oglc, func); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        }                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
 * Exported methods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
OGLContext *OGLContext_SetSurfaces(JNIEnv *env, jlong pSrc, jlong pDst);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
void OGLContext_ResetClip(OGLContext *oglc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
void OGLContext_SetRectClip(OGLContext *oglc, OGLSDOps *dstOps,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
                            jint x1, jint y1, jint x2, jint y2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
void OGLContext_BeginShapeClip(OGLContext *oglc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
void OGLContext_EndShapeClip(OGLContext *oglc, OGLSDOps *dstOps);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
void OGLContext_SetExtraAlpha(jfloat ea);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
void OGLContext_ResetComposite(OGLContext *oglc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
void OGLContext_SetAlphaComposite(OGLContext *oglc,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
                                  jint rule, jfloat extraAlpha, jint flags);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
void OGLContext_SetXorComposite(OGLContext *oglc, jint xorPixel);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
void OGLContext_ResetTransform(OGLContext *oglc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
void OGLContext_SetTransform(OGLContext *oglc,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
                             jdouble m00, jdouble m10,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
                             jdouble m01, jdouble m11,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
                             jdouble m02, jdouble m12);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
jboolean OGLContext_InitBlitTileTexture(OGLContext *oglc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
GLuint OGLContext_CreateBlitTexture(GLenum internalFormat, GLenum pixelFormat,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
                                    GLuint width, GLuint height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
void OGLContext_DestroyContextResources(OGLContext *oglc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
jboolean OGLContext_IsExtensionAvailable(const char *extString, char *extName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
void OGLContext_GetExtensionInfo(JNIEnv *env, jint *caps);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
jboolean OGLContext_IsVersionSupported(const unsigned char *versionstr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
GLhandleARB OGLContext_CreateFragmentProgram(const char *fragmentShaderSource);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
#endif /* OGLContext_h_Included */