From 9cf56f8b4ca47f69e4aedfc67a0ec1f25c020dd9 Mon Sep 17 00:00:00 2001 From: Aesen Vismea Date: Sun, 28 Feb 2016 02:49:34 -0500 Subject: [PATCH] linux-capture: Add "Use alpha-less texture format" option This is to work around a Mesa issue that prevents copying between RGB and RGBA textures. Other drivers seem to allow this, even though it's technically not allowed by the GL spec. Closes jp9000/obs-studio#514 --- plugins/linux-capture/data/locale/en-US.ini | 1 + plugins/linux-capture/xcompcap-main.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/plugins/linux-capture/data/locale/en-US.ini b/plugins/linux-capture/data/locale/en-US.ini index 4f20c37cc..5661f3833 100644 --- a/plugins/linux-capture/data/locale/en-US.ini +++ b/plugins/linux-capture/data/locale/en-US.ini @@ -12,3 +12,4 @@ CropBottom="Crop Bottom (pixels)" SwapRedBlue="Swap red and blue" LockX="Lock X server when capturing" IncludeXBorder="Include X Border" +ExcludeAlpha="Use alpha-less texture format (Mesa workaround)" diff --git a/plugins/linux-capture/xcompcap-main.cpp b/plugins/linux-capture/xcompcap-main.cpp index 42ecd770f..f9cf00cf6 100644 --- a/plugins/linux-capture/xcompcap-main.cpp +++ b/plugins/linux-capture/xcompcap-main.cpp @@ -86,6 +86,9 @@ obs_properties_t *XCompcapMain::properties() obs_properties_add_bool(props, "include_border", obs_module_text("IncludeXBorder")); + obs_properties_add_bool(props, "exclude_alpha", + obs_module_text("ExcludeAlpha")); + return props; } @@ -100,6 +103,7 @@ void XCompcapMain::defaults(obs_data_t *settings) obs_data_set_default_bool(settings, "lock_x", false); obs_data_set_default_bool(settings, "show_cursor", true); obs_data_set_default_bool(settings, "include_border", false); + obs_data_set_default_bool(settings, "exclude_alpha", false); } @@ -142,6 +146,7 @@ struct XCompcapMain_private bool swapRedBlue; bool lockX; bool include_border; + bool exclude_alpha; uint32_t width; uint32_t height; @@ -287,6 +292,7 @@ void XCompcapMain::updateSettings(obs_data_t *settings) p->swapRedBlue = obs_data_get_bool(settings, "swap_redblue"); p->show_cursor = obs_data_get_bool(settings, "show_cursor"); p->include_border = obs_data_get_bool(settings, "include_border"); + p->exclude_alpha = obs_data_get_bool(settings, "exclude_alpha"); } else { p->win = prevWin; } @@ -323,6 +329,10 @@ void XCompcapMain::updateSettings(obs_data_t *settings) gs_color_format cf = GS_RGBA; + if (p->exclude_alpha) { + cf = GS_BGRX; + } + p->border = attr.border_width; if (p->include_border) {