From de18189b443d9da7849bec241a965ab7093ba28a Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Wed, 2 Aug 2023 01:08:31 -0400 Subject: [PATCH] Fix Graphical Glitches On Some NVIDIA GPUs And Fix Crash When Taking Large Screenshots --- .../core/gles/src/compatibility-layer/shaders/main.fsh | 2 +- .../core/gles/src/compatibility-layer/shaders/main.vsh | 2 +- mods/src/screenshot/screenshot.c | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/media-layer/core/gles/src/compatibility-layer/shaders/main.fsh b/media-layer/core/gles/src/compatibility-layer/shaders/main.fsh index 1c66598..416f6a4 100644 --- a/media-layer/core/gles/src/compatibility-layer/shaders/main.fsh +++ b/media-layer/core/gles/src/compatibility-layer/shaders/main.fsh @@ -1,5 +1,5 @@ #version 100 -precision mediump float; +precision highp float; // Texture uniform bool u_has_texture; uniform sampler2D u_texture_unit; diff --git a/media-layer/core/gles/src/compatibility-layer/shaders/main.vsh b/media-layer/core/gles/src/compatibility-layer/shaders/main.vsh index 24e34de..8ecb237 100644 --- a/media-layer/core/gles/src/compatibility-layer/shaders/main.vsh +++ b/media-layer/core/gles/src/compatibility-layer/shaders/main.vsh @@ -1,5 +1,5 @@ #version 100 -precision mediump float; +precision highp float; // Matrices uniform mat4 u_projection; uniform mat4 u_model_view; diff --git a/mods/src/screenshot/screenshot.c b/mods/src/screenshot/screenshot.c index 40f3527..af4a37b 100644 --- a/mods/src/screenshot/screenshot.c +++ b/mods/src/screenshot/screenshot.c @@ -144,7 +144,8 @@ void screenshot_take(char *home) { int size = height * line_size; // Read Pixels - unsigned char pixels[size]; + unsigned char *pixels = (unsigned char *) malloc(size); + ALLOC_CHECK(pixels); glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); // Save Image @@ -157,4 +158,5 @@ void screenshot_take(char *home) { // Free free(file); free(screenshots); + free(pixels); }