Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Odin + WASM - RuntimeError: memory access out of bounds #68

Open
cstrachan88 opened this issue Dec 20, 2024 · 1 comment
Open

Odin + WASM - RuntimeError: memory access out of bounds #68

cstrachan88 opened this issue Dec 20, 2024 · 1 comment

Comments

@cstrachan88
Copy link

I'm rendering Clay with Odin through WebGPU. Two targets: win64 (through GLFW) and js_wasm32. On desktop, everything is working as expected. For the wasm target, I am getting "RuntimeError: memory access out of bounds" when trying to access a rectangle config.

Code...
if clay.UI(
  clay.Rectangle(clay.RectangleElementConfig{color = clay.Color{255, 0, 0, 255}}),
  clay.Layout(clay.LayoutConfig{sizing = clay.Sizing{width = clay.SizingGrow({}), height = clay.SizingGrow({})}}),
) {}
for i in 0 ..< render_commands.length {
  render_command := clay.RenderCommandArray_Get(render_commands, i32(i))
  switch (render_command.commandType) {
    case clay.RenderCommandType.None:
    case clay.RenderCommandType.Text:
    case clay.RenderCommandType.Image:
    case clay.RenderCommandType.ScissorStart:
    case clay.RenderCommandType.ScissorEnd:
    case clay.RenderCommandType.Rectangle:
      config := renderCommand.config.rectangleElementConfig
      fmt.println(config)
      // BUG: Crashing here
    case clay.RenderCommandType.Border:
    case clay.RenderCommandType.Custom:
  }
}

The pointer to renderCommand.config.rectangleElementConfig is 64bit on desktop and 32 bit in the browser. I'm assuming it's being lopped off.

(Found Clay through your recent Youtube vid - looks nice and I'm excited to play with it some more)

@nicbarker
Copy link
Owner

Hello, and thanks for reaching out! I've seen a bit of weirdness around 32 vs 64bit pointers in wasm, so I'll take a closer look and let you know what I find.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants