libmach: update API again, factors out init/update/deinit from native #423
No reviewers
Labels
No labels
CI
all
basisu
blog
bug
build
contributor-friendly
core
correctness
deferred
dev
direct3d-headers
docs
driver-os-issue
duplicate
dxcompiler
editor
examples
experiment
feature-idea
feedback
flac
freetype
gamemode
gkurve
glfw
gpu
gpu-dawn
harfbuzz
help welcome
in-progress
infrastructure
invalid
libmach
linux-audio-headers
long-term
mach
mach.gfx
mach.math
mach.physics
mach.testing
model3d
needs-triage
object
opengl-headers
opus
os/linux
os/macos
os/wasm
os/windows
package-manager
priority
proposal
proposal-accepted
question
roadmap
slipped
stability
sysaudio
sysgpu
sysjs
validating-fix
vulkan-zig-generated
wayland-headers
website
wontfix
wrench
www
x11-headers
xcode-frameworks
zig-update
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
hexops/mach!423
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "libmach"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR makes a few changes to the libmach API in accordance with the comments on the previous PR.
Also, it seems like I forgot to stage my changes to
build.zigin the previous commit, so they are included in this commit instead.@ -4,13 +4,19 @@I wonder if it might be a good idea to have these prefixed with an underscore, use a
_Force32to force the enum to be 32-bits (in case someone puts it somewhere expecting a fixed size), similar to how webgpu.h does it. We could also name this "Status" instead of "Return" so that there could be other error status codes in the future:Maybe you have a different idea for error handling though?
@ -587,60 +587,80 @@ pub const Platform = struct {should remove double comment here
@ -587,60 +587,80 @@ pub const Platform = struct {I think this function shouldn't be exported.
Also, while
snake_caseis correct in C (andlibmach.zig), here it is not. The function names in this file should becoreDeinit,coreInit,coreUpdate- quoting the Zig style guide:Of course what you did in
libmach.zigis correct, since those names must match C conventions as exported functions.@ -587,60 +587,80 @@ pub const Platform = struct {How about we pass the allocator into this function instead? Would eliminate these semi-confusing comments, and is a better approach to use generally anyway.
A few small suggestions, once those are addressed I'll merge. Looks great overall!
@ -587,60 +587,80 @@ pub const Platform = struct {Ok. I wasn't sure if the pattern in Zig was to explicitly pass the same allocator into the deinit function. I figured that it might be annoying to have to keep the allocator around in order to deinit an object (but I guess with
deferthat's not too much of an issue).This is a single review of the overall PR. While the PR implements everything well in its own ways, I think some things are confusing.
mach_coreshould map directly to src/Core.zigmach_platform_*andmach_core_*.I m not suggesting to do it now with this PR. Doing it slowly over time is fine. I m just suggesting that there should be some goal/rules in order to clear up the path ahead. Thoughts?
@ -4,13 +4,19 @@I'm not exactly an expert on error handling in C... just having error codes is probably fine for now.
Alright, I've made a few changes
Agreed with most of what you said @iddev5 - I'll merge this PR now as it's an improvement, but I think we should continue working towards that.