react-native-wgpu 0.1.14 → 0.1.15
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.
|
@@ -50,14 +50,18 @@ public:
|
|
|
50
50
|
|
|
51
51
|
void *switchToOffscreen() {
|
|
52
52
|
std::unique_lock<std::shared_mutex> lock(_mutex);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
// We only do this if the onscreen surface is configured.
|
|
54
|
+
auto isConfigured = config.device != nullptr;
|
|
55
|
+
if (isConfigured) {
|
|
56
|
+
wgpu::TextureDescriptor textureDesc;
|
|
57
|
+
textureDesc.usage = wgpu::TextureUsage::RenderAttachment |
|
|
58
|
+
wgpu::TextureUsage::CopySrc |
|
|
59
|
+
wgpu::TextureUsage::TextureBinding;
|
|
60
|
+
textureDesc.format = config.format;
|
|
61
|
+
textureDesc.size.width = config.width;
|
|
62
|
+
textureDesc.size.height = config.height;
|
|
63
|
+
texture = config.device.CreateTexture(&textureDesc);
|
|
64
|
+
}
|
|
61
65
|
surface = nullptr;
|
|
62
66
|
return nativeSurface;
|
|
63
67
|
}
|
|
@@ -67,6 +67,14 @@ static void convertJSUnionToEnum(const std::string &inUnion,
|
|
|
67
67
|
*outEnum = wgpu::BlendFactor::Constant;
|
|
68
68
|
} else if (inUnion == "one-minus-constant") {
|
|
69
69
|
*outEnum = wgpu::BlendFactor::OneMinusConstant;
|
|
70
|
+
} else if (inUnion == "src1") {
|
|
71
|
+
*outEnum = wgpu::BlendFactor::Src1;
|
|
72
|
+
} else if (inUnion == "one-minus-src1") {
|
|
73
|
+
*outEnum = wgpu::BlendFactor::OneMinusSrc1;
|
|
74
|
+
} else if (inUnion == "src1-alpha") {
|
|
75
|
+
*outEnum = wgpu::BlendFactor::Src1Alpha;
|
|
76
|
+
} else if (inUnion == "one-minus-src1-alpha") {
|
|
77
|
+
*outEnum = wgpu::BlendFactor::OneMinusSrc1Alpha;
|
|
70
78
|
} else {
|
|
71
79
|
throw invalidUnion(inUnion);
|
|
72
80
|
}
|
|
@@ -114,6 +122,18 @@ static void convertEnumToJSUnion(wgpu::BlendFactor inEnum,
|
|
|
114
122
|
case wgpu::BlendFactor::OneMinusConstant:
|
|
115
123
|
*outUnion = "one-minus-constant";
|
|
116
124
|
break;
|
|
125
|
+
case wgpu::BlendFactor::Src1:
|
|
126
|
+
*outUnion = "src1";
|
|
127
|
+
break;
|
|
128
|
+
case wgpu::BlendFactor::OneMinusSrc1:
|
|
129
|
+
*outUnion = "one-minus-src1";
|
|
130
|
+
break;
|
|
131
|
+
case wgpu::BlendFactor::Src1Alpha:
|
|
132
|
+
*outUnion = "src1-alpha";
|
|
133
|
+
break;
|
|
134
|
+
case wgpu::BlendFactor::OneMinusSrc1Alpha:
|
|
135
|
+
*outUnion = "one-minus-src1-alpha";
|
|
136
|
+
break;
|
|
117
137
|
default:
|
|
118
138
|
throw invalidEnum(inEnum);
|
|
119
139
|
}
|
|
@@ -412,6 +432,10 @@ static void convertJSUnionToEnum(const std::string &inUnion,
|
|
|
412
432
|
*outEnum = wgpu::FeatureName::BGRA8UnormStorage;
|
|
413
433
|
} else if (inUnion == "float32-filterable") {
|
|
414
434
|
*outEnum = wgpu::FeatureName::Float32Filterable;
|
|
435
|
+
} else if (inUnion == "clip-distances") {
|
|
436
|
+
*outEnum = wgpu::FeatureName::ClipDistances;
|
|
437
|
+
} else if (inUnion == "dual-source-blending") {
|
|
438
|
+
*outEnum = wgpu::FeatureName::DualSourceBlending;
|
|
415
439
|
} else {
|
|
416
440
|
throw invalidUnion(inUnion);
|
|
417
441
|
}
|
|
@@ -453,6 +477,12 @@ static void convertEnumToJSUnion(wgpu::FeatureName inEnum,
|
|
|
453
477
|
case wgpu::FeatureName::Float32Filterable:
|
|
454
478
|
*outUnion = "float32-filterable";
|
|
455
479
|
break;
|
|
480
|
+
case wgpu::FeatureName::ClipDistances:
|
|
481
|
+
*outUnion = "clip-distances";
|
|
482
|
+
break;
|
|
483
|
+
case wgpu::FeatureName::DualSourceBlending:
|
|
484
|
+
*outUnion = "dual-source-blending";
|
|
485
|
+
break;
|
|
456
486
|
default:
|
|
457
487
|
throw invalidEnum(inEnum);
|
|
458
488
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-wgpu",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "React Native WebGPU",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@types/ws": "^8.5.10",
|
|
66
66
|
"@typescript-eslint/eslint-plugin": "^8.4.0",
|
|
67
67
|
"@typescript-eslint/parser": "^8.4.0",
|
|
68
|
-
"@webgpu/types": "
|
|
68
|
+
"@webgpu/types": "0.1.49",
|
|
69
69
|
"clang-format": "^1.8.0",
|
|
70
70
|
"del-cli": "^5.1.0",
|
|
71
71
|
"eslint": "8",
|