From d0f59dbd8bf1cb6d8c3121ed2ff5bd83193e6bdb Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 3 May 2026 10:26:16 +0200 Subject: [PATCH] RGB8 -> RGB --- README.md | 2 +- include/color_conversion.h | 2 +- src/color_conversion.c | 14 +++++++------- src/main.cpp | 2 +- src/plugins.c | 3 +-- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 06bb10e..e188498 100644 --- a/README.md +++ b/README.md @@ -166,7 +166,7 @@ Note that for best performance you should close other screen recorders such as O ## Note about optimal performance on NVIDIA NVIDIA driver has a "feature" (read: bug) where it will downclock memory transfer rate when a program uses cuda (or nvenc, which uses cuda), such as GPU Screen Recorder. This can affect game performance. GPU Screen Recorder installs an NVIDIA profile on the system (`~/.nv/nvidia-application-profiles-rc.d/10-gsr-cuda-no-stable-perf-limit`) to get around this issue but this requires a relatively -new NVIDIA driver version (~580). If you have an older NVIDIA driver then you can choose to record with vulkan video encoding instead as it doesn't have this issue. +new NVIDIA driver version (580+). If you have an older NVIDIA driver then you can choose to record with vulkan video encoding instead as it doesn't have this issue. You can use vulkan video encoding by adding `_vulkan` at the end of the video codec option, for example: `-k h264_vulkan` or a full command example: `gpu-screen-recorder -w screen -k h264_vulkan -o video.mp4`. Vulkan video encoding in GPU Screen Recorder supports `h264`, `hevc` and `av1` (along with `hdr` and `10bit` options), assuming your gpu drivers, ffmpeg and vulkan is up to date. diff --git a/include/color_conversion.h b/include/color_conversion.h index 9157712..f1f1b29 100644 --- a/include/color_conversion.h +++ b/include/color_conversion.h @@ -18,7 +18,7 @@ typedef enum { typedef enum { GSR_DESTINATION_COLOR_NV12, /* YUV420, BT709, 8-bit */ GSR_DESTINATION_COLOR_P010, /* YUV420, BT2020, 10-bit */ - GSR_DESTINATION_COLOR_RGB8 + GSR_DESTINATION_COLOR_RGB } gsr_destination_color; typedef enum { diff --git a/src/color_conversion.c b/src/color_conversion.c index 8a75e20..bb39df9 100644 --- a/src/color_conversion.c +++ b/src/color_conversion.c @@ -65,7 +65,7 @@ static const char* color_format_range_get_transform_matrix(gsr_destination_color } break; } - case GSR_DESTINATION_COLOR_RGB8: + case GSR_DESTINATION_COLOR_RGB: return ""; default: return NULL; @@ -534,7 +534,7 @@ static bool gsr_color_conversion_load_graphics_shaders(gsr_color_conversion *sel } break; } - case GSR_DESTINATION_COLOR_RGB8: { + case GSR_DESTINATION_COLOR_RGB: { if(load_graphics_shader_rgb(&self->graphics_shaders[GRAPHICS_SHADER_INDEX_RGB], self->params.egl, &self->graphics_uniforms[GRAPHICS_SHADER_INDEX_RGB], false) != 0) { fprintf(stderr, "gsr error: gsr_color_conversion_init: failed to load RGB graphics shader\n"); return false; @@ -575,7 +575,7 @@ static bool gsr_color_conversion_load_external_graphics_shaders(gsr_color_conver } break; } - case GSR_DESTINATION_COLOR_RGB8: { + case GSR_DESTINATION_COLOR_RGB: { if(load_graphics_shader_rgb(&self->graphics_shaders[GRAPHICS_SHADER_INDEX_RGB_EXTERNAL], self->params.egl, &self->graphics_uniforms[GRAPHICS_SHADER_INDEX_RGB_EXTERNAL], true) != 0) { fprintf(stderr, "gsr error: gsr_color_conversion_init: failed to load RGB graphics shader (external)\n"); return false; @@ -607,7 +607,7 @@ int gsr_color_conversion_init(gsr_color_conversion *self, const gsr_color_conver } break; } - case GSR_DESTINATION_COLOR_RGB8: { + case GSR_DESTINATION_COLOR_RGB: { if(self->params.num_destination_textures != 1) { fprintf(stderr, "gsr error: gsr_color_conversion_init: expected 1 destination textures for destination color RGB8, got %d destination texture(s)\n", self->params.num_destination_textures); goto err; @@ -808,7 +808,7 @@ static void gsr_color_conversion_draw_graphics(gsr_color_conversion *self, unsig } break; } - case GSR_DESTINATION_COLOR_RGB8: { + case GSR_DESTINATION_COLOR_RGB: { self->params.egl->glBindFramebuffer(GL_FRAMEBUFFER, self->framebuffers[0]); //cap_xcomp->params.egl->glClear(GL_COLOR_BUFFER_BIT); // TODO: Do this in a separate clear_ function. We want to do that when using multiple drm to create the final image (multiple monitors for example) @@ -847,7 +847,7 @@ static void gsr_color_conversion_draw_graphics(gsr_color_conversion *self, unsig } break; } - case GSR_DESTINATION_COLOR_RGB8: { + case GSR_DESTINATION_COLOR_RGB: { self->params.egl->glBindFramebuffer(GL_FRAMEBUFFER, self->framebuffers[0]); //cap_xcomp->params.egl->glClear(GL_COLOR_BUFFER_BIT); // TODO: Do this in a separate clear_ function. We want to do that when using multiple drm to create the final image (multiple monitors for example) @@ -913,7 +913,7 @@ void gsr_color_conversion_clear(gsr_color_conversion *self) { color2[3] = 1.0f; break; } - case GSR_DESTINATION_COLOR_RGB8: { + case GSR_DESTINATION_COLOR_RGB: { color2[0] = 0.0f; color2[1] = 0.0f; color2[2] = 0.0f; diff --git a/src/main.cpp b/src/main.cpp index ba94f77..09f14a2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2446,7 +2446,7 @@ static void capture_image_to_file(args_parser &arg_parser, gsr_egl *egl, gsr_win color_conversion_params.destination_textures[0] = image_writer.texture; color_conversion_params.destination_textures_size[0] = video_size; color_conversion_params.num_destination_textures = 1; - color_conversion_params.destination_color = GSR_DESTINATION_COLOR_RGB8; + color_conversion_params.destination_color = GSR_DESTINATION_COLOR_RGB; gsr_color_conversion color_conversion; if(gsr_color_conversion_init(&color_conversion, &color_conversion_params) != 0) { diff --git a/src/plugins.c b/src/plugins.c index 061534c..764dbc7 100644 --- a/src/plugins.c +++ b/src/plugins.c @@ -21,7 +21,6 @@ bool gsr_plugins_init(gsr_plugins *self, gsr_plugin_init_params init_params, gsr self->init_params = init_params; self->egl = egl; - /* TODO: GL_RGB8? */ const unsigned int texture = gl_create_texture(egl, init_params.width, init_params.height, color_depth_to_gl_internal_format(init_params.color_depth), GL_RGBA, GL_LINEAR); if(texture == 0) { fprintf(stderr, "gsr error: gsr_plugins_init failed to create texture\n"); @@ -31,7 +30,7 @@ bool gsr_plugins_init(gsr_plugins *self, gsr_plugin_init_params init_params, gsr gsr_color_conversion_params color_conversion_params = { .egl = egl, - .destination_color = GSR_DESTINATION_COLOR_RGB8, /* TODO: Support 10-bits, use init_params.color_depth */ + .destination_color = GSR_DESTINATION_COLOR_RGB, .destination_textures[0] = self->texture, .destination_textures_size[0] = (vec2i){ init_params.width, init_params.height }, .num_destination_textures = 1,