react-native-wgpu 0.2.0 → 0.2.2
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/android/CMakeLists.txt +1 -1
- package/android/build.gradle +2 -1
- package/android/src/main/java/com/webgpu/WebGPUAHBView.java +247 -45
- package/android/src/main/java/com/webgpu/WebGPUView.java +4 -4
- package/apple/ApplePlatformContext.h +1 -0
- package/apple/RNWGUIKit.h +5 -0
- package/apple/platform/ThreadUtils.cpp +1 -0
- package/cpp/WGPULogger.h +1 -0
- package/cpp/dawn/dawn_proc_table.h +31 -10
- package/cpp/dawn/native/D3D11Backend.h +8 -2
- package/cpp/dawn/native/D3DBackend.h +0 -3
- package/cpp/dawn/native/DawnNative.h +4 -0
- package/cpp/dawn/platform/DawnPlatform.h +2 -1
- package/cpp/dawn/webgpu_cpp_print.h +202 -25
- package/cpp/dawn_logging.cpp +3 -6
- package/cpp/jsi/RNFHybridObject.cpp +2 -1
- package/cpp/jsi/RNFJSIConverter.h +5 -2
- package/cpp/jsi/RNFPromise.cpp +2 -0
- package/cpp/jsi/RNFWorkletRuntimeRegistry.cpp +1 -0
- package/cpp/rnwgpu/SurfaceRegistry.h +1 -0
- package/cpp/rnwgpu/api/GPU.cpp +5 -1
- package/cpp/rnwgpu/api/GPU.h +7 -3
- package/cpp/rnwgpu/api/GPUAdapter.cpp +3 -0
- package/cpp/rnwgpu/api/GPUBuffer.cpp +1 -0
- package/cpp/rnwgpu/api/GPUCanvasContext.cpp +1 -0
- package/cpp/rnwgpu/api/GPUCanvasContext.h +1 -0
- package/cpp/rnwgpu/api/GPUCommandEncoder.cpp +2 -0
- package/cpp/rnwgpu/api/GPUComputePassEncoder.cpp +2 -0
- package/cpp/rnwgpu/api/GPUComputePipeline.cpp +1 -0
- package/cpp/rnwgpu/api/GPUDevice.cpp +3 -0
- package/cpp/rnwgpu/api/GPUDeviceLostInfo.cpp +1 -0
- package/cpp/rnwgpu/api/GPUQueue.cpp +9 -5
- package/cpp/rnwgpu/api/GPURenderBundleEncoder.cpp +3 -0
- package/cpp/rnwgpu/api/GPURenderPassEncoder.cpp +4 -0
- package/cpp/rnwgpu/api/GPUShaderModule.cpp +1 -0
- package/cpp/rnwgpu/api/descriptors/Unions.h +3 -2
- package/cpp/threading/Dispatcher.cpp +2 -1
- package/cpp/threading/ThreadPool.cpp +2 -0
- package/cpp/webgpu/webgpu.h +571 -261
- package/cpp/webgpu/webgpu_cpp.h +871 -313
- package/lib/typescript/src/__tests__/setup.d.ts +0 -1
- package/lib/typescript/src/__tests__/setup.d.ts.map +1 -1
- package/libs/android/arm64-v8a/libwebgpu_dawn.a +0 -0
- package/libs/android/arm64-v8a/libwebgpu_dawn.so +0 -0
- package/libs/android/armeabi-v7a/libwebgpu_dawn.a +0 -0
- package/libs/android/armeabi-v7a/libwebgpu_dawn.so +0 -0
- package/libs/android/x86/libwebgpu_dawn.a +0 -0
- package/libs/android/x86/libwebgpu_dawn.so +0 -0
- package/libs/android/x86_64/libwebgpu_dawn.a +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 +10 -10
- 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 +422 -206
- package/package.json +1 -1
- package/src/__tests__/Constants.spec.ts +2 -4
- package/src/__tests__/Device.spec.ts +42 -24
- package/src/__tests__/GPU.spec.ts +115 -105
- package/src/__tests__/setup.ts +0 -1
|
@@ -341,6 +341,35 @@ namespace wgpu {
|
|
|
341
341
|
return o;
|
|
342
342
|
}
|
|
343
343
|
template <typename CharT, typename Traits>
|
|
344
|
+
std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, ComponentSwizzle value) {
|
|
345
|
+
switch (value) {
|
|
346
|
+
case ComponentSwizzle::Undefined:
|
|
347
|
+
o << "ComponentSwizzle::Undefined";
|
|
348
|
+
break;
|
|
349
|
+
case ComponentSwizzle::Zero:
|
|
350
|
+
o << "ComponentSwizzle::Zero";
|
|
351
|
+
break;
|
|
352
|
+
case ComponentSwizzle::One:
|
|
353
|
+
o << "ComponentSwizzle::One";
|
|
354
|
+
break;
|
|
355
|
+
case ComponentSwizzle::R:
|
|
356
|
+
o << "ComponentSwizzle::R";
|
|
357
|
+
break;
|
|
358
|
+
case ComponentSwizzle::G:
|
|
359
|
+
o << "ComponentSwizzle::G";
|
|
360
|
+
break;
|
|
361
|
+
case ComponentSwizzle::B:
|
|
362
|
+
o << "ComponentSwizzle::B";
|
|
363
|
+
break;
|
|
364
|
+
case ComponentSwizzle::A:
|
|
365
|
+
o << "ComponentSwizzle::A";
|
|
366
|
+
break;
|
|
367
|
+
default:
|
|
368
|
+
o << "ComponentSwizzle::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<ComponentSwizzle>::type>(value);
|
|
369
|
+
}
|
|
370
|
+
return o;
|
|
371
|
+
}
|
|
372
|
+
template <typename CharT, typename Traits>
|
|
344
373
|
std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, CompositeAlphaMode value) {
|
|
345
374
|
switch (value) {
|
|
346
375
|
case CompositeAlphaMode::Auto:
|
|
@@ -424,6 +453,20 @@ namespace wgpu {
|
|
|
424
453
|
return o;
|
|
425
454
|
}
|
|
426
455
|
template <typename CharT, typename Traits>
|
|
456
|
+
std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, DynamicBindingKind value) {
|
|
457
|
+
switch (value) {
|
|
458
|
+
case DynamicBindingKind::Undefined:
|
|
459
|
+
o << "DynamicBindingKind::Undefined";
|
|
460
|
+
break;
|
|
461
|
+
case DynamicBindingKind::SampledTexture:
|
|
462
|
+
o << "DynamicBindingKind::SampledTexture";
|
|
463
|
+
break;
|
|
464
|
+
default:
|
|
465
|
+
o << "DynamicBindingKind::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<DynamicBindingKind>::type>(value);
|
|
466
|
+
}
|
|
467
|
+
return o;
|
|
468
|
+
}
|
|
469
|
+
template <typename CharT, typename Traits>
|
|
427
470
|
std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, ErrorFilter value) {
|
|
428
471
|
switch (value) {
|
|
429
472
|
case ErrorFilter::Validation:
|
|
@@ -503,15 +546,15 @@ namespace wgpu {
|
|
|
503
546
|
template <typename CharT, typename Traits>
|
|
504
547
|
std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, FeatureName value) {
|
|
505
548
|
switch (value) {
|
|
549
|
+
case FeatureName::CoreFeaturesAndLimits:
|
|
550
|
+
o << "FeatureName::CoreFeaturesAndLimits";
|
|
551
|
+
break;
|
|
506
552
|
case FeatureName::DepthClipControl:
|
|
507
553
|
o << "FeatureName::DepthClipControl";
|
|
508
554
|
break;
|
|
509
555
|
case FeatureName::Depth32FloatStencil8:
|
|
510
556
|
o << "FeatureName::Depth32FloatStencil8";
|
|
511
557
|
break;
|
|
512
|
-
case FeatureName::TimestampQuery:
|
|
513
|
-
o << "FeatureName::TimestampQuery";
|
|
514
|
-
break;
|
|
515
558
|
case FeatureName::TextureCompressionBC:
|
|
516
559
|
o << "FeatureName::TextureCompressionBC";
|
|
517
560
|
break;
|
|
@@ -527,6 +570,9 @@ namespace wgpu {
|
|
|
527
570
|
case FeatureName::TextureCompressionASTCSliced3D:
|
|
528
571
|
o << "FeatureName::TextureCompressionASTCSliced3D";
|
|
529
572
|
break;
|
|
573
|
+
case FeatureName::TimestampQuery:
|
|
574
|
+
o << "FeatureName::TimestampQuery";
|
|
575
|
+
break;
|
|
530
576
|
case FeatureName::IndirectFirstInstance:
|
|
531
577
|
o << "FeatureName::IndirectFirstInstance";
|
|
532
578
|
break;
|
|
@@ -554,8 +600,14 @@ namespace wgpu {
|
|
|
554
600
|
case FeatureName::Subgroups:
|
|
555
601
|
o << "FeatureName::Subgroups";
|
|
556
602
|
break;
|
|
557
|
-
case FeatureName::
|
|
558
|
-
o << "FeatureName::
|
|
603
|
+
case FeatureName::TextureFormatsTier1:
|
|
604
|
+
o << "FeatureName::TextureFormatsTier1";
|
|
605
|
+
break;
|
|
606
|
+
case FeatureName::TextureFormatsTier2:
|
|
607
|
+
o << "FeatureName::TextureFormatsTier2";
|
|
608
|
+
break;
|
|
609
|
+
case FeatureName::PrimitiveIndex:
|
|
610
|
+
o << "FeatureName::PrimitiveIndex";
|
|
559
611
|
break;
|
|
560
612
|
case FeatureName::DawnInternalUsages:
|
|
561
613
|
o << "FeatureName::DawnInternalUsages";
|
|
@@ -727,6 +779,12 @@ namespace wgpu {
|
|
|
727
779
|
break;
|
|
728
780
|
case FeatureName::DawnDeviceAllocatorControl:
|
|
729
781
|
o << "FeatureName::DawnDeviceAllocatorControl";
|
|
782
|
+
break;
|
|
783
|
+
case FeatureName::TextureComponentSwizzle:
|
|
784
|
+
o << "FeatureName::TextureComponentSwizzle";
|
|
785
|
+
break;
|
|
786
|
+
case FeatureName::ChromiumExperimentalBindless:
|
|
787
|
+
o << "FeatureName::ChromiumExperimentalBindless";
|
|
730
788
|
break;
|
|
731
789
|
default:
|
|
732
790
|
o << "FeatureName::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<FeatureName>::type>(value);
|
|
@@ -785,6 +843,23 @@ namespace wgpu {
|
|
|
785
843
|
return o;
|
|
786
844
|
}
|
|
787
845
|
template <typename CharT, typename Traits>
|
|
846
|
+
std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, InstanceFeatureName value) {
|
|
847
|
+
switch (value) {
|
|
848
|
+
case InstanceFeatureName::TimedWaitAny:
|
|
849
|
+
o << "InstanceFeatureName::TimedWaitAny";
|
|
850
|
+
break;
|
|
851
|
+
case InstanceFeatureName::ShaderSourceSPIRV:
|
|
852
|
+
o << "InstanceFeatureName::ShaderSourceSPIRV";
|
|
853
|
+
break;
|
|
854
|
+
case InstanceFeatureName::MultipleDevicesPerAdapter:
|
|
855
|
+
o << "InstanceFeatureName::MultipleDevicesPerAdapter";
|
|
856
|
+
break;
|
|
857
|
+
default:
|
|
858
|
+
o << "InstanceFeatureName::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<InstanceFeatureName>::type>(value);
|
|
859
|
+
}
|
|
860
|
+
return o;
|
|
861
|
+
}
|
|
862
|
+
template <typename CharT, typename Traits>
|
|
788
863
|
std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, LoadOp value) {
|
|
789
864
|
switch (value) {
|
|
790
865
|
case LoadOp::Undefined:
|
|
@@ -896,6 +971,20 @@ namespace wgpu {
|
|
|
896
971
|
return o;
|
|
897
972
|
}
|
|
898
973
|
template <typename CharT, typename Traits>
|
|
974
|
+
std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, PredefinedColorSpace value) {
|
|
975
|
+
switch (value) {
|
|
976
|
+
case PredefinedColorSpace::SRGB:
|
|
977
|
+
o << "PredefinedColorSpace::SRGB";
|
|
978
|
+
break;
|
|
979
|
+
case PredefinedColorSpace::DisplayP3:
|
|
980
|
+
o << "PredefinedColorSpace::DisplayP3";
|
|
981
|
+
break;
|
|
982
|
+
default:
|
|
983
|
+
o << "PredefinedColorSpace::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<PredefinedColorSpace>::type>(value);
|
|
984
|
+
}
|
|
985
|
+
return o;
|
|
986
|
+
}
|
|
987
|
+
template <typename CharT, typename Traits>
|
|
899
988
|
std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, PresentMode value) {
|
|
900
989
|
switch (value) {
|
|
901
990
|
case PresentMode::Undefined:
|
|
@@ -1180,8 +1269,14 @@ namespace wgpu {
|
|
|
1180
1269
|
case SType::SurfaceSourceXCBWindow:
|
|
1181
1270
|
o << "SType::SurfaceSourceXCBWindow";
|
|
1182
1271
|
break;
|
|
1183
|
-
case SType::
|
|
1184
|
-
o << "SType::
|
|
1272
|
+
case SType::SurfaceColorManagement:
|
|
1273
|
+
o << "SType::SurfaceColorManagement";
|
|
1274
|
+
break;
|
|
1275
|
+
case SType::RequestAdapterWebXROptions:
|
|
1276
|
+
o << "SType::RequestAdapterWebXROptions";
|
|
1277
|
+
break;
|
|
1278
|
+
case SType::CompatibilityModeLimits:
|
|
1279
|
+
o << "SType::CompatibilityModeLimits";
|
|
1185
1280
|
break;
|
|
1186
1281
|
case SType::TextureBindingViewDimensionDescriptor:
|
|
1187
1282
|
o << "SType::TextureBindingViewDimensionDescriptor";
|
|
@@ -1392,6 +1487,33 @@ namespace wgpu {
|
|
|
1392
1487
|
break;
|
|
1393
1488
|
case SType::RequestAdapterWebGPUBackendOptions:
|
|
1394
1489
|
o << "SType::RequestAdapterWebGPUBackendOptions";
|
|
1490
|
+
break;
|
|
1491
|
+
case SType::DawnFakeDeviceInitializeErrorForTesting:
|
|
1492
|
+
o << "SType::DawnFakeDeviceInitializeErrorForTesting";
|
|
1493
|
+
break;
|
|
1494
|
+
case SType::TextureComponentSwizzleDescriptor:
|
|
1495
|
+
o << "SType::TextureComponentSwizzleDescriptor";
|
|
1496
|
+
break;
|
|
1497
|
+
case SType::SharedTextureMemoryD3D11BeginState:
|
|
1498
|
+
o << "SType::SharedTextureMemoryD3D11BeginState";
|
|
1499
|
+
break;
|
|
1500
|
+
case SType::DawnConsumeAdapterDescriptor:
|
|
1501
|
+
o << "SType::DawnConsumeAdapterDescriptor";
|
|
1502
|
+
break;
|
|
1503
|
+
case SType::BindGroupLayoutDynamicBindingArray:
|
|
1504
|
+
o << "SType::BindGroupLayoutDynamicBindingArray";
|
|
1505
|
+
break;
|
|
1506
|
+
case SType::DynamicBindingArrayLimits:
|
|
1507
|
+
o << "SType::DynamicBindingArrayLimits";
|
|
1508
|
+
break;
|
|
1509
|
+
case SType::BindGroupDynamicBindingArray:
|
|
1510
|
+
o << "SType::BindGroupDynamicBindingArray";
|
|
1511
|
+
break;
|
|
1512
|
+
case SType::TexelBufferBindingEntry:
|
|
1513
|
+
o << "SType::TexelBufferBindingEntry";
|
|
1514
|
+
break;
|
|
1515
|
+
case SType::TexelBufferBindingLayout:
|
|
1516
|
+
o << "SType::TexelBufferBindingLayout";
|
|
1395
1517
|
break;
|
|
1396
1518
|
default:
|
|
1397
1519
|
o << "SType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<SType>::type>(value);
|
|
@@ -1412,6 +1534,12 @@ namespace wgpu {
|
|
|
1412
1534
|
break;
|
|
1413
1535
|
case SubgroupMatrixComponentType::I32:
|
|
1414
1536
|
o << "SubgroupMatrixComponentType::I32";
|
|
1537
|
+
break;
|
|
1538
|
+
case SubgroupMatrixComponentType::U8:
|
|
1539
|
+
o << "SubgroupMatrixComponentType::U8";
|
|
1540
|
+
break;
|
|
1541
|
+
case SubgroupMatrixComponentType::I8:
|
|
1542
|
+
o << "SubgroupMatrixComponentType::I8";
|
|
1415
1543
|
break;
|
|
1416
1544
|
default:
|
|
1417
1545
|
o << "SubgroupMatrixComponentType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<SubgroupMatrixComponentType>::type>(value);
|
|
@@ -1445,6 +1573,23 @@ namespace wgpu {
|
|
|
1445
1573
|
return o;
|
|
1446
1574
|
}
|
|
1447
1575
|
template <typename CharT, typename Traits>
|
|
1576
|
+
std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, TexelBufferAccess value) {
|
|
1577
|
+
switch (value) {
|
|
1578
|
+
case TexelBufferAccess::Undefined:
|
|
1579
|
+
o << "TexelBufferAccess::Undefined";
|
|
1580
|
+
break;
|
|
1581
|
+
case TexelBufferAccess::ReadOnly:
|
|
1582
|
+
o << "TexelBufferAccess::ReadOnly";
|
|
1583
|
+
break;
|
|
1584
|
+
case TexelBufferAccess::ReadWrite:
|
|
1585
|
+
o << "TexelBufferAccess::ReadWrite";
|
|
1586
|
+
break;
|
|
1587
|
+
default:
|
|
1588
|
+
o << "TexelBufferAccess::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<TexelBufferAccess>::type>(value);
|
|
1589
|
+
}
|
|
1590
|
+
return o;
|
|
1591
|
+
}
|
|
1592
|
+
template <typename CharT, typename Traits>
|
|
1448
1593
|
std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, TextureAspect value) {
|
|
1449
1594
|
switch (value) {
|
|
1450
1595
|
case TextureAspect::Undefined:
|
|
@@ -1511,6 +1656,12 @@ namespace wgpu {
|
|
|
1511
1656
|
case TextureFormat::R8Sint:
|
|
1512
1657
|
o << "TextureFormat::R8Sint";
|
|
1513
1658
|
break;
|
|
1659
|
+
case TextureFormat::R16Unorm:
|
|
1660
|
+
o << "TextureFormat::R16Unorm";
|
|
1661
|
+
break;
|
|
1662
|
+
case TextureFormat::R16Snorm:
|
|
1663
|
+
o << "TextureFormat::R16Snorm";
|
|
1664
|
+
break;
|
|
1514
1665
|
case TextureFormat::R16Uint:
|
|
1515
1666
|
o << "TextureFormat::R16Uint";
|
|
1516
1667
|
break;
|
|
@@ -1541,6 +1692,12 @@ namespace wgpu {
|
|
|
1541
1692
|
case TextureFormat::R32Sint:
|
|
1542
1693
|
o << "TextureFormat::R32Sint";
|
|
1543
1694
|
break;
|
|
1695
|
+
case TextureFormat::RG16Unorm:
|
|
1696
|
+
o << "TextureFormat::RG16Unorm";
|
|
1697
|
+
break;
|
|
1698
|
+
case TextureFormat::RG16Snorm:
|
|
1699
|
+
o << "TextureFormat::RG16Snorm";
|
|
1700
|
+
break;
|
|
1544
1701
|
case TextureFormat::RG16Uint:
|
|
1545
1702
|
o << "TextureFormat::RG16Uint";
|
|
1546
1703
|
break;
|
|
@@ -1592,6 +1749,12 @@ namespace wgpu {
|
|
|
1592
1749
|
case TextureFormat::RG32Sint:
|
|
1593
1750
|
o << "TextureFormat::RG32Sint";
|
|
1594
1751
|
break;
|
|
1752
|
+
case TextureFormat::RGBA16Unorm:
|
|
1753
|
+
o << "TextureFormat::RGBA16Unorm";
|
|
1754
|
+
break;
|
|
1755
|
+
case TextureFormat::RGBA16Snorm:
|
|
1756
|
+
o << "TextureFormat::RGBA16Snorm";
|
|
1757
|
+
break;
|
|
1595
1758
|
case TextureFormat::RGBA16Uint:
|
|
1596
1759
|
o << "TextureFormat::RGBA16Uint";
|
|
1597
1760
|
break;
|
|
@@ -1784,24 +1947,6 @@ namespace wgpu {
|
|
|
1784
1947
|
case TextureFormat::ASTC12x12UnormSrgb:
|
|
1785
1948
|
o << "TextureFormat::ASTC12x12UnormSrgb";
|
|
1786
1949
|
break;
|
|
1787
|
-
case TextureFormat::R16Unorm:
|
|
1788
|
-
o << "TextureFormat::R16Unorm";
|
|
1789
|
-
break;
|
|
1790
|
-
case TextureFormat::RG16Unorm:
|
|
1791
|
-
o << "TextureFormat::RG16Unorm";
|
|
1792
|
-
break;
|
|
1793
|
-
case TextureFormat::RGBA16Unorm:
|
|
1794
|
-
o << "TextureFormat::RGBA16Unorm";
|
|
1795
|
-
break;
|
|
1796
|
-
case TextureFormat::R16Snorm:
|
|
1797
|
-
o << "TextureFormat::R16Snorm";
|
|
1798
|
-
break;
|
|
1799
|
-
case TextureFormat::RG16Snorm:
|
|
1800
|
-
o << "TextureFormat::RG16Snorm";
|
|
1801
|
-
break;
|
|
1802
|
-
case TextureFormat::RGBA16Snorm:
|
|
1803
|
-
o << "TextureFormat::RGBA16Snorm";
|
|
1804
|
-
break;
|
|
1805
1950
|
case TextureFormat::R8BG8Biplanar420Unorm:
|
|
1806
1951
|
o << "TextureFormat::R8BG8Biplanar420Unorm";
|
|
1807
1952
|
break;
|
|
@@ -1890,6 +2035,20 @@ namespace wgpu {
|
|
|
1890
2035
|
return o;
|
|
1891
2036
|
}
|
|
1892
2037
|
template <typename CharT, typename Traits>
|
|
2038
|
+
std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, ToneMappingMode value) {
|
|
2039
|
+
switch (value) {
|
|
2040
|
+
case ToneMappingMode::Standard:
|
|
2041
|
+
o << "ToneMappingMode::Standard";
|
|
2042
|
+
break;
|
|
2043
|
+
case ToneMappingMode::Extended:
|
|
2044
|
+
o << "ToneMappingMode::Extended";
|
|
2045
|
+
break;
|
|
2046
|
+
default:
|
|
2047
|
+
o << "ToneMappingMode::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<ToneMappingMode>::type>(value);
|
|
2048
|
+
}
|
|
2049
|
+
return o;
|
|
2050
|
+
}
|
|
2051
|
+
template <typename CharT, typename Traits>
|
|
1893
2052
|
std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, VertexFormat value) {
|
|
1894
2053
|
switch (value) {
|
|
1895
2054
|
case VertexFormat::Uint8:
|
|
@@ -2072,6 +2231,12 @@ namespace wgpu {
|
|
|
2072
2231
|
case WGSLLanguageFeatureName::SizedBindingArray:
|
|
2073
2232
|
o << "WGSLLanguageFeatureName::SizedBindingArray";
|
|
2074
2233
|
break;
|
|
2234
|
+
case WGSLLanguageFeatureName::TexelBuffers:
|
|
2235
|
+
o << "WGSLLanguageFeatureName::TexelBuffers";
|
|
2236
|
+
break;
|
|
2237
|
+
case WGSLLanguageFeatureName::ChromiumPrint:
|
|
2238
|
+
o << "WGSLLanguageFeatureName::ChromiumPrint";
|
|
2239
|
+
break;
|
|
2075
2240
|
case WGSLLanguageFeatureName::ChromiumTestingUnimplemented:
|
|
2076
2241
|
o << "WGSLLanguageFeatureName::ChromiumTestingUnimplemented";
|
|
2077
2242
|
break;
|
|
@@ -2188,6 +2353,14 @@ namespace wgpu {
|
|
|
2188
2353
|
o << "QueryResolve";
|
|
2189
2354
|
value &= ~BufferUsage::QueryResolve;
|
|
2190
2355
|
}
|
|
2356
|
+
if (value & BufferUsage::TexelBuffer) {
|
|
2357
|
+
if (!first) {
|
|
2358
|
+
o << "|";
|
|
2359
|
+
}
|
|
2360
|
+
first = false;
|
|
2361
|
+
o << "TexelBuffer";
|
|
2362
|
+
value &= ~BufferUsage::TexelBuffer;
|
|
2363
|
+
}
|
|
2191
2364
|
|
|
2192
2365
|
if (static_cast<bool>(value)) {
|
|
2193
2366
|
if (!first) {
|
|
@@ -2518,6 +2691,10 @@ namespace wgpu {
|
|
|
2518
2691
|
return o;
|
|
2519
2692
|
}
|
|
2520
2693
|
|
|
2694
|
+
} // namespace wgpu
|
|
2695
|
+
|
|
2696
|
+
namespace wgpu {
|
|
2697
|
+
|
|
2521
2698
|
template <typename CharT, typename Traits>
|
|
2522
2699
|
std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, StringView value) {
|
|
2523
2700
|
o << std::string_view(value);
|
package/cpp/dawn_logging.cpp
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
#include <cstdio>
|
|
1
2
|
#include <sstream>
|
|
2
3
|
#include <string>
|
|
4
|
+
#include <utility>
|
|
3
5
|
|
|
4
6
|
#ifdef __ANDROID__
|
|
5
7
|
#include <android/log.h>
|
|
@@ -21,10 +23,8 @@ class LogMessage {
|
|
|
21
23
|
public:
|
|
22
24
|
explicit LogMessage(LogSeverity severity);
|
|
23
25
|
~LogMessage();
|
|
24
|
-
|
|
25
26
|
LogMessage(LogMessage&& other);
|
|
26
27
|
LogMessage& operator=(LogMessage&& other);
|
|
27
|
-
|
|
28
28
|
template <typename T>
|
|
29
29
|
LogMessage& operator<<(T&& value) {
|
|
30
30
|
mStream << value;
|
|
@@ -34,7 +34,6 @@ public:
|
|
|
34
34
|
private:
|
|
35
35
|
LogMessage(const LogMessage& other) = delete;
|
|
36
36
|
LogMessage& operator=(const LogMessage& other) = delete;
|
|
37
|
-
|
|
38
37
|
LogSeverity mSeverity;
|
|
39
38
|
std::ostringstream mStream;
|
|
40
39
|
};
|
|
@@ -42,7 +41,7 @@ private:
|
|
|
42
41
|
// Implementation of LogMessage methods
|
|
43
42
|
LogMessage::LogMessage(LogSeverity severity) : mSeverity(severity) {}
|
|
44
43
|
|
|
45
|
-
LogMessage::LogMessage(LogMessage&& other)
|
|
44
|
+
LogMessage::LogMessage(LogMessage&& other)
|
|
46
45
|
: mSeverity(other.mSeverity), mStream(std::move(other.mStream)) {}
|
|
47
46
|
|
|
48
47
|
LogMessage& LogMessage::operator=(LogMessage&& other) {
|
|
@@ -55,11 +54,9 @@ LogMessage& LogMessage::operator=(LogMessage&& other) {
|
|
|
55
54
|
|
|
56
55
|
LogMessage::~LogMessage() {
|
|
57
56
|
std::string fullMessage = mStream.str();
|
|
58
|
-
|
|
59
57
|
if (fullMessage.empty()) {
|
|
60
58
|
return;
|
|
61
59
|
}
|
|
62
|
-
|
|
63
60
|
const char* severityName;
|
|
64
61
|
switch (mSeverity) {
|
|
65
62
|
case LogSeverity::Debug: severityName = "Debug"; break;
|
|
@@ -28,6 +28,9 @@
|
|
|
28
28
|
#include "Dispatcher.h"
|
|
29
29
|
#include "ThreadPool.h"
|
|
30
30
|
|
|
31
|
+
// This number is the maximum integer that can be represented exactly as a double
|
|
32
|
+
#define MAX_SAFE_INTEGER static_cast<uint64_t>(9007199254740991)
|
|
33
|
+
|
|
31
34
|
#if __has_include(<cxxabi.h>)
|
|
32
35
|
#include <cxxabi.h>
|
|
33
36
|
#endif
|
|
@@ -122,7 +125,7 @@ template <> struct JSIConverter<uint64_t> {
|
|
|
122
125
|
static uint64_t fromJSI(jsi::Runtime& runtime, const jsi::Value& arg, bool outOfBound) {
|
|
123
126
|
if (arg.isNumber()) {
|
|
124
127
|
double value = arg.asNumber();
|
|
125
|
-
if (value < 0 || value >
|
|
128
|
+
if (value < 0 || value > MAX_SAFE_INTEGER) {
|
|
126
129
|
throw jsi::JSError(runtime, "Number out of range for uint64_t");
|
|
127
130
|
}
|
|
128
131
|
return static_cast<uint64_t>(value);
|
|
@@ -132,7 +135,7 @@ template <> struct JSIConverter<uint64_t> {
|
|
|
132
135
|
}
|
|
133
136
|
|
|
134
137
|
static jsi::Value toJSI(jsi::Runtime& runtime, uint64_t arg) {
|
|
135
|
-
if (arg <=
|
|
138
|
+
if (arg <= MAX_SAFE_INTEGER) {
|
|
136
139
|
return jsi::Value(static_cast<double>(arg));
|
|
137
140
|
} else {
|
|
138
141
|
throw jsi::JSError(runtime, "Number too large to be represented as a double");
|
package/cpp/jsi/RNFPromise.cpp
CHANGED
package/cpp/rnwgpu/api/GPU.cpp
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
#include "GPU.h"
|
|
2
2
|
|
|
3
|
+
#include <cstdio>
|
|
4
|
+
#include <memory>
|
|
5
|
+
#include <string>
|
|
6
|
+
#include <unordered_set>
|
|
3
7
|
#include <utility>
|
|
4
8
|
#include <vector>
|
|
5
9
|
|
|
@@ -50,7 +54,7 @@ GPU::requestAdapter(
|
|
|
50
54
|
std::unordered_set<std::string> GPU::getWgslLanguageFeatures() {
|
|
51
55
|
wgpu::SupportedWGSLLanguageFeatures supportedFeatures = {};
|
|
52
56
|
_instance.GetWGSLLanguageFeatures(&supportedFeatures);
|
|
53
|
-
|
|
57
|
+
|
|
54
58
|
std::unordered_set<std::string> result;
|
|
55
59
|
for (size_t i = 0; i < supportedFeatures.featureCount; i++) {
|
|
56
60
|
wgpu::WGSLLanguageFeatureName feature = supportedFeatures.features[i];
|
package/cpp/rnwgpu/api/GPU.h
CHANGED
|
@@ -28,9 +28,13 @@ namespace m = margelo;
|
|
|
28
28
|
class GPU : public m::HybridObject {
|
|
29
29
|
public:
|
|
30
30
|
GPU() : HybridObject("GPU") {
|
|
31
|
-
wgpu::
|
|
32
|
-
instanceDesc.
|
|
33
|
-
|
|
31
|
+
static const auto kTimedWaitAny = wgpu::InstanceFeatureName::TimedWaitAny;
|
|
32
|
+
wgpu::InstanceDescriptor instanceDesc{.requiredFeatureCount = 1,
|
|
33
|
+
.requiredFeatures = &kTimedWaitAny};
|
|
34
|
+
|
|
35
|
+
// For limits:
|
|
36
|
+
wgpu::InstanceLimits limits{.timedWaitAnyMaxCount = 64};
|
|
37
|
+
instanceDesc.requiredLimits = &limits;
|
|
34
38
|
_instance = wgpu::CreateInstance(&instanceDesc);
|
|
35
39
|
auto instance = &_instance;
|
|
36
40
|
_async = std::make_shared<AsyncRunner>(instance);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
#include "GPUQueue.h"
|
|
2
2
|
|
|
3
3
|
#include <limits>
|
|
4
|
+
#include <memory>
|
|
5
|
+
#include <vector>
|
|
4
6
|
|
|
5
7
|
#include "Convertors.h"
|
|
6
8
|
|
|
@@ -38,7 +40,7 @@ void GPUQueue::writeBuffer(std::shared_ptr<GPUBuffer> buffer,
|
|
|
38
40
|
|
|
39
41
|
// Note that in the JS semantics of WebGPU, writeBuffer works in number of
|
|
40
42
|
// elements of the typed arrays.
|
|
41
|
-
if (dataOffsetElements > uint64_t(src.size / src.bytesPerElement)) {
|
|
43
|
+
if (dataOffsetElements > static_cast<uint64_t>(src.size / src.bytesPerElement)) {
|
|
42
44
|
throw std::runtime_error("dataOffset is larger than data's size.");
|
|
43
45
|
return;
|
|
44
46
|
}
|
|
@@ -49,7 +51,7 @@ void GPUQueue::writeBuffer(std::shared_ptr<GPUBuffer> buffer,
|
|
|
49
51
|
// Size defaults to dataSize - dataOffset. Instead of computing in elements,
|
|
50
52
|
// we directly use it in bytes, and convert the provided value, if any, in
|
|
51
53
|
// bytes.
|
|
52
|
-
uint64_t size64 = uint64_t(src.size);
|
|
54
|
+
uint64_t size64 = static_cast<uint64_t>(src.size);
|
|
53
55
|
if (sizeElements.has_value()) {
|
|
54
56
|
if (sizeElements.value() >
|
|
55
57
|
std::numeric_limits<uint64_t>::max() / src.bytesPerElement) {
|
|
@@ -59,7 +61,7 @@ void GPUQueue::writeBuffer(std::shared_ptr<GPUBuffer> buffer,
|
|
|
59
61
|
size64 = sizeElements.value() * src.bytesPerElement;
|
|
60
62
|
}
|
|
61
63
|
|
|
62
|
-
if (size64 > uint64_t(src.size)) {
|
|
64
|
+
if (size64 > static_cast<uint64_t>(src.size)) {
|
|
63
65
|
throw std::runtime_error("size + dataOffset is larger than data's size.");
|
|
64
66
|
return;
|
|
65
67
|
}
|
|
@@ -76,10 +78,12 @@ void GPUQueue::writeBuffer(std::shared_ptr<GPUBuffer> buffer,
|
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
std::future<void> GPUQueue::onSubmittedWorkDone() {
|
|
79
|
-
return _async->runAsync([
|
|
81
|
+
return _async->runAsync([&] {
|
|
80
82
|
return _instance.OnSubmittedWorkDone(
|
|
81
83
|
wgpu::CallbackMode::WaitAnyOnly,
|
|
82
|
-
[](wgpu::QueueWorkDoneStatus status) {
|
|
84
|
+
[](wgpu::QueueWorkDoneStatus status, wgpu::StringView message) {
|
|
85
|
+
// Handle the callback if needed
|
|
86
|
+
});
|
|
83
87
|
});
|
|
84
88
|
}
|
|
85
89
|
|