Comments (6)
have you tried
glfw.window_hint(WindowHint::ClientApi(ClientApiHint::NoApi));
just before creating the windows. This fixed some issues on some platforms.
from wgpu.
That's probably todo with
state.window.make_current();
only some calls can be done without an api (typically because the other api can do this). For example:
window.swap_buffers();
does basically the same thing as
surface_texture.present();
though on the internal API (in this case OpenGL).
Also this conversation should probably be moved to glfw-rs as this is mostly a glfw issue.
Questions I have:
- Why use Surface Target Unsafe? Couldn't you use a
Arc<Window>
or use thewindow.render_context()
function? - Why
glfw.set_swap_interval(glfw::SwapInterval::Sync(1));
? Wgpu has it's own presentation mode. - Why both
state.window.swap_buffers();
anddrawable.present();
don't these do the same thing?
Sorry if these seem like a lot of suggestions, I'm just trying to work out the code.
from wgpu.
Copying the code onto my machine and making this the run function
let mut glfw = glfw::init(fail_on_errors!())
.unwrap();
glfw.window_hint(WindowHint::ClientApi(ClientApiHint::NoApi));
let (mut window, events) =
glfw.create_window(
800, 600, "It's SNA time.",
glfw::WindowMode::Windowed).unwrap();
let mut state = State::new(&mut window).await;
//state.window.set_all_polling(true);
//state.window.make_current();
//glfw.set_swap_interval(glfw::SwapInterval::Sync(1));
while !state.window.should_close() {
glfw.poll_events();
for (_, event) in glfw::flush_messages(&events) {
match event {
glfw::WindowEvent::Key(Key::Escape, _, Action::Press, _) => {
state.window.set_should_close(true)
}
_ => {}
}
}
match state.render() {
Ok(_) => {},
Err(e) => eprintln!("{:?}", e),
}
//state.window.swap_buffers();
}
seems to fix the issue (commented out code is both not required and unsupported). This is definitely a GLFW documentation issue. I'm working on a pull request to fix the docs.
from wgpu.
Thank you! By the way, there is a safe way of creating a surface:
instance.create_surface(window.render_context()).unwrap();
from wgpu.
I put it right before creating the window, but it returns a new error:
GLFW Error: Cannot make current with a window that has no OpenGL or OpenGL ES context
from wgpu.
OMG, it works now! Thank you so much!!!
from wgpu.
Related Issues (20)
- Report overflow when shl overflows into sign bit HOT 1
- mem leak HOT 5
- multi_draw_indirect_count set incorrect count buffer id. HOT 2
- WGSL: xyzw and rgba are not allowed to apear in same swizzle
- Refcount traffic due to lazy buffer initialization could be reduced
- Examples shouldn't use bytemuck to cast out of a get_mapped_range() BufferView HOT 4
- requires directive does not appear to be supported (specifically pointer_composite_access)
- `Instance::request_adapter` silently fails when browser doesn't support WebGPU and `wgpu` compiled without `webgl` feature.
- WebGPU backend: "Cannot perform %TypedArray%.prototype.set on a detached ArrayBuffer" if buffer is destroyed
- Support the `readonly_and_readwrite_storage_textures` WGSL language extension HOT 2
- [d3d12] Make sure WARP device creation works properly HOT 2
- [naga wgsl-out] `let`declarations are wrongly detected as const HOT 4
- [glsl-in] lost statement of multi part loop-expression
- WGL and EGL's context activation is unsound
- Unable to break out of the loop in SPIR-V
- Limits on maximum buffer size (MaxBufferSize or MaxStorageBufferBindingSize) is not being correctly applied HOT 5
- Texture usages TextureUsages(STORAGE_BINDING) are not allowed on a texture of type R8Uint HOT 1
- `Texture` from `ID3D12Resource/ID3D11Resource`? HOT 4
- `const_assert` doesn't evaluate conditions properly HOT 5
- Are `wgpu_hal::CommandEncoder::set_bind_group`'s guarantees too weak / too strong? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wgpu.