High priority egl context if possible, use eglBindAPI(EGL_OPENGL_ES_API)

This commit is contained in:
dec05eba
2023-07-26 02:31:12 +02:00
parent bee99a69e3
commit 4ad0118f35
4 changed files with 19 additions and 13 deletions

View File

@@ -214,12 +214,13 @@ static bool gsr_egl_create_window(gsr_egl *self, bool wayland) {
const int32_t attr[] = {
EGL_BUFFER_SIZE, 24,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_NONE
EGL_NONE, EGL_NONE
};
const int32_t ctxattr[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
EGL_CONTEXT_PRIORITY_LEVEL_IMG, EGL_CONTEXT_PRIORITY_HIGH_IMG,
EGL_NONE, EGL_NONE
};
if(wayland) {
@@ -251,7 +252,7 @@ static bool gsr_egl_create_window(gsr_egl *self, bool wayland) {
}
}
self->eglBindAPI(EGL_OPENGL_ES2_BIT);
self->eglBindAPI(EGL_OPENGL_ES_API);
self->egl_display = self->eglGetDisplay(self->wayland.dpy ? (EGLNativeDisplayType)self->wayland.dpy : (EGLNativeDisplayType)self->x11.dpy);
if(!self->egl_display) {

View File

@@ -210,6 +210,7 @@ bool get_monitor_by_name(void *connection, gsr_connection_type connection_type,
}
bool gl_get_gpu_info(gsr_egl *egl, gsr_gpu_info *info) {
const char *software_renderers[] = { "llvmpipe", "SWR", "softpipe", NULL };
bool supported = true;
const unsigned char *gl_vendor = egl->glGetString(GL_VENDOR);
const unsigned char *gl_renderer = egl->glGetString(GL_RENDERER);
@@ -222,10 +223,14 @@ bool gl_get_gpu_info(gsr_egl *egl, gsr_gpu_info *info) {
goto end;
}
if(gl_renderer && strstr((const char*)gl_renderer, "llvmpipe")) {
fprintf(stderr, "gsr error: your opengl environment is not properly setup. It's using llvmpipe (cpu fallback) for opengl instead of your graphics card\n");
supported = false;
goto end;
if(gl_renderer) {
for(int i = 0; software_renderers[i]; ++i) {
if(strstr((const char*)gl_renderer, software_renderers[i])) {
fprintf(stderr, "gsr error: your opengl environment is not properly setup. It's using %s (software rendering) for opengl instead of your graphics card. Please make sure your graphics driver is properly installed\n", software_renderers[i]);
supported = false;
goto end;
}
}
}
if(strstr((const char*)gl_vendor, "AMD"))