Swap flush and memory barrier

This commit is contained in:
dec05eba
2025-06-07 11:47:27 +02:00
parent baa7bfd5e4
commit b0b1442a03
4 changed files with 5 additions and 14 deletions

View File

@@ -1,4 +1,4 @@
project('gpu-screen-recorder', ['c', 'cpp'], version : '5.5.6', default_options : ['warning_level=2']) project('gpu-screen-recorder', ['c', 'cpp'], version : '5.5.7', default_options : ['warning_level=2'])
add_project_arguments('-Wshadow', language : ['c', 'cpp']) add_project_arguments('-Wshadow', language : ['c', 'cpp'])
if get_option('buildtype') == 'debug' if get_option('buildtype') == 'debug'

View File

@@ -1,7 +1,7 @@
[package] [package]
name = "gpu-screen-recorder" name = "gpu-screen-recorder"
type = "executable" type = "executable"
version = "5.5.6" version = "5.5.7"
platforms = ["posix"] platforms = ["posix"]
[config] [config]

View File

@@ -920,7 +920,6 @@ void gsr_color_conversion_draw(gsr_color_conversion *self, unsigned int texture_
source_position.x += source_pos.x; source_position.x += source_pos.x;
source_position.y += source_pos.y; source_position.y += source_pos.y;
gsr_color_conversion_draw_graphics(self, texture_id, external_texture, rotation_matrix, source_position, source_size, destination_pos, texture_size, scale, source_color); gsr_color_conversion_draw_graphics(self, texture_id, external_texture, rotation_matrix, source_position, source_size, destination_pos, texture_size, scale, source_color);
// TODO: Is glFlush and glFinish needed here for graphics garbage?
} else { } else {
switch(rotation) { switch(rotation) {
case GSR_ROT_0: case GSR_ROT_0:
@@ -955,13 +954,13 @@ void gsr_color_conversion_draw(gsr_color_conversion *self, unsigned int texture_
} }
} }
self->params.egl->glFlush();
// TODO: Use the minimal barrier required // TODO: Use the minimal barrier required
self->params.egl->glMemoryBarrier(GL_ALL_BARRIER_BITS); // GL_SHADER_IMAGE_ACCESS_BARRIER_BIT self->params.egl->glMemoryBarrier(GL_ALL_BARRIER_BITS); // GL_SHADER_IMAGE_ACCESS_BARRIER_BIT
self->params.egl->glUseProgram(0); self->params.egl->glUseProgram(0);
gsr_color_conversion_swizzle_reset(self, source_color); gsr_color_conversion_swizzle_reset(self, source_color);
self->params.egl->glBindTexture(texture_target, 0); self->params.egl->glBindTexture(texture_target, 0);
self->params.egl->glFlush();
} }
void gsr_color_conversion_clear(gsr_color_conversion *self) { void gsr_color_conversion_clear(gsr_color_conversion *self) {

View File

@@ -517,15 +517,7 @@ void gsr_egl_unload(gsr_egl *self) {
} }
void gsr_egl_swap_buffers(gsr_egl *self) { void gsr_egl_swap_buffers(gsr_egl *self) {
/* This uses less cpu than swap buffer on nvidia */
// TODO: Do these and remove swap
self->glFlush(); self->glFlush();
// self->glFinish(); // TODO: Use the minimal barrier required
// if(self->egl_display) { self->glMemoryBarrier(GL_ALL_BARRIER_BITS); // GL_SHADER_IMAGE_ACCESS_BARRIER_BIT
// self->eglSwapBuffers(self->egl_display, self->egl_surface);
// } else if(gsr_window_get_display_server(self->window) == GSR_DISPLAY_SERVER_X11) {
// Display *display = gsr_window_get_display(self->window);
// const Window window = (Window)gsr_window_get_window(self->window);
// self->glXSwapBuffers(display, window);
// }
} }