Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/native/sun/java2d/ShaderList.h
38829 views
1
/*
2
* Copyright (c) 2007, 2008, 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 ShaderList_h_Included
27
#define ShaderList_h_Included
28
29
#ifdef __cplusplus
30
extern "C" {
31
#endif
32
33
#include "jni.h"
34
#include "jlong.h"
35
36
typedef void (ShaderDisposeFunc)(jlong programID);
37
38
/**
39
* The following structures are used to maintain a list of fragment program
40
* objects and their associated attributes. Each logical shader (e.g.
41
* RadialGradientPaint shader, ConvolveOp shader) can have a number of
42
* different variants depending on a number of factors, such as whether
43
* antialiasing is enabled or the current composite mode. Since the number
44
* of possible combinations of these factors is in the hundreds, we need
45
* some way to create fragment programs on an as-needed basis, and also
46
* keep them in a limited sized cache to avoid creating too many objects.
47
*
48
* The ShaderInfo structure keeps a reference to the fragment program's
49
* handle, as well as some other values that help differentiate one ShaderInfo
50
* from another. ShaderInfos can be chained together to form a linked list.
51
*
52
* The ShaderList structure acts as a cache for ShaderInfos, placing
53
* most-recently used items at the front, and removing items from the
54
* cache when its size exceeds the "maxItems" limit.
55
*/
56
typedef struct _ShaderInfo ShaderInfo;
57
58
typedef struct {
59
ShaderInfo *head;
60
ShaderDisposeFunc *dispose;
61
jint maxItems;
62
} ShaderList;
63
64
struct _ShaderInfo {
65
ShaderInfo *next;
66
jlong programID;
67
jint compType;
68
jint compMode;
69
jint flags;
70
};
71
72
void ShaderList_AddProgram(ShaderList *programList,
73
jlong programID,
74
jint compType, jint compMode,
75
jint flags);
76
jlong ShaderList_FindProgram(ShaderList *programList,
77
jint compType, jint compMode,
78
jint flags);
79
void ShaderList_Dispose(ShaderList *programList);
80
81
#ifdef __cplusplus
82
};
83
#endif
84
85
#endif /* ShaderList_h_Included */
86
87