-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Program crashes when releasing the framerate #17
Comments
Can you try setting "wgpu::PresentMode::Immediate" to "wgpu::PresentMode::AutoNoVsync" here: game-physics-template/src/Simulator.cpp Line 80 in 245163b
see https://docs.rs/wgpu/latest/wgpu/enum.PresentMode.html#variant.AutoNoVsync |
gives me [build] /home/felix/Downloads/game-physics-template/src/Simulator.cpp: In member function ‘void Simulator::onGUI()’:
[build] /home/felix/Downloads/game-physics-template/src/Simulator.cpp:85:60: error: ‘AutoNoVsync’ is not a member of ‘wgpu::PresentMode’
[build] 85 | renderer.setPresentMode(wgpu::PresentMode::AutoNoVsync);
[build] | ^~~~~~~~~~~
[build] make[2]: *** [CMakeFiles/Template.dir/build.make:146: CMakeFiles/Template.dir/src/Simulator.cpp.o] Error 1
[build] make[1]: *** [CMakeFiles/Makefile2:187: CMakeFiles/Template.dir/all] Error 2
[build] make: *** [Makefile:91: all] Error 2 Could it be that this is a feature only supported by a more recent version of WebGPU? |
I could reproduce the issue on my WSL setup: The version in our codebase only supports: ENUM(PresentMode)
ENUM_ENTRY(Immediate, 0x00000000)
ENUM_ENTRY(Mailbox, 0x00000001)
ENUM_ENTRY(Fifo, 0x00000002)
ENUM_ENTRY(Force32, 0x7FFFFFFF)
END If you then look at the webgpu documentation you get this: Immediate = 4
Presentation frames are not queued at all. The moment a present command is executed on the GPU, the presented image is swapped onto the front buffer immediately.
Tearing can be observed.
Supported on most platforms except older DX12 and Wayland.
This is traditionally called “Vsync Off”. We can bandaid fix this for now by disabling the limit fps button if we are running on wayland, e.g., #ifdef _GLFW_WAYLAND
ImGui::BeginDisabled();
if (Checkbox("Limit FPS (disabled on Wayland)", &limitFPS))
ImGui::EndDisabled();
#else
if (Checkbox("Limit FPS", &limitFPS)){
if (limitFPS)
renderer.setPresentMode(wgpu::PresentMode::Fifo);
else
renderer.setPresentMode(wgpu::PresentMode::Immediate);
}
#endif This is now implemented in the fix-wayland branch. |
Thanks for looking into it. The approach definitely fixes it on Wayland for me. However, it also occurs on X11 sessions. Using version d9939f3ac22d9915aa7bcad6f509a27da250fa13 of the -- The CXX compiler identification is GNU 14.2.1
-- The C compiler identification is GNU 14.2.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
Using X11 (detected via XDG_SESSION_TYPE)
-- Using wgpu-native backend for WebGPU
-- Using WebGPU runtime from '/home/felix/Downloads/game-physics-template/build/_deps/webgpu-backend-wgpu-src/bin/linux-x86_64/libwgpu_native.so'
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Including X11 support
-- Found X11: /usr/include
-- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXext.so
-- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Configuring done (26.5s)
-- Generating done (0.0s) Running the program and releasing the FPS results in the same stack trace as initially described. However, this is only on my Arch Laptop with Intel iGPU. On my X11 Ubuntu 22.04 workstation with an nvidia GPU, there is no issue with it. Based on that, I assume it might be related to my Laptop having integrated graphics? Or could it also be an issue with Vulkan? I assume WebGPU is using Vulkan in the backend? Since it should not impact the students much, I guess it's not a high priority, but I still find it strange. |
PR #16 addresses this issue by disabling the button in incompatible setups and making setups compatible is beyond our scope. I think we can close this issue for now. |
Agree |
I compiled the main branch, executed the program and unticked the
Limit FPS
under the Rendering tap in the GUI. Then the program crashesMy OS is Arch Linux. System info from CMAKE configure:
The text was updated successfully, but these errors were encountered: