react-native-wgpu 0.1.0 → 0.1.3
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/README.md +221 -13
- package/android/CMakeLists.txt +15 -1
- package/android/build.gradle +0 -18
- package/android/cpp/AndroidPlatformContext.h +132 -0
- package/android/cpp/cpp-adapter.cpp +70 -4
- package/android/src/main/java/com/webgpu/WebGPUModule.java +69 -21
- package/android/src/main/java/com/webgpu/WebGPUView.java +63 -8
- package/android/src/main/java/com/webgpu/WebGPUViewManager.java +5 -6
- package/android/src/newarch/{WgpuViewManagerSpec.java → com/webgpu/WebGPUViewManagerSpec.java} +5 -5
- package/android/src/oldarch/com/webgpu/NativeWebGPUModuleSpec.java +23 -0
- package/android/src/oldarch/{WebGPUViewManagerSpec.java → com/webgpu/WebGPUViewManagerSpec.java} +1 -1
- package/cpp/{Logger.h → WGPULogger.h} +13 -6
- package/cpp/dawn/webgpu.h +9 -0
- package/cpp/dawn/webgpu_cpp.h +95 -43
- package/cpp/dawn/webgpu_cpp_print.h +6 -0
- package/cpp/dawn/wire/client/webgpu_cpp.h +80 -43
- package/cpp/jsi/RNFHybridObject.cpp +1 -1
- package/cpp/jsi/RNFHybridObject.h +4 -4
- package/cpp/jsi/RNFJSIConverter.h +204 -17
- package/cpp/rnwgpu/ArrayBuffer.h +72 -0
- package/cpp/rnwgpu/PlatformContext.h +29 -0
- package/cpp/rnwgpu/RNWebGPUManager.cpp +13 -11
- package/cpp/rnwgpu/RNWebGPUManager.h +9 -1
- package/cpp/rnwgpu/SurfaceRegistry.h +36 -0
- package/cpp/rnwgpu/api/AsyncRunner.h +30 -0
- package/cpp/rnwgpu/api/Canvas.h +55 -0
- package/cpp/rnwgpu/api/Convertors.h +765 -0
- package/cpp/rnwgpu/api/External.h +12 -0
- package/cpp/rnwgpu/api/GPU.cpp +81 -23
- package/cpp/rnwgpu/api/GPU.h +24 -6
- package/cpp/rnwgpu/api/GPUAdapter.cpp +138 -24
- package/cpp/rnwgpu/api/GPUAdapter.h +24 -5
- package/cpp/rnwgpu/api/GPUAdapterInfo.h +19 -7
- package/cpp/rnwgpu/api/GPUBindGroup.cpp +3 -0
- package/cpp/rnwgpu/api/GPUBindGroup.h +11 -4
- package/cpp/rnwgpu/api/GPUBindGroupLayout.h +11 -4
- package/cpp/rnwgpu/api/GPUBuffer.cpp +82 -7
- package/cpp/rnwgpu/api/GPUBuffer.h +44 -8
- package/cpp/rnwgpu/api/GPUCanvasContext.cpp +63 -0
- package/cpp/rnwgpu/api/GPUCanvasContext.h +51 -8
- package/cpp/rnwgpu/api/GPUCommandBuffer.h +11 -4
- package/cpp/rnwgpu/api/GPUCommandEncoder.cpp +177 -0
- package/cpp/rnwgpu/api/GPUCommandEncoder.h +75 -3
- package/cpp/rnwgpu/api/GPUCompilationInfo.h +65 -8
- package/cpp/rnwgpu/api/GPUCompilationMessage.h +6 -4
- package/cpp/rnwgpu/api/GPUComputePassEncoder.cpp +58 -0
- package/cpp/rnwgpu/api/GPUComputePassEncoder.h +49 -3
- package/cpp/rnwgpu/api/GPUComputePipeline.cpp +11 -0
- package/cpp/rnwgpu/api/GPUComputePipeline.h +18 -3
- package/cpp/rnwgpu/api/GPUDevice.cpp +330 -3
- package/cpp/rnwgpu/api/GPUDevice.h +119 -5
- package/cpp/rnwgpu/api/GPUDeviceLostInfo.cpp +6 -0
- package/cpp/rnwgpu/api/GPUDeviceLostInfo.h +14 -7
- package/cpp/rnwgpu/api/GPUError.h +42 -0
- package/cpp/rnwgpu/api/GPUExtent3D.h +69 -0
- package/cpp/rnwgpu/api/GPUExternalTexture.h +11 -4
- package/cpp/rnwgpu/api/GPUFeatures.h +221 -0
- package/cpp/rnwgpu/api/GPUOrigin2D.h +59 -0
- package/cpp/rnwgpu/api/GPUOrigin3D.h +66 -0
- package/cpp/rnwgpu/api/GPUPipelineLayout.h +11 -4
- package/cpp/rnwgpu/api/GPUQuerySet.cpp +11 -0
- package/cpp/rnwgpu/api/GPUQuerySet.h +19 -5
- package/cpp/rnwgpu/api/GPUQueue.cpp +153 -0
- package/cpp/rnwgpu/api/GPUQueue.h +45 -4
- package/cpp/rnwgpu/api/GPURenderBundle.h +11 -4
- package/cpp/rnwgpu/api/GPURenderBundleEncoder.cpp +128 -0
- package/cpp/rnwgpu/api/GPURenderBundleEncoder.h +72 -3
- package/cpp/rnwgpu/api/GPURenderPassEncoder.cpp +161 -0
- package/cpp/rnwgpu/api/GPURenderPassEncoder.h +93 -3
- package/cpp/rnwgpu/api/GPURenderPipeline.cpp +13 -0
- package/cpp/rnwgpu/api/GPURenderPipeline.h +18 -3
- package/cpp/rnwgpu/api/GPUSampler.h +11 -4
- package/cpp/rnwgpu/api/GPUShaderModule.cpp +39 -0
- package/cpp/rnwgpu/api/GPUShaderModule.h +23 -4
- package/cpp/rnwgpu/api/GPUSupportedLimits.cpp +133 -0
- package/cpp/rnwgpu/api/GPUSupportedLimits.h +128 -4
- package/cpp/rnwgpu/api/GPUTexture.cpp +47 -0
- package/cpp/rnwgpu/api/GPUTexture.h +38 -4
- package/cpp/rnwgpu/api/GPUTextureView.h +11 -4
- package/cpp/rnwgpu/api/ImageBitmap.h +34 -0
- package/cpp/rnwgpu/api/RNWebGPU.h +100 -0
- package/cpp/rnwgpu/api/WebGPUCanvasContextFactory.h +59 -0
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +31 -43
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +40 -31
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +24 -32
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +56 -49
- package/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +27 -20
- package/cpp/rnwgpu/api/descriptors/GPUBlendState.h +23 -31
- package/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +25 -36
- package/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +25 -25
- package/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +26 -46
- package/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +31 -53
- package/cpp/rnwgpu/api/descriptors/GPUColor.h +72 -0
- package/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +27 -33
- package/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h +51 -0
- package/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h +51 -0
- package/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +24 -25
- package/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +25 -42
- package/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +32 -42
- package/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +58 -76
- package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +38 -30
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +11 -11
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +43 -34
- package/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +39 -46
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +29 -45
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +32 -31
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +32 -36
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +42 -44
- package/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +24 -34
- package/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +24 -32
- package/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +25 -35
- package/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +35 -26
- package/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +29 -35
- package/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +23 -43
- package/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h +49 -0
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h +51 -0
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +41 -57
- package/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +42 -61
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +54 -66
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +52 -55
- package/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +25 -42
- package/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +60 -56
- package/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +21 -20
- package/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +17 -14
- package/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +63 -63
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +28 -27
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +28 -49
- package/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +32 -23
- package/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +27 -29
- package/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +27 -20
- package/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +49 -76
- package/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +48 -64
- package/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +29 -31
- package/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +23 -44
- package/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +30 -36
- package/cpp/rnwgpu/api/descriptors/GPUVertexState.h +39 -38
- package/cpp/rnwgpu/api/descriptors/Unions.h +57 -2
- package/ios/IOSPlatformContext.h +19 -0
- package/ios/IOSPlatformContext.mm +68 -0
- package/ios/MetalView.h +10 -0
- package/ios/MetalView.mm +27 -0
- package/ios/SurfaceUtils.h +13 -0
- package/ios/SurfaceUtils.mm +24 -0
- package/ios/WebGPUModule.h +8 -7
- package/ios/WebGPUModule.mm +47 -14
- package/ios/WebGPUView.h +6 -3
- package/ios/WebGPUView.mm +36 -24
- package/ios/WebGPUViewComponentDescriptor.h +61 -0
- package/ios/WebGPUViewManager.mm +6 -4
- package/lib/commonjs/Canvas.js +47 -0
- package/lib/commonjs/Canvas.js.map +1 -0
- package/lib/commonjs/{WebGPUNativeModule.js → NativeWebGPUModule.js} +1 -1
- package/lib/commonjs/{WebGPUNativeModule.js.map → NativeWebGPUModule.js.map} +1 -1
- package/lib/commonjs/WebGPUView.js +2 -0
- package/lib/commonjs/WebGPUView.js.map +1 -0
- package/lib/commonjs/WebGPUViewNativeComponent.js.map +1 -1
- package/lib/commonjs/index.js +183 -19
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils.js +39 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/module/Canvas.js +40 -0
- package/lib/module/Canvas.js.map +1 -0
- package/lib/module/{WebGPUNativeModule.js → NativeWebGPUModule.js} +1 -1
- package/lib/module/NativeWebGPUModule.js.map +1 -0
- package/lib/module/WebGPUView.js +2 -0
- package/lib/module/WebGPUView.js.map +1 -0
- package/lib/module/WebGPUViewNativeComponent.js.map +1 -1
- package/lib/module/index.js +158 -6
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils.js +31 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/typescript/example/src/Triangle/triangle.d.ts +3 -0
- package/lib/typescript/example/src/Triangle/triangle.d.ts.map +1 -0
- package/lib/typescript/example/src/Wireframe/Shaders.d.ts +3 -0
- package/lib/typescript/example/src/Wireframe/Shaders.d.ts.map +1 -0
- package/lib/typescript/example/src/Wireframe/models.d.ts +29 -0
- package/lib/typescript/example/src/Wireframe/models.d.ts.map +1 -0
- package/lib/typescript/example/src/components/DrawingContext.d.ts +13 -0
- package/lib/typescript/example/src/components/DrawingContext.d.ts.map +1 -0
- package/lib/typescript/example/src/components/cube.d.ts +7 -0
- package/lib/typescript/example/src/components/cube.d.ts.map +1 -0
- package/lib/typescript/example/src/components/meshes/sphere.d.ts +12 -0
- package/lib/typescript/example/src/components/meshes/sphere.d.ts.map +1 -0
- package/lib/typescript/example/src/components/meshes/teapot.d.ts +6 -0
- package/lib/typescript/example/src/components/meshes/teapot.d.ts.map +1 -0
- package/lib/typescript/example/src/components/meshes/utils.d.ts +10 -0
- package/lib/typescript/example/src/components/meshes/utils.d.ts.map +1 -0
- package/lib/typescript/jest.config.d.ts +4 -0
- package/lib/typescript/lib/commonjs/Canvas.d.ts +4 -0
- package/lib/typescript/lib/commonjs/Canvas.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/{WebGPUNativeModule.d.ts → NativeWebGPUModule.d.ts} +1 -1
- package/lib/typescript/lib/commonjs/NativeWebGPUModule.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/WebGPUView.d.ts +1 -0
- package/lib/typescript/lib/commonjs/WebGPUView.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/index.d.ts +0 -2
- package/lib/typescript/lib/commonjs/utils.d.ts +5 -0
- package/lib/typescript/lib/commonjs/utils.d.ts.map +1 -0
- package/lib/typescript/lib/module/Canvas.d.ts +2 -0
- package/lib/typescript/lib/module/Canvas.d.ts.map +1 -0
- package/lib/typescript/lib/module/{WebGPUNativeModule.d.ts → NativeWebGPUModule.d.ts} +1 -1
- package/lib/typescript/lib/module/NativeWebGPUModule.d.ts.map +1 -0
- package/lib/typescript/lib/module/WebGPUView.d.ts +1 -0
- package/lib/typescript/lib/module/WebGPUView.d.ts.map +1 -0
- package/lib/typescript/lib/module/index.d.ts +3 -3
- package/lib/typescript/lib/module/utils.d.ts +3 -0
- package/lib/typescript/lib/module/utils.d.ts.map +1 -0
- package/lib/typescript/src/Canvas.d.ts +29 -0
- package/lib/typescript/src/Canvas.d.ts.map +1 -0
- package/lib/typescript/src/{WebGPUNativeModule.d.ts → NativeWebGPUModule.d.ts} +2 -1
- package/lib/typescript/src/NativeWebGPUModule.d.ts.map +1 -0
- package/lib/typescript/src/WebGPUView.d.ts +1 -0
- package/lib/typescript/src/WebGPUView.d.ts.map +1 -0
- package/lib/typescript/src/WebGPUViewNativeComponent.d.ts +2 -1
- package/lib/typescript/src/WebGPUViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +3 -7
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/utils.d.ts +7 -0
- package/lib/typescript/src/utils.d.ts.map +1 -0
- 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/dawn.json +4597 -0
- package/libs/ios/arm64_iphoneos/libwebgpu_dawn.a +0 -0
- package/libs/ios/arm64_iphonesimulator/libwebgpu_dawn.a +0 -0
- package/libs/ios/libwebgpu_dawn.a +0 -0
- package/libs/ios/libwebgpu_dawn.xcframework/Info.plist +44 -0
- package/libs/ios/libwebgpu_dawn.xcframework/ios-arm64/libwebgpu_dawn.a +0 -0
- package/libs/ios/libwebgpu_dawn.xcframework/ios-arm64_x86_64-simulator/libwebgpu_dawn.a +0 -0
- package/libs/ios/x86_64_iphonesimulator/libwebgpu_dawn.a +0 -0
- package/package.json +25 -8
- package/{react-native-webgpu.podspec → react-native-wgpu.podspec} +6 -9
- package/src/Canvas.tsx +73 -0
- package/src/{WebGPUNativeModule.ts → NativeWebGPUModule.ts} +1 -0
- package/src/WebGPUView.tsx +0 -0
- package/src/WebGPUViewNativeComponent.ts +2 -1
- package/src/index.tsx +191 -8
- package/src/utils.ts +40 -0
- package/android/src/main/AndroidManifestNew.xml +0 -2
- package/cpp/rnwgpu/MutableBuffer.h +0 -48
- package/cpp/rnwgpu/api/GPUUncapturedErrorEvent.h +0 -33
- package/cpp/rnwgpu/api/descriptors/GPUColorDict.h +0 -81
- package/cpp/rnwgpu/api/descriptors/GPUExtent3DDict.h +0 -76
- package/cpp/rnwgpu/api/descriptors/GPUExtent3DDictStrict.h +0 -91
- package/cpp/rnwgpu/api/descriptors/GPUOrigin2DDict.h +0 -61
- package/cpp/rnwgpu/api/descriptors/GPUOrigin2DDictStrict.h +0 -75
- package/cpp/rnwgpu/api/descriptors/GPUOrigin3DDict.h +0 -71
- package/cpp/rnwgpu/api/descriptors/GPUPipelineErrorInit.h +0 -54
- package/cpp/rnwgpu/api/descriptors/GPURenderPassLayout.h +0 -83
- package/ios/RNFAppleLogger.mm +0 -22
- package/ios/Utils.h +0 -5
- package/ios/Utils.m +0 -26
- package/lib/module/WebGPUNativeModule.js.map +0 -1
- package/lib/typescript/lib/commonjs/WebGPUNativeModule.d.ts.map +0 -1
- package/lib/typescript/lib/module/WebGPUNativeModule.d.ts.map +0 -1
- package/lib/typescript/scripts/build/copy-artifacts.d.ts +0 -2
- package/lib/typescript/scripts/build/copy-artifacts.d.ts.map +0 -1
- package/lib/typescript/scripts/build/dawn.d.ts +0 -2
- package/lib/typescript/scripts/build/dawn.d.ts.map +0 -1
- package/lib/typescript/scripts/build/util.d.ts +0 -13
- package/lib/typescript/scripts/build/util.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/codegen.d.ts +0 -2
- package/lib/typescript/scripts/codegen/codegen.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/model/dawn.d.ts +0 -2
- package/lib/typescript/scripts/codegen/model/dawn.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/model/model.d.ts +0 -8
- package/lib/typescript/scripts/codegen/model/model.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/templates/Descriptor.d.ts +0 -4
- package/lib/typescript/scripts/codegen/templates/Descriptor.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/templates/Enum.d.ts +0 -3
- package/lib/typescript/scripts/codegen/templates/Enum.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/templates/HybridObject.d.ts +0 -3
- package/lib/typescript/scripts/codegen/templates/HybridObject.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/templates/Unions.d.ts +0 -6
- package/lib/typescript/scripts/codegen/templates/Unions.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/templates/common.d.ts +0 -9
- package/lib/typescript/scripts/codegen/templates/common.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/util.d.ts +0 -2
- package/lib/typescript/scripts/codegen/util.d.ts.map +0 -1
- package/lib/typescript/src/WebGPUNativeModule.d.ts.map +0 -1
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
#include "GPURenderPassEncoder.h"
|
|
2
|
+
#include "Convertors.h"
|
|
3
|
+
|
|
4
|
+
namespace rnwgpu {
|
|
5
|
+
|
|
6
|
+
void GPURenderPassEncoder::end() { _instance.End(); }
|
|
7
|
+
|
|
8
|
+
void GPURenderPassEncoder::setPipeline(
|
|
9
|
+
std::shared_ptr<GPURenderPipeline> pipeline) {
|
|
10
|
+
_instance.SetPipeline(pipeline->get());
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
void GPURenderPassEncoder::draw(uint32_t vertexCount,
|
|
14
|
+
std::optional<uint32_t> instanceCount,
|
|
15
|
+
std::optional<uint32_t> firstVertex,
|
|
16
|
+
std::optional<uint32_t> firstInstance) {
|
|
17
|
+
_instance.Draw(vertexCount, instanceCount.value_or(1),
|
|
18
|
+
firstVertex.value_or(0), firstInstance.value_or(0));
|
|
19
|
+
}
|
|
20
|
+
void GPURenderPassEncoder::setVertexBuffer(
|
|
21
|
+
uint32_t slot,
|
|
22
|
+
std::variant<std::nullptr_t, std::shared_ptr<GPUBuffer>> buffer,
|
|
23
|
+
std::optional<uint64_t> offset, std::optional<uint64_t> size) {
|
|
24
|
+
Convertor conv;
|
|
25
|
+
|
|
26
|
+
wgpu::Buffer b{};
|
|
27
|
+
uint64_t s = wgpu::kWholeSize;
|
|
28
|
+
if (!conv(b, buffer) || !conv(s, size)) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
_instance.SetVertexBuffer(slot, b, offset.value_or(0), s);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
void GPURenderPassEncoder::setBindGroup(
|
|
35
|
+
uint32_t groupIndex,
|
|
36
|
+
std::variant<std::nullptr_t, std::shared_ptr<GPUBindGroup>> bindGroup,
|
|
37
|
+
std::optional<std::vector<uint32_t>> dynamicOffsets) {
|
|
38
|
+
auto dynOffsets = dynamicOffsets.value_or(std::vector<uint32_t>());
|
|
39
|
+
if (dynOffsets.size() == 0) {
|
|
40
|
+
if (std::holds_alternative<nullptr_t>(bindGroup)) {
|
|
41
|
+
_instance.SetBindGroup(groupIndex, nullptr, 0, nullptr);
|
|
42
|
+
} else {
|
|
43
|
+
auto group = std::get<std::shared_ptr<GPUBindGroup>>(bindGroup);
|
|
44
|
+
_instance.SetBindGroup(groupIndex, group->get(), 0, nullptr);
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
if (std::holds_alternative<nullptr_t>(bindGroup)) {
|
|
48
|
+
_instance.SetBindGroup(groupIndex, nullptr, dynOffsets.size(),
|
|
49
|
+
dynamicOffsets->data());
|
|
50
|
+
} else {
|
|
51
|
+
auto group = std::get<std::shared_ptr<GPUBindGroup>>(bindGroup);
|
|
52
|
+
_instance.SetBindGroup(groupIndex, group->get(), dynOffsets.size(),
|
|
53
|
+
dynamicOffsets->data());
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
void GPURenderPassEncoder::setIndexBuffer(std::shared_ptr<GPUBuffer> buffer,
|
|
59
|
+
wgpu::IndexFormat indexFormat,
|
|
60
|
+
std::optional<uint64_t> offset,
|
|
61
|
+
std::optional<uint64_t> size) {
|
|
62
|
+
Convertor conv;
|
|
63
|
+
|
|
64
|
+
wgpu::Buffer b{};
|
|
65
|
+
wgpu::IndexFormat f{};
|
|
66
|
+
uint64_t o = 0;
|
|
67
|
+
uint64_t s = wgpu::kWholeSize;
|
|
68
|
+
if (!conv(b, buffer) || //
|
|
69
|
+
!conv(f, indexFormat) || //
|
|
70
|
+
!conv(o, offset) || //
|
|
71
|
+
!conv(s, size)) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
_instance.SetIndexBuffer(b, f, o, s);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
void GPURenderPassEncoder::endOcclusionQuery() {
|
|
79
|
+
_instance.EndOcclusionQuery();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
void GPURenderPassEncoder::beginOcclusionQuery(uint32_t queryIndex) {
|
|
83
|
+
_instance.BeginOcclusionQuery(queryIndex);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
void GPURenderPassEncoder::drawIndexed(uint32_t indexCount,
|
|
87
|
+
std::optional<uint32_t> instanceCount,
|
|
88
|
+
std::optional<uint32_t> firstIndex,
|
|
89
|
+
std::optional<double> baseVertex,
|
|
90
|
+
std::optional<uint32_t> firstInstance) {
|
|
91
|
+
_instance.DrawIndexed(indexCount, instanceCount.value_or(1),
|
|
92
|
+
firstIndex.value_or(0), baseVertex.value_or(0),
|
|
93
|
+
firstInstance.value_or(0));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
void GPURenderPassEncoder::executeBundles(
|
|
97
|
+
std::vector<std::shared_ptr<GPURenderBundle>> bundles_in) {
|
|
98
|
+
Convertor conv;
|
|
99
|
+
|
|
100
|
+
wgpu::RenderBundle *bundles = nullptr;
|
|
101
|
+
size_t bundleCount = 0;
|
|
102
|
+
if (!conv(bundles, bundleCount, bundles_in)) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
_instance.ExecuteBundles(bundleCount, bundles);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
void GPURenderPassEncoder::setScissorRect(uint32_t x, uint32_t y,
|
|
110
|
+
uint32_t width, uint32_t height) {
|
|
111
|
+
_instance.SetScissorRect(x, y, width, height);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
void GPURenderPassEncoder::setViewport(double x, double y, double width,
|
|
115
|
+
double height, double minDepth,
|
|
116
|
+
double maxDepth) {
|
|
117
|
+
_instance.SetViewport(x, y, width, height, minDepth, maxDepth);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
void GPURenderPassEncoder::setBlendConstant(std::shared_ptr<GPUColor> color) {
|
|
121
|
+
Convertor conv;
|
|
122
|
+
wgpu::Color c{};
|
|
123
|
+
if (!conv(c, color)) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
_instance.SetBlendConstant(&c);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
void GPURenderPassEncoder::setStencilReference(uint32_t reference) {
|
|
130
|
+
_instance.SetStencilReference(reference);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
void GPURenderPassEncoder::pushDebugGroup(std::string groupLabel) {
|
|
134
|
+
_instance.PushDebugGroup(groupLabel.c_str());
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
void GPURenderPassEncoder::popDebugGroup() { _instance.PopDebugGroup(); }
|
|
138
|
+
|
|
139
|
+
void GPURenderPassEncoder::insertDebugMarker(std::string markerLabel) {
|
|
140
|
+
_instance.InsertDebugMarker(markerLabel.c_str());
|
|
141
|
+
}
|
|
142
|
+
void GPURenderPassEncoder::drawIndirect(
|
|
143
|
+
std::shared_ptr<GPUBuffer> indirectBuffer, uint64_t indirectOffset) {
|
|
144
|
+
Convertor conv;
|
|
145
|
+
wgpu::Buffer b{};
|
|
146
|
+
if (!conv(b, indirectBuffer)) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
_instance.DrawIndirect(b, indirectOffset);
|
|
150
|
+
}
|
|
151
|
+
void GPURenderPassEncoder::drawIndexedIndirect(
|
|
152
|
+
std::shared_ptr<GPUBuffer> indirectBuffer, uint64_t indirectOffset) {
|
|
153
|
+
Convertor conv;
|
|
154
|
+
wgpu::Buffer b{};
|
|
155
|
+
if (!conv(b, indirectBuffer)) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
_instance.DrawIndexedIndirect(b, indirectOffset);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
} // namespace rnwgpu
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#include <future>
|
|
4
3
|
#include <memory>
|
|
4
|
+
#include <optional>
|
|
5
5
|
#include <string>
|
|
6
|
+
#include <variant>
|
|
7
|
+
#include <vector>
|
|
6
8
|
|
|
7
9
|
#include "Unions.h"
|
|
8
|
-
#include <RNFHybridObject.h>
|
|
9
10
|
|
|
10
|
-
#include "
|
|
11
|
+
#include "RNFHybridObject.h"
|
|
12
|
+
|
|
13
|
+
#include "AsyncRunner.h"
|
|
11
14
|
|
|
12
15
|
#include "webgpu/webgpu_cpp.h"
|
|
13
16
|
|
|
17
|
+
#include "GPUBindGroup.h"
|
|
18
|
+
#include "GPUBuffer.h"
|
|
19
|
+
#include "GPUColor.h"
|
|
20
|
+
#include "GPURenderBundle.h"
|
|
21
|
+
#include "GPURenderPipeline.h"
|
|
22
|
+
|
|
14
23
|
namespace rnwgpu {
|
|
15
24
|
|
|
16
25
|
namespace m = margelo;
|
|
@@ -25,16 +34,97 @@ public:
|
|
|
25
34
|
public:
|
|
26
35
|
std::string getBrand() { return _name; }
|
|
27
36
|
|
|
37
|
+
void setViewport(double x, double y, double width, double height,
|
|
38
|
+
double minDepth, double maxDepth);
|
|
39
|
+
void setScissorRect(uint32_t x, uint32_t y, uint32_t width, uint32_t height);
|
|
40
|
+
void setBlendConstant(std::shared_ptr<GPUColor> color);
|
|
41
|
+
void setStencilReference(uint32_t reference);
|
|
42
|
+
void beginOcclusionQuery(uint32_t queryIndex);
|
|
43
|
+
void endOcclusionQuery();
|
|
44
|
+
void executeBundles(std::vector<std::shared_ptr<GPURenderBundle>> bundles);
|
|
45
|
+
void end();
|
|
46
|
+
void pushDebugGroup(std::string groupLabel);
|
|
47
|
+
void popDebugGroup();
|
|
48
|
+
void insertDebugMarker(std::string markerLabel);
|
|
49
|
+
void setBindGroup(
|
|
50
|
+
uint32_t index,
|
|
51
|
+
std::variant<std::nullptr_t, std::shared_ptr<GPUBindGroup>> bindGroup,
|
|
52
|
+
std::optional<std::vector<uint32_t>> dynamicOffsets);
|
|
53
|
+
void setPipeline(std::shared_ptr<GPURenderPipeline> pipeline);
|
|
54
|
+
void setIndexBuffer(std::shared_ptr<GPUBuffer> buffer,
|
|
55
|
+
wgpu::IndexFormat indexFormat,
|
|
56
|
+
std::optional<uint64_t> offset,
|
|
57
|
+
std::optional<uint64_t> size);
|
|
58
|
+
void setVertexBuffer(
|
|
59
|
+
uint32_t slot,
|
|
60
|
+
std::variant<std::nullptr_t, std::shared_ptr<GPUBuffer>> buffer,
|
|
61
|
+
std::optional<uint64_t> offset, std::optional<uint64_t> size);
|
|
62
|
+
void draw(uint32_t vertexCount, std::optional<uint32_t> instanceCount,
|
|
63
|
+
std::optional<uint32_t> firstVertex,
|
|
64
|
+
std::optional<uint32_t> firstInstance);
|
|
65
|
+
void drawIndexed(uint32_t indexCount, std::optional<uint32_t> instanceCount,
|
|
66
|
+
std::optional<uint32_t> firstIndex,
|
|
67
|
+
std::optional<double> baseVertex,
|
|
68
|
+
std::optional<uint32_t> firstInstance);
|
|
69
|
+
void drawIndirect(std::shared_ptr<GPUBuffer> indirectBuffer,
|
|
70
|
+
uint64_t indirectOffset);
|
|
71
|
+
void drawIndexedIndirect(std::shared_ptr<GPUBuffer> indirectBuffer,
|
|
72
|
+
uint64_t indirectOffset);
|
|
73
|
+
|
|
28
74
|
std::string getLabel() { return _label; }
|
|
75
|
+
void setLabel(const std::string &label) {
|
|
76
|
+
_label = label;
|
|
77
|
+
_instance.SetLabel(_label.c_str());
|
|
78
|
+
}
|
|
29
79
|
|
|
30
80
|
void loadHybridMethods() override {
|
|
31
81
|
registerHybridGetter("__brand", &GPURenderPassEncoder::getBrand, this);
|
|
82
|
+
registerHybridMethod("setViewport", &GPURenderPassEncoder::setViewport,
|
|
83
|
+
this);
|
|
84
|
+
registerHybridMethod("setScissorRect",
|
|
85
|
+
&GPURenderPassEncoder::setScissorRect, this);
|
|
86
|
+
registerHybridMethod("setBlendConstant",
|
|
87
|
+
&GPURenderPassEncoder::setBlendConstant, this);
|
|
88
|
+
registerHybridMethod("setStencilReference",
|
|
89
|
+
&GPURenderPassEncoder::setStencilReference, this);
|
|
90
|
+
registerHybridMethod("beginOcclusionQuery",
|
|
91
|
+
&GPURenderPassEncoder::beginOcclusionQuery, this);
|
|
92
|
+
registerHybridMethod("endOcclusionQuery",
|
|
93
|
+
&GPURenderPassEncoder::endOcclusionQuery, this);
|
|
94
|
+
registerHybridMethod("executeBundles",
|
|
95
|
+
&GPURenderPassEncoder::executeBundles, this);
|
|
96
|
+
registerHybridMethod("end", &GPURenderPassEncoder::end, this);
|
|
97
|
+
registerHybridMethod("pushDebugGroup",
|
|
98
|
+
&GPURenderPassEncoder::pushDebugGroup, this);
|
|
99
|
+
registerHybridMethod("popDebugGroup", &GPURenderPassEncoder::popDebugGroup,
|
|
100
|
+
this);
|
|
101
|
+
registerHybridMethod("insertDebugMarker",
|
|
102
|
+
&GPURenderPassEncoder::insertDebugMarker, this);
|
|
103
|
+
registerHybridMethod("setBindGroup", &GPURenderPassEncoder::setBindGroup,
|
|
104
|
+
this);
|
|
105
|
+
registerHybridMethod("setPipeline", &GPURenderPassEncoder::setPipeline,
|
|
106
|
+
this);
|
|
107
|
+
registerHybridMethod("setIndexBuffer",
|
|
108
|
+
&GPURenderPassEncoder::setIndexBuffer, this);
|
|
109
|
+
registerHybridMethod("setVertexBuffer",
|
|
110
|
+
&GPURenderPassEncoder::setVertexBuffer, this);
|
|
111
|
+
registerHybridMethod("draw", &GPURenderPassEncoder::draw, this);
|
|
112
|
+
registerHybridMethod("drawIndexed", &GPURenderPassEncoder::drawIndexed,
|
|
113
|
+
this);
|
|
114
|
+
registerHybridMethod("drawIndirect", &GPURenderPassEncoder::drawIndirect,
|
|
115
|
+
this);
|
|
116
|
+
registerHybridMethod("drawIndexedIndirect",
|
|
117
|
+
&GPURenderPassEncoder::drawIndexedIndirect, this);
|
|
32
118
|
|
|
33
119
|
registerHybridGetter("label", &GPURenderPassEncoder::getLabel, this);
|
|
120
|
+
registerHybridSetter("label", &GPURenderPassEncoder::setLabel, this);
|
|
34
121
|
}
|
|
35
122
|
|
|
123
|
+
inline const wgpu::RenderPassEncoder get() { return _instance; }
|
|
124
|
+
|
|
36
125
|
private:
|
|
37
126
|
wgpu::RenderPassEncoder _instance;
|
|
38
127
|
std::string _label;
|
|
39
128
|
};
|
|
129
|
+
|
|
40
130
|
} // namespace rnwgpu
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#include "GPURenderPipeline.h"
|
|
2
|
+
|
|
3
|
+
#include <memory>
|
|
4
|
+
|
|
5
|
+
namespace rnwgpu {
|
|
6
|
+
|
|
7
|
+
std::shared_ptr<GPUBindGroupLayout>
|
|
8
|
+
GPURenderPipeline::getBindGroupLayout(uint32_t groupIndex) {
|
|
9
|
+
auto bindGroupLayout = _instance.GetBindGroupLayout(groupIndex);
|
|
10
|
+
return std::make_shared<GPUBindGroupLayout>(bindGroupLayout, "");
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
} // namespace rnwgpu
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#include <future>
|
|
4
3
|
#include <memory>
|
|
5
4
|
#include <string>
|
|
6
5
|
|
|
7
6
|
#include "Unions.h"
|
|
8
|
-
#include <RNFHybridObject.h>
|
|
9
7
|
|
|
10
|
-
#include "
|
|
8
|
+
#include "RNFHybridObject.h"
|
|
9
|
+
|
|
10
|
+
#include "AsyncRunner.h"
|
|
11
11
|
|
|
12
12
|
#include "webgpu/webgpu_cpp.h"
|
|
13
13
|
|
|
14
|
+
#include "GPUBindGroupLayout.h"
|
|
15
|
+
|
|
14
16
|
namespace rnwgpu {
|
|
15
17
|
|
|
16
18
|
namespace m = margelo;
|
|
@@ -23,16 +25,29 @@ public:
|
|
|
23
25
|
public:
|
|
24
26
|
std::string getBrand() { return _name; }
|
|
25
27
|
|
|
28
|
+
std::shared_ptr<GPUBindGroupLayout> getBindGroupLayout(uint32_t index);
|
|
29
|
+
|
|
26
30
|
std::string getLabel() { return _label; }
|
|
31
|
+
void setLabel(const std::string &label) {
|
|
32
|
+
_label = label;
|
|
33
|
+
_instance.SetLabel(_label.c_str());
|
|
34
|
+
}
|
|
27
35
|
|
|
28
36
|
void loadHybridMethods() override {
|
|
29
37
|
registerHybridGetter("__brand", &GPURenderPipeline::getBrand, this);
|
|
38
|
+
registerHybridMethod("getBindGroupLayout",
|
|
39
|
+
&GPURenderPipeline::getBindGroupLayout, this);
|
|
30
40
|
|
|
31
41
|
registerHybridGetter("label", &GPURenderPipeline::getLabel, this);
|
|
42
|
+
registerHybridSetter("label", &GPURenderPipeline::setLabel, this);
|
|
32
43
|
}
|
|
33
44
|
|
|
45
|
+
inline const wgpu::RenderPipeline get() { return _instance; }
|
|
46
|
+
|
|
34
47
|
private:
|
|
35
48
|
wgpu::RenderPipeline _instance;
|
|
36
49
|
std::string _label;
|
|
50
|
+
friend class GPUDevice;
|
|
37
51
|
};
|
|
52
|
+
|
|
38
53
|
} // namespace rnwgpu
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#include <future>
|
|
4
|
-
#include <memory>
|
|
5
3
|
#include <string>
|
|
6
4
|
|
|
7
5
|
#include "Unions.h"
|
|
8
|
-
#include <RNFHybridObject.h>
|
|
9
6
|
|
|
10
|
-
#include "
|
|
7
|
+
#include "RNFHybridObject.h"
|
|
8
|
+
|
|
9
|
+
#include "AsyncRunner.h"
|
|
11
10
|
|
|
12
11
|
#include "webgpu/webgpu_cpp.h"
|
|
13
12
|
|
|
@@ -24,15 +23,23 @@ public:
|
|
|
24
23
|
std::string getBrand() { return _name; }
|
|
25
24
|
|
|
26
25
|
std::string getLabel() { return _label; }
|
|
26
|
+
void setLabel(const std::string &label) {
|
|
27
|
+
_label = label;
|
|
28
|
+
_instance.SetLabel(_label.c_str());
|
|
29
|
+
}
|
|
27
30
|
|
|
28
31
|
void loadHybridMethods() override {
|
|
29
32
|
registerHybridGetter("__brand", &GPUSampler::getBrand, this);
|
|
30
33
|
|
|
31
34
|
registerHybridGetter("label", &GPUSampler::getLabel, this);
|
|
35
|
+
registerHybridSetter("label", &GPUSampler::setLabel, this);
|
|
32
36
|
}
|
|
33
37
|
|
|
38
|
+
inline const wgpu::Sampler get() { return _instance; }
|
|
39
|
+
|
|
34
40
|
private:
|
|
35
41
|
wgpu::Sampler _instance;
|
|
36
42
|
std::string _label;
|
|
37
43
|
};
|
|
44
|
+
|
|
38
45
|
} // namespace rnwgpu
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#include "GPUShaderModule.h"
|
|
2
|
+
|
|
3
|
+
#include <utility>
|
|
4
|
+
|
|
5
|
+
namespace rnwgpu {
|
|
6
|
+
|
|
7
|
+
std::future<std::shared_ptr<GPUCompilationInfo>>
|
|
8
|
+
GPUShaderModule::getCompilationInfo() {
|
|
9
|
+
return _async->runAsync([=](wgpu::Instance *instance) {
|
|
10
|
+
wgpu::CompilationInfo compilationInfo;
|
|
11
|
+
auto result = std::make_shared<GPUCompilationInfo>();
|
|
12
|
+
auto future = _instance.GetCompilationInfo(
|
|
13
|
+
wgpu::CallbackMode::WaitAnyOnly,
|
|
14
|
+
[&result](wgpu::CompilationInfoRequestStatus status,
|
|
15
|
+
wgpu::CompilationInfo const *compilationInfo) {
|
|
16
|
+
if (status == wgpu::CompilationInfoRequestStatus::Success &&
|
|
17
|
+
compilationInfo) {
|
|
18
|
+
for (size_t i = 0; i < compilationInfo->messageCount; ++i) {
|
|
19
|
+
const auto &wgpuMessage = compilationInfo->messages[i];
|
|
20
|
+
GPUCompilationMessage message;
|
|
21
|
+
message.message = wgpuMessage.message ? wgpuMessage.message : "";
|
|
22
|
+
message.type = wgpuMessage.type;
|
|
23
|
+
message.lineNum = wgpuMessage.lineNum;
|
|
24
|
+
message.linePos = wgpuMessage.linePos;
|
|
25
|
+
message.offset = wgpuMessage.offset;
|
|
26
|
+
message.length = wgpuMessage.length;
|
|
27
|
+
message.utf16LinePos = wgpuMessage.utf16LinePos;
|
|
28
|
+
message.utf16Offset = wgpuMessage.utf16Offset;
|
|
29
|
+
message.utf16Length = wgpuMessage.utf16Length;
|
|
30
|
+
result->_messages.push_back(std::move(message));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
instance->WaitAny(future, UINT64_MAX);
|
|
35
|
+
return result;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
} // namespace rnwgpu
|
|
@@ -5,34 +5,53 @@
|
|
|
5
5
|
#include <string>
|
|
6
6
|
|
|
7
7
|
#include "Unions.h"
|
|
8
|
-
#include <RNFHybridObject.h>
|
|
9
8
|
|
|
10
|
-
#include "
|
|
9
|
+
#include "RNFHybridObject.h"
|
|
10
|
+
|
|
11
|
+
#include "AsyncRunner.h"
|
|
11
12
|
|
|
12
13
|
#include "webgpu/webgpu_cpp.h"
|
|
13
14
|
|
|
15
|
+
#include "GPUCompilationInfo.h"
|
|
16
|
+
|
|
14
17
|
namespace rnwgpu {
|
|
15
18
|
|
|
16
19
|
namespace m = margelo;
|
|
17
20
|
|
|
18
21
|
class GPUShaderModule : public m::HybridObject {
|
|
19
22
|
public:
|
|
20
|
-
explicit GPUShaderModule(wgpu::ShaderModule instance,
|
|
21
|
-
|
|
23
|
+
explicit GPUShaderModule(wgpu::ShaderModule instance,
|
|
24
|
+
std::shared_ptr<AsyncRunner> async,
|
|
25
|
+
std::string label)
|
|
26
|
+
: HybridObject("GPUShaderModule"), _instance(instance), _async(async),
|
|
27
|
+
_label(label) {}
|
|
22
28
|
|
|
23
29
|
public:
|
|
24
30
|
std::string getBrand() { return _name; }
|
|
25
31
|
|
|
32
|
+
std::future<std::shared_ptr<GPUCompilationInfo>> getCompilationInfo();
|
|
33
|
+
|
|
26
34
|
std::string getLabel() { return _label; }
|
|
35
|
+
void setLabel(const std::string &label) {
|
|
36
|
+
_label = label;
|
|
37
|
+
_instance.SetLabel(_label.c_str());
|
|
38
|
+
}
|
|
27
39
|
|
|
28
40
|
void loadHybridMethods() override {
|
|
29
41
|
registerHybridGetter("__brand", &GPUShaderModule::getBrand, this);
|
|
42
|
+
registerHybridMethod("getCompilationInfo",
|
|
43
|
+
&GPUShaderModule::getCompilationInfo, this);
|
|
30
44
|
|
|
31
45
|
registerHybridGetter("label", &GPUShaderModule::getLabel, this);
|
|
46
|
+
registerHybridSetter("label", &GPUShaderModule::setLabel, this);
|
|
32
47
|
}
|
|
33
48
|
|
|
49
|
+
inline const wgpu::ShaderModule get() { return _instance; }
|
|
50
|
+
|
|
34
51
|
private:
|
|
35
52
|
wgpu::ShaderModule _instance;
|
|
53
|
+
std::shared_ptr<AsyncRunner> _async;
|
|
36
54
|
std::string _label;
|
|
37
55
|
};
|
|
56
|
+
|
|
38
57
|
} // namespace rnwgpu
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
#include "GPUSupportedLimits.h"
|
|
2
|
+
|
|
3
|
+
namespace rnwgpu {
|
|
4
|
+
|
|
5
|
+
double GPUSupportedLimits::getMaxTextureDimension1D() {
|
|
6
|
+
return _instance.limits.maxTextureDimension1D;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
double GPUSupportedLimits::getMaxTextureDimension2D() {
|
|
10
|
+
return _instance.limits.maxTextureDimension2D;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
double GPUSupportedLimits::getMaxTextureDimension3D() {
|
|
14
|
+
return _instance.limits.maxTextureDimension3D;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
double GPUSupportedLimits::getMaxTextureArrayLayers() {
|
|
18
|
+
return _instance.limits.maxTextureArrayLayers;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
double GPUSupportedLimits::getMaxBindGroups() {
|
|
22
|
+
return _instance.limits.maxBindGroups;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
double GPUSupportedLimits::getMaxBindGroupsPlusVertexBuffers() {
|
|
26
|
+
return _instance.limits.maxBindGroupsPlusVertexBuffers;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
double GPUSupportedLimits::getMaxBindingsPerBindGroup() {
|
|
30
|
+
return _instance.limits.maxBindingsPerBindGroup;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
double GPUSupportedLimits::getMaxDynamicUniformBuffersPerPipelineLayout() {
|
|
34
|
+
return _instance.limits.maxDynamicUniformBuffersPerPipelineLayout;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
double GPUSupportedLimits::getMaxDynamicStorageBuffersPerPipelineLayout() {
|
|
38
|
+
return _instance.limits.maxDynamicStorageBuffersPerPipelineLayout;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
double GPUSupportedLimits::getMaxSampledTexturesPerShaderStage() {
|
|
42
|
+
return _instance.limits.maxSampledTexturesPerShaderStage;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
double GPUSupportedLimits::getMaxSamplersPerShaderStage() {
|
|
46
|
+
return _instance.limits.maxSamplersPerShaderStage;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
double GPUSupportedLimits::getMaxStorageBuffersPerShaderStage() {
|
|
50
|
+
return _instance.limits.maxStorageBuffersPerShaderStage;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
double GPUSupportedLimits::getMaxStorageTexturesPerShaderStage() {
|
|
54
|
+
return _instance.limits.maxStorageTexturesPerShaderStage;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
double GPUSupportedLimits::getMaxUniformBuffersPerShaderStage() {
|
|
58
|
+
return _instance.limits.maxUniformBuffersPerShaderStage;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
double GPUSupportedLimits::getMaxUniformBufferBindingSize() {
|
|
62
|
+
return _instance.limits.maxUniformBufferBindingSize;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
double GPUSupportedLimits::getMaxStorageBufferBindingSize() {
|
|
66
|
+
return _instance.limits.maxStorageBufferBindingSize;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
double GPUSupportedLimits::getMinUniformBufferOffsetAlignment() {
|
|
70
|
+
return _instance.limits.minUniformBufferOffsetAlignment;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
double GPUSupportedLimits::getMinStorageBufferOffsetAlignment() {
|
|
74
|
+
return _instance.limits.minStorageBufferOffsetAlignment;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
double GPUSupportedLimits::getMaxVertexBuffers() {
|
|
78
|
+
return _instance.limits.maxVertexBuffers;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
double GPUSupportedLimits::getMaxBufferSize() {
|
|
82
|
+
return _instance.limits.maxBufferSize;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
double GPUSupportedLimits::getMaxVertexAttributes() {
|
|
86
|
+
return _instance.limits.maxVertexAttributes;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
double GPUSupportedLimits::getMaxVertexBufferArrayStride() {
|
|
90
|
+
return _instance.limits.maxVertexBufferArrayStride;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
double GPUSupportedLimits::getMaxInterStageShaderComponents() {
|
|
94
|
+
return _instance.limits.maxInterStageShaderComponents;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
double GPUSupportedLimits::getMaxInterStageShaderVariables() {
|
|
98
|
+
return _instance.limits.maxInterStageShaderVariables;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
double GPUSupportedLimits::getMaxColorAttachments() {
|
|
102
|
+
return _instance.limits.maxColorAttachments;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
double GPUSupportedLimits::getMaxColorAttachmentBytesPerSample() {
|
|
106
|
+
return _instance.limits.maxColorAttachmentBytesPerSample;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
double GPUSupportedLimits::getMaxComputeWorkgroupStorageSize() {
|
|
110
|
+
return _instance.limits.maxComputeWorkgroupStorageSize;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
double GPUSupportedLimits::getMaxComputeInvocationsPerWorkgroup() {
|
|
114
|
+
return _instance.limits.maxComputeInvocationsPerWorkgroup;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
double GPUSupportedLimits::getMaxComputeWorkgroupSizeX() {
|
|
118
|
+
return _instance.limits.maxComputeWorkgroupSizeX;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
double GPUSupportedLimits::getMaxComputeWorkgroupSizeY() {
|
|
122
|
+
return _instance.limits.maxComputeWorkgroupSizeY;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
double GPUSupportedLimits::getMaxComputeWorkgroupSizeZ() {
|
|
126
|
+
return _instance.limits.maxComputeWorkgroupSizeZ;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
double GPUSupportedLimits::getMaxComputeWorkgroupsPerDimension() {
|
|
130
|
+
return _instance.limits.maxComputeWorkgroupsPerDimension;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
} // namespace rnwgpu
|