react-native-wgpu 0.1.23 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cpp/dawn/dawn_proc_table.h +17 -25
- package/cpp/dawn/native/D3D11Backend.h +7 -0
- package/cpp/dawn/native/DawnNative.h +70 -26
- package/cpp/dawn/native/WebGPUBackend.h +35 -0
- package/cpp/dawn/platform/DawnPlatform.h +1 -0
- package/cpp/dawn/webgpu_cpp_print.h +338 -293
- package/cpp/dawn_logging.cpp +122 -0
- package/cpp/rnwgpu/SurfaceRegistry.h +3 -2
- package/cpp/rnwgpu/api/Convertors.h +38 -42
- package/cpp/rnwgpu/api/GPU.cpp +20 -18
- package/cpp/rnwgpu/api/GPU.h +6 -2
- package/cpp/rnwgpu/api/GPUAdapter.cpp +49 -40
- package/cpp/rnwgpu/api/GPUBuffer.cpp +21 -19
- package/cpp/rnwgpu/api/GPUCanvasContext.cpp +1 -0
- package/cpp/rnwgpu/api/GPUCommandEncoder.cpp +6 -6
- package/cpp/rnwgpu/api/GPUCompilationInfo.h +0 -9
- package/cpp/rnwgpu/api/GPUDevice.cpp +7 -10
- package/cpp/rnwgpu/api/GPUFeatures.h +5 -14
- package/cpp/rnwgpu/api/GPUQueue.cpp +4 -4
- package/cpp/rnwgpu/api/GPUShaderModule.cpp +0 -3
- package/cpp/rnwgpu/api/GPUSupportedLimits.cpp +31 -35
- package/cpp/rnwgpu/api/GPUSupportedLimits.h +3 -7
- package/cpp/rnwgpu/api/descriptors/Unions.h +8 -28
- package/cpp/webgpu/webgpu.h +2197 -1863
- package/cpp/webgpu/webgpu_cpp.h +2800 -2479
- package/cpp/webgpu/webgpu_cpp_print.h +33 -0
- package/cpp/webgpu/webgpu_glfw.h +17 -0
- package/lib/typescript/src/__tests__/components/meshes/mesh.d.ts.map +1 -1
- package/lib/typescript/src/__tests__/setup.d.ts.map +1 -1
- package/lib/typescript/src/hooks.d.ts.map +1 -1
- package/libs/android/arm64-v8a/libwebgpu_dawn.so +0 -0
- package/libs/android/armeabi-v7a/libwebgpu_dawn.so +0 -0
- package/libs/android/x86/libwebgpu_dawn.so +0 -0
- package/libs/android/x86_64/libwebgpu_dawn.so +0 -0
- package/libs/apple/arm64_iphoneos/libwebgpu_dawn.a +0 -0
- package/libs/apple/arm64_iphonesimulator/libwebgpu_dawn.a +0 -0
- package/libs/apple/arm64_xros/libwebgpu_dawn.a +0 -0
- package/libs/apple/arm64_xrsimulator/libwebgpu_dawn.a +0 -0
- package/libs/apple/iphonesimulator/libwebgpu_dawn.a +0 -0
- package/libs/apple/libwebgpu_dawn.xcframework/Info.plist +11 -11
- package/libs/apple/libwebgpu_dawn.xcframework/ios-arm64/libwebgpu_dawn.a +0 -0
- package/libs/apple/libwebgpu_dawn.xcframework/ios-arm64_x86_64-simulator/libwebgpu_dawn.a +0 -0
- package/libs/apple/libwebgpu_dawn.xcframework/macos-arm64_x86_64/libwebgpu_dawn.a +0 -0
- package/libs/apple/libwebgpu_dawn.xcframework/xros-arm64/libwebgpu_dawn.a +0 -0
- package/libs/apple/libwebgpu_dawn.xcframework/xros-arm64-simulator/libwebgpu_dawn.a +0 -0
- package/libs/apple/universal_macosx/libwebgpu_dawn.a +0 -0
- package/libs/apple/x86_64_iphonesimulator/libwebgpu_dawn.a +0 -0
- package/libs/dawn.json +659 -798
- package/package.json +4 -4
|
@@ -8,24 +8,25 @@
|
|
|
8
8
|
typedef struct DawnProcTable {
|
|
9
9
|
WGPUProcAdapterInfoFreeMembers adapterInfoFreeMembers;
|
|
10
10
|
WGPUProcAdapterPropertiesMemoryHeapsFreeMembers adapterPropertiesMemoryHeapsFreeMembers;
|
|
11
|
+
WGPUProcAdapterPropertiesSubgroupMatrixConfigsFreeMembers adapterPropertiesSubgroupMatrixConfigsFreeMembers;
|
|
11
12
|
WGPUProcCreateInstance createInstance;
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
WGPUProcDawnDrmFormatCapabilitiesFreeMembers dawnDrmFormatCapabilitiesFreeMembers;
|
|
14
|
+
WGPUProcGetInstanceCapabilities getInstanceCapabilities;
|
|
14
15
|
WGPUProcGetProcAddress getProcAddress;
|
|
15
16
|
WGPUProcSharedBufferMemoryEndAccessStateFreeMembers sharedBufferMemoryEndAccessStateFreeMembers;
|
|
16
17
|
WGPUProcSharedTextureMemoryEndAccessStateFreeMembers sharedTextureMemoryEndAccessStateFreeMembers;
|
|
18
|
+
WGPUProcSupportedFeaturesFreeMembers supportedFeaturesFreeMembers;
|
|
19
|
+
WGPUProcSupportedWGSLLanguageFeaturesFreeMembers supportedWGSLLanguageFeaturesFreeMembers;
|
|
17
20
|
WGPUProcSurfaceCapabilitiesFreeMembers surfaceCapabilitiesFreeMembers;
|
|
18
21
|
|
|
19
22
|
WGPUProcAdapterCreateDevice adapterCreateDevice;
|
|
20
|
-
|
|
23
|
+
WGPUProcAdapterGetFeatures adapterGetFeatures;
|
|
21
24
|
WGPUProcAdapterGetFormatCapabilities adapterGetFormatCapabilities;
|
|
22
25
|
WGPUProcAdapterGetInfo adapterGetInfo;
|
|
23
26
|
WGPUProcAdapterGetInstance adapterGetInstance;
|
|
24
27
|
WGPUProcAdapterGetLimits adapterGetLimits;
|
|
25
28
|
WGPUProcAdapterHasFeature adapterHasFeature;
|
|
26
29
|
WGPUProcAdapterRequestDevice adapterRequestDevice;
|
|
27
|
-
WGPUProcAdapterRequestDevice2 adapterRequestDevice2;
|
|
28
|
-
WGPUProcAdapterRequestDeviceF adapterRequestDeviceF;
|
|
29
30
|
WGPUProcAdapterAddRef adapterAddRef;
|
|
30
31
|
WGPUProcAdapterRelease adapterRelease;
|
|
31
32
|
|
|
@@ -39,15 +40,15 @@ typedef struct DawnProcTable {
|
|
|
39
40
|
|
|
40
41
|
WGPUProcBufferDestroy bufferDestroy;
|
|
41
42
|
WGPUProcBufferGetConstMappedRange bufferGetConstMappedRange;
|
|
42
|
-
WGPUProcBufferGetMapState bufferGetMapState;
|
|
43
43
|
WGPUProcBufferGetMappedRange bufferGetMappedRange;
|
|
44
|
+
WGPUProcBufferGetMapState bufferGetMapState;
|
|
44
45
|
WGPUProcBufferGetSize bufferGetSize;
|
|
45
46
|
WGPUProcBufferGetUsage bufferGetUsage;
|
|
46
47
|
WGPUProcBufferMapAsync bufferMapAsync;
|
|
47
|
-
|
|
48
|
-
WGPUProcBufferMapAsyncF bufferMapAsyncF;
|
|
48
|
+
WGPUProcBufferReadMappedRange bufferReadMappedRange;
|
|
49
49
|
WGPUProcBufferSetLabel bufferSetLabel;
|
|
50
50
|
WGPUProcBufferUnmap bufferUnmap;
|
|
51
|
+
WGPUProcBufferWriteMappedRange bufferWriteMappedRange;
|
|
51
52
|
WGPUProcBufferAddRef bufferAddRef;
|
|
52
53
|
WGPUProcBufferRelease bufferRelease;
|
|
53
54
|
|
|
@@ -81,6 +82,7 @@ typedef struct DawnProcTable {
|
|
|
81
82
|
WGPUProcComputePassEncoderPopDebugGroup computePassEncoderPopDebugGroup;
|
|
82
83
|
WGPUProcComputePassEncoderPushDebugGroup computePassEncoderPushDebugGroup;
|
|
83
84
|
WGPUProcComputePassEncoderSetBindGroup computePassEncoderSetBindGroup;
|
|
85
|
+
WGPUProcComputePassEncoderSetImmediateData computePassEncoderSetImmediateData;
|
|
84
86
|
WGPUProcComputePassEncoderSetLabel computePassEncoderSetLabel;
|
|
85
87
|
WGPUProcComputePassEncoderSetPipeline computePassEncoderSetPipeline;
|
|
86
88
|
WGPUProcComputePassEncoderWriteTimestamp computePassEncoderWriteTimestamp;
|
|
@@ -98,8 +100,6 @@ typedef struct DawnProcTable {
|
|
|
98
100
|
WGPUProcDeviceCreateCommandEncoder deviceCreateCommandEncoder;
|
|
99
101
|
WGPUProcDeviceCreateComputePipeline deviceCreateComputePipeline;
|
|
100
102
|
WGPUProcDeviceCreateComputePipelineAsync deviceCreateComputePipelineAsync;
|
|
101
|
-
WGPUProcDeviceCreateComputePipelineAsync2 deviceCreateComputePipelineAsync2;
|
|
102
|
-
WGPUProcDeviceCreateComputePipelineAsyncF deviceCreateComputePipelineAsyncF;
|
|
103
103
|
WGPUProcDeviceCreateErrorBuffer deviceCreateErrorBuffer;
|
|
104
104
|
WGPUProcDeviceCreateErrorExternalTexture deviceCreateErrorExternalTexture;
|
|
105
105
|
WGPUProcDeviceCreateErrorShaderModule deviceCreateErrorShaderModule;
|
|
@@ -110,17 +110,17 @@ typedef struct DawnProcTable {
|
|
|
110
110
|
WGPUProcDeviceCreateRenderBundleEncoder deviceCreateRenderBundleEncoder;
|
|
111
111
|
WGPUProcDeviceCreateRenderPipeline deviceCreateRenderPipeline;
|
|
112
112
|
WGPUProcDeviceCreateRenderPipelineAsync deviceCreateRenderPipelineAsync;
|
|
113
|
-
WGPUProcDeviceCreateRenderPipelineAsync2 deviceCreateRenderPipelineAsync2;
|
|
114
|
-
WGPUProcDeviceCreateRenderPipelineAsyncF deviceCreateRenderPipelineAsyncF;
|
|
115
113
|
WGPUProcDeviceCreateSampler deviceCreateSampler;
|
|
116
114
|
WGPUProcDeviceCreateShaderModule deviceCreateShaderModule;
|
|
117
115
|
WGPUProcDeviceCreateTexture deviceCreateTexture;
|
|
118
116
|
WGPUProcDeviceDestroy deviceDestroy;
|
|
119
|
-
WGPUProcDeviceEnumerateFeatures deviceEnumerateFeatures;
|
|
120
117
|
WGPUProcDeviceForceLoss deviceForceLoss;
|
|
121
|
-
WGPUProcDeviceGetAHardwareBufferProperties deviceGetAHardwareBufferProperties;
|
|
122
118
|
WGPUProcDeviceGetAdapter deviceGetAdapter;
|
|
119
|
+
WGPUProcDeviceGetAdapterInfo deviceGetAdapterInfo;
|
|
120
|
+
WGPUProcDeviceGetAHardwareBufferProperties deviceGetAHardwareBufferProperties;
|
|
121
|
+
WGPUProcDeviceGetFeatures deviceGetFeatures;
|
|
123
122
|
WGPUProcDeviceGetLimits deviceGetLimits;
|
|
123
|
+
WGPUProcDeviceGetLostFuture deviceGetLostFuture;
|
|
124
124
|
WGPUProcDeviceGetQueue deviceGetQueue;
|
|
125
125
|
WGPUProcDeviceHasFeature deviceHasFeature;
|
|
126
126
|
WGPUProcDeviceImportSharedBufferMemory deviceImportSharedBufferMemory;
|
|
@@ -128,13 +128,9 @@ typedef struct DawnProcTable {
|
|
|
128
128
|
WGPUProcDeviceImportSharedTextureMemory deviceImportSharedTextureMemory;
|
|
129
129
|
WGPUProcDeviceInjectError deviceInjectError;
|
|
130
130
|
WGPUProcDevicePopErrorScope devicePopErrorScope;
|
|
131
|
-
WGPUProcDevicePopErrorScope2 devicePopErrorScope2;
|
|
132
|
-
WGPUProcDevicePopErrorScopeF devicePopErrorScopeF;
|
|
133
131
|
WGPUProcDevicePushErrorScope devicePushErrorScope;
|
|
134
|
-
WGPUProcDeviceSetDeviceLostCallback deviceSetDeviceLostCallback;
|
|
135
132
|
WGPUProcDeviceSetLabel deviceSetLabel;
|
|
136
133
|
WGPUProcDeviceSetLoggingCallback deviceSetLoggingCallback;
|
|
137
|
-
WGPUProcDeviceSetUncapturedErrorCallback deviceSetUncapturedErrorCallback;
|
|
138
134
|
WGPUProcDeviceTick deviceTick;
|
|
139
135
|
WGPUProcDeviceValidateTextureDescriptor deviceValidateTextureDescriptor;
|
|
140
136
|
WGPUProcDeviceAddRef deviceAddRef;
|
|
@@ -148,12 +144,10 @@ typedef struct DawnProcTable {
|
|
|
148
144
|
WGPUProcExternalTextureRelease externalTextureRelease;
|
|
149
145
|
|
|
150
146
|
WGPUProcInstanceCreateSurface instanceCreateSurface;
|
|
151
|
-
|
|
147
|
+
WGPUProcInstanceGetWGSLLanguageFeatures instanceGetWGSLLanguageFeatures;
|
|
152
148
|
WGPUProcInstanceHasWGSLLanguageFeature instanceHasWGSLLanguageFeature;
|
|
153
149
|
WGPUProcInstanceProcessEvents instanceProcessEvents;
|
|
154
150
|
WGPUProcInstanceRequestAdapter instanceRequestAdapter;
|
|
155
|
-
WGPUProcInstanceRequestAdapter2 instanceRequestAdapter2;
|
|
156
|
-
WGPUProcInstanceRequestAdapterF instanceRequestAdapterF;
|
|
157
151
|
WGPUProcInstanceWaitAny instanceWaitAny;
|
|
158
152
|
WGPUProcInstanceAddRef instanceAddRef;
|
|
159
153
|
WGPUProcInstanceRelease instanceRelease;
|
|
@@ -172,8 +166,6 @@ typedef struct DawnProcTable {
|
|
|
172
166
|
WGPUProcQueueCopyExternalTextureForBrowser queueCopyExternalTextureForBrowser;
|
|
173
167
|
WGPUProcQueueCopyTextureForBrowser queueCopyTextureForBrowser;
|
|
174
168
|
WGPUProcQueueOnSubmittedWorkDone queueOnSubmittedWorkDone;
|
|
175
|
-
WGPUProcQueueOnSubmittedWorkDone2 queueOnSubmittedWorkDone2;
|
|
176
|
-
WGPUProcQueueOnSubmittedWorkDoneF queueOnSubmittedWorkDoneF;
|
|
177
169
|
WGPUProcQueueSetLabel queueSetLabel;
|
|
178
170
|
WGPUProcQueueSubmit queueSubmit;
|
|
179
171
|
WGPUProcQueueWriteBuffer queueWriteBuffer;
|
|
@@ -194,6 +186,7 @@ typedef struct DawnProcTable {
|
|
|
194
186
|
WGPUProcRenderBundleEncoderPopDebugGroup renderBundleEncoderPopDebugGroup;
|
|
195
187
|
WGPUProcRenderBundleEncoderPushDebugGroup renderBundleEncoderPushDebugGroup;
|
|
196
188
|
WGPUProcRenderBundleEncoderSetBindGroup renderBundleEncoderSetBindGroup;
|
|
189
|
+
WGPUProcRenderBundleEncoderSetImmediateData renderBundleEncoderSetImmediateData;
|
|
197
190
|
WGPUProcRenderBundleEncoderSetIndexBuffer renderBundleEncoderSetIndexBuffer;
|
|
198
191
|
WGPUProcRenderBundleEncoderSetLabel renderBundleEncoderSetLabel;
|
|
199
192
|
WGPUProcRenderBundleEncoderSetPipeline renderBundleEncoderSetPipeline;
|
|
@@ -217,6 +210,7 @@ typedef struct DawnProcTable {
|
|
|
217
210
|
WGPUProcRenderPassEncoderPushDebugGroup renderPassEncoderPushDebugGroup;
|
|
218
211
|
WGPUProcRenderPassEncoderSetBindGroup renderPassEncoderSetBindGroup;
|
|
219
212
|
WGPUProcRenderPassEncoderSetBlendConstant renderPassEncoderSetBlendConstant;
|
|
213
|
+
WGPUProcRenderPassEncoderSetImmediateData renderPassEncoderSetImmediateData;
|
|
220
214
|
WGPUProcRenderPassEncoderSetIndexBuffer renderPassEncoderSetIndexBuffer;
|
|
221
215
|
WGPUProcRenderPassEncoderSetLabel renderPassEncoderSetLabel;
|
|
222
216
|
WGPUProcRenderPassEncoderSetPipeline renderPassEncoderSetPipeline;
|
|
@@ -238,8 +232,6 @@ typedef struct DawnProcTable {
|
|
|
238
232
|
WGPUProcSamplerRelease samplerRelease;
|
|
239
233
|
|
|
240
234
|
WGPUProcShaderModuleGetCompilationInfo shaderModuleGetCompilationInfo;
|
|
241
|
-
WGPUProcShaderModuleGetCompilationInfo2 shaderModuleGetCompilationInfo2;
|
|
242
|
-
WGPUProcShaderModuleGetCompilationInfoF shaderModuleGetCompilationInfoF;
|
|
243
235
|
WGPUProcShaderModuleSetLabel shaderModuleSetLabel;
|
|
244
236
|
WGPUProcShaderModuleAddRef shaderModuleAddRef;
|
|
245
237
|
WGPUProcShaderModuleRelease shaderModuleRelease;
|
|
@@ -57,6 +57,13 @@ struct DAWN_NATIVE_EXPORT SharedTextureMemoryD3D11Texture2DDescriptor : wgpu::Ch
|
|
|
57
57
|
// This ID3D11Texture2D object must be created from the same ID3D11Device used in the
|
|
58
58
|
// WGPUDevice.
|
|
59
59
|
Microsoft::WRL::ComPtr<ID3D11Texture2D> texture;
|
|
60
|
+
|
|
61
|
+
// If this flag is true, Dawn is required to signal a fence before EndAccess() and return it in
|
|
62
|
+
// SharedTextureMemoryEndAccessState's fences list.
|
|
63
|
+
// If it's false, no fence signaling is needed and EndAccess() might return empty fence list.
|
|
64
|
+
// Note: this flag is not relevant if the feature SharedFenceDXGISharedHandle is disabled/not
|
|
65
|
+
// supported.
|
|
66
|
+
bool requiresEndAccessFence = true;
|
|
60
67
|
};
|
|
61
68
|
|
|
62
69
|
} // namespace dawn::native::d3d11
|
|
@@ -89,13 +89,6 @@ class DAWN_NATIVE_EXPORT Adapter {
|
|
|
89
89
|
Adapter(const Adapter& other);
|
|
90
90
|
Adapter& operator=(const Adapter& other);
|
|
91
91
|
|
|
92
|
-
// TODO(crbug.com/347047627): These methods are historical duplicates of
|
|
93
|
-
// those in webgpu_cpp.h. Update uses of these methods and remove them.
|
|
94
|
-
wgpu::Status GetInfo(wgpu::AdapterInfo* info) const;
|
|
95
|
-
wgpu::Status GetInfo(WGPUAdapterInfo* info) const;
|
|
96
|
-
std::vector<const char*> GetSupportedFeatures() const;
|
|
97
|
-
wgpu::ConvertibleStatus GetLimits(WGPUSupportedLimits* limits) const;
|
|
98
|
-
|
|
99
92
|
void SetUseTieredLimits(bool useTieredLimits);
|
|
100
93
|
|
|
101
94
|
// Check that the Adapter is able to support importing external images. This is necessary
|
|
@@ -108,18 +101,6 @@ class DAWN_NATIVE_EXPORT Adapter {
|
|
|
108
101
|
WGPUDevice CreateDevice(const wgpu::DeviceDescriptor* deviceDescriptor);
|
|
109
102
|
WGPUDevice CreateDevice(const WGPUDeviceDescriptor* deviceDescriptor = nullptr);
|
|
110
103
|
|
|
111
|
-
void RequestDevice(const wgpu::DeviceDescriptor* descriptor,
|
|
112
|
-
WGPURequestDeviceCallback callback,
|
|
113
|
-
void* userdata);
|
|
114
|
-
void RequestDevice(const WGPUDeviceDescriptor* descriptor,
|
|
115
|
-
WGPURequestDeviceCallback callback,
|
|
116
|
-
void* userdata);
|
|
117
|
-
void RequestDevice(std::nullptr_t descriptor,
|
|
118
|
-
WGPURequestDeviceCallback callback,
|
|
119
|
-
void* userdata) {
|
|
120
|
-
RequestDevice(static_cast<const wgpu::DeviceDescriptor*>(descriptor), callback, userdata);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
104
|
// Returns the underlying WGPUAdapter object.
|
|
124
105
|
WGPUAdapter Get() const;
|
|
125
106
|
|
|
@@ -142,8 +123,40 @@ struct DAWN_NATIVE_EXPORT DawnInstanceDescriptor : wgpu::ChainedStruct {
|
|
|
142
123
|
BackendValidationLevel backendValidationLevel = BackendValidationLevel::Disabled;
|
|
143
124
|
bool beginCaptureOnStartup = false;
|
|
144
125
|
|
|
145
|
-
|
|
146
|
-
|
|
126
|
+
WGPULoggingCallbackInfo loggingCallbackInfo = WGPU_LOGGING_CALLBACK_INFO_INIT;
|
|
127
|
+
|
|
128
|
+
template <typename F,
|
|
129
|
+
typename T,
|
|
130
|
+
typename Cb = wgpu::LoggingCallback<T>,
|
|
131
|
+
typename = std::enable_if_t<std::is_convertible_v<F, Cb*>>>
|
|
132
|
+
void SetLoggingCallback(F callback, T userdata) {
|
|
133
|
+
assert(loggingCallbackInfo.callback == nullptr);
|
|
134
|
+
|
|
135
|
+
loggingCallbackInfo.callback = [](WGPULoggingType type, struct WGPUStringView message,
|
|
136
|
+
void* callback_param, void* userdata_param) {
|
|
137
|
+
auto cb = reinterpret_cast<Cb*>(callback_param);
|
|
138
|
+
(*cb)(static_cast<wgpu::LoggingType>(type), message, static_cast<T>(userdata_param));
|
|
139
|
+
};
|
|
140
|
+
loggingCallbackInfo.userdata1 = reinterpret_cast<void*>(+callback);
|
|
141
|
+
loggingCallbackInfo.userdata2 = reinterpret_cast<void*>(userdata);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
template <typename L,
|
|
145
|
+
typename Cb = wgpu::LoggingCallback<>,
|
|
146
|
+
typename = std::enable_if_t<std::is_convertible_v<L, Cb>>>
|
|
147
|
+
void SetLoggingCallback(L callback) {
|
|
148
|
+
assert(loggingCallbackInfo.callback == nullptr);
|
|
149
|
+
using F = wgpu::LoggingCallback<void>;
|
|
150
|
+
static_assert(std::is_convertible_v<L, F*>, "Logging callback cannot be a binding lambda");
|
|
151
|
+
|
|
152
|
+
loggingCallbackInfo.callback = [](WGPULoggingType type, struct WGPUStringView message,
|
|
153
|
+
void* callback_param, void*) {
|
|
154
|
+
auto cb = reinterpret_cast<F*>(callback_param);
|
|
155
|
+
(*cb)(static_cast<wgpu::LoggingType>(type), message);
|
|
156
|
+
};
|
|
157
|
+
loggingCallbackInfo.userdata1 = reinterpret_cast<void*>(+callback);
|
|
158
|
+
loggingCallbackInfo.userdata2 = nullptr;
|
|
159
|
+
}
|
|
147
160
|
|
|
148
161
|
// Equality operators, mostly for testing. Note that this tests
|
|
149
162
|
// strict pointer-pointer equality if the struct contains member pointers.
|
|
@@ -158,6 +171,7 @@ struct DAWN_NATIVE_EXPORT DawnInstanceDescriptor : wgpu::ChainedStruct {
|
|
|
158
171
|
class DAWN_NATIVE_EXPORT Instance {
|
|
159
172
|
public:
|
|
160
173
|
explicit Instance(const WGPUInstanceDescriptor* desc = nullptr);
|
|
174
|
+
explicit Instance(const wgpu::InstanceDescriptor* desc);
|
|
161
175
|
explicit Instance(InstanceBase* impl);
|
|
162
176
|
~Instance();
|
|
163
177
|
|
|
@@ -301,12 +315,42 @@ class DAWN_NATIVE_EXPORT MemoryDump {
|
|
|
301
315
|
};
|
|
302
316
|
DAWN_NATIVE_EXPORT void DumpMemoryStatistics(WGPUDevice device, MemoryDump* dump);
|
|
303
317
|
|
|
304
|
-
//
|
|
305
|
-
|
|
306
|
-
|
|
318
|
+
// Intended for background tracing for UMA that returns the estimated memory usage.
|
|
319
|
+
struct DAWN_NATIVE_EXPORT MemoryUsageInfo {
|
|
320
|
+
// Total memory usage.
|
|
321
|
+
uint64_t totalUsage;
|
|
322
|
+
// Total depth stencil textures' memory.
|
|
323
|
+
uint64_t depthStencilTexturesUsage;
|
|
324
|
+
// Total MSAA textures' memory.
|
|
325
|
+
uint64_t msaaTexturesUsage;
|
|
326
|
+
// Number of MSAA textures.
|
|
327
|
+
uint64_t msaaTexturesCount;
|
|
328
|
+
// Largest MSAA texture's memory.
|
|
329
|
+
uint64_t largestMsaaTextureUsage;
|
|
330
|
+
// Total textures' memory.
|
|
331
|
+
uint64_t texturesUsage;
|
|
332
|
+
// Total buffers' memory.
|
|
333
|
+
uint64_t buffersUsage;
|
|
334
|
+
};
|
|
335
|
+
DAWN_NATIVE_EXPORT MemoryUsageInfo ComputeEstimatedMemoryUsageInfo(WGPUDevice device);
|
|
336
|
+
|
|
337
|
+
// Memory information gathered from backend specific allocators.
|
|
338
|
+
// - memory allocated by clients for objects such as buffers, textures.
|
|
339
|
+
// - heap memory used by the allocator for allocations.
|
|
340
|
+
struct DAWN_NATIVE_EXPORT AllocatorMemoryInfo {
|
|
341
|
+
uint64_t totalUsedMemory = 0;
|
|
342
|
+
uint64_t totalAllocatedMemory = 0;
|
|
343
|
+
};
|
|
344
|
+
DAWN_NATIVE_EXPORT AllocatorMemoryInfo GetAllocatorMemoryInfo(WGPUDevice device);
|
|
345
|
+
|
|
346
|
+
// Free any unused GPU memory like staging buffers, cached resources, etc. Returns true if there are
|
|
347
|
+
// still objects to delete and ReduceMemoryUsage() should be run again after a short delay to allow
|
|
348
|
+
// submitted work to complete.
|
|
349
|
+
DAWN_NATIVE_EXPORT bool ReduceMemoryUsage(WGPUDevice device);
|
|
307
350
|
|
|
308
|
-
//
|
|
309
|
-
|
|
351
|
+
// Perform tasks that are appropriate to do when idle like serializing pipeline
|
|
352
|
+
// caches, etc.
|
|
353
|
+
DAWN_NATIVE_EXPORT void PerformIdleTasks(const wgpu::Device& device);
|
|
310
354
|
|
|
311
355
|
} // namespace dawn::native
|
|
312
356
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Copyright 2025 The Dawn & Tint Authors
|
|
2
|
+
//
|
|
3
|
+
// Redistribution and use in source and binary forms, with or without
|
|
4
|
+
// modification, are permitted provided that the following conditions are met:
|
|
5
|
+
//
|
|
6
|
+
// 1. Redistributions of source code must retain the above copyright notice, this
|
|
7
|
+
// list of conditions and the following disclaimer.
|
|
8
|
+
//
|
|
9
|
+
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
10
|
+
// this list of conditions and the following disclaimer in the documentation
|
|
11
|
+
// and/or other materials provided with the distribution.
|
|
12
|
+
//
|
|
13
|
+
// 3. Neither the name of the copyright holder nor the names of its
|
|
14
|
+
// contributors may be used to endorse or promote products derived from
|
|
15
|
+
// this software without specific prior written permission.
|
|
16
|
+
//
|
|
17
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
18
|
+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
19
|
+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
20
|
+
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
21
|
+
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
22
|
+
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
23
|
+
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
24
|
+
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
25
|
+
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
26
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
+
|
|
28
|
+
#ifndef INCLUDE_DAWN_NATIVE_WEBGPUBACKEND_H_
|
|
29
|
+
#define INCLUDE_DAWN_NATIVE_WEBGPUBACKEND_H_
|
|
30
|
+
|
|
31
|
+
#include "dawn/native/DawnNative.h"
|
|
32
|
+
|
|
33
|
+
namespace dawn::native::webgpu {} // namespace dawn::native::webgpu
|
|
34
|
+
|
|
35
|
+
#endif // INCLUDE_DAWN_NATIVE_WEBGPUBACKEND_H_
|