aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-07-05 12:00:01 +0200
committerdec05eba <dec05eba@protonmail.com>2024-07-05 12:00:01 +0200
commit6c5acf2da680525a536b5fb4576bd1a06e6c7505 (patch)
treee352942770e0e9373f22be20d3f5434d5bb8b530 /src
parenta5720df10fa0a40e1438e18b254925361bb623b8 (diff)
Use GL_TEXTURE_EXTERNAL_OES for cursor texture on kms nvidia
Diffstat (limited to 'src')
-rw-r--r--src/capture/kms.c15
1 files changed, 9 insertions, 6 deletions
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. */