Skip to content

Implement toWGPU() method for structs in adapter.zig device.zig - #28

Merged
bronter merged 4 commits into
bronter:idiomatic-zigfrom
TotoShampoin:idiomatic-zig
Jul 7, 2025
Merged

Implement toWGPU() method for structs in adapter.zig device.zig#28
bronter merged 4 commits into
bronter:idiomatic-zigfrom
TotoShampoin:idiomatic-zig

Conversation

@TotoShampoin

Copy link
Copy Markdown

I am kind of unsure about some of these, so they may need some extra reviews... Or actual testing

@bronter

bronter commented Jul 7, 2025

Copy link
Copy Markdown
Owner

I can write some tests, in fact for those I can pretty much just copy/paste the current tests but pass in the optional data structures that were null in the other tests.

Comment thread src/adapter.zig
}
};

pub const WGPURequestAdapterOptions = extern struct {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to make all of these WGPU structs public? I've been changing them to private, but I suppose it wouldn't be a bad idea to expose them in some way, as long as it doesn't lead to confusion. I think in root.zig we should probably export them under their own namespace so we don't have people mistakenly mixing them with our wrapper code. There has been talk about Zig getting rid of usingnamespace so I need to do some work on root.zig soon anyway.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's up to you. I personally like to have things exposed so I can use them everywhere I'd need (especially types), but that's just me.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I think let's make them public, but before we merge in the draft PR we put the WGPU structs into their own namespace.

@bronter
bronter merged commit 1daeaeb into bronter:idiomatic-zig Jul 7, 2025
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

Successfully merging this pull request may close these issues.

2 participants