From 6c5acf2da680525a536b5fb4576bd1a06e6c7505 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 5 Jul 2024 12:00:01 +0200 Subject: Use GL_TEXTURE_EXTERNAL_OES for cursor texture on kms nvidia --- src/capture/kms.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/capture') diff --git a/src/capture/kms.c b/src/capture/kms.c index 2601c5b..a9ce73c 100644 --- a/src/capture/kms.c +++ b/src/capture/kms.c @@ -79,13 +79,16 @@ static void gsr_capture_kms_create_input_textures(gsr_capture_kms *self) { self->params.egl->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); self->params.egl->glBindTexture(GL_TEXTURE_2D, 0); + const bool cursor_texture_is_external = self->params.egl->gpu_info.vendor == GSR_GPU_VENDOR_NVIDIA; + const int cursor_texture_target = cursor_texture_is_external ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D; + self->params.egl->glGenTextures(1, &self->cursor_texture); - self->params.egl->glBindTexture(GL_TEXTURE_2D, self->cursor_texture); - self->params.egl->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - self->params.egl->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - self->params.egl->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - self->params.egl->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - self->params.egl->glBindTexture(GL_TEXTURE_2D, 0); + self->params.egl->glBindTexture(cursor_texture_target, self->cursor_texture); + self->params.egl->glTexParameteri(cursor_texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + self->params.egl->glTexParameteri(cursor_texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + self->params.egl->glTexParameteri(cursor_texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + self->params.egl->glTexParameteri(cursor_texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + self->params.egl->glBindTexture(cursor_texture_target, 0); } /* TODO: On monitor reconfiguration, find monitor x, y, width and height again. Do the same for nvfbc. */ -- cgit v1.2.3