examples/CustomShader does not build for wasm: DOM branch still sets UICustomBinding::_pad #158

Open
opened 2026-10-06 13:25:45 +00:00 by jorijnvdgraaf · 0 comments

Summary

examples/CustomShader does not build for wasm at 6aa0338:

$ cd examples/CustomShader && crafter-build --target=wasm32-wasip1
examples/CustomShader/main.cpp:63:12: error: field designator '_pad' does not refer to any field in type 'UICustomBinding'
examples/CustomShader/main.cpp:66:19: error: no matching member function for call to 'Load'

The native build of the same example is fine, and examples/HelloUI builds for wasm.

Root cause

097cc37 (#27) replaced UICustomBinding::_pad with format (interfaces/Crafter.Graphics-WebGPUComputeShader.cppm:66-72). The example's DOM branch (examples/CustomShader/main.cpp:59-66) still initialises ._pad = 0 and was not updated.

The Load error is most likely a follow-on from the invalid initialiser: the Load(const std::filesystem::path&, std::span<const UICustomBinding>, bool) overload the example calls still exists (WebGPUComputeShader.cppm:105).

Fix

Replace ._pad = 0 with .format = 0, or drop the designator. I have not build-verified this.

It would also help to build the wasm examples in CI, so an API change in the WebGPU backend cannot leave one behind again.

## Summary `examples/CustomShader` does not build for wasm at `6aa0338`: ``` $ cd examples/CustomShader && crafter-build --target=wasm32-wasip1 examples/CustomShader/main.cpp:63:12: error: field designator '_pad' does not refer to any field in type 'UICustomBinding' examples/CustomShader/main.cpp:66:19: error: no matching member function for call to 'Load' ``` The native build of the same example is fine, and `examples/HelloUI` builds for wasm. ## Root cause `097cc37` (#27) replaced `UICustomBinding::_pad` with `format` (`interfaces/Crafter.Graphics-WebGPUComputeShader.cppm:66-72`). The example's DOM branch (`examples/CustomShader/main.cpp:59-66`) still initialises `._pad = 0` and was not updated. The `Load` error is most likely a follow-on from the invalid initialiser: the `Load(const std::filesystem::path&, std::span<const UICustomBinding>, bool)` overload the example calls still exists (`WebGPUComputeShader.cppm:105`). ## Fix Replace `._pad = 0` with `.format = 0`, or drop the designator. I have not build-verified this. It would also help to build the wasm examples in CI, so an API change in the WebGPU backend cannot leave one behind again.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Catcrafts/Crafter.Graphics#158
No description provided.