You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.
The proposal is to rewrite the Curv "viewer" window to use WebGPU, replacing the use of OpenGL.
Rationale: Currently Curv is stuck at version 3.3 of OpenGL due to MacOS compatibility requirements. There's no way to use advanced features like compute shaders in OpenGL due to MacOS limitations. WebGPU can be thought of as the modern replacement for OpenGL. It is faster and more powerful than OpenGL. It is much easier to use than Vulkan. WebGPU is more portable than Vulkan, since it runs on all desktop and mobile platforms, plus it supports web assembly (WASM) and web browsers.
Once Curv is ported to WebGPU, we can build a faster and more powerful rendering engine based on the use of compute shaders.
How To Do It: The only Curv code that needs to change is located in libcurv/viewer. This code runs the graphical "viewer" window. This software component is well isolated from the rest of Curv. One approach is to write a new viewer from scratch, instead of attempting to translate the OpenGL code into WebGPU. There are lots of "GPU shader sandbox" apps available in open source, so we could use an existing such app coded to the WebGPU API as a starting point. (The current Curv viewer is based on GLSLViewer.)
The initial prototype need not be integrated into Curv, it could be a standalone app. Curv has the ability to export a shape as a *.jgpu file: this is a JSON encoding data structure containing all the inputs required to run a Viewer window. So the prototype could just read and parse this JSON file then display the shape in a window. This may simplify the development process.
Since Curv is written in C++, we can use Google's Dawn library, which has a C++ interface. The Curv shader compiler generates GLSL code, so we can use a library to translate GLSL into SPIR-V, which Dawn accepts as input. The current viewer code depends on the ImGUI library for GUI widgets. There's no requirement to use ImGUI in the new viewer implementation, but I see that there is already a WebGPU port for imgui.
Resources:
This WebGPU native examples project contains some good example code, including this ShaderToy loader which could be directly used with light modifications to display Curv 3D shapes.
The text was updated successfully, but these errors were encountered:
An alternative backend is the WGPU C++ api: https://github.com/gfx-rs/wgpu-native
I haven't tried it, but I believe it can run on directx, vulcan, opengl and metal, possibly featuring support for multiple shader languages.
I agree.There is a C/C++ implementation from Google (Dawn) that doesn't introduce a Rust dependency. Nice to know that gfx-rs now has a C++ wrapper. WGPU is on track to be finalized some time this year. (Right now it is still an unstable alpha, with breaking changes still planned.) WGPU will open up a richer API, including compute shaders, which will be very useful to Curv.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The proposal is to rewrite the Curv "viewer" window to use WebGPU, replacing the use of OpenGL.
Rationale: Currently Curv is stuck at version 3.3 of OpenGL due to MacOS compatibility requirements. There's no way to use advanced features like compute shaders in OpenGL due to MacOS limitations. WebGPU can be thought of as the modern replacement for OpenGL. It is faster and more powerful than OpenGL. It is much easier to use than Vulkan. WebGPU is more portable than Vulkan, since it runs on all desktop and mobile platforms, plus it supports web assembly (WASM) and web browsers.
Once Curv is ported to WebGPU, we can build a faster and more powerful rendering engine based on the use of compute shaders.
How To Do It: The only Curv code that needs to change is located in
libcurv/viewer
. This code runs the graphical "viewer" window. This software component is well isolated from the rest of Curv. One approach is to write a new viewer from scratch, instead of attempting to translate the OpenGL code into WebGPU. There are lots of "GPU shader sandbox" apps available in open source, so we could use an existing such app coded to the WebGPU API as a starting point. (The current Curv viewer is based on GLSLViewer.)The initial prototype need not be integrated into Curv, it could be a standalone app. Curv has the ability to export a shape as a
*.jgpu
file: this is a JSON encoding data structure containing all the inputs required to run a Viewer window. So the prototype could just read and parse this JSON file then display the shape in a window. This may simplify the development process.Since Curv is written in C++, we can use Google's Dawn library, which has a C++ interface. The Curv shader compiler generates GLSL code, so we can use a library to translate GLSL into SPIR-V, which Dawn accepts as input. The current viewer code depends on the ImGUI library for GUI widgets. There's no requirement to use ImGUI in the new viewer implementation, but I see that there is already a WebGPU port for imgui.
Resources:
The text was updated successfully, but these errors were encountered: