1/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_FILTERFW_JNI_SHADER_PROGRAM_H
18#define ANDROID_FILTERFW_JNI_SHADER_PROGRAM_H
19
20#include <jni.h>
21
22#include "native/core/value.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28JNIEXPORT jboolean JNICALL
29Java_android_filterfw_core_ShaderProgram_allocate(JNIEnv* env,
30                                                  jobject thiz,
31                                                  jobject gl_env,
32                                                  jstring vertex_shader,
33                                                  jstring fragment_shader);
34
35JNIEXPORT jboolean JNICALL
36Java_android_filterfw_core_ShaderProgram_deallocate(JNIEnv* env, jobject thiz);
37
38JNIEXPORT jboolean JNICALL
39Java_android_filterfw_core_ShaderProgram_compileAndLink(JNIEnv* env, jobject thiz);
40
41JNIEXPORT jboolean JNICALL
42Java_android_filterfw_core_ShaderProgram_setUniformValue(JNIEnv* env,
43                                                         jobject thiz,
44                                                         jstring key,
45                                                         jobject value);
46
47JNIEXPORT jobject JNICALL
48Java_android_filterfw_core_ShaderProgram_getUniformValue(JNIEnv* env,
49                                                         jobject thiz,
50                                                         jstring key);
51
52JNIEXPORT jboolean JNICALL
53Java_android_filterfw_core_ShaderProgram_shaderProcess(JNIEnv* env,
54                                                       jobject thiz,
55                                                       jobjectArray inputs,
56                                                       jobject output);
57
58JNIEXPORT jobject JNICALL
59Java_android_filterfw_core_ShaderProgram_nativeCreateIdentity(JNIEnv* env,
60                                                              jclass clazz,
61                                                              jobject gl_env);
62
63JNIEXPORT jboolean JNICALL
64Java_android_filterfw_core_ShaderProgram_setSourceRegion(JNIEnv* env,
65                                                         jobject thiz,
66                                                         jfloat x0,
67                                                         jfloat y0,
68                                                         jfloat x1,
69                                                         jfloat y1,
70                                                         jfloat x2,
71                                                         jfloat y2,
72                                                         jfloat x3,
73                                                         jfloat y3);
74
75JNIEXPORT jboolean JNICALL
76Java_android_filterfw_core_ShaderProgram_setTargetRegion(JNIEnv* env,
77                                                         jobject thiz,
78                                                         jfloat x0,
79                                                         jfloat y0,
80                                                         jfloat x1,
81                                                         jfloat y1,
82                                                         jfloat x2,
83                                                         jfloat y2,
84                                                         jfloat x3,
85                                                         jfloat y3);
86
87JNIEXPORT jboolean JNICALL
88Java_android_filterfw_core_ShaderProgram_setShaderClearsOutput(JNIEnv* env,
89                                                               jobject thiz,
90                                                               jboolean clears);
91
92JNIEXPORT jboolean JNICALL
93Java_android_filterfw_core_ShaderProgram_setShaderClearColor(JNIEnv* env,
94                                                             jobject thiz,
95                                                             jfloat r,
96                                                             jfloat g,
97                                                             jfloat b);
98
99JNIEXPORT jboolean JNICALL
100Java_android_filterfw_core_ShaderProgram_setShaderBlendEnabled(JNIEnv* env,
101                                                               jobject thiz,
102                                                               jboolean enable);
103
104JNIEXPORT jboolean JNICALL
105Java_android_filterfw_core_ShaderProgram_setShaderBlendFunc(JNIEnv* env,
106                                                               jobject thiz,
107                                                               jint sfactor,
108                                                               jint dfactor);
109JNIEXPORT jboolean JNICALL
110Java_android_filterfw_core_ShaderProgram_setShaderDrawMode(JNIEnv* env,
111                                                           jobject thiz,
112                                                           jint draw_mode);
113
114JNIEXPORT jboolean JNICALL
115Java_android_filterfw_core_ShaderProgram_setShaderTileCounts(JNIEnv* env,
116                                                             jobject thiz,
117                                                             jint x_count,
118                                                             jint y_count);
119
120JNIEXPORT jboolean JNICALL
121Java_android_filterfw_core_ShaderProgram_setShaderVertexCount(JNIEnv* env,
122                                                              jobject thiz,
123                                                              jint vertex_count);
124
125JNIEXPORT jboolean JNICALL
126Java_android_filterfw_core_ShaderProgram_beginShaderDrawing(JNIEnv* env, jobject thiz);
127
128JNIEXPORT jboolean JNICALL
129Java_android_filterfw_core_ShaderProgram_setShaderAttributeValues(JNIEnv* env,
130                                                                  jobject thiz,
131                                                                  jstring attr_name,
132                                                                  jfloatArray values,
133                                                                  jint component_count);
134
135JNIEXPORT jboolean JNICALL
136Java_android_filterfw_core_ShaderProgram_setShaderAttributeVertexFrame(JNIEnv* env,
137                                                                       jobject thiz,
138                                                                       jstring attr_name,
139                                                                       jobject vertex_frame,
140                                                                       jint type,
141                                                                       jint component_count,
142                                                                       jint stride,
143                                                                       jint offset,
144                                                                       jboolean normalize);
145
146#ifdef __cplusplus
147}
148#endif
149
150#endif // ANDROID_FILTERFW_JNI_SHADER_PROGRAM_H
151