Skip to content

Commit

Permalink
Check OpenGL version earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Oct 23, 2023
1 parent f8e071d commit 764d0e6
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions wgpu-hal/src/gles/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,28 @@ impl super::Adapter {
return None;
}

if let Some(es_ver) = es_ver {
if es_ver < (3, 0) {
log::warn!(
"Returned GLES context is {}.{}, when 3.0+ was requested",
es_ver.0,
es_ver.1
);
return None;
}
}

if let Some(full_ver) = full_ver {
if full_ver < (3, 3) {
log::warn!(
"Returned GL context is {}.{}, when 3.3+ is needed",
full_ver.0,
full_ver.1
);
return None;
}
}

let shading_language_version = {
let sl_version = unsafe { gl.get_parameter_string(glow::SHADING_LANGUAGE_VERSION) };
log::info!("SL version: {}", &sl_version);
Expand All @@ -251,28 +273,6 @@ impl super::Adapter {

log::trace!("Supported GL Extensions: {:#?}", extensions);

if let Some(es_ver) = es_ver {
if es_ver < (3, 0) {
log::warn!(
"Returned GLES context is {}.{}, when 3.0+ was requested",
es_ver.0,
es_ver.1
);
return None;
}
}

if let Some(full_ver) = full_ver {
if full_ver < (3, 3) {
log::warn!(
"Returned GL context is {}.{}, when 3.3+ is needed",
full_ver.0,
full_ver.1
);
return None;
}
}

let supported = |(req_es_major, req_es_minor), (req_full_major, req_full_minor)| {
let es_supported = es_ver
.map(|es_ver| es_ver >= (req_es_major, req_es_minor))
Expand Down

0 comments on commit 764d0e6

Please sign in to comment.