mirror of
				https://gitlab.freedesktop.org/wayland/wayland.git
				synced 2025-11-03 09:01:42 -05:00 
			
		
		
		
	window.c: Use eglGetProcAddress to look up extension functions
This commit is contained in:
		
							parent
							
								
									297d6dd442
								
							
						
					
					
						commit
						0d5007a76f
					
				
					 1 changed files with 15 additions and 7 deletions
				
			
		| 
						 | 
					@ -38,8 +38,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <wayland-egl.h>
 | 
					#include <wayland-egl.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define EGL_EGLEXT_PROTOTYPES 1
 | 
					 | 
				
			||||||
#define GL_GLEXT_PROTOTYPES 1
 | 
					 | 
				
			||||||
#include <GL/gl.h>
 | 
					#include <GL/gl.h>
 | 
				
			||||||
#include <EGL/egl.h>
 | 
					#include <EGL/egl.h>
 | 
				
			||||||
#include <EGL/eglext.h>
 | 
					#include <EGL/eglext.h>
 | 
				
			||||||
| 
						 | 
					@ -81,6 +79,10 @@ struct display {
 | 
				
			||||||
	cairo_surface_t **pointer_surfaces;
 | 
						cairo_surface_t **pointer_surfaces;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	display_global_handler_t global_handler;
 | 
						display_global_handler_t global_handler;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PFNGLEGLIMAGETARGETTEXTURE2DOESPROC image_target_texture_2d;
 | 
				
			||||||
 | 
						PFNEGLCREATEIMAGEKHRPROC create_image;
 | 
				
			||||||
 | 
						PFNEGLDESTROYIMAGEKHRPROC destroy_image;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct window {
 | 
					struct window {
 | 
				
			||||||
| 
						 | 
					@ -204,7 +206,7 @@ egl_image_surface_data_destroy(void *p)
 | 
				
			||||||
	glDeleteTextures(1, &data->texture);
 | 
						glDeleteTextures(1, &data->texture);
 | 
				
			||||||
	cairo_device_release(d->device);
 | 
						cairo_device_release(d->device);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	eglDestroyImageKHR(d->dpy, data->image);
 | 
						d->destroy_image(d->dpy, data->image);
 | 
				
			||||||
	wl_buffer_destroy(data->data.buffer);
 | 
						wl_buffer_destroy(data->data.buffer);
 | 
				
			||||||
	wl_egl_pixmap_destroy(data->pixmap);
 | 
						wl_egl_pixmap_destroy(data->pixmap);
 | 
				
			||||||
	free(p);
 | 
						free(p);
 | 
				
			||||||
| 
						 | 
					@ -246,9 +248,10 @@ display_create_egl_image_surface(struct display *display,
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	data->image = eglCreateImageKHR(dpy, NULL,
 | 
						data->image = display->create_image(dpy, NULL,
 | 
				
			||||||
					    EGL_NATIVE_PIXMAP_KHR,
 | 
										    EGL_NATIVE_PIXMAP_KHR,
 | 
				
			||||||
					(EGLClientBuffer) data->pixmap, NULL);
 | 
										    (EGLClientBuffer) data->pixmap,
 | 
				
			||||||
 | 
										    NULL);
 | 
				
			||||||
	if (data->image == EGL_NO_IMAGE_KHR) {
 | 
						if (data->image == EGL_NO_IMAGE_KHR) {
 | 
				
			||||||
		wl_egl_pixmap_destroy(data->pixmap);
 | 
							wl_egl_pixmap_destroy(data->pixmap);
 | 
				
			||||||
		free(data);
 | 
							free(data);
 | 
				
			||||||
| 
						 | 
					@ -261,7 +264,7 @@ display_create_egl_image_surface(struct display *display,
 | 
				
			||||||
	cairo_device_acquire(display->device);
 | 
						cairo_device_acquire(display->device);
 | 
				
			||||||
	glGenTextures(1, &data->texture);
 | 
						glGenTextures(1, &data->texture);
 | 
				
			||||||
	glBindTexture(GL_TEXTURE_2D, data->texture);
 | 
						glBindTexture(GL_TEXTURE_2D, data->texture);
 | 
				
			||||||
	glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, data->image);
 | 
						display->image_target_texture_2d(GL_TEXTURE_2D, data->image);
 | 
				
			||||||
	cairo_device_release(display->device);
 | 
						cairo_device_release(display->device);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	surface = cairo_gl_surface_create_for_texture(display->device,
 | 
						surface = cairo_gl_surface_create_for_texture(display->device,
 | 
				
			||||||
| 
						 | 
					@ -1680,6 +1683,11 @@ display_create(int *argc, char **argv[], const GOptionEntry *option_entries)
 | 
				
			||||||
	if (init_egl(d) < 0)
 | 
						if (init_egl(d) < 0)
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						d->image_target_texture_2d =
 | 
				
			||||||
 | 
							(void *) eglGetProcAddress("glEGLImageTargetTexture2DOES");
 | 
				
			||||||
 | 
						d->create_image = (void *) eglGetProcAddress("eglCreateImageKHR");
 | 
				
			||||||
 | 
						d->destroy_image = (void *) eglGetProcAddress("eglDestroyImageKHR");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	create_pointer_surfaces(d);
 | 
						create_pointer_surfaces(d);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	display_render_frame(d);
 | 
						display_render_frame(d);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue