Add Graphics Backend Preference Option For WebGPU Render Window#
vtkWebGPURenderWindow now provides a way to choose a graphics backend
at runtime. The available backends vary on different operating systems.
Here are the available backends:
D3D11
D3D12
OpenGL
OpenGL ES
Metal
Vulkan
VTK pre-initializes the render window with a suitable default backend. They are:
D3D12 on Windows
Metal on macOS
Vulkan everywhere else
In case a backend is unavailable, the webgpu implementation (Dawn) may fallback to a suitable default or fail to return an adapter.
You may indicate preference like so:
vtkNew<vtkRenderWindow> renWin
// requests webgpu implementation for a D3D12 backend
renderWindow->SetBackendTypeToD3D12();
// Similarly,
// renderWindow->SetBackendTypeToD3D11();
// renderWindow->SetBackendTypeToOpenGL();
// renderWindow->SetBackendTypeToOpenGLES();
// renderWindow->SetBackendTypeToMetal();
// renderWindow->SetBackendTypeToVulkan();
//..
renderWindow->Render();