diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-10-27 14:19:18 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-10-27 14:19:18 +0100 |
commit | fde7e3c499f3a460b62c0aca34159aa1d3e340a1 (patch) | |
tree | 320b7565b027cb4c0b8df4f707c7cc29d8180c3b /src/main.cpp | |
parent | c6b5ff05ecf4072ab83d5618eb41937b0db489c8 (diff) |
Fix for prime systems
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index ec23cac..3d367fa 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,11 +33,31 @@ static void sigint_handler(int signal) { running = 0; } +static void disable_prime_run() { + unsetenv("__NV_PRIME_RENDER_OFFLOAD"); + unsetenv("__NV_PRIME_RENDER_OFFLOAD_PROVIDER"); + unsetenv("__GLX_VENDOR_LIBRARY_NAME"); + unsetenv("__VK_LAYER_NV_optimus"); +} + int main(int argc, char **argv) { (void)argc; (void)argv; setlocale(LC_ALL, "C"); // Sigh... stupid C + // Cant get window texture when prime-run is used + disable_prime_run(); + + // Stop nvidia driver from buffering frames + setenv("__GL_MaxFramesAllowed", "1", true); + // If this is set to 1 then cuGraphicsGLRegisterImage will fail for egl context with error: invalid OpenGL or DirectX context, + // so we overwrite it + setenv("__GL_THREADED_OPTIMIZATIONS", "0", true); + // Some people set this to force all applications to vsync on nvidia, but this makes eglSwapBuffers never return. + unsetenv("__GL_SYNC_TO_VBLANK"); + // Same as above, but for amd/intel + unsetenv("vblank_mode"); + signal(SIGINT, sigint_handler); gsr::GsrInfo gsr_info; |