From 6f0717f8c1f0cd0d56cb6ac557d550d2b6bf05b8 Mon Sep 17 00:00:00 2001 From: PancakeTAS Date: Wed, 28 Aug 2024 02:29:08 +0200 Subject: [PATCH] linux-pipewire: Fix 10- and 16-bit captures --- plugins/linux-pipewire/pipewire.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/plugins/linux-pipewire/pipewire.c b/plugins/linux-pipewire/pipewire.c index 0bf2d2ecec3c1f..20851a9e675b8c 100644 --- a/plugins/linux-pipewire/pipewire.c +++ b/plugins/linux-pipewire/pipewire.c @@ -804,8 +804,9 @@ static void process_video_sync(obs_pipewire_stream *obs_pw_stream) obs_pw_stream->texture = gs_texture_create_from_dmabuf( obs_pw_stream->format.info.raw.size.width, obs_pw_stream->format.info.raw.size.height, - obs_pw_video_format.drm_format, GS_BGRX, planes, fds, - strides, offsets, use_modifiers ? modifiers : NULL); + obs_pw_video_format.drm_format, + obs_pw_video_format.gs_format, planes, fds, strides, + offsets, use_modifiers ? modifiers : NULL); if (obs_pw_stream->texture == NULL) { remove_modifier_from_format( @@ -1373,6 +1374,13 @@ void obs_pipewire_stream_video_render(obs_pipewire_stream *obs_pw_stream, gs_blend_state_push(); gs_blend_function(GS_BLEND_ONE, GS_BLEND_INVSRCALPHA); + enum gs_color_format format = s_get_color_space() == GS_CS_SRGB + ? "Draw" + : "DrawSrgbDecompress"; + gs_technique_t *tech = gs_effect_get_technique(effect, format); + gs_technique_begin(tech); + gs_technique_begin_pass(tech, 0); + if (has_effective_crop(obs_pw_stream)) { gs_draw_sprite_subregion(obs_pw_stream->texture, flip, obs_pw_stream->crop.x, @@ -1404,6 +1412,9 @@ void obs_pipewire_stream_video_render(obs_pipewire_stream *obs_pw_stream, gs_matrix_pop(); } + gs_technique_end_pass(tech); + gs_technique_end(tech); + gs_blend_state_pop(); }