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
This commit is contained in:
Aesen Vismea 2016-02-28 02:49:34 -05:00 committed by jp9000
parent f6a940cce7
commit 9cf56f8b4c
2 changed files with 11 additions and 0 deletions

View File

@ -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)"

View File

@ -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) {