diff options
author | dec05eba <dec05eba@protonmail.com> | 2025-06-10 00:32:51 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2025-06-10 00:32:51 +0200 |
commit | 53557133c21205dab879365234727416977e8a4b (patch) | |
tree | 12043c848fd0b644c41ffc15834b95f4ac871e28 /src/encoder/video | |
parent | 7f00ce22e7e86904e09f900422dfa591d045f447 (diff) |
Reapply "Fix screen and portal capture not working on some intel gpus"
This reverts commit 7f00ce22e7e86904e09f900422dfa591d045f447.
Diffstat (limited to 'src/encoder/video')
-rw-r--r-- | src/encoder/video/software.c | 11 | ||||
-rw-r--r-- | src/encoder/video/vaapi.c | 7 |
2 files changed, 5 insertions, 13 deletions
diff --git a/src/encoder/video/software.c b/src/encoder/video/software.c index 627cdea..d8d9828 100644 --- a/src/encoder/video/software.c +++ b/src/encoder/video/software.c @@ -71,16 +71,15 @@ void gsr_video_encoder_software_stop(gsr_video_encoder_software *self, AVCodecCo } static void gsr_video_encoder_software_copy_textures_to_frame(gsr_video_encoder *encoder, AVFrame *frame, gsr_color_conversion *color_conversion) { - gsr_video_encoder_software *self = encoder->priv; + (void)encoder; + //gsr_video_encoder_software *self = encoder->priv; // TODO: hdr support const unsigned int formats[2] = { GL_RED, GL_RG }; + const int div[2] = {1, 2}; // divide UV texture size by 2 because chroma is half size for(int i = 0; i < 2; ++i) { - self->params.egl->glBindTexture(GL_TEXTURE_2D, self->target_textures[i]); - // We could use glGetTexSubImage and then we wouldn't have to use a specific linesize (LINESIZE_ALIGNMENT) that adds padding, - // but glGetTexSubImage is only available starting from opengl 4.5. - self->params.egl->glGetTexImage(GL_TEXTURE_2D, 0, formats[i], GL_UNSIGNED_BYTE, frame->data[i]); + // TODO: Use glPixelStore? + gsr_color_conversion_read_destination_texture(color_conversion, i, 0, 0, frame->width / div[i], frame->height / div[i], formats[i], GL_UNSIGNED_BYTE, frame->data[i]); } - self->params.egl->glBindTexture(GL_TEXTURE_2D, 0); // cap_kms->kms.base.egl->eglSwapBuffers(cap_kms->kms.base.egl->egl_display, cap_kms->kms.base.egl->egl_surface); //self->params.egl->glFlush(); diff --git a/src/encoder/video/vaapi.c b/src/encoder/video/vaapi.c index c7ccd26..0daf4d8 100644 --- a/src/encoder/video/vaapi.c +++ b/src/encoder/video/vaapi.c @@ -92,10 +92,6 @@ static bool gsr_video_encoder_vaapi_setup_textures(gsr_video_encoder_vaapi *self if(self->prime.fourcc == VA_FOURCC_NV12 || self->prime.fourcc == VA_FOURCC_P010) { const uint32_t *formats = self->prime.fourcc == VA_FOURCC_NV12 ? formats_nv12 : formats_p010; const int div[2] = {1, 2}; // divide UV texture size by 2 because chroma is half size - const float border_colors[2][4] = { - {0.0f, 0.0f, 0.0f, 1.0f}, - {0.5f, 0.5f, 0.0f, 1.0f} - }; self->params.egl->glGenTextures(2, self->target_textures); for(int i = 0; i < 2; ++i) { @@ -125,9 +121,6 @@ static bool gsr_video_encoder_vaapi_setup_textures(gsr_video_encoder_vaapi *self } self->params.egl->glBindTexture(GL_TEXTURE_2D, self->target_textures[i]); - self->params.egl->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); - self->params.egl->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER); - self->params.egl->glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, border_colors[i]); self->params.egl->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); self->params.egl->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |