diff options
Diffstat (limited to 'include/egl.h')
-rw-r--r-- | include/egl.h | 61 |
1 files changed, 10 insertions, 51 deletions
diff --git a/include/egl.h b/include/egl.h index 8958f31..0d08270 100644 --- a/include/egl.h +++ b/include/egl.h @@ -10,6 +10,8 @@ #include "vec2.h" #include "defs.h" +typedef struct gsr_window gsr_window; + #ifdef _WIN64 typedef signed long long int khronos_intptr_t; typedef unsigned long long int khronos_uintptr_t; @@ -102,11 +104,13 @@ typedef void(*__GLXextFuncPtr)(void); #define GL_RG 0x8227 #define GL_RGB 0x1907 #define GL_RGBA 0x1908 +#define GL_RGB8 0x8051 #define GL_RGBA8 0x8058 #define GL_R8 0x8229 #define GL_RG8 0x822B #define GL_R16 0x822A #define GL_RG16 0x822C +#define GL_RGB16 0x8054 #define GL_UNSIGNED_BYTE 0x1401 #define GL_COLOR_BUFFER_BIT 0x00004000 #define GL_TEXTURE_WRAP_S 0x2802 @@ -128,6 +132,8 @@ typedef void(*__GLXextFuncPtr)(void); #define GL_ONE_MINUS_SRC_ALPHA 0x0303 #define GL_DEBUG_OUTPUT 0x92E0 #define GL_SCISSOR_TEST 0x0C11 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_UNPACK_ALIGNMENT 0x0CF5 #define GL_VENDOR 0x1F00 #define GL_RENDERER 0x1F01 @@ -152,54 +158,11 @@ typedef int (*FUNC_eglQueryDisplayAttribEXT)(EGLDisplay dpy, int32_t attribute, typedef const char* (*FUNC_eglQueryDeviceStringEXT)(void *device, int32_t name); typedef int (*FUNC_eglQueryDmaBufModifiersEXT)(EGLDisplay dpy, int32_t format, int32_t max_modifiers, uint64_t *modifiers, int *external_only, int32_t *num_modifiers); -#define GSR_MAX_OUTPUTS 32 - -typedef struct { - char *name; - vec2i pos; - vec2i size; - uint32_t connector_id; - gsr_monitor_rotation rotation; - uint32_t monitor_identifier; /* crtc id */ -} gsr_x11_output; - -typedef struct { - Display *dpy; - Window window; - gsr_x11_output outputs[GSR_MAX_OUTPUTS]; - int num_outputs; - XEvent xev; -} gsr_x11; - -typedef struct { - uint32_t wl_name; - void *output; - vec2i pos; - vec2i size; - int32_t transform; - char *name; -} gsr_wayland_output; - -typedef struct { - void *dpy; - void *window; - void *registry; - void *surface; - void *compositor; - gsr_wayland_output outputs[GSR_MAX_OUTPUTS]; - int num_outputs; -} gsr_wayland; - typedef enum { GSR_GL_CONTEXT_TYPE_EGL, GSR_GL_CONTEXT_TYPE_GLX } gsr_gl_context_type; -typedef enum { - GSR_DISPLAY_SERVER_X11, - GSR_DISPLAY_SERVER_WAYLAND -} gsr_display_server; - typedef struct gsr_egl gsr_egl; struct gsr_egl { void *egl_library; @@ -207,6 +170,7 @@ struct gsr_egl { void *gl_library; gsr_gl_context_type context_type; + gsr_window *window; EGLDisplay egl_display; EGLSurface egl_surface; @@ -218,8 +182,6 @@ struct gsr_egl { gsr_gpu_info gpu_info; - gsr_x11 x11; - gsr_wayland wayland; char card_path[128]; int32_t (*eglGetError)(void); @@ -273,6 +235,7 @@ struct gsr_egl { void (*glTexParameteriv)(unsigned int target, unsigned int pname, const int *params); void (*glGetTexLevelParameteriv)(unsigned int target, int level, unsigned int pname, int *params); void (*glTexImage2D)(unsigned int target, int level, int internalFormat, int width, int height, int border, unsigned int format, unsigned int type, const void *pixels); + void (*glTexSubImage2D)(unsigned int target, int level, int xoffset, int yoffset, int width, int height, unsigned format, unsigned type, const void *pixels); void (*glGetTexImage)(unsigned int target, int level, unsigned int format, unsigned int type, void *pixels); void (*glGenFramebuffers)(int n, unsigned int *framebuffers); void (*glBindFramebuffer)(unsigned int target, unsigned int framebuffer); @@ -309,6 +272,7 @@ struct gsr_egl { void (*glEnable)(unsigned int cap); void (*glDisable)(unsigned int cap); void (*glBlendFunc)(unsigned int sfactor, unsigned int dfactor); + void (*glPixelStorei)(unsigned int pname, int param); int (*glGetUniformLocation)(unsigned int program, const char *name); void (*glUniform1f)(int location, float v0); void (*glUniform2f)(int location, float v0, float v1); @@ -319,15 +283,10 @@ struct gsr_egl { unsigned char (*glUnmapBuffer)(unsigned int target); }; -bool gsr_egl_load(gsr_egl *self, Display *dpy, bool wayland, bool is_monitor_capture); +bool gsr_egl_load(gsr_egl *self, gsr_window *window, bool is_monitor_capture, bool enable_debug); void gsr_egl_unload(gsr_egl *self); -/* Returns true if an event is available */ -bool gsr_egl_process_event(gsr_egl *self); /* Does opengl swap with egl or glx, depending on which one is active */ void gsr_egl_swap_buffers(gsr_egl *self); -gsr_display_server gsr_egl_get_display_server(const gsr_egl *self); -XEvent* gsr_egl_get_event_data(gsr_egl *self); - #endif /* GSR_EGL_H */ |