1 /* void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) */
2 static void
android_glGetTransformFeedbackVarying__III_3II_3II_3II_3BI(JNIEnv * _env,jobject _this,jint program,jint index,jint bufsize,jintArray length_ref,jint lengthOffset,jintArray size_ref,jint sizeOffset,jintArray type_ref,jint typeOffset,jbyteArray name_ref,jint nameOffset)3 android_glGetTransformFeedbackVarying__III_3II_3II_3II_3BI
4 (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jintArray length_ref, jint lengthOffset, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset, jbyteArray name_ref, jint nameOffset) {
5 jint _exception = 0;
6 const char * _exceptionType;
7 const char * _exceptionMessage;
8 GLsizei *length_base = (GLsizei *) 0;
9 jint _lengthRemaining;
10 GLsizei *length = (GLsizei *) 0;
11 GLint *size_base = (GLint *) 0;
12 jint _sizeRemaining;
13 GLint *size = (GLint *) 0;
14 GLenum *type_base = (GLenum *) 0;
15 jint _typeRemaining;
16 GLenum *type = (GLenum *) 0;
17 char *name_base = (char *) 0;
18 jint _nameRemaining;
19 char *name = (char *) 0;
20
21 if (length_ref) {
22 if (lengthOffset < 0) {
23 _exception = 1;
24 _exceptionType = "java/lang/IllegalArgumentException";
25 _exceptionMessage = "lengthOffset < 0";
26 goto exit;
27 }
28 _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
29 length_base = (GLsizei *)
30 _env->GetIntArrayElements(length_ref, (jboolean *)0);
31 length = length_base + lengthOffset;
32 }
33
34 if (!size_ref) {
35 _exception = 1;
36 _exceptionType = "java/lang/IllegalArgumentException";
37 _exceptionMessage = "size == null";
38 goto exit;
39 }
40 if (sizeOffset < 0) {
41 _exception = 1;
42 _exceptionType = "java/lang/IllegalArgumentException";
43 _exceptionMessage = "sizeOffset < 0";
44 goto exit;
45 }
46 _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
47 size_base = (GLint *)
48 _env->GetIntArrayElements(size_ref, (jboolean *)0);
49 size = size_base + sizeOffset;
50
51 if (!type_ref) {
52 _exception = 1;
53 _exceptionType = "java/lang/IllegalArgumentException";
54 _exceptionMessage = "type == null";
55 goto exit;
56 }
57 if (typeOffset < 0) {
58 _exception = 1;
59 _exceptionType = "java/lang/IllegalArgumentException";
60 _exceptionMessage = "typeOffset < 0";
61 goto exit;
62 }
63 _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
64 type_base = (GLenum *)
65 _env->GetIntArrayElements(type_ref, (jboolean *)0);
66 type = type_base + typeOffset;
67
68 if (!name_ref) {
69 _exception = 1;
70 _exceptionType = "java/lang/IllegalArgumentException";
71 _exceptionMessage = "name == null";
72 goto exit;
73 }
74 if (nameOffset < 0) {
75 _exception = 1;
76 _exceptionType = "java/lang/IllegalArgumentException";
77 _exceptionMessage = "nameOffset < 0";
78 goto exit;
79 }
80 _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
81 name_base = (char *)
82 _env->GetByteArrayElements(name_ref, (jboolean *)0);
83 name = name_base + nameOffset;
84
85 glGetTransformFeedbackVarying(
86 (GLuint)program,
87 (GLuint)index,
88 (GLsizei)bufsize,
89 (GLsizei *)length,
90 (GLint *)size,
91 (GLenum *)type,
92 (char *)name
93 );
94
95 exit:
96 if (name_base) {
97 _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base,
98 _exception ? JNI_ABORT: 0);
99 }
100 if (type_base) {
101 _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
102 _exception ? JNI_ABORT: 0);
103 }
104 if (size_base) {
105 _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
106 _exception ? JNI_ABORT: 0);
107 }
108 if (length_base) {
109 _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
110 _exception ? JNI_ABORT: 0);
111 }
112 if (_exception) {
113 jniThrowException(_env, _exceptionType, _exceptionMessage);
114 }
115 }
116
117 /* void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) */
118 static void
android_glGetTransformFeedbackVarying__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B(JNIEnv * _env,jobject _this,jint program,jint index,jint bufsize,jobject length_buf,jobject size_buf,jobject type_buf,jbyte name)119 android_glGetTransformFeedbackVarying__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
120 (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) {
121 jniThrowException(_env, "java/lang/UnsupportedOperationException", "deprecated");
122 }
123
124 /* void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) */
125 static void
android_glGetTransformFeedbackVarying__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_ByteBuffer_2(JNIEnv * _env,jobject _this,jint program,jint index,jint bufsize,jobject length_buf,jobject size_buf,jobject type_buf,jobject name_buf)126 android_glGetTransformFeedbackVarying__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_ByteBuffer_2
127 (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jobject name_buf) {
128 jintArray _lengthArray = (jintArray) 0;
129 jint _lengthBufferOffset = (jint) 0;
130 jintArray _sizeArray = (jintArray) 0;
131 jint _sizeBufferOffset = (jint) 0;
132 jintArray _typeArray = (jintArray) 0;
133 jint _typeBufferOffset = (jint) 0;
134 jbyteArray _nameArray = (jbyteArray)0;
135 jint _nameBufferOffset = (jint)0;
136 jint _lengthRemaining;
137 GLsizei *length = (GLsizei *) 0;
138 jint _sizeRemaining;
139 GLint *size = (GLint *) 0;
140 jint _typeRemaining;
141 GLenum *type = (GLenum *) 0;
142 jint _nameRemaining;
143 GLchar* name = (GLchar*)0;
144
145
146 length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
147 size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
148 type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
149 name = (GLchar*)getPointer(_env, name_buf, (jarray*)&_nameArray, &_nameRemaining, &_nameBufferOffset);
150 if (length == NULL) {
151 char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
152 length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
153 }
154 if (size == NULL) {
155 char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
156 size = (GLint *) (_sizeBase + _sizeBufferOffset);
157 }
158 if (type == NULL) {
159 char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
160 type = (GLenum *) (_typeBase + _typeBufferOffset);
161 }
162 if (name == NULL) {
163 char* _nameBase = (char *)_env->GetByteArrayElements(_nameArray, (jboolean*)0);
164 name = (GLchar *) (_nameBase + _nameBufferOffset);
165 }
166 glGetTransformFeedbackVarying(
167 (GLuint)program,
168 (GLuint)index,
169 (GLsizei)bufsize,
170 (GLsizei *)length,
171 (GLint *)size,
172 (GLenum *)type,
173 (GLchar*)name
174 );
175 if (_typeArray) {
176 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
177 }
178 if (_sizeArray) {
179 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
180 }
181 if (_lengthArray) {
182 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE);
183 }
184 if (_nameArray) {
185 releaseArrayPointer<jbyteArray, jbyte*, ByteArrayReleaser>(_env, _nameArray, (jbyte*)name, JNI_TRUE);
186 }
187 }
188
189 /* void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) */
190 static jstring
android_glGetTransformFeedbackVarying1(JNIEnv * _env,jobject _this,jint program,jint index,jintArray size_ref,jint sizeOffset,jintArray type_ref,jint typeOffset)191 android_glGetTransformFeedbackVarying1
192 (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) {
193 jint _exception = 0;
194 const char * _exceptionType;
195 const char * _exceptionMessage;
196 GLint *size_base = (GLint *) 0;
197 jint _sizeRemaining;
198 GLint *size = (GLint *) 0;
199 GLenum *type_base = (GLenum *) 0;
200 jint _typeRemaining;
201 GLenum *type = (GLenum *) 0;
202
203 jstring result = 0;
204
205 GLint len = 0;
206 glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
207 if (!len) {
208 return _env->NewStringUTF("");
209 }
210 char* buf = (char*) malloc(len);
211
212 if (buf == NULL) {
213 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
214 return NULL;
215 }
216 if (!size_ref) {
217 _exception = 1;
218 _exceptionType = "java/lang/IllegalArgumentException";
219 _exceptionMessage = "size == null";
220 goto exit;
221 }
222 if (sizeOffset < 0) {
223 _exception = 1;
224 _exceptionType = "java/lang/IllegalArgumentException";
225 _exceptionMessage = "sizeOffset < 0";
226 goto exit;
227 }
228 _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
229 size_base = (GLint *)
230 _env->GetIntArrayElements(size_ref, (jboolean *)0);
231 size = size_base + sizeOffset;
232
233 if (!type_ref) {
234 _exception = 1;
235 _exceptionType = "java/lang/IllegalArgumentException";
236 _exceptionMessage = "type == null";
237 goto exit;
238 }
239 if (typeOffset < 0) {
240 _exception = 1;
241 _exceptionType = "java/lang/IllegalArgumentException";
242 _exceptionMessage = "typeOffset < 0";
243 goto exit;
244 }
245 _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
246 type_base = (GLenum *)
247 _env->GetIntArrayElements(type_ref, (jboolean *)0);
248 type = type_base + typeOffset;
249
250 glGetTransformFeedbackVarying(
251 (GLuint)program,
252 (GLuint)index,
253 (GLsizei)len,
254 NULL,
255 (GLint *)size,
256 (GLenum *)type,
257 (char *)buf
258 );
259 exit:
260 if (type_base) {
261 _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
262 _exception ? JNI_ABORT: 0);
263 }
264 if (size_base) {
265 _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
266 _exception ? JNI_ABORT: 0);
267 }
268 if (_exception != 1) {
269 result = _env->NewStringUTF(buf);
270 }
271 if (buf) {
272 free(buf);
273 }
274 if (_exception) {
275 jniThrowException(_env, _exceptionType, _exceptionMessage);
276 }
277 if (result == 0) {
278 result = _env->NewStringUTF("");
279 }
280
281 return result;
282 }
283
284 /* void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) */
285 static jstring
android_glGetTransformFeedbackVarying2(JNIEnv * _env,jobject _this,jint program,jint index,jobject size_buf,jobject type_buf)286 android_glGetTransformFeedbackVarying2
287 (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
288 jintArray _sizeArray = (jintArray) 0;
289 jint _sizeBufferOffset = (jint) 0;
290 jintArray _typeArray = (jintArray) 0;
291 jint _typeBufferOffset = (jint) 0;
292 jint _lengthRemaining;
293 GLsizei *length = (GLsizei *) 0;
294 jint _sizeRemaining;
295 GLint *size = (GLint *) 0;
296 jint _typeRemaining;
297 GLenum *type = (GLenum *) 0;
298
299 jstring result = 0;
300
301 GLint len = 0;
302 glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
303 if (!len) {
304 return _env->NewStringUTF("");
305 }
306 char* buf = (char*) malloc(len);
307
308 if (buf == NULL) {
309 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
310 return NULL;
311 }
312
313 size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
314 type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
315 if (size == NULL) {
316 char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
317 size = (GLint *) (_sizeBase + _sizeBufferOffset);
318 }
319 if (type == NULL) {
320 char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
321 type = (GLenum *) (_typeBase + _typeBufferOffset);
322 }
323 glGetTransformFeedbackVarying(
324 (GLuint)program,
325 (GLuint)index,
326 (GLsizei)len,
327 NULL,
328 (GLint *)size,
329 (GLenum *)type,
330 (char *)buf
331 );
332
333 if (_typeArray) {
334 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
335 }
336 if (_sizeArray) {
337 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
338 }
339 result = _env->NewStringUTF(buf);
340 if (buf) {
341 free(buf);
342 }
343 return result;
344 }
345