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 25 extern "C" { 26 #endif 27 28 JNIEXPORT jboolean JNICALL 29 Java_android_filterfw_core_ShaderProgram_allocate(JNIEnv* env, 30 jobject thiz, 31 jobject gl_env, 32 jstring vertex_shader, 33 jstring fragment_shader); 34 35 JNIEXPORT jboolean JNICALL 36 Java_android_filterfw_core_ShaderProgram_deallocate(JNIEnv* env, jobject thiz); 37 38 JNIEXPORT jboolean JNICALL 39 Java_android_filterfw_core_ShaderProgram_compileAndLink(JNIEnv* env, jobject thiz); 40 41 JNIEXPORT jboolean JNICALL 42 Java_android_filterfw_core_ShaderProgram_setUniformValue(JNIEnv* env, 43 jobject thiz, 44 jstring key, 45 jobject value); 46 47 JNIEXPORT jobject JNICALL 48 Java_android_filterfw_core_ShaderProgram_getUniformValue(JNIEnv* env, 49 jobject thiz, 50 jstring key); 51 52 JNIEXPORT jboolean JNICALL 53 Java_android_filterfw_core_ShaderProgram_shaderProcess(JNIEnv* env, 54 jobject thiz, 55 jobjectArray inputs, 56 jobject output); 57 58 JNIEXPORT jobject JNICALL 59 Java_android_filterfw_core_ShaderProgram_nativeCreateIdentity(JNIEnv* env, 60 jclass clazz, 61 jobject gl_env); 62 63 JNIEXPORT jboolean JNICALL 64 Java_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 75 JNIEXPORT jboolean JNICALL 76 Java_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 87 JNIEXPORT jboolean JNICALL 88 Java_android_filterfw_core_ShaderProgram_setShaderClearsOutput(JNIEnv* env, 89 jobject thiz, 90 jboolean clears); 91 92 JNIEXPORT jboolean JNICALL 93 Java_android_filterfw_core_ShaderProgram_setShaderClearColor(JNIEnv* env, 94 jobject thiz, 95 jfloat r, 96 jfloat g, 97 jfloat b); 98 99 JNIEXPORT jboolean JNICALL 100 Java_android_filterfw_core_ShaderProgram_setShaderBlendEnabled(JNIEnv* env, 101 jobject thiz, 102 jboolean enable); 103 104 JNIEXPORT jboolean JNICALL 105 Java_android_filterfw_core_ShaderProgram_setShaderBlendFunc(JNIEnv* env, 106 jobject thiz, 107 jint sfactor, 108 jint dfactor); 109 JNIEXPORT jboolean JNICALL 110 Java_android_filterfw_core_ShaderProgram_setShaderDrawMode(JNIEnv* env, 111 jobject thiz, 112 jint draw_mode); 113 114 JNIEXPORT jboolean JNICALL 115 Java_android_filterfw_core_ShaderProgram_setShaderTileCounts(JNIEnv* env, 116 jobject thiz, 117 jint x_count, 118 jint y_count); 119 120 JNIEXPORT jboolean JNICALL 121 Java_android_filterfw_core_ShaderProgram_setShaderVertexCount(JNIEnv* env, 122 jobject thiz, 123 jint vertex_count); 124 125 JNIEXPORT jboolean JNICALL 126 Java_android_filterfw_core_ShaderProgram_beginShaderDrawing(JNIEnv* env, jobject thiz); 127 128 JNIEXPORT jboolean JNICALL 129 Java_android_filterfw_core_ShaderProgram_setShaderAttributeValues(JNIEnv* env, 130 jobject thiz, 131 jstring attr_name, 132 jfloatArray values, 133 jint component_count); 134 135 JNIEXPORT jboolean JNICALL 136 Java_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