author | jdv |
Fri, 21 Jun 2019 12:08:37 +0530 | |
branch | metal-prototype-branch |
changeset 57416 | e153174dba06 |
permissions | -rw-r--r-- |
57416
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
1 |
/* |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
2 |
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
4 |
* |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
10 |
* |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
15 |
* accompanied this code). |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
16 |
* |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
20 |
* |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
23 |
* questions. |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
24 |
*/ |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
25 |
|
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
26 |
#ifndef MTLSurfaceDataBase_h_Included |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
27 |
#define MTLSurfaceDataBase_h_Included |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
28 |
|
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
29 |
#include "java_awt_image_AffineTransformOp.h" |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
30 |
#include "sun_java2d_metal_MTLSurfaceData.h" |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
31 |
#include "sun_java2d_pipe_hw_AccelSurface.h" |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
32 |
|
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
33 |
#include "SurfaceData.h" |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
34 |
#include "Trace.h" |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
35 |
#include "MTLFuncs.h" |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
36 |
|
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
37 |
|
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
38 |
/** |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
39 |
* The MTLPixelFormat structure contains all the information OpenGL needs to |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
40 |
* know when copying from or into a particular system memory image buffer (via |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
41 |
* glDrawPixels(), glReadPixels, glTexSubImage2D(), etc). |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
42 |
* |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
43 |
* GLenum format; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
44 |
* The pixel format parameter used in glDrawPixels() and other similar calls. |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
45 |
* Indicates the component ordering for each pixel (e.g. GL_BGRA). |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
46 |
* |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
47 |
* GLenum type; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
48 |
* The pixel data type parameter used in glDrawPixels() and other similar |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
49 |
* calls. Indicates the data type for an entire pixel or for each component |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
50 |
* in a pixel (e.g. GL_UNSIGNED_BYTE with GL_BGR means a pixel consists of |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
51 |
* 3 unsigned byte components, blue first, then green, then red; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
52 |
* GL_UNSIGNED_INT_8_8_8_8_REV with GL_BGRA means a pixel consists of 1 |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
53 |
* unsigned integer comprised of four byte components, alpha first, then red, |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
54 |
* then green, then blue). |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
55 |
* |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
56 |
* jint alignment; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
57 |
* The byte alignment parameter used in glPixelStorei(GL_UNPACK_ALIGNMENT). A |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
58 |
* value of 4 indicates that each pixel starts on a 4-byte aligned region in |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
59 |
* memory, and so on. This alignment parameter helps OpenGL speed up pixel |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
60 |
* transfer operations by transferring memory in aligned blocks. |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
61 |
* |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
62 |
* jboolean hasAlpha; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
63 |
* If true, indicates that this pixel format contains an alpha component. |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
64 |
* |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
65 |
* jboolean isPremult; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
66 |
* If true, indicates that this pixel format contains color components that |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
67 |
* have been pre-multiplied by their corresponding alpha component. |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
68 |
*/ |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
69 |
typedef struct { |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
70 |
//GLenum format; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
71 |
//GLenum type; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
72 |
jint format; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
73 |
jint type; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
74 |
jint alignment; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
75 |
jboolean hasAlpha; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
76 |
jboolean isPremult; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
77 |
} MTPixelFormat; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
78 |
|
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
79 |
/** |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
80 |
* The MTLSDOps structure describes a native OpenGL surface and contains all |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
81 |
* information pertaining to the native surface. Some information about |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
82 |
* the more important/different fields: |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
83 |
* |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
84 |
* void *privOps; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
85 |
* Pointer to native-specific (GLX, WGL, etc.) SurfaceData info, such as the |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
86 |
* native Drawable handle and GraphicsConfig data. |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
87 |
* |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
88 |
* jint drawableType; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
89 |
* The surface type; can be any one of the surface type constants defined |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
90 |
* below (MTLSD_WINDOW, MTLSD_TEXTURE, etc). |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
91 |
* |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
92 |
* GLenum activeBuffer; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
93 |
* Can be either GL_FRONT if this is the front buffer surface of an onscreen |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
94 |
* window or a pbuffer surface, or GL_BACK if this is the backbuffer surface |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
95 |
* of an onscreen window. |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
96 |
* |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
97 |
* jboolean isOpaque; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
98 |
* If true, the surface should be treated as being fully opaque. If |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
99 |
* the underlying surface (e.g. pbuffer) has an alpha channel and isOpaque |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
100 |
* is true, then we should take appropriate action (i.e. call glColorMask() |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
101 |
* to disable writes into the alpha channel) to ensure that the surface |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
102 |
* remains fully opaque. |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
103 |
* |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
104 |
* jboolean needsInit; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
105 |
* If true, the surface requires some one-time initialization, which should |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
106 |
* be performed after a context has been made current to the surface for |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
107 |
* the first time. |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
108 |
* |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
109 |
* jint x/yOffset |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
110 |
* The offset in pixels of the OpenGL viewport origin from the lower-left |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
111 |
* corner of the heavyweight drawable. For example, a top-level frame on |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
112 |
* Windows XP has lower-left insets of (4,4). The OpenGL viewport origin |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
113 |
* would typically begin at the lower-left corner of the client region (inside |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
114 |
* the frame decorations), but AWT/Swing will take the insets into account |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
115 |
* when rendering into that window. So in order to account for this, we |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
116 |
* need to adjust the OpenGL viewport origin by an x/yOffset of (-4,-4). On |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
117 |
* X11, top-level frames typically don't have this insets issue, so their |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
118 |
* x/yOffset would be (0,0) (the same applies to pbuffers). |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
119 |
* |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
120 |
* jint width/height; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
121 |
* The cached surface bounds. For offscreen surface types (MTLSD_FBOBJECT, |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
122 |
* MTLSD_TEXTURE, etc.) these values must remain constant. Onscreen window |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
123 |
* surfaces (MTLSD_WINDOW, MTLSD_FLIP_BACKBUFFER, etc.) may have their |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
124 |
* bounds changed in response to a programmatic or user-initiated event, so |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
125 |
* these values represent the last known dimensions. To determine the true |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
126 |
* current bounds of this surface, query the native Drawable through the |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
127 |
* privOps field. |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
128 |
* |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
129 |
* GLuint textureID; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
130 |
* The texture object handle, as generated by glGenTextures(). If this value |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
131 |
* is zero, the texture has not yet been initialized. |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
132 |
* |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
133 |
* jint textureWidth/Height; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
134 |
* The actual bounds of the texture object for this surface. If the |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
135 |
* GL_ARB_texture_non_power_of_two extension is not present, the dimensions |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
136 |
* of an OpenGL texture object must be a power-of-two (e.g. 64x32 or 128x512). |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
137 |
* The texture image that we care about has dimensions specified by the width |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
138 |
* and height fields in this MTLSDOps structure. For example, if the image |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
139 |
* to be stored in the texture has dimensions 115x47, the actual OpenGL |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
140 |
* texture we allocate will have dimensions 128x64 to meet the pow2 |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
141 |
* restriction. The image bounds within the texture can be accessed using |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
142 |
* floating point texture coordinates in the range [0.0,1.0]. |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
143 |
* |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
144 |
* GLenum textureTarget; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
145 |
* The texture target of the texture object for this surface. If this |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
146 |
* surface is not backed by a texture, this value is set to zero. Otherwise, |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
147 |
* this value is GL_TEXTURE_RECTANGLE_ARB when the GL_ARB_texture_rectangle |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
148 |
* extension is in use; if not, it is set to GL_TEXTURE_2D. |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
149 |
* |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
150 |
* GLint textureFilter; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
151 |
* The current filter state for this texture object (can be either GL_NEAREST |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
152 |
* or GL_LINEAR). We cache this value here and check it before updating |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
153 |
* the filter state to avoid redundant calls to glTexParameteri() when the |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
154 |
* filter state remains constant (see the MTLSD_UPDATE_TEXTURE_FILTER() |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
155 |
* macro below). |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
156 |
* |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
157 |
* GLuint fbobjectID, depthID; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
158 |
* The object handles for the framebuffer object and depth renderbuffer |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
159 |
* associated with this surface. These fields are only used when |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
160 |
* drawableType is MTLSD_FBOBJECT, otherwise they are zero. |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
161 |
*/ |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
162 |
typedef struct { |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
163 |
SurfaceDataOps sdOps; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
164 |
void *privOps; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
165 |
jint drawableType; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
166 |
jint activeBuffer; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
167 |
jboolean isOpaque; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
168 |
jboolean needsInit; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
169 |
jint xOffset; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
170 |
jint yOffset; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
171 |
jint width; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
172 |
jint height; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
173 |
void* pTexture; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
174 |
jint textureWidth; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
175 |
jint textureHeight; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
176 |
/* GLenum */ jint textureTarget; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
177 |
/* GLint */ jint textureFilter; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
178 |
/* GLuint */ jint fbobjectID; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
179 |
/* GLuint */ jint depthID; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
180 |
} BMTLSDOps; |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
181 |
|
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
182 |
#define MTLSD_UNDEFINED sun_java2d_pipe_hw_AccelSurface_UNDEFINED |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
183 |
#define MTLSD_WINDOW sun_java2d_pipe_hw_AccelSurface_WINDOW |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
184 |
#define MTLSD_TEXTURE sun_java2d_pipe_hw_AccelSurface_TEXTURE |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
185 |
#define MTLSD_FLIP_BACKBUFFER sun_java2d_pipe_hw_AccelSurface_FLIP_BACKBUFFER |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
186 |
#define MTLSD_RT_TEXTURE sun_java2d_pipe_hw_AccelSurface_RT_TEXTURE |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
187 |
|
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
188 |
/** |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
189 |
* These are shorthand names for the filtering method constants used by |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
190 |
* image transform methods. |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
191 |
*/ |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
192 |
#define MTLSD_XFORM_DEFAULT 0 |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
193 |
#define MTLSD_XFORM_NEAREST_NEIGHBOR \ |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
194 |
java_awt_image_AffineTransformOp_TYPE_NEAREST_NEIGHBOR |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
195 |
#define MTLSD_XFORM_BILINEAR \ |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
196 |
java_awt_image_AffineTransformOp_TYPE_BILINEAR |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
197 |
|
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
198 |
/** |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
199 |
* Exported methods. |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
200 |
*/ |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
201 |
jint MTLSD_Lock(JNIEnv *env, |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
202 |
SurfaceDataOps *ops, SurfaceDataRasInfo *pRasInfo, |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
203 |
jint lockflags); |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
204 |
void MTLSD_GetRasInfo(JNIEnv *env, |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
205 |
SurfaceDataOps *ops, SurfaceDataRasInfo *pRasInfo); |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
206 |
void MTLSD_Unlock(JNIEnv *env, |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
207 |
SurfaceDataOps *ops, SurfaceDataRasInfo *pRasInfo); |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
208 |
void MTLSD_Dispose(JNIEnv *env, SurfaceDataOps *ops); |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
209 |
void MTLSD_Delete(JNIEnv *env, BMTLSDOps *mtlsdo); |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
210 |
jint MTLSD_NextPowerOfTwo(jint val, jint max); |
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
211 |
|
e153174dba06
Merge JDK-8220154 initial metal implementation patch to the jdk sandbox branch
jdv
parents:
diff
changeset
|
212 |
#endif /* MTLSurfaceDataBase_h_Included */ |