juj / wasm_webgpu

System headers for interfacing WebGPU from C programs compiled via Emscripten to WebAssembly
BSD 3-Clause "New" or "Revised" License
331 stars 26 forks source link

Windows. -Wpadded violation #46

Closed Jura-Z closed 2 months ago

Jura-Z commented 2 months ago

Hey old friends :)

I'm on windows, emscripten 3.1.64 (fd61bacaf40131f74987e649a135f1dd559aff60), ninja-git-release-64bit

emcmake cmake ../samples -DCMAKE_BUILD_TYPE=MinSizeRel ninja

gives me the next message. And it is not really clear how should I eliminate the padding

FAILED: CMakeFiles/hello_triangle_verbose.dir/hello_triangle/hello_triangle_verbose.c.o
C:\Projects\emscripten\emsdk\upstream\emscripten\emcc.bat  -IC:/Projects/wasm_webgpu/lib -IC:/Projects/wasm_webgpu/samples/common -Wno-error -Os -DNDEBUG -MD -MT CMakeFiles/hello_triangle_verbose.dir/hello_triangle/hello_triangle_verbose.c.o -MF CMakeFiles\hello_triangle_verbose.dir\hello_triangle\hello_triangle_verbose.c.o.d -o CMakeFiles/hello_triangle_verbose.dir/hello_triangle/hello_triangle_verbose.c.o -c C:/Projects/wasm_webgpu/samples/hello_triangle/hello_triangle_verbose.c
In file included from C:/Projects/wasm_webgpu/samples/hello_triangle/hello_triangle_verbose.c:5:
C:/Projects/wasm_webgpu/lib\lib_webgpu.h:1241:12: error: padding struct 'struct WGpuBufferBindingLayout' with 3 bytes to align 'minBindingSize' [-Werror,-Wpadded]
 1241 |   uint64_t minBindingSize;
      |            ^
C:/Projects/wasm_webgpu/lib\lib_webgpu.h:2369:16: error: padding struct 'struct WGpuRenderPassDepthStencilAttachment' with 3 bytes to align 'stencilLoadOp' [-Werror,-Wpadded]
 2369 |   WGPU_LOAD_OP stencilLoadOp;  // Either WGPU_LOAD_OP_LOAD (== default, 0) or WGPU_LOAD_OP_CLEAR
      |                ^
C:/Projects/wasm_webgpu/lib\lib_webgpu.h:2359:16: error: padding size of 'struct WGpuRenderPassDepthStencilAttachment' with 3 bytes to alignment boundary [-Werror,-Wpadded]
 2359 | typedef struct WGpuRenderPassDepthStencilAttachment
      |                ^
C:/Projects/wasm_webgpu/lib\lib_webgpu.h:1633:16: error: padding size of 'struct WGpuPrimitiveState' with 3 bytes to alignment boundary [-Werror,-Wpadded]
 1633 | typedef struct WGpuPrimitiveState
      |                ^
C:/Projects/wasm_webgpu/lib\lib_webgpu.h:2910:25: error: padding struct 'struct WGpuDepthStencilState' with 3 bytes to align 'depthCompare' [-Werror,-Wpadded]
 2910 |   WGPU_COMPARE_FUNCTION depthCompare;
      |                         ^
C:/Projects/wasm_webgpu/lib\lib_webgpu.h:2903:16: error: padding size of 'struct WGpuDepthStencilState' with 3 bytes to alignment boundary [-Werror,-Wpadded]
 2903 | typedef struct WGpuDepthStencilState
      |                ^
C:/Projects/wasm_webgpu/lib\lib_webgpu.h:1674:16: error: padding size of 'struct WGpuMultisampleState' with 3 bytes to alignment boundary [-Werror,-Wpadded]
 1674 | typedef struct WGpuMultisampleState
      |                ^
C:/Projects/wasm_webgpu/lib\lib_webgpu.h:336:16: error: padding size of 'struct WGpuRequestAdapterOptions' with 3 bytes to alignment boundary [-Werror,-Wpadded]
  336 | typedef struct WGpuRequestAdapterOptions
      |                ^
8 errors generated.
ninja: build stopped: subcommand failed.
Jura-Z commented 2 months ago

3.1.56 works, btw

juj commented 2 months ago

Thanks, fixed in above commit.