Help with WebGPU setup & test

Hi @jaswantp,

I am currently trying out WebGPU with VTK following the guide here https://docs.vtk.org/en/latest/modules/vtk-modules/Rendering/WebGPU/README.html

I was able to setup dawn & build VTK using it. However I’m not quite sure of how to know if WebGPU is actually functioning under the hood. Note that I’m testing with a project that previously used ‘OpenGL’ as its VTK_RENDERING_BACKEND.

I would like to know

  • How can I check to see if WebGPU is running as opposed to OpenGL
  • besides the steps in the aforementioned guide above, are there specific flags that need be set in make when building VTK using dawn, perhaps there are things missing in my setup.
  • I am running on a macOS, and previously used the following in my cmake set (VTK_RENDERING_BACKEND "OpenGL2" ), would the following be sufficient.?

set (VTK_ENABLE_WEBGPU 1 CACHE BOOL )
set (VTK_GRAPHICS_BACKEND “WEBGPU”)

Hi @Seun

set VTK_GRAPHICS_BACKEND equal to “WEBGPU” in your shell environment, not in the cmake.

How can I check to see if WebGPU is running as opposed to OpenGL

  • How can I check to see if WebGPU is running as opposed to OpenGL

VTK does not yet have a webgpu render window using Cocoa. It is being devloped.
Normally, VTK will display Metal or Vulkan or D3D12 in the window title.

Thanks for the quick response, I’ll give this a shot.

Since rendering with cocoa isn’t ready yet, is it safe to assume that Metal is. If this is the case, does that mean that I’ll have to set

set (VTK_RENDERING_BACKEND “Metal” )

Hi @Seun,

It should be sufficient for you to

  1. set (VTK_ENABLE_WEBGPU 1 CACHE BOOL ) in your CMake or pass -DVTK_ENABLE_WEBGPU:BOOL=ON when building VTK.
  2. Set the environment variable VTK_GRAPHICS_BACKEND = “WEBGPU”. The other alternative is “OPENGL”.

To clarify, Cocoa is a window framework which provides a connection to Metal or OpenGL in macOS. If you’re familiar with linux, Cocoa serves a similar purpose to X or wayland.

Please ignore the cmake setting VTK_RENDERING_BACKEND. We don’t use that anymore as far as webgpu is concerned.

Even though the window stuff is a work-in-progress, you can still get a taste of webgpu compute pipelines because those do not require a window - https://www.kitware.com/webgpu-compute-api-in-vtk/

Solid! I have the 2 bullet points setup, I’ll ignore that cmake setting and take a look at the link to get a feel for it, thanks a lot for the clarification.