Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/native/sun/java2d/ShaderList.h
38829 views
/*1* Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#ifndef ShaderList_h_Included26#define ShaderList_h_Included2728#ifdef __cplusplus29extern "C" {30#endif3132#include "jni.h"33#include "jlong.h"3435typedef void (ShaderDisposeFunc)(jlong programID);3637/**38* The following structures are used to maintain a list of fragment program39* objects and their associated attributes. Each logical shader (e.g.40* RadialGradientPaint shader, ConvolveOp shader) can have a number of41* different variants depending on a number of factors, such as whether42* antialiasing is enabled or the current composite mode. Since the number43* of possible combinations of these factors is in the hundreds, we need44* some way to create fragment programs on an as-needed basis, and also45* keep them in a limited sized cache to avoid creating too many objects.46*47* The ShaderInfo structure keeps a reference to the fragment program's48* handle, as well as some other values that help differentiate one ShaderInfo49* from another. ShaderInfos can be chained together to form a linked list.50*51* The ShaderList structure acts as a cache for ShaderInfos, placing52* most-recently used items at the front, and removing items from the53* cache when its size exceeds the "maxItems" limit.54*/55typedef struct _ShaderInfo ShaderInfo;5657typedef struct {58ShaderInfo *head;59ShaderDisposeFunc *dispose;60jint maxItems;61} ShaderList;6263struct _ShaderInfo {64ShaderInfo *next;65jlong programID;66jint compType;67jint compMode;68jint flags;69};7071void ShaderList_AddProgram(ShaderList *programList,72jlong programID,73jint compType, jint compMode,74jint flags);75jlong ShaderList_FindProgram(ShaderList *programList,76jint compType, jint compMode,77jint flags);78void ShaderList_Dispose(ShaderList *programList);7980#ifdef __cplusplus81};82#endif8384#endif /* ShaderList_h_Included */858687