mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-21 15:00:57 +01:00
feature = emscripten, compability fixes for wgpu-native (#2450)
This commit is contained in:
1 parent
8c351970ce
commit
f05e070d60
2 files changed
+18
-15
No files matched your search
@@ -4,8 +4,9 @@
|
||||
//! Emscripten build:
|
||||
//! 1. install emsdk
|
||||
//! 2. build this example with cargo:
|
||||
//! EMMAKEN_CFLAGS="-g -s ERROR_ON_UNDEFINED_SYMBOLS=0 --no-entry -s FULL_ES3=1" cargo build --example raw-gles --target wasm32-unknown-emscripten --features emscripten,webgl
|
||||
//! 3. copy raw-gles.em.html into target/wasm32-unknown-emscripten/debug/examples/ and open it in browser
|
||||
//! EMCC_CFLAGS="-g -s ERROR_ON_UNDEFINED_SYMBOLS=0 --no-entry -s FULL_ES3=1" cargo build --example raw-gles --target wasm32-unknown-emscripten --features emscripten,webgl
|
||||
//! 3. copy raw-gles.em.html into target directory and open it in browser:
|
||||
//! cp wgpu-hal/examples/raw-gles.em.html target/wasm32-unknown-emscripten/debug/examples
|
||||
|
||||
extern crate wgpu_hal as hal;
|
||||
|
||||
|
||||
+15
-13
@@ -501,19 +501,21 @@ impl Inner {
|
||||
|
||||
// Testing if context can be binded without surface
|
||||
// and creating dummy pbuffer surface if not.
|
||||
let pbuffer =
|
||||
if version >= (1, 5) || display_extensions.contains("EGL_KHR_surfaceless_context") {
|
||||
log::info!("\tEGL context: +surfaceless");
|
||||
None
|
||||
} else {
|
||||
let attributes = [egl::WIDTH, 1, egl::HEIGHT, 1, egl::NONE];
|
||||
egl.create_pbuffer_surface(display, config, &attributes)
|
||||
.map(Some)
|
||||
.map_err(|e| {
|
||||
log::warn!("Error in create_pbuffer_surface: {:?}", e);
|
||||
crate::InstanceError
|
||||
})?
|
||||
};
|
||||
let pbuffer = if version >= (1, 5)
|
||||
|| display_extensions.contains("EGL_KHR_surfaceless_context")
|
||||
|| cfg!(feature = "emscripten")
|
||||
{
|
||||
log::info!("\tEGL context: +surfaceless");
|
||||
None
|
||||
} else {
|
||||
let attributes = [egl::WIDTH, 1, egl::HEIGHT, 1, egl::NONE];
|
||||
egl.create_pbuffer_surface(display, config, &attributes)
|
||||
.map(Some)
|
||||
.map_err(|e| {
|
||||
log::warn!("Error in create_pbuffer_surface: {:?}", e);
|
||||
crate::InstanceError
|
||||
})?
|
||||
};
|
||||
|
||||
Ok(Self {
|
||||
egl: EglContext {
|
||||
|
||||
Reference in new issue
Block a user