gpu: getMappedRange, writeBuffer, etc. should check type has defined memory layout #566

Open
opened 2022-09-21 15:11:05 +00:00 by silversquirl · 0 comments
silversquirl commented 2022-09-21 15:11:05 +00:00 (Migrated from github.com)

This would avoid accidents like #565

I see two ways to do this currently: the good way and the hack.

  • The good way is to write a function that mirror's Zig's logic for whether a type can be part of a callconv(.C) function type.
    I might've missed something in std.meta.trait that already does this, but if not it might be worth contributing.
  • The hack is to create a callconv(.C) function type using the type and let Zig throw the error :)
    Awful in every way, but easy!
This would avoid accidents like #565 I see two ways to do this currently: the good way and the hack. - The good way is to write a function that mirror's Zig's logic for whether a type can be part of a `callconv(.C)` function type. I might've missed something in `std.meta.trait` that already does this, but if not it might be worth contributing. - The hack is to create a `callconv(.C)` function type using the type and let Zig throw the error :) Awful in every way, but easy!
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
hexops/mach#566
No description provided.