mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-24 07:43:49 +00:00
Seperate GLES and GL version selection (#5657)
* Seperate GLES and GL version selection * Add info when gles minor version is specified and not used
This commit is contained in:
parent
0d70a7361d
commit
8084eb6c8f
@ -549,22 +549,28 @@ impl Inner {
|
||||
let mut khr_context_flags = 0;
|
||||
let supports_khr_context = display_extensions.contains("EGL_KHR_create_context");
|
||||
|
||||
//TODO: make it so `Device` == EGL Context
|
||||
let mut context_attributes = vec![
|
||||
khronos_egl::CONTEXT_MAJOR_VERSION,
|
||||
3, // Request GLES 3.0 or higher
|
||||
];
|
||||
|
||||
if force_gles_minor_version != wgt::Gles3MinorVersion::Automatic {
|
||||
let mut context_attributes = vec![];
|
||||
if supports_opengl {
|
||||
context_attributes.push(khronos_egl::CONTEXT_MAJOR_VERSION);
|
||||
context_attributes.push(3);
|
||||
context_attributes.push(khronos_egl::CONTEXT_MINOR_VERSION);
|
||||
context_attributes.push(match force_gles_minor_version {
|
||||
wgt::Gles3MinorVersion::Version0 => 0,
|
||||
wgt::Gles3MinorVersion::Version1 => 1,
|
||||
wgt::Gles3MinorVersion::Version2 => 2,
|
||||
_ => unreachable!(),
|
||||
});
|
||||
context_attributes.push(3);
|
||||
if force_gles_minor_version != wgt::Gles3MinorVersion::Automatic {
|
||||
log::warn!("Ignoring specified GLES minor version as OpenGL is used");
|
||||
}
|
||||
} else {
|
||||
context_attributes.push(khronos_egl::CONTEXT_MAJOR_VERSION);
|
||||
context_attributes.push(3); // Request GLES 3.0 or higher
|
||||
if force_gles_minor_version != wgt::Gles3MinorVersion::Automatic {
|
||||
context_attributes.push(khronos_egl::CONTEXT_MINOR_VERSION);
|
||||
context_attributes.push(match force_gles_minor_version {
|
||||
wgt::Gles3MinorVersion::Automatic => unreachable!(),
|
||||
wgt::Gles3MinorVersion::Version0 => 0,
|
||||
wgt::Gles3MinorVersion::Version1 => 1,
|
||||
wgt::Gles3MinorVersion::Version2 => 2,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if flags.contains(wgt::InstanceFlags::DEBUG) {
|
||||
if version >= (1, 5) {
|
||||
log::debug!("\tEGL context: +debug");
|
||||
@ -594,8 +600,6 @@ impl Inner {
|
||||
// because it's for desktop GL only, not GLES.
|
||||
log::warn!("\tEGL context: -robust access");
|
||||
}
|
||||
|
||||
//TODO do we need `khronos_egl::CONTEXT_OPENGL_NOTIFICATION_STRATEGY_EXT`?
|
||||
}
|
||||
if khr_context_flags != 0 {
|
||||
context_attributes.push(EGL_CONTEXT_FLAGS_KHR);
|
||||
|
@ -7094,7 +7094,7 @@ pub struct InstanceDescriptor {
|
||||
pub flags: InstanceFlags,
|
||||
/// Which DX12 shader compiler to use.
|
||||
pub dx12_shader_compiler: Dx12Compiler,
|
||||
/// Which OpenGL ES 3 minor version to request.
|
||||
/// Which OpenGL ES 3 minor version to request. Will be ignored if OpenGL is available.
|
||||
pub gles_minor_version: Gles3MinorVersion,
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user