• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* EGLSync eglCreateSync ( EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list ) */
2 static jobject
android_eglCreateSync(JNIEnv * _env,jobject _this,jobject dpy,jint type,jlongArray attrib_list_ref,jint offset)3 android_eglCreateSync
4   (JNIEnv *_env, jobject _this, jobject dpy, jint type, jlongArray attrib_list_ref, jint offset) {
5     jint _exception = 0;
6     const char * _exceptionType = NULL;
7     const char * _exceptionMessage = NULL;
8     EGLSync _returnValue = (EGLSync) 0;
9     EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
10     jlong *attrib_list_base = (jlong *) 0;
11     jint _remaining;
12     WrappedEGLAttribs attrib_list;
13 
14     if (!attrib_list_ref) {
15         _exception = 1;
16         _exceptionType = "java/lang/IllegalArgumentException";
17         _exceptionMessage = "attrib_list == null";
18         goto exit;
19     }
20     if (offset < 0) {
21         _exception = 1;
22         _exceptionType = "java/lang/IllegalArgumentException";
23         _exceptionMessage = "offset < 0";
24         goto exit;
25     }
26     _remaining = _env->GetArrayLength(attrib_list_ref) - offset;
27     attrib_list_base = (jlong *)
28         _env->GetLongArrayElements(attrib_list_ref, (jboolean *)0);
29     attrib_list.init(attrib_list_base + offset, _remaining);
30 
31     _returnValue = eglCreateSync(
32         (EGLDisplay)dpy_native,
33         (EGLenum)type,
34         attrib_list.attribs
35     );
36 
37 exit:
38     if (attrib_list_base) {
39         _env->ReleaseLongArrayElements(attrib_list_ref, (jlong*)attrib_list_base,
40             JNI_ABORT);
41     }
42     if (_exception) {
43         jniThrowException(_env, _exceptionType, _exceptionMessage);
44         return nullptr;
45     }
46     return toEGLHandle(_env, eglsyncClass, eglsyncConstructor, _returnValue);
47 }
48 
49 /* EGLBoolean eglGetSyncAttrib ( EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value ) */
50 static jboolean
android_eglGetSyncAttrib(JNIEnv * _env,jobject _this,jobject dpy,jobject sync,jint attribute,jlongArray value_ref,jint offset)51 android_eglGetSyncAttrib
52   (JNIEnv *_env, jobject _this, jobject dpy, jobject sync, jint attribute, jlongArray value_ref, jint offset) {
53     jint _exception = 0;
54     const char * _exceptionType = NULL;
55     const char * _exceptionMessage = NULL;
56     EGLBoolean _returnValue = (EGLBoolean) 0;
57     EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
58     EGLSync sync_native = (EGLSync) fromEGLHandle(_env, eglsyncGetHandleID, sync);
59     jlong *value_base = (jlong *) 0;
60     jint _remaining;
61     EGLAttrib value;
62 
63     if (!value_ref) {
64         _exception = 1;
65         _exceptionType = "java/lang/IllegalArgumentException";
66         _exceptionMessage = "value == null";
67         goto exit;
68     }
69     if (offset < 0) {
70         _exception = 1;
71         _exceptionType = "java/lang/IllegalArgumentException";
72         _exceptionMessage = "offset < 0";
73         goto exit;
74     }
75     _remaining = _env->GetArrayLength(value_ref) - offset;
76     value_base = (jlong *)
77         _env->GetLongArrayElements(value_ref, (jboolean *)0);
78 
79     _returnValue = eglGetSyncAttrib(
80         (EGLDisplay)dpy_native,
81         (EGLSync)sync_native,
82         (EGLint)attribute,
83         &value
84     );
85 
86     if (value_base && _returnValue == EGL_TRUE) {
87         *(value_base + offset) = (jlong) value;
88     }
89 
90 exit:
91     if (value_base) {
92         _env->ReleaseLongArrayElements(value_ref, (jlong*)value_base,
93             _exception ? JNI_ABORT: 0);
94     }
95     if (_exception) {
96         jniThrowException(_env, _exceptionType, _exceptionMessage);
97         return JNI_FALSE;
98     }
99     return (jboolean)_returnValue;
100 }
101 
102