Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLSurfaceDataBase.h
41159 views
1
/*
2
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
#ifndef MTLSurfaceDataBase_h_Included
27
#define MTLSurfaceDataBase_h_Included
28
29
#include "java_awt_image_AffineTransformOp.h"
30
#include "sun_java2d_pipe_hw_AccelSurface.h"
31
32
#include "SurfaceData.h"
33
#include "Trace.h"
34
35
/**
36
* The MTLSDOps structure describes a native Metal surface and contains all
37
* information pertaining to the native surface. Some information about
38
* the more important/different fields:
39
*
40
* void* privOps;
41
* Pointer to native-specific (Metal) SurfaceData info, such as the
42
* native Drawable handle and GraphicsConfig data.
43
*
44
* jint drawableType;
45
* The surface type; can be any one of the surface type constants defined
46
* below (MTLSD_WINDOW, MTLSD_TEXTURE, etc).
47
*
48
* jboolean isOpaque;
49
* If true, the surface should be treated as being fully opaque. If
50
* the underlying surface (e.g. MTLTexture/MTLBuffer) has an alpha channel and
51
* isOpaque is true, then we should take appropriate action to ensure that the
52
* surface remains fully opaque.
53
*
54
* jint width/height;
55
* The cached surface bounds. For offscreen surface types (
56
* MTLSD_TEXTURE, MTLSD_RT_TEXTURE etc.) these values must remain constant.
57
* Onscreen window surfaces (MTLSD_WINDOW, MTLSD_FLIP_BACKBUFFER, etc.) may
58
* have their bounds changed in response to a programmatic or user-initiated
59
* event, so these values represent the last known dimensions. To determine the
60
* true current bounds of this surface, query the native Drawable through the
61
* privOps field.
62
*
63
* void* pTexture;
64
* The texture object handle, as generated by MTLTextureDescriptor(). If this
65
* value is null, the texture has not yet been initialized.
66
*
67
* void* pStencilTexture;
68
* The byte buffer stencil mask used in rendering Metal rendering pass.
69
*/
70
typedef struct {
71
SurfaceDataOps sdOps;
72
void* privOps;
73
jobject graphicsConfig;
74
jint drawableType;
75
jboolean isOpaque;
76
jint width;
77
jint height;
78
void* pTexture;
79
void* pStencilData; // stencil data to be rendered to this buffer
80
void* pStencilTexture; // stencil texture byte buffer stencil mask used in main rendering
81
} BMTLSDOps;
82
83
#define MTLSD_UNDEFINED sun_java2d_pipe_hw_AccelSurface_UNDEFINED
84
#define MTLSD_WINDOW sun_java2d_pipe_hw_AccelSurface_WINDOW
85
#define MTLSD_TEXTURE sun_java2d_pipe_hw_AccelSurface_TEXTURE
86
#define MTLSD_FLIP_BACKBUFFER sun_java2d_pipe_hw_AccelSurface_FLIP_BACKBUFFER
87
#define MTLSD_RT_TEXTURE sun_java2d_pipe_hw_AccelSurface_RT_TEXTURE
88
89
/**
90
* These are shorthand names for the filtering method constants used by
91
* image transform methods.
92
*/
93
#define MTLSD_XFORM_DEFAULT 0
94
#define MTLSD_XFORM_NEAREST_NEIGHBOR \
95
java_awt_image_AffineTransformOp_TYPE_NEAREST_NEIGHBOR
96
#define MTLSD_XFORM_BILINEAR \
97
java_awt_image_AffineTransformOp_TYPE_BILINEAR
98
99
/**
100
* The SurfaceRasterFlags structure contains information about raster (of some MTLTexture):
101
*
102
* jboolean isOpaque;
103
* If true, indicates that this pixel format hasn't alpha component (and values of this component can contain garbage).
104
*
105
* jboolean isPremultiplied;
106
* If true, indicates that this pixel format contains color components that have been pre-multiplied by their
107
* corresponding alpha component.
108
*/
109
typedef struct {
110
jboolean isOpaque;
111
jboolean isPremultiplied;
112
} SurfaceRasterFlags;
113
114
/**
115
* Exported methods.
116
*/
117
jint MTLSD_Lock(JNIEnv *env,
118
SurfaceDataOps *ops, SurfaceDataRasInfo *pRasInfo,
119
jint lockflags);
120
void MTLSD_GetRasInfo(JNIEnv *env,
121
SurfaceDataOps *ops, SurfaceDataRasInfo *pRasInfo);
122
void MTLSD_Unlock(JNIEnv *env,
123
SurfaceDataOps *ops, SurfaceDataRasInfo *pRasInfo);
124
void MTLSD_Dispose(JNIEnv *env, SurfaceDataOps *ops);
125
void MTLSD_Delete(JNIEnv *env, BMTLSDOps *mtlsdo);
126
jint MTLSD_NextPowerOfTwo(jint val, jint max);
127
128
#endif /* MTLSurfaceDataBase_h_Included */
129
130