react-native-webgpu 0.23.0 → 0.24.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/Package.swift +18 -129
- package/android/cpp/AndroidPlatformContext.h +10 -9
- package/android/src/main/java/com/webgpu/WebGPUModule.java +3 -3
- package/android/src/main/java/com/webgpu/WebGPUVideoPlayer.java +1 -1
- package/apple/ApplePlatformContext.h +2 -1
- package/apple/ApplePlatformContext.mm +2 -2
- package/binaries.json +53 -105
- package/cpp/dawn/common/ExternalTextureParams.h +3 -3
- package/cpp/dawn/include/dawn/dawn_proc.h +53 -0
- package/cpp/dawn/include/dawn/dawn_proc_table.h +329 -0
- package/cpp/dawn/include/dawn/dawn_thread_dispatch_proc.h +47 -0
- package/cpp/dawn/include/dawn/dawn_version.h +51 -0
- package/cpp/dawn/include/dawn/native/D3D11Backend.h +65 -0
- package/cpp/dawn/include/dawn/native/D3D12Backend.h +104 -0
- package/cpp/dawn/include/dawn/native/D3DBackend.h +56 -0
- package/cpp/dawn/include/dawn/native/DawnNative.h +375 -0
- package/cpp/dawn/include/dawn/native/MetalBackend.h +67 -0
- package/cpp/dawn/include/dawn/native/NullBackend.h +39 -0
- package/cpp/dawn/include/dawn/native/OpenGLBackend.h +89 -0
- package/cpp/dawn/include/dawn/native/VulkanBackend.h +199 -0
- package/cpp/dawn/include/dawn/native/WebGPUBackend.h +49 -0
- package/cpp/dawn/include/dawn/native/dawn_native_export.h +49 -0
- package/cpp/dawn/include/dawn/platform/DawnPlatform.h +210 -0
- package/cpp/dawn/include/dawn/platform/dawn_platform_export.h +49 -0
- package/cpp/dawn/include/dawn/replay/Replay.h +99 -0
- package/cpp/dawn/include/dawn/replay/dawn_replay_export.h +49 -0
- package/cpp/dawn/include/dawn/webgpu.h +5119 -0
- package/cpp/dawn/include/dawn/webgpu_cpp.h +10506 -0
- package/cpp/dawn/include/dawn/webgpu_cpp_print.h +2897 -0
- package/cpp/dawn/include/webgpu/webgpu.h +33 -0
- package/cpp/dawn/include/webgpu/webgpu_cpp.h +33 -0
- package/cpp/dawn/include/webgpu/webgpu_cpp_chained_struct.h +57 -0
- package/cpp/dawn/include/webgpu/webgpu_cpp_print.h +33 -0
- package/cpp/dawn/include/webgpu/webgpu_enum_class_bitmasks.h +163 -0
- package/cpp/dawn/include/webgpu/webgpu_glfw.h +88 -0
- package/cpp/rnwgpu/PlatformContext.h +1 -1
- package/cpp/rnwgpu/SurfaceRegistry.h +2 -2
- package/cpp/rnwgpu/api/GPUAdapter.cpp +1 -1
- package/cpp/rnwgpu/api/RNWebGPU.h +5 -4
- package/lib/commonjs/video.js +8 -4
- package/lib/commonjs/video.js.map +1 -1
- package/lib/module/video.js +6 -2
- package/lib/module/video.js.map +1 -1
- package/lib/typescript/lib/commonjs/video.d.ts +6 -2
- package/lib/typescript/lib/commonjs/video.d.ts.map +1 -1
- package/lib/typescript/lib/module/video.d.ts +1 -1
- package/lib/typescript/lib/module/video.d.ts.map +1 -1
- package/lib/typescript/react-native.config.d.ts +1 -0
- package/lib/typescript/src/index.d.ts +2 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +1 -1
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/video.d.ts +7 -3
- package/lib/typescript/src/video.d.ts.map +1 -1
- package/package.json +10 -5
- package/react-native-webgpu.podspec +46 -78
- package/react-native.config.js +9 -6
- package/scripts/apple-binaries-utils.sh +280 -0
- package/scripts/prepare-apple-binaries.sh +309 -0
- package/scripts/spm-plugin.js +130 -0
- package/src/index.tsx +4 -4
- package/src/types.ts +1 -1
- package/src/video.ts +12 -5
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Copyright 2022 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_WEBGPU_WEBGPU_H_
|
|
29
|
+
#define INCLUDE_WEBGPU_WEBGPU_H_
|
|
30
|
+
|
|
31
|
+
#include "dawn/webgpu.h"
|
|
32
|
+
|
|
33
|
+
#endif // INCLUDE_WEBGPU_WEBGPU_H_
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Copyright 2022 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_WEBGPU_WEBGPU_CPP_H_
|
|
29
|
+
#define INCLUDE_WEBGPU_WEBGPU_CPP_H_
|
|
30
|
+
|
|
31
|
+
#include "dawn/webgpu_cpp.h"
|
|
32
|
+
|
|
33
|
+
#endif // INCLUDE_WEBGPU_WEBGPU_CPP_H_
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Copyright 2023 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
|
+
#ifdef __EMSCRIPTEN__
|
|
29
|
+
#error "Do not include this header. Use the headers provided by Emdawnwebgpu instead."
|
|
30
|
+
#endif
|
|
31
|
+
|
|
32
|
+
#ifndef WEBGPU_CPP_CHAINED_STRUCT_H_
|
|
33
|
+
#define WEBGPU_CPP_CHAINED_STRUCT_H_
|
|
34
|
+
|
|
35
|
+
#include <cstddef>
|
|
36
|
+
#include <cstdint>
|
|
37
|
+
|
|
38
|
+
// This header file declares the ChainedStruct structures separately from the WebGPU
|
|
39
|
+
// headers so that dependencies can directly extend structures without including the larger header
|
|
40
|
+
// which exposes capabilities that may require correctly set proc tables.
|
|
41
|
+
namespace wgpu {
|
|
42
|
+
|
|
43
|
+
enum class SType : uint32_t;
|
|
44
|
+
|
|
45
|
+
struct ChainedStruct {
|
|
46
|
+
ChainedStruct const * nextInChain = nullptr;
|
|
47
|
+
SType sType = SType(0u);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
struct ChainedStructOut {
|
|
51
|
+
ChainedStructOut * nextInChain = nullptr;
|
|
52
|
+
SType sType = SType(0u);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
} // namespace wgpu}
|
|
56
|
+
|
|
57
|
+
#endif // WEBGPU_CPP_CHAINED_STRUCT_H_
|
|
@@ -0,0 +1,33 @@
|
|
|
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_WEBGPU_WEBGPU_CPP_PRINT_H_
|
|
29
|
+
#define INCLUDE_WEBGPU_WEBGPU_CPP_PRINT_H_
|
|
30
|
+
|
|
31
|
+
#include "dawn/webgpu_cpp_print.h"
|
|
32
|
+
|
|
33
|
+
#endif // INCLUDE_WEBGPU_WEBGPU_CPP_PRINT_H_
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// Copyright 2017 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 WEBGPU_ENUM_CLASS_BITMASKS_H_
|
|
29
|
+
#define WEBGPU_ENUM_CLASS_BITMASKS_H_
|
|
30
|
+
|
|
31
|
+
#include <type_traits>
|
|
32
|
+
|
|
33
|
+
// The operators in wgpu:: namespace need be introduced into other namespaces with
|
|
34
|
+
// using-declarations for C++ Argument Dependent Lookup to work.
|
|
35
|
+
#define WGPU_IMPORT_BITMASK_OPERATORS \
|
|
36
|
+
using wgpu::operator|; \
|
|
37
|
+
using wgpu::operator&; \
|
|
38
|
+
using wgpu::operator^; \
|
|
39
|
+
using wgpu::operator~; \
|
|
40
|
+
using wgpu::operator&=; \
|
|
41
|
+
using wgpu::operator|=; \
|
|
42
|
+
using wgpu::operator^=; \
|
|
43
|
+
using wgpu::HasZeroOrOneBits;
|
|
44
|
+
|
|
45
|
+
namespace wgpu {
|
|
46
|
+
|
|
47
|
+
template <typename T>
|
|
48
|
+
struct IsWGPUBitmask {
|
|
49
|
+
static constexpr bool enable = false;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
template <typename T, typename Enable = void>
|
|
53
|
+
struct LowerBitmask {
|
|
54
|
+
static constexpr bool enable = false;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
template <typename T>
|
|
58
|
+
struct LowerBitmask<T, typename std::enable_if<IsWGPUBitmask<T>::enable>::type> {
|
|
59
|
+
static constexpr bool enable = true;
|
|
60
|
+
using type = T;
|
|
61
|
+
constexpr static T Lower(T t) { return t; }
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
template <typename T>
|
|
65
|
+
struct BoolConvertible {
|
|
66
|
+
using Integral = typename std::underlying_type<T>::type;
|
|
67
|
+
|
|
68
|
+
explicit constexpr BoolConvertible(Integral value) : value(value) {}
|
|
69
|
+
// NOLINTNEXTLINE(google-explicit-constructor)
|
|
70
|
+
constexpr operator bool() const { return value != 0; }
|
|
71
|
+
// NOLINTNEXTLINE(google-explicit-constructor)
|
|
72
|
+
constexpr operator T() const { return static_cast<T>(value); }
|
|
73
|
+
|
|
74
|
+
Integral value;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
template <typename T>
|
|
78
|
+
struct LowerBitmask<BoolConvertible<T>> {
|
|
79
|
+
static constexpr bool enable = true;
|
|
80
|
+
using type = T;
|
|
81
|
+
static constexpr type Lower(BoolConvertible<T> t) { return t; }
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
template <
|
|
85
|
+
typename T1,
|
|
86
|
+
typename T2,
|
|
87
|
+
typename = typename std::enable_if<LowerBitmask<T1>::enable && LowerBitmask<T2>::enable>::type>
|
|
88
|
+
constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator|(T1 left, T2 right) {
|
|
89
|
+
using T = typename LowerBitmask<T1>::type;
|
|
90
|
+
using Integral = typename std::underlying_type<T>::type;
|
|
91
|
+
return BoolConvertible<T>(static_cast<Integral>(LowerBitmask<T1>::Lower(left)) |
|
|
92
|
+
static_cast<Integral>(LowerBitmask<T2>::Lower(right)));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
template <
|
|
96
|
+
typename T1,
|
|
97
|
+
typename T2,
|
|
98
|
+
typename = typename std::enable_if<LowerBitmask<T1>::enable && LowerBitmask<T2>::enable>::type>
|
|
99
|
+
constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator&(T1 left, T2 right) {
|
|
100
|
+
using T = typename LowerBitmask<T1>::type;
|
|
101
|
+
using Integral = typename std::underlying_type<T>::type;
|
|
102
|
+
return BoolConvertible<T>(static_cast<Integral>(LowerBitmask<T1>::Lower(left)) &
|
|
103
|
+
static_cast<Integral>(LowerBitmask<T2>::Lower(right)));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
template <
|
|
107
|
+
typename T1,
|
|
108
|
+
typename T2,
|
|
109
|
+
typename = typename std::enable_if<LowerBitmask<T1>::enable && LowerBitmask<T2>::enable>::type>
|
|
110
|
+
constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator^(T1 left, T2 right) {
|
|
111
|
+
using T = typename LowerBitmask<T1>::type;
|
|
112
|
+
using Integral = typename std::underlying_type<T>::type;
|
|
113
|
+
return BoolConvertible<T>(static_cast<Integral>(LowerBitmask<T1>::Lower(left)) ^
|
|
114
|
+
static_cast<Integral>(LowerBitmask<T2>::Lower(right)));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
template <typename T1>
|
|
118
|
+
constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator~(T1 t) {
|
|
119
|
+
using T = typename LowerBitmask<T1>::type;
|
|
120
|
+
using Integral = typename std::underlying_type<T>::type;
|
|
121
|
+
return BoolConvertible<T>(
|
|
122
|
+
static_cast<Integral>(~static_cast<Integral>(LowerBitmask<T1>::Lower(t))));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
template <
|
|
126
|
+
typename T,
|
|
127
|
+
typename T2,
|
|
128
|
+
typename = typename std::enable_if<IsWGPUBitmask<T>::enable && LowerBitmask<T2>::enable>::type>
|
|
129
|
+
constexpr T& operator&=(T& l, T2 right) {
|
|
130
|
+
T r = LowerBitmask<T2>::Lower(right);
|
|
131
|
+
l = l & r;
|
|
132
|
+
return l;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
template <
|
|
136
|
+
typename T,
|
|
137
|
+
typename T2,
|
|
138
|
+
typename = typename std::enable_if<IsWGPUBitmask<T>::enable && LowerBitmask<T2>::enable>::type>
|
|
139
|
+
constexpr T& operator|=(T& l, T2 right) {
|
|
140
|
+
T r = LowerBitmask<T2>::Lower(right);
|
|
141
|
+
l = l | r;
|
|
142
|
+
return l;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
template <
|
|
146
|
+
typename T,
|
|
147
|
+
typename T2,
|
|
148
|
+
typename = typename std::enable_if<IsWGPUBitmask<T>::enable && LowerBitmask<T2>::enable>::type>
|
|
149
|
+
constexpr T& operator^=(T& l, T2 right) {
|
|
150
|
+
T r = LowerBitmask<T2>::Lower(right);
|
|
151
|
+
l = l ^ r;
|
|
152
|
+
return l;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
template <typename T>
|
|
156
|
+
constexpr bool HasZeroOrOneBits(T value) {
|
|
157
|
+
using Integral = typename std::underlying_type<T>::type;
|
|
158
|
+
return (static_cast<Integral>(value) & (static_cast<Integral>(value) - 1)) == 0;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
} // namespace wgpu
|
|
162
|
+
|
|
163
|
+
#endif // WEBGPU_ENUM_CLASS_BITMASKS_H_
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// Copyright 2022 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_WEBGPU_WEBGPU_GLFW_H_
|
|
29
|
+
#define INCLUDE_WEBGPU_WEBGPU_GLFW_H_
|
|
30
|
+
|
|
31
|
+
#ifdef __cplusplus
|
|
32
|
+
#include <memory>
|
|
33
|
+
|
|
34
|
+
#include "webgpu/webgpu_cpp.h"
|
|
35
|
+
#else
|
|
36
|
+
#include "webgpu/webgpu.h"
|
|
37
|
+
#endif
|
|
38
|
+
|
|
39
|
+
#if defined(WGPU_GLFW_SHARED_LIBRARY)
|
|
40
|
+
#if defined(_WIN32)
|
|
41
|
+
#if defined(WGPU_GLFW_IMPLEMENTATION)
|
|
42
|
+
#define WGPU_GLFW_EXPORT __declspec(dllexport)
|
|
43
|
+
#else
|
|
44
|
+
#define WGPU_GLFW_EXPORT __declspec(dllimport)
|
|
45
|
+
#endif
|
|
46
|
+
#else // defined(_WIN32)
|
|
47
|
+
#if defined(WGPU_GLFW_IMPLEMENTATION)
|
|
48
|
+
#define WGPU_GLFW_EXPORT __attribute__((visibility("default")))
|
|
49
|
+
#else
|
|
50
|
+
#define WGPU_GLFW_EXPORT
|
|
51
|
+
#endif
|
|
52
|
+
#endif // defined(_WIN32)
|
|
53
|
+
#else // defined(WGPU_GLFW_SHARED_LIBRARY)
|
|
54
|
+
#define WGPU_GLFW_EXPORT
|
|
55
|
+
#endif // defined(WGPU_GLFW_SHARED_LIBRARY)
|
|
56
|
+
|
|
57
|
+
struct GLFWwindow;
|
|
58
|
+
|
|
59
|
+
#ifdef __cplusplus
|
|
60
|
+
extern "C" {
|
|
61
|
+
#endif
|
|
62
|
+
|
|
63
|
+
WGPU_GLFW_EXPORT WGPUSurface wgpuGlfwCreateSurfaceForWindow(const WGPUInstance instance,
|
|
64
|
+
struct GLFWwindow* window);
|
|
65
|
+
|
|
66
|
+
#ifdef __cplusplus
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
namespace wgpu::glfw {
|
|
70
|
+
|
|
71
|
+
// Does the necessary setup on the GLFWwindow to allow creating a wgpu::Surface with it and
|
|
72
|
+
// calls `instance.CreateSurface` with the correct descriptor for this window.
|
|
73
|
+
// Returns a null wgpu::Surface on failure.
|
|
74
|
+
WGPU_GLFW_EXPORT wgpu::Surface CreateSurfaceForWindow(const wgpu::Instance& instance,
|
|
75
|
+
GLFWwindow* window);
|
|
76
|
+
|
|
77
|
+
// Use for testing only. Does everything that CreateSurfaceForWindow does except the call to
|
|
78
|
+
// CreateSurface. Useful to be able to modify the descriptor for testing, or when trying to
|
|
79
|
+
// avoid using the global proc table.
|
|
80
|
+
// NOLINTNEXTLINE(build/include_what_you_use)
|
|
81
|
+
WGPU_GLFW_EXPORT std::unique_ptr<wgpu::ChainedStruct, void (*)(wgpu::ChainedStruct*)>
|
|
82
|
+
SetupWindowAndGetSurfaceDescriptor(GLFWwindow* window);
|
|
83
|
+
|
|
84
|
+
} // namespace wgpu::glfw
|
|
85
|
+
|
|
86
|
+
#endif
|
|
87
|
+
|
|
88
|
+
#endif // INCLUDE_WEBGPU_WEBGPU_GLFW_H_
|
|
@@ -246,7 +246,7 @@ public:
|
|
|
246
246
|
// for a regular sampled GPUTexture; NV12 is the right shape for the
|
|
247
247
|
// importExternalTexture path (zero-copy biplanar YUV).
|
|
248
248
|
virtual std::unique_ptr<IVideoPlayer>
|
|
249
|
-
|
|
249
|
+
createTestVideoPlayer(const std::string &path, VideoPixelFormat format) = 0;
|
|
250
250
|
|
|
251
251
|
// Wrap a CVPixelBufferRef (Apple) or AHardwareBuffer* (Android) pointer
|
|
252
252
|
// obtained from another library (typically VisionCamera's
|
|
@@ -442,8 +442,8 @@ public:
|
|
|
442
442
|
// not touch the device, and this must not change behaviour there.
|
|
443
443
|
//
|
|
444
444
|
// Remove once the pinned Dawn contains the upstream fix; the check in
|
|
445
|
-
// scripts/check-dawn.ts fails when
|
|
446
|
-
//
|
|
445
|
+
// scripts/check-dawn.ts fails when binaries.json selects another Dawn
|
|
446
|
+
// commit, so that decision is not forgotten.
|
|
447
447
|
void releaseSurfaceForDevice(const wgpu::Device &device) {
|
|
448
448
|
#if defined(__ANDROID__)
|
|
449
449
|
std::unique_lock<std::shared_mutex> lock(_mutex);
|
|
@@ -295,7 +295,7 @@ async::AsyncTaskHandle GPUAdapter::requestDevice(
|
|
|
295
295
|
// held work settles once the app is back (the same toggle Skia
|
|
296
296
|
// requests on the device it shares, see react-native-skia's
|
|
297
297
|
// DawnUtils::requestDevice). Dawn applies it on iOS and tvOS only, and
|
|
298
|
-
// a Dawn without it (
|
|
298
|
+
// a Dawn without it (Dawn binaries releases before 157.1.0) drops
|
|
299
299
|
// the name. The caller opts out through disabledToggles.
|
|
300
300
|
{
|
|
301
301
|
static const char *const kName =
|
|
@@ -507,11 +507,12 @@ public:
|
|
|
507
507
|
}
|
|
508
508
|
|
|
509
509
|
std::shared_ptr<VideoPlayer>
|
|
510
|
-
|
|
510
|
+
createTestVideoPlayer(std::string path,
|
|
511
|
+
std::optional<std::string> pixelFormat) {
|
|
511
512
|
auto format = (pixelFormat && pixelFormat.value() == "nv12")
|
|
512
513
|
? VideoPixelFormat::NV12
|
|
513
514
|
: VideoPixelFormat::BGRA8;
|
|
514
|
-
auto impl = _platformContext->
|
|
515
|
+
auto impl = _platformContext->createTestVideoPlayer(path, format);
|
|
515
516
|
return std::make_shared<VideoPlayer>(std::move(impl));
|
|
516
517
|
}
|
|
517
518
|
|
|
@@ -581,8 +582,8 @@ public:
|
|
|
581
582
|
installMethodWithRuntime(runtime, prototype, "importDevice",
|
|
582
583
|
&RNWebGPU::importDevice);
|
|
583
584
|
installMethod(runtime, prototype, "adoptTexture", &RNWebGPU::adoptTexture);
|
|
584
|
-
installMethod(runtime, prototype, "
|
|
585
|
-
&RNWebGPU::
|
|
585
|
+
installMethod(runtime, prototype, "createTestVideoPlayer",
|
|
586
|
+
&RNWebGPU::createTestVideoPlayer);
|
|
586
587
|
installMethod(runtime, prototype, "createNativeBuffer",
|
|
587
588
|
&RNWebGPU::createNativeBuffer);
|
|
588
589
|
installMethod(runtime, prototype, "allocateNativeBufferViewId",
|
package/lib/commonjs/video.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.createTestVideoPlayer = exports.createTestVideoFrame = exports.createNativeBufferFromPointer = exports.createNativeBuffer = void 0;
|
|
7
7
|
const native = name => {
|
|
8
8
|
if (typeof RNWebGPU === "undefined") {
|
|
9
9
|
throw new Error(`react-native-webgpu is not installed natively; ${name} is unavailable`);
|
|
@@ -14,6 +14,10 @@ const native = name => {
|
|
|
14
14
|
/**
|
|
15
15
|
* Decodes a video into native frames the GPU samples without any copy.
|
|
16
16
|
*
|
|
17
|
+
* For tests and examples only: video decoding is out of the scope of this
|
|
18
|
+
* library. For video in an app, use a video library and wrap its frames with
|
|
19
|
+
* `createNativeBufferFromPointer()`.
|
|
20
|
+
*
|
|
17
21
|
* `source` is a URL (`http`, `https`, `file`) or a file path. Playback is
|
|
18
22
|
* controlled like an HTMLMediaElement (`play()`, `pause()`, `currentTime`,
|
|
19
23
|
* `loop`, `volume`); frames are pulled with `copyLatestFrame()` on every
|
|
@@ -21,7 +25,7 @@ const native = name => {
|
|
|
21
25
|
* `importSharedTextureMemory()`:
|
|
22
26
|
*
|
|
23
27
|
* ```ts
|
|
24
|
-
* const player =
|
|
28
|
+
* const player = createTestVideoPlayer(url);
|
|
25
29
|
* player.play();
|
|
26
30
|
* const render = () => {
|
|
27
31
|
* const frame = player.copyLatestFrame();
|
|
@@ -36,7 +40,7 @@ const native = name => {
|
|
|
36
40
|
* `{ pixelFormat: "nv12" }`. On Android they are always in the decoder's
|
|
37
41
|
* native YUV layout, for `importExternalTexture()`.
|
|
38
42
|
*/
|
|
39
|
-
const
|
|
43
|
+
const createTestVideoPlayer = (source, options) => native("createTestVideoPlayer").createTestVideoPlayer(source, options?.pixelFormat);
|
|
40
44
|
|
|
41
45
|
/**
|
|
42
46
|
* Wraps a native buffer produced by another library (a `CVPixelBufferRef` on
|
|
@@ -44,7 +48,7 @@ const createVideoPlayer = (source, options) => native("createVideoPlayer").creat
|
|
|
44
48
|
* VisionCamera's `frame.getNativeBuffer().pointer`) into a `NativeBuffer`
|
|
45
49
|
* that keeps it alive until released.
|
|
46
50
|
*/
|
|
47
|
-
exports.
|
|
51
|
+
exports.createTestVideoPlayer = createTestVideoPlayer;
|
|
48
52
|
const createNativeBufferFromPointer = pointer => native("createNativeBufferFromPointer").createNativeBufferFromPointer(pointer);
|
|
49
53
|
|
|
50
54
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["native","name","RNWebGPU","Error","
|
|
1
|
+
{"version":3,"names":["native","name","RNWebGPU","Error","createTestVideoPlayer","source","options","pixelFormat","exports","createNativeBufferFromPointer","pointer","createTestVideoFrame","width","height","createNativeBuffer"],"sourceRoot":"../../src","sources":["video.ts"],"mappings":";;;;;;AAOA,MAAMA,MAAM,GAAIC,IAAY,IAAK;EAC/B,IAAI,OAAOC,QAAQ,KAAK,WAAW,EAAE;IACnC,MAAM,IAAIC,KAAK,CACb,kDAAkDF,IAAI,iBACxD,CAAC;EACH;EACA,OAAOC,QAAQ;AACjB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,qBAAqB,GAAGA,CACnCC,MAAc,EACdC,OAAsC,KAEtCN,MAAM,CAAC,uBAAuB,CAAC,CAACI,qBAAqB,CACnDC,MAAM,EACNC,OAAO,EAAEC,WACX,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AALAC,OAAA,CAAAJ,qBAAA,GAAAA,qBAAA;AAMO,MAAMK,6BAA6B,GAAIC,OAAe,IAC3DV,MAAM,CAAC,+BAA+B,CAAC,CAACS,6BAA6B,CACnEC,OACF,CAAC;;AAEH;AACA;AACA;AACA;AACA;AAJAF,OAAA,CAAAC,6BAAA,GAAAA,6BAAA;AAKO,MAAME,oBAAoB,GAAGA,CAClCC,KAAa,EACbC,MAAc,KAEdb,MAAM,CAAC,sBAAsB,CAAC,CAACW,oBAAoB,CAACC,KAAK,EAAEC,MAAM,CAAC;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA;AANAL,OAAA,CAAAG,oBAAA,GAAAA,oBAAA;AAOO,MAAMG,kBAAkB,GAAGA,CAChCF,KAAa,EACbC,MAAc,EACdP,OAAmC,KAEnCN,MAAM,CAAC,oBAAoB,CAAC,CAACc,kBAAkB,CAACF,KAAK,EAAEC,MAAM,EAAEP,OAAO,CAAC;AAACE,OAAA,CAAAM,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
package/lib/module/video.js
CHANGED
|
@@ -8,6 +8,10 @@ const native = name => {
|
|
|
8
8
|
/**
|
|
9
9
|
* Decodes a video into native frames the GPU samples without any copy.
|
|
10
10
|
*
|
|
11
|
+
* For tests and examples only: video decoding is out of the scope of this
|
|
12
|
+
* library. For video in an app, use a video library and wrap its frames with
|
|
13
|
+
* `createNativeBufferFromPointer()`.
|
|
14
|
+
*
|
|
11
15
|
* `source` is a URL (`http`, `https`, `file`) or a file path. Playback is
|
|
12
16
|
* controlled like an HTMLMediaElement (`play()`, `pause()`, `currentTime`,
|
|
13
17
|
* `loop`, `volume`); frames are pulled with `copyLatestFrame()` on every
|
|
@@ -15,7 +19,7 @@ const native = name => {
|
|
|
15
19
|
* `importSharedTextureMemory()`:
|
|
16
20
|
*
|
|
17
21
|
* ```ts
|
|
18
|
-
* const player =
|
|
22
|
+
* const player = createTestVideoPlayer(url);
|
|
19
23
|
* player.play();
|
|
20
24
|
* const render = () => {
|
|
21
25
|
* const frame = player.copyLatestFrame();
|
|
@@ -30,7 +34,7 @@ const native = name => {
|
|
|
30
34
|
* `{ pixelFormat: "nv12" }`. On Android they are always in the decoder's
|
|
31
35
|
* native YUV layout, for `importExternalTexture()`.
|
|
32
36
|
*/
|
|
33
|
-
export const
|
|
37
|
+
export const createTestVideoPlayer = (source, options) => native("createTestVideoPlayer").createTestVideoPlayer(source, options?.pixelFormat);
|
|
34
38
|
|
|
35
39
|
/**
|
|
36
40
|
* Wraps a native buffer produced by another library (a `CVPixelBufferRef` on
|
package/lib/module/video.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["native","name","RNWebGPU","Error","
|
|
1
|
+
{"version":3,"names":["native","name","RNWebGPU","Error","createTestVideoPlayer","source","options","pixelFormat","createNativeBufferFromPointer","pointer","createTestVideoFrame","width","height","createNativeBuffer"],"sourceRoot":"../../src","sources":["video.ts"],"mappings":"AAOA,MAAMA,MAAM,GAAIC,IAAY,IAAK;EAC/B,IAAI,OAAOC,QAAQ,KAAK,WAAW,EAAE;IACnC,MAAM,IAAIC,KAAK,CACb,kDAAkDF,IAAI,iBACxD,CAAC;EACH;EACA,OAAOC,QAAQ;AACjB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,qBAAqB,GAAGA,CACnCC,MAAc,EACdC,OAAsC,KAEtCN,MAAM,CAAC,uBAAuB,CAAC,CAACI,qBAAqB,CACnDC,MAAM,EACNC,OAAO,EAAEC,WACX,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,6BAA6B,GAAIC,OAAe,IAC3DT,MAAM,CAAC,+BAA+B,CAAC,CAACQ,6BAA6B,CACnEC,OACF,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,oBAAoB,GAAGA,CAClCC,KAAa,EACbC,MAAc,KAEdZ,MAAM,CAAC,sBAAsB,CAAC,CAACU,oBAAoB,CAACC,KAAK,EAAEC,MAAM,CAAC;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,GAAGA,CAChCF,KAAa,EACbC,MAAc,EACdN,OAAmC,KAEnCN,MAAM,CAAC,oBAAoB,CAAC,CAACa,kBAAkB,CAACF,KAAK,EAAEC,MAAM,EAAEN,OAAO,CAAC","ignoreList":[]}
|
|
@@ -2,6 +2,10 @@ export const __esModule: boolean;
|
|
|
2
2
|
/**
|
|
3
3
|
* Decodes a video into native frames the GPU samples without any copy.
|
|
4
4
|
*
|
|
5
|
+
* For tests and examples only: video decoding is out of the scope of this
|
|
6
|
+
* library. For video in an app, use a video library and wrap its frames with
|
|
7
|
+
* `createNativeBufferFromPointer()`.
|
|
8
|
+
*
|
|
5
9
|
* `source` is a URL (`http`, `https`, `file`) or a file path. Playback is
|
|
6
10
|
* controlled like an HTMLMediaElement (`play()`, `pause()`, `currentTime`,
|
|
7
11
|
* `loop`, `volume`); frames are pulled with `copyLatestFrame()` on every
|
|
@@ -9,7 +13,7 @@ export const __esModule: boolean;
|
|
|
9
13
|
* `importSharedTextureMemory()`:
|
|
10
14
|
*
|
|
11
15
|
* ```ts
|
|
12
|
-
* const player =
|
|
16
|
+
* const player = createTestVideoPlayer(url);
|
|
13
17
|
* player.play();
|
|
14
18
|
* const render = () => {
|
|
15
19
|
* const frame = player.copyLatestFrame();
|
|
@@ -24,7 +28,7 @@ export const __esModule: boolean;
|
|
|
24
28
|
* `{ pixelFormat: "nv12" }`. On Android they are always in the decoder's
|
|
25
29
|
* native YUV layout, for `importExternalTexture()`.
|
|
26
30
|
*/
|
|
27
|
-
export function
|
|
31
|
+
export function createTestVideoPlayer(source: any, options: any): import("../../src").VideoPlayer;
|
|
28
32
|
export function createNativeBufferFromPointer(pointer: any): import("../../src").NativeBuffer;
|
|
29
33
|
export function createTestVideoFrame(width: any, height: any): import("../../src").NativeBuffer;
|
|
30
34
|
export function createNativeBuffer(width: any, height: any, options: any): import("../../src").NativeBuffer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../../commonjs/video.js"],"names":[],"mappings":";AAaA
|
|
1
|
+
{"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../../commonjs/video.js"],"names":[],"mappings":";AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,kGAAsI;AAStI,8FAA+H;AAQ/H,gGAAkH;AAUlH,4GAA8H"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function
|
|
1
|
+
export function createTestVideoPlayer(source: any, options: any): import("../../src").VideoPlayer;
|
|
2
2
|
export function createNativeBufferFromPointer(pointer: any): import("../../src").NativeBuffer;
|
|
3
3
|
export function createTestVideoFrame(width: any, height: any): import("../../src").NativeBuffer;
|
|
4
4
|
export function createNativeBuffer(width: any, height: any, options: any): import("../../src").NativeBuffer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../../module/video.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../../module/video.js"],"names":[],"mappings":"AAoCO,kGAAsI;AAQtI,8FAA+H;AAO/H,gGAAkH;AASlH,4GAA8H"}
|
|
@@ -4,7 +4,7 @@ export * from "./main";
|
|
|
4
4
|
export * from "./constants";
|
|
5
5
|
export { installWebGPU } from "./install";
|
|
6
6
|
export { requestAnimationFrame, cancelAnimationFrame } from "./animationFrame";
|
|
7
|
-
export type { NativeBuffer, VideoPlayer, GPUSharedFence, GPUSharedFenceDescriptor, GPUSharedFenceExportInfo, GPUSharedFenceState, GPUSharedFenceType, GPUSharedTextureMemory, GPUSharedTextureMemoryDescriptor, GPUSharedTextureMemoryEndAccessState, NativeBufferPixelFormat,
|
|
7
|
+
export type { NativeBuffer, VideoPlayer, GPUSharedFence, GPUSharedFenceDescriptor, GPUSharedFenceExportInfo, GPUSharedFenceState, GPUSharedFenceType, GPUSharedTextureMemory, GPUSharedTextureMemoryDescriptor, GPUSharedTextureMemoryEndAccessState, NativeBufferPixelFormat, CreateTestVideoPlayerOptions, GPUCopyExternalNativeFrameSourceInfo, GPUDawnTogglesDescriptor, GPUNativeExternalTextureDescriptor, NativeBufferColorSpace, GPUExtent2D, GPUDrawElementImageDestination, GPUDrawElementImageSource, GPUDrawElementImageSourceView, CreateNativeBufferOptions, } from "./types";
|
|
8
8
|
declare global {
|
|
9
9
|
interface Navigator {
|
|
10
10
|
gpu: GPU;
|
|
@@ -29,7 +29,7 @@ declare global {
|
|
|
29
29
|
createNativeBufferFromPointer: (pointer: bigint) => NativeBuffer;
|
|
30
30
|
importDevice: (pointer: bigint) => GPUDevice;
|
|
31
31
|
adoptTexture: (pointer: bigint) => GPUTexture;
|
|
32
|
-
|
|
32
|
+
createTestVideoPlayer: (source: string, pixelFormat?: NativeBufferPixelFormat) => VideoPlayer;
|
|
33
33
|
writeTestVideoFile: () => string;
|
|
34
34
|
createNativeBuffer: (width: number, height: number, options?: CreateNativeBufferOptions) => NativeBuffer;
|
|
35
35
|
allocateNativeBufferViewId: () => number;
|