RGB8 -> RGB

This commit is contained in:
dec05eba
2026-05-03 10:26:16 +02:00
parent be5e51b03f
commit d0f59dbd8b
5 changed files with 11 additions and 12 deletions

View File

@@ -166,7 +166,7 @@ Note that for best performance you should close other screen recorders such as O
## Note about optimal performance on NVIDIA ## 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. 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 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`. 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. 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.

View File

@@ -18,7 +18,7 @@ typedef enum {
typedef enum { typedef enum {
GSR_DESTINATION_COLOR_NV12, /* YUV420, BT709, 8-bit */ GSR_DESTINATION_COLOR_NV12, /* YUV420, BT709, 8-bit */
GSR_DESTINATION_COLOR_P010, /* YUV420, BT2020, 10-bit */ GSR_DESTINATION_COLOR_P010, /* YUV420, BT2020, 10-bit */
GSR_DESTINATION_COLOR_RGB8 GSR_DESTINATION_COLOR_RGB
} gsr_destination_color; } gsr_destination_color;
typedef enum { typedef enum {

View File

@@ -65,7 +65,7 @@ static const char* color_format_range_get_transform_matrix(gsr_destination_color
} }
break; break;
} }
case GSR_DESTINATION_COLOR_RGB8: case GSR_DESTINATION_COLOR_RGB:
return ""; return "";
default: default:
return NULL; return NULL;
@@ -534,7 +534,7 @@ static bool gsr_color_conversion_load_graphics_shaders(gsr_color_conversion *sel
} }
break; 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) { 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"); fprintf(stderr, "gsr error: gsr_color_conversion_init: failed to load RGB graphics shader\n");
return false; return false;
@@ -575,7 +575,7 @@ static bool gsr_color_conversion_load_external_graphics_shaders(gsr_color_conver
} }
break; 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) { 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"); fprintf(stderr, "gsr error: gsr_color_conversion_init: failed to load RGB graphics shader (external)\n");
return false; return false;
@@ -607,7 +607,7 @@ int gsr_color_conversion_init(gsr_color_conversion *self, const gsr_color_conver
} }
break; break;
} }
case GSR_DESTINATION_COLOR_RGB8: { case GSR_DESTINATION_COLOR_RGB: {
if(self->params.num_destination_textures != 1) { 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); 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; goto err;
@@ -808,7 +808,7 @@ static void gsr_color_conversion_draw_graphics(gsr_color_conversion *self, unsig
} }
break; break;
} }
case GSR_DESTINATION_COLOR_RGB8: { case GSR_DESTINATION_COLOR_RGB: {
self->params.egl->glBindFramebuffer(GL_FRAMEBUFFER, self->framebuffers[0]); 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) //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; break;
} }
case GSR_DESTINATION_COLOR_RGB8: { case GSR_DESTINATION_COLOR_RGB: {
self->params.egl->glBindFramebuffer(GL_FRAMEBUFFER, self->framebuffers[0]); 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) //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; color2[3] = 1.0f;
break; break;
} }
case GSR_DESTINATION_COLOR_RGB8: { case GSR_DESTINATION_COLOR_RGB: {
color2[0] = 0.0f; color2[0] = 0.0f;
color2[1] = 0.0f; color2[1] = 0.0f;
color2[2] = 0.0f; color2[2] = 0.0f;

View File

@@ -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[0] = image_writer.texture;
color_conversion_params.destination_textures_size[0] = video_size; color_conversion_params.destination_textures_size[0] = video_size;
color_conversion_params.num_destination_textures = 1; 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; gsr_color_conversion color_conversion;
if(gsr_color_conversion_init(&color_conversion, &color_conversion_params) != 0) { if(gsr_color_conversion_init(&color_conversion, &color_conversion_params) != 0) {

View File

@@ -21,7 +21,6 @@ bool gsr_plugins_init(gsr_plugins *self, gsr_plugin_init_params init_params, gsr
self->init_params = init_params; self->init_params = init_params;
self->egl = egl; 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); 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) { if(texture == 0) {
fprintf(stderr, "gsr error: gsr_plugins_init failed to create texture\n"); 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 = { gsr_color_conversion_params color_conversion_params = {
.egl = egl, .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[0] = self->texture,
.destination_textures_size[0] = (vec2i){ init_params.width, init_params.height }, .destination_textures_size[0] = (vec2i){ init_params.width, init_params.height },
.num_destination_textures = 1, .num_destination_textures = 1,