Skip to content

Hundreds of webgpu compilation errors with mediapipe sources... #24253

Closed as duplicate of#23432
@Honya2000

Description

@Honya2000

Hello,
I'm trying to compile latest mediapipe for WASM and compiler throws lot of errors during compiling of WebGPU related code:
/mediapipe/gpu/webgpu/webgpu_service.cc:79:60: error: member reference base type 'const char *' is not a structure or union
79 | adapter_info_.device.length = strlen(adapter_info_.device.data);
| ~~~~~~~~~~~~~~~~~~~~^~~~~
/mediapipe/gpu/webgpu/webgpu_service.cc:80:23: error: member reference base type 'const char *' is not a structure or union
80 | adapter_info_.vendor.data = GetAdapterVendor();

/mediapipe/gpu/webgpu/webgpu_utils.cc:30:17: error: no member named 'capabilities' in 'wgpu::InstanceDescriptor'
30 | instance_desc.capabilities.timedWaitAnyEnable = true;
| ~~~~~~~~~~~~~ ^
/mediapipe/gpu/webgpu/webgpu_utils.cc:93:53: error: no member named 'WaitAny' in 'wgpu::Instance'
93 | wgpu::WaitStatus wait_status = kWebGpuInstance->WaitAny(
| ~~~~~~~~~~~~~~~~~^
/mediapipe/gpu/webgpu/webgpu_utils.cc:159:58: error: no type named 'StringView' in namespace 'wgpu'
159 | wgpu::ComputePipeline pipeline, wgpu::StringView message) {
| ~~~~~~^
/mediapipe/gpu/webgpu/webgpu_utils.cc:157:19: error: cannot initialize a parameter of type 'CreateComputePipelineAsyncCallback' (aka 'void (*)(WGPUCreatePipelineAsyncStatus, WGPUComputePipelineImpl *, const char *, void )') with an rvalue of type 'wgpu::CallbackMode'
157 | descriptor, wgpu::CallbackMode::WaitAnyOnly,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\emsdk\upstream\emscripten\cache\sysroot/include\webgpu/webgpu_cpp.h:945:122: note: passing argument to parameter 'callback' here
945 | void CreateComputePipelineAsync(ComputePipelineDescriptor const * descriptor, CreateComputePipelineAsyncCallback callback, void * userdata) const;
| ^
/mediapipe/gpu/webgpu/webgpu_utils.cc:187:57: error: no type named 'StringView' in namespace 'wgpu'
187 | wgpu::RenderPipeline pipeline, wgpu::StringView message) {
| ~~~~~~^
/mediapipe/gpu/webgpu/webgpu_utils.cc:185:19: error: cannot initialize a parameter of type 'CreateRenderPipelineAsyncCallback' (aka 'void (
)(WGPUCreatePipelineAsyncStatus, WGPURenderPipelineImpl *, const char *, void *)') with an rvalue of type 'wgpu::CallbackMode'
185 | descriptor, wgpu::CallbackMode::WaitAnyOnly,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\emscripten\cache\sysroot/include\webgpu/webgpu_cpp.h:950:119: note: passing argument to parameter 'callback' here
950 | void CreateRenderPipelineAsync(RenderPipelineDescriptor const * descriptor, CreateRenderPipelineAsyncCallback callback, void * userdata) const;
| ^
/mediapipe/gpu/webgpu/webgpu_utils.cc:273:9: error: no type named 'TexelCopyTextureInfo' in namespace 'wgpu'
273 | wgpu::TexelCopyTextureInfo destination = {.texture = texture};
| ~~~~~~^
/mediapipe/gpu/webgpu/webgpu_utils.cc:274:9: error: no type named 'TexelCopyBufferLayout' in namespace 'wgpu'
274 | wgpu::TexelCopyBufferLayout texel_copy_buffer_layout = {
| ~~~~~~^
/mediapipe/gpu/webgpu/webgpu_utils.cc:319:9: error: no type named 'TexelCopyTextureInfo' in namespace 'wgpu'
319 | wgpu::TexelCopyTextureInfo copy_src{.texture = texture};
| ~~~~~~^
/mediapipe/gpu/webgpu/webgpu_utils.cc:320:9: error: no type named 'TexelCopyBufferInfo' in namespace 'wgpu'
320 | wgpu::TexelCopyBufferInfo copy_dst{.layout = {.bytesPerRow = bytes_per_row},

Seems like it throws errors on any function in wgpu Scope. I'm using -s USE_WEBGPU=1 for cmake setup.
Included all possible emscripten wgpu related headers:
#include <emscripten.h>
#include <emscripten/em_js.h>
#include <webgpu/webgpu_cpp.h>
#include <emscripten/html5_webgpu.h>

Not sure what is wrong.

P.S. The code is compilable in windows using dawn.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions