430N/A/*
2362N/A * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
430N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
430N/A *
430N/A * This code is free software; you can redistribute it and/or modify it
430N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
430N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
430N/A *
430N/A * This code is distributed in the hope that it will be useful, but WITHOUT
430N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
430N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
430N/A * version 2 for more details (a copy is included in the LICENSE file that
430N/A * accompanied this code).
430N/A *
430N/A * You should have received a copy of the GNU General Public License version
430N/A * 2 along with this work; if not, write to the Free Software Foundation,
430N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
430N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
430N/A */
430N/A
430N/A#ifndef ShaderList_h_Included
430N/A#define ShaderList_h_Included
430N/A
430N/A#ifdef __cplusplus
430N/Aextern "C" {
430N/A#endif
430N/A
430N/A#include "jni.h"
430N/A#include "jlong.h"
430N/A
430N/Atypedef void (ShaderDisposeFunc)(jlong programID);
430N/A
430N/A/**
430N/A * The following structures are used to maintain a list of fragment program
430N/A * objects and their associated attributes. Each logical shader (e.g.
430N/A * RadialGradientPaint shader, ConvolveOp shader) can have a number of
430N/A * different variants depending on a number of factors, such as whether
430N/A * antialiasing is enabled or the current composite mode. Since the number
430N/A * of possible combinations of these factors is in the hundreds, we need
430N/A * some way to create fragment programs on an as-needed basis, and also
430N/A * keep them in a limited sized cache to avoid creating too many objects.
430N/A *
430N/A * The ShaderInfo structure keeps a reference to the fragment program's
430N/A * handle, as well as some other values that help differentiate one ShaderInfo
430N/A * from another. ShaderInfos can be chained together to form a linked list.
430N/A *
430N/A * The ShaderList structure acts as a cache for ShaderInfos, placing
430N/A * most-recently used items at the front, and removing items from the
430N/A * cache when its size exceeds the "maxItems" limit.
430N/A */
430N/Atypedef struct _ShaderInfo ShaderInfo;
430N/A
430N/Atypedef struct {
430N/A ShaderInfo *head;
430N/A ShaderDisposeFunc *dispose;
430N/A jint maxItems;
430N/A} ShaderList;
430N/A
430N/Astruct _ShaderInfo {
430N/A ShaderInfo *next;
430N/A jlong programID;
430N/A jint compType;
430N/A jint compMode;
430N/A jint flags;
430N/A};
430N/A
430N/Avoid ShaderList_AddProgram(ShaderList *programList,
430N/A jlong programID,
430N/A jint compType, jint compMode,
430N/A jint flags);
430N/Ajlong ShaderList_FindProgram(ShaderList *programList,
430N/A jint compType, jint compMode,
430N/A jint flags);
430N/Avoid ShaderList_Dispose(ShaderList *programList);
430N/A
430N/A#ifdef __cplusplus
430N/A};
430N/A#endif
430N/A
430N/A#endif /* ShaderList_h_Included */