@@ -51,6 +51,7 @@ macro_rules! impl_send_sync {
51
51
} ;
52
52
}
53
53
54
+ #[ derive( Clone ) ]
54
55
pub struct ContextWebGpu {
55
56
/// `None` if browser does not advertise support for WebGPU.
56
57
gpu : Option < DefinedNonNullJsValue < webgpu_sys:: Gpu > > ,
@@ -86,7 +87,7 @@ impl crate::Error {
86
87
}
87
88
}
88
89
89
- #[ derive( Debug ) ]
90
+ #[ derive( Debug , Clone ) ]
90
91
pub struct WebShaderModule {
91
92
module : webgpu_sys:: GpuShaderModule ,
92
93
compilation_info : WebShaderCompilationInfo ,
@@ -1107,7 +1108,7 @@ extern "C" {
1107
1108
fn worker ( this : & Global ) -> JsValue ;
1108
1109
}
1109
1110
1110
- #[ derive( Debug ) ]
1111
+ #[ derive( Debug , Clone ) ]
1111
1112
pub enum Canvas {
1112
1113
Canvas ( web_sys:: HtmlCanvasElement ) ,
1113
1114
Offscreen ( web_sys:: OffscreenCanvas ) ,
@@ -1147,49 +1148,49 @@ pub fn get_browser_gpu_property(
1147
1148
Ok ( DefinedNonNullJsValue :: new ( maybe_undefined_gpu) )
1148
1149
}
1149
1150
1150
- #[ derive( Debug ) ]
1151
+ #[ derive( Debug , Clone ) ]
1151
1152
pub struct WebAdapter {
1152
1153
pub ( crate ) inner : webgpu_sys:: GpuAdapter ,
1153
1154
/// Unique identifier for this Adapter.
1154
1155
ident : crate :: cmp:: Identifier ,
1155
1156
}
1156
1157
1157
- #[ derive( Debug ) ]
1158
+ #[ derive( Debug , Clone ) ]
1158
1159
pub struct WebDevice {
1159
1160
pub ( crate ) inner : webgpu_sys:: GpuDevice ,
1160
1161
/// Unique identifier for this Device.
1161
1162
ident : crate :: cmp:: Identifier ,
1162
1163
}
1163
1164
1164
- #[ derive( Debug ) ]
1165
+ #[ derive( Debug , Clone ) ]
1165
1166
pub struct WebQueue {
1166
1167
pub ( crate ) inner : webgpu_sys:: GpuQueue ,
1167
1168
/// Unique identifier for this Queue.
1168
1169
ident : crate :: cmp:: Identifier ,
1169
1170
}
1170
1171
1171
- #[ derive( Debug ) ]
1172
+ #[ derive( Debug , Clone ) ]
1172
1173
pub struct WebBindGroupLayout {
1173
1174
pub ( crate ) inner : webgpu_sys:: GpuBindGroupLayout ,
1174
1175
/// Unique identifier for this BindGroupLayout.
1175
1176
ident : crate :: cmp:: Identifier ,
1176
1177
}
1177
1178
1178
- #[ derive( Debug ) ]
1179
+ #[ derive( Debug , Clone ) ]
1179
1180
pub struct WebBindGroup {
1180
1181
pub ( crate ) inner : webgpu_sys:: GpuBindGroup ,
1181
1182
/// Unique identifier for this BindGroup.
1182
1183
ident : crate :: cmp:: Identifier ,
1183
1184
}
1184
1185
1185
- #[ derive( Debug ) ]
1186
+ #[ derive( Debug , Clone ) ]
1186
1187
pub struct WebTextureView {
1187
1188
pub ( crate ) inner : webgpu_sys:: GpuTextureView ,
1188
1189
/// Unique identifier for this TextureView.
1189
1190
ident : crate :: cmp:: Identifier ,
1190
1191
}
1191
1192
1192
- #[ derive( Debug ) ]
1193
+ #[ derive( Debug , Clone ) ]
1193
1194
pub struct WebSampler {
1194
1195
pub ( crate ) inner : webgpu_sys:: GpuSampler ,
1195
1196
/// Unique identifier for this Sampler.
@@ -1198,7 +1199,7 @@ pub struct WebSampler {
1198
1199
1199
1200
/// Remembers which portion of a buffer has been mapped, along with a reference
1200
1201
/// to the mapped portion.
1201
- #[ derive( Debug ) ]
1202
+ #[ derive( Debug , Clone ) ]
1202
1203
struct WebBufferMapState {
1203
1204
/// The mapped memory of the buffer.
1204
1205
pub mapped_buffer : Option < js_sys:: ArrayBuffer > ,
@@ -1210,7 +1211,7 @@ struct WebBufferMapState {
1210
1211
/// The WebGPU specification forbids calling `getMappedRange` on a `webgpu_sys::GpuBuffer` more than
1211
1212
/// once, so this struct stores the initial mapped range and re-uses it, allowing for multiple `get_mapped_range`
1212
1213
/// calls on the Rust-side.
1213
- #[ derive( Debug ) ]
1214
+ #[ derive( Debug , Clone ) ]
1214
1215
pub struct WebBuffer {
1215
1216
/// The associated GPU buffer.
1216
1217
inner : webgpu_sys:: GpuBuffer ,
@@ -1258,66 +1259,66 @@ impl WebBuffer {
1258
1259
}
1259
1260
}
1260
1261
1261
- #[ derive( Debug ) ]
1262
+ #[ derive( Debug , Clone ) ]
1262
1263
pub struct WebTexture {
1263
1264
pub ( crate ) inner : webgpu_sys:: GpuTexture ,
1264
1265
/// Unique identifier for this Texture.
1265
1266
ident : crate :: cmp:: Identifier ,
1266
1267
}
1267
1268
1268
- #[ derive( Debug ) ]
1269
+ #[ derive( Debug , Clone ) ]
1269
1270
pub struct WebExternalTexture {
1270
1271
/// Unique identifier for this ExternalTexture.
1271
1272
ident : crate :: cmp:: Identifier ,
1272
1273
}
1273
1274
1274
- #[ derive( Debug ) ]
1275
+ #[ derive( Debug , Clone ) ]
1275
1276
pub struct WebBlas {
1276
1277
/// Unique identifier for this Blas.
1277
1278
ident : crate :: cmp:: Identifier ,
1278
1279
}
1279
1280
1280
- #[ derive( Debug ) ]
1281
+ #[ derive( Debug , Clone ) ]
1281
1282
pub struct WebTlas {
1282
1283
/// Unique identifier for this Blas.
1283
1284
ident : crate :: cmp:: Identifier ,
1284
1285
}
1285
1286
1286
- #[ derive( Debug ) ]
1287
+ #[ derive( Debug , Clone ) ]
1287
1288
pub struct WebQuerySet {
1288
1289
pub ( crate ) inner : webgpu_sys:: GpuQuerySet ,
1289
1290
/// Unique identifier for this QuerySet.
1290
1291
ident : crate :: cmp:: Identifier ,
1291
1292
}
1292
1293
1293
- #[ derive( Debug ) ]
1294
+ #[ derive( Debug , Clone ) ]
1294
1295
pub struct WebPipelineLayout {
1295
1296
pub ( crate ) inner : webgpu_sys:: GpuPipelineLayout ,
1296
1297
/// Unique identifier for this PipelineLayout.
1297
1298
ident : crate :: cmp:: Identifier ,
1298
1299
}
1299
1300
1300
- #[ derive( Debug ) ]
1301
+ #[ derive( Debug , Clone ) ]
1301
1302
pub struct WebRenderPipeline {
1302
1303
pub ( crate ) inner : webgpu_sys:: GpuRenderPipeline ,
1303
1304
/// Unique identifier for this RenderPipeline.
1304
1305
ident : crate :: cmp:: Identifier ,
1305
1306
}
1306
1307
1307
- #[ derive( Debug ) ]
1308
+ #[ derive( Debug , Clone ) ]
1308
1309
pub struct WebComputePipeline {
1309
1310
pub ( crate ) inner : webgpu_sys:: GpuComputePipeline ,
1310
1311
/// Unique identifier for this ComputePipeline.
1311
1312
ident : crate :: cmp:: Identifier ,
1312
1313
}
1313
1314
1314
- #[ derive( Debug ) ]
1315
+ #[ derive( Debug , Clone ) ]
1315
1316
pub struct WebPipelineCache {
1316
1317
/// Unique identifier for this PipelineCache.
1317
1318
ident : crate :: cmp:: Identifier ,
1318
1319
}
1319
1320
1320
- #[ derive( Debug ) ]
1321
+ #[ derive( Debug , Clone ) ]
1321
1322
pub struct WebCommandEncoder {
1322
1323
pub ( crate ) inner : webgpu_sys:: GpuCommandEncoder ,
1323
1324
/// Unique identifier for this CommandEncoder.
@@ -1345,21 +1346,21 @@ pub struct WebCommandBuffer {
1345
1346
ident : crate :: cmp:: Identifier ,
1346
1347
}
1347
1348
1348
- #[ derive( Debug ) ]
1349
+ #[ derive( Debug , Clone ) ]
1349
1350
pub struct WebRenderBundleEncoder {
1350
1351
pub ( crate ) inner : webgpu_sys:: GpuRenderBundleEncoder ,
1351
1352
/// Unique identifier for this RenderBundleEncoder.
1352
1353
ident : crate :: cmp:: Identifier ,
1353
1354
}
1354
1355
1355
- #[ derive( Debug ) ]
1356
+ #[ derive( Debug , Clone ) ]
1356
1357
pub struct WebRenderBundle {
1357
1358
pub ( crate ) inner : webgpu_sys:: GpuRenderBundle ,
1358
1359
/// Unique identifier for this RenderBundle.
1359
1360
ident : crate :: cmp:: Identifier ,
1360
1361
}
1361
1362
1362
- #[ derive( Debug ) ]
1363
+ #[ derive( Debug , Clone ) ]
1363
1364
pub struct WebSurface {
1364
1365
gpu : Option < DefinedNonNullJsValue < webgpu_sys:: Gpu > > ,
1365
1366
canvas : Canvas ,
@@ -1368,7 +1369,7 @@ pub struct WebSurface {
1368
1369
ident : crate :: cmp:: Identifier ,
1369
1370
}
1370
1371
1371
- #[ derive( Debug ) ]
1372
+ #[ derive( Debug , Clone ) ]
1372
1373
pub struct WebSurfaceOutputDetail {
1373
1374
/// Unique identifier for this SurfaceOutputDetail.
1374
1375
ident : crate :: cmp:: Identifier ,
0 commit comments