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/common.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 COMMON_H
27
#define COMMON_H
28
29
#include <simd/simd.h>
30
31
#define PGRAM_VERTEX_COUNT 6
32
#define QUAD_VERTEX_COUNT 4
33
#define GRAD_MAX_FRACTIONS 12
34
35
enum GradCycleMethod {
36
GradNoCycle = 0,
37
GradReflect = 1,
38
GradRepeat = 2
39
};
40
enum VertexAttributes {
41
VertexAttributePosition = 0,
42
VertexAttributeTexPos = 1,
43
VertexAttributeITexPos = 2
44
};
45
46
enum BufferIndex {
47
MeshVertexBuffer = 0,
48
FrameUniformBuffer = 1,
49
MatrixBuffer = 2
50
};
51
52
struct FrameUniforms {
53
vector_float4 color;
54
};
55
56
struct TransformMatrix {
57
matrix_float4x4 transformMatrix;
58
};
59
60
struct GradFrameUniforms {
61
vector_float3 params;
62
vector_float4 color1;
63
vector_float4 color2;
64
int isCyclic;
65
float extraAlpha;
66
};
67
68
struct LinGradFrameUniforms {
69
vector_float3 params;
70
float fract[GRAD_MAX_FRACTIONS];
71
vector_float4 color[GRAD_MAX_FRACTIONS];
72
int numFracts;
73
int isLinear;
74
int cycleMethod;
75
float extraAlpha;
76
};
77
78
struct RadGradFrameUniforms {
79
float fract[GRAD_MAX_FRACTIONS];
80
vector_float4 color[GRAD_MAX_FRACTIONS];
81
int numFracts;
82
int isLinear;
83
int cycleMethod;
84
vector_float3 m0;
85
vector_float3 m1;
86
vector_float3 precalc;
87
float extraAlpha;
88
};
89
90
struct Vertex {
91
float position[2];
92
};
93
94
struct TxtVertex {
95
float position[2];
96
float txtpos[2];
97
};
98
99
struct AAVertex {
100
float position[2];
101
float otxtpos[2];
102
float itxtpos[2];
103
};
104
105
// These values are mapped from AffineTransformOp
106
#define INTERPOLATION_NEAREST_NEIGHBOR 1
107
#define INTERPOLATION_BILINEAR 2
108
// #define INTERPOLATION_BICUBIC 3
109
// NOTE: Metal samplers doesn't supports bicubic interpolation
110
// see table 2.7 from https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf
111
// (probably we need to implement separate fragment shader with bicubic interpolation)
112
113
struct TxtFrameUniforms {
114
vector_float4 color;
115
int mode; // NOTE: consider to use bit fields
116
int isSrcOpaque;
117
int isDstOpaque;
118
float extraAlpha;
119
};
120
121
struct TxtFrameOpRescaleUniforms {
122
vector_float4 color;
123
float extraAlpha;
124
125
int isSrcOpaque;
126
int isNonPremult;
127
128
vector_float4 normScaleFactors;
129
vector_float4 normOffsets;
130
};
131
132
struct TxtFrameOpConvolveUniforms {
133
float extraAlpha;
134
int isSrcOpaque;
135
vector_float4 imgEdge;
136
int kernelSize;
137
int isEdgeZeroFill;
138
};
139
140
struct TxtFrameOpLookupUniforms {
141
float extraAlpha;
142
int isSrcOpaque;
143
vector_float4 offset;
144
int isUseSrcAlpha;
145
int isNonPremult;
146
};
147
148
struct AnchorData
149
{
150
vector_float3 xParams;
151
vector_float3 yParams;
152
};
153
154
struct LCDFrameUniforms {
155
vector_float3 src_adj;
156
vector_float3 gamma;
157
vector_float3 invgamma;
158
};
159
160
struct SwizzleUniforms {
161
unsigned char swizzle[4];
162
unsigned char hasAlpha;
163
};
164
#endif
165
166