Bug 1678711 - Make running with --software without the "software" feature panic. r=lsalzman

I think this is more helpful than silently failing.

Differential Revision: https://phabricator.services.mozilla.com/D97804
This commit is contained in:
Jeff Muizelaar 2020-11-27 14:51:19 +00:00
Родитель 417ed499f1
Коммит 5ef90cabc3
1 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -305,15 +305,15 @@ impl WindowWrapper {
} }
#[cfg(feature = "software")] #[cfg(feature = "software")]
fn make_software_context() -> Option<swgl::Context> { fn make_software_context() -> swgl::Context {
let ctx = swgl::Context::create(); let ctx = swgl::Context::create();
ctx.make_current(); ctx.make_current();
Some(ctx) ctx
} }
#[cfg(not(feature = "software"))] #[cfg(not(feature = "software"))]
fn make_software_context() -> Option<swgl::Context> { fn make_software_context() -> swgl::Context {
None panic!("software feature not enabled")
} }
fn make_window( fn make_window(
@ -326,7 +326,7 @@ fn make_window(
software: bool, software: bool,
) -> WindowWrapper { ) -> WindowWrapper {
let sw_ctx = if software { let sw_ctx = if software {
make_software_context() Some(make_software_context())
} else { } else {
None None
}; };