VTK  9.7.20260913
vtkWebGPUConfigurationInternals.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
3
4#ifndef vtkWebGPUConfigurationInternals_h
5#define vtkWebGPUConfigurationInternals_h
6
7#include "Private/vtkWebGPUHandle.h" // for the handle types
9#include "vtk_wgpu.h"
10
11#include <atomic>
12#include <vector>
13
14VTK_ABI_NAMESPACE_BEGIN
16{
17public:
19
20 vtkWebGPU::Adapter Adapter;
21 vtkWebGPU::Device Device;
22 std::atomic<bool> RequestComplete{ false };
23 bool DeviceReady = false;
24 bool Timedout = false;
25
26 // in milliseconds
27 static double DefaultTimeout;
28 // We only keep one webgpu Instance around.
29 static vtkWebGPU::Instance Instance;
30 // Helps clean up the instance after it is no longer needed.
31 static std::size_t InstanceCount;
32
33 WGPULimits RequiredLimits = WGPU_LIMITS_INIT;
34 std::vector<WGPUFeatureName> RequiredFeatures;
35
36 // Buffers whose last reference must not be dropped inside a WebGPU callback.
37 // See vtkWebGPUConfiguration::DeferBufferRelease.
38 // Buffers whose last reference must not be dropped inside a WebGPU callback;
39 // see vtkWebGPUConfiguration::DeferBufferRelease.
40 std::vector<vtkWebGPU::Buffer> BuffersPendingRelease;
41
42 static void AddInstanceRef();
43
44 static void ReleaseInstanceRef();
45
47
49
50 static WGPUPowerPreference ToWGPUPowerPreferenceType(
52
57 void PopulateRequiredLimits(WGPUAdapter adapter);
58
64};
65VTK_ABI_NAMESPACE_END
66
67#endif
68// VTK-HeaderTest-Exclude: vtkWebGPUConfigurationInternals.h
void PopulateRequiredFeatures()
Stores the required features for querying the device in the RequiredFeatures vector of this Configura...
std::vector< vtkWebGPU::Buffer > BuffersPendingRelease
static WGPUPowerPreference ToWGPUPowerPreferenceType(vtkWebGPUConfiguration::PowerPreferenceType powerPreference)
static WGPUBackendType ToWGPUBackendType(vtkWebGPUConfiguration::BackendType backend)
std::vector< WGPUFeatureName > RequiredFeatures
void PopulateRequiredLimits(WGPUAdapter adapter)
Stores the required limits needed for querying the device in the RequiredLimits attribute of this Con...
static vtkWebGPUConfiguration::BackendType FromWGPUBackendType(WGPUBackendType backend)
PowerPreferenceType
These enums have a one-one correspondence with the webgpu enums.
Reference-counted ownership for WebGPU C API handles.