@@ -29,11 +29,9 @@ typedef EGLBoolean eglInitialize_t (EGLDisplay dpy, EGLint *major, EGLint *minor
2929typedef EGLBoolean eglChooseConfig_t (EGLDisplay dpy , const EGLint * attrib_list , EGLConfig * configs , EGLint config_size , EGLint * num_config );
3030typedef EGLBoolean eglGetConfigAttrib_t (EGLDisplay dpy , EGLConfig config , EGLint attribute , EGLint * value );
3131typedef EGLBoolean eglBindAPI_t (EGLenum api );
32- typedef EGLSurface eglCreatePbufferSurface_t (EGLDisplay dpy , EGLConfig config , const EGLint * attrib_list );
3332typedef EGLContext eglCreateContext_t (EGLDisplay dpy , EGLConfig config , EGLContext share_context , const EGLint * attrib_list );
3433typedef EGLBoolean eglMakeCurrent_t (EGLDisplay dpy , EGLSurface draw , EGLSurface read , EGLContext ctx );
3534typedef EGLint eglGetError_t (void );
36- typedef EGLBoolean eglSwapBuffers_t (EGLDisplay dpy , EGLSurface surface );
3735typedef EGLBoolean eglSwapInterval_t (EGLDisplay dpy , EGLint interval );
3836typedef __eglMustCastToProperFunctionPointerType eglGetProcAddress_t (const char * procname );
3937
@@ -42,17 +40,14 @@ eglInitialize_t* eglInitialize_p;
4240eglChooseConfig_t * eglChooseConfig_p ;
4341eglGetConfigAttrib_t * eglGetConfigAttrib_p ;
4442eglBindAPI_t * eglBindAPI_p ;
45- eglCreatePbufferSurface_t * eglCreatePbufferSurface_p ;
4643eglCreateContext_t * eglCreateContext_p ;
4744eglMakeCurrent_t * eglMakeCurrent_p ;
4845eglGetError_t * eglGetError_p ;
49- eglSwapBuffers_t * eglSwapBuffers_p ;
5046eglSwapInterval_t * eglSwapInterval_p ;
5147eglGetProcAddress_t * eglGetProcAddress_p ;
5248
5349EGLContext xrEglContext ;
5450EGLDisplay xrEglDisplay ;
55- EGLSurface xrEglSurface ;
5651EGLConfig xrConfig ;
5752
5853void * gbuffer ;
@@ -74,11 +69,9 @@ void dlsym_egl() {
7469 eglChooseConfig_p = (eglChooseConfig_t * ) eglGetProcAddress_p ("eglChooseConfig" );
7570 eglGetConfigAttrib_p = (eglGetConfigAttrib_t * ) eglGetProcAddress_p ("eglGetConfigAttrib" );
7671 eglBindAPI_p = (eglBindAPI_t * ) eglGetProcAddress_p ("eglBindAPI" );
77- eglCreatePbufferSurface_p = (eglCreatePbufferSurface_t * ) eglGetProcAddress_p ("eglCreatePbufferSurface" );
7872 eglCreateContext_p = (eglCreateContext_t * ) eglGetProcAddress_p ("eglCreateContext" );
7973 eglMakeCurrent_p = (eglMakeCurrent_t * ) eglGetProcAddress_p ("eglMakeCurrent" );
8074 eglGetError_p = (eglGetError_t * ) eglGetProcAddress_p ("eglGetError" );
81- eglSwapBuffers_p = (eglSwapBuffers_t * ) eglGetProcAddress_p ("eglSwapBuffers" );
8275 eglSwapInterval_p = (eglSwapInterval_t * ) eglGetProcAddress_p ("eglSwapInterval" );
8376}
8477
@@ -101,11 +94,11 @@ int xrEglInit() {
10194 // printf("EGLBridge: ANativeWindow pointer = %p\n", androidWindow);
10295 //(*env)->ThrowNew(env,(*env)->FindClass(env,"java/lang/Exception"),"Trace exception");
10396 if (!eglInitialize_p (xrEglDisplay , NULL , NULL )) {
104- printf ("EGLBridge: Error eglInitialize() failed: %s \n" , eglGetError_p ());
97+ printf ("EGLBridge: Error eglInitialize() failed: %d \n" , eglGetError_p ());
10598 return 0 ;
10699 }
107100
108- static const EGLint attribs [] = {
101+ EGLint attribs [] = {
109102 EGL_RED_SIZE , 8 ,
110103 EGL_GREEN_SIZE , 8 ,
111104 EGL_BLUE_SIZE , 8 ,
@@ -121,43 +114,33 @@ int xrEglInit() {
121114 EGLint vid ;
122115
123116 if (!eglChooseConfig_p (xrEglDisplay , attribs , & xrConfig , 1 , & num_configs )) {
124- printf ("EGLBridge: Error couldn't get an EGL visual config: %s \n" , eglGetError_p ());
117+ printf ("EGLBridge: Error couldn't get an EGL visual config: %d \n" , eglGetError_p ());
125118 return 0 ;
126119 }
127120
128121 assert (xrConfig );
129122 assert (num_configs > 0 );
130123
131124 if (!eglGetConfigAttrib_p (xrEglDisplay , xrConfig , EGL_NATIVE_VISUAL_ID , & vid )) {
132- printf ("EGLBridge: Error eglGetConfigAttrib() failed: %s \n" , eglGetError_p ());
125+ printf ("EGLBridge: Error eglGetConfigAttrib() failed: %d \n" , eglGetError_p ());
133126 return 0 ;
134127 }
135128
136129 eglBindAPI_p (EGL_OPENGL_ES_API );
137130
138- xrEglSurface = eglCreatePbufferSurface_p (xrEglDisplay , xrConfig ,
139- NULL );
140- if (!xrEglSurface ) {
141- printf ("EGLBridge: Error eglCreatePbufferSurface failed: %d\n" , eglGetError_p ());
142- return 0 ;
143- }
144-
145- printf ("Created pbuffersurface\n" );
146-
147131 printf ("XREGLBridge: Initialized!\n" );
148132 printf ("XREGLBridge: ThreadID=%d\n" , gettid ());
149- printf ("XREGLBridge: XREGLDisplay=%p, XREGLSurface=%p \n" ,
133+ printf ("XREGLBridge: XREGLDisplay=%p\n" ,
150134/* window==0 ? EGL_NO_CONTEXT : */
151- xrEglDisplay ,
152- xrEglSurface
135+ xrEglDisplay
153136 );
154137
155138 return 1 ;
156139}
157140
158141int pojavInit () {
159- savedWidth = 1 ;
160- savedHeight = 1 ;
142+ savedWidth = 1080 ;
143+ savedHeight = 720 ;
161144 printf ("XREGLBridge: Thread name is %d\n" , gettid ());
162145
163146 return xrEglInit ();
@@ -170,15 +153,15 @@ void pojavSetWindowHint(int hint, int value) {
170153
171154int32_t stride ;
172155void pojavSwapBuffers () {
173- eglSwapBuffers_p (xrEglDisplay , xrEglSurface );
156+ // eglSwapBuffers_p(xrEglDisplay, xrEglSurface);
174157}
175158
176159bool locked = false;
177160void pojavMakeCurrent (void * window ) {
178161 EGLBoolean success = eglMakeCurrent_p (
179162 xrEglDisplay ,
180- xrEglSurface ,
181- xrEglSurface ,
163+ EGL_NO_SURFACE ,
164+ EGL_NO_SURFACE ,
182165 window
183166 );
184167
0 commit comments