-
Notifications
You must be signed in to change notification settings - Fork 187
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
Complete rewrite of the generator #344
Comments
@MaikKlein That'd be a great improvement, especially ditching vkxml that has now been unmaintained for quite some time and with a questionable conversion layer from vk-parse to vkxml format. In particular pointers have bothered me. As explained in #341 (comment) I've deduplicated the type conversion system for safe functions (builders) and their unsafe struct/FFI counterpart in master...Traverse-Research:simplify. Pointers for dynamic arrays denote the same level as the array type, whereas the add up for static arrays. I'm curious to the thought behind your choice to drop I had also already performed the conversion to syn/quote/proc_macro v1: master...Traverse-Research:quote1. Both of these branches have not been submitted yet to not take away review from KHR_ray_tracing and its preparation PR. Not sure if I should submit them now that those made it in, perhaps that might help when reworking existing parts of the codebase into the new, refactored generator? |
If possible, please address #305 during the rewrite. |
@MaikKlein Perhaps something to take into account with the new generator: have you thought about what to do when multiple struct fields share the same length field? Right now the builder overwrites it which can either yield unexpected results or out of bounds reads. A good example: I extended our use of There seem to be a couple ways to make this safer:
|
|
I really like how I thought about switching to it at one point but ran into a few things that I didn't like (and I think ash should avoid or keep in mind)
|
Just for clarity's sake, generator Windows support and CI support was since addressed. |
We've discussed merging with erupt in the past, and trying to assemble the best of both worlds. A detailed writeup of where the libs currently differ, and proposals for which approach to retain, would be a great place for that effort to kick off. |
I put together a roadmap on where erupt currently stands in regards to the ash merge. https://gitlab.com/Friz64/erupt/-/issues/56 |
There is also higher level APIs that implement auto-destroy or treating CommandBuffers with different Queue properties as being separate rust types, to guard against calling unsupported cmd functions at compile time. |
@Friz64 That's great, looking forward to collaborating on a unified, smooth Vulkan wrapper experience! I'll make sure to be around and help out as much as I can. For starters we should lay out the differences between both our generators and the code generated from it. Combine that with current desires for the codebase and we should have a nice plan forward, mainly driven by the resulting user-visible API. What do you think is the best way to cook this up: a long GH discussion thread, a collaborative design document or something else entirely? I could start naming some random points but don't think that's very useful without structure. |
❤️
My initial thought was using a GitHub discussion where you can throw in comments for any differences that need to be addressed and people can discuss what to do in the replies of each comment. |
I really dislike how I announced this over 4 months ago, and then promptly disappeared. I do want to get this done, but it hasn't worked with the current approach. I'm not able to exactly pinpoint what went wrong, but I think it's the merge being too daunting for me, especially the fear that I'd have to rework big parts of the existing erupt generator codebase, and that being a ton of annoying work very hard to finish. So, I want to try to start work on the new generator now, and discuss design choices as they come up. This doesn't mean we have to throw old the entirety of the cold code, there's certainly still ideas and snippets that can be reused. If this plan sounds good, i'll start a "Design of the rewrite" discussion and (hopefully be able to) get to work. |
Sounds good to me, thanks! |
The discussion: #662 |
Same here, this topic crossed my mind a few times yet have too many responsibilities on my mind. Alas, I don't think this is a thing anyone should be doing all alone. It doesn't seem like merging would work. If anything I'd start with the generator that's in the best shape - In the end I prefer to set some goals targeting the outcome of the generator: where do For the generator itself I mostly wish that One thing to keep in mind is that I recently found @jdtatz overhauling the entire generator to finally switch to |
Yes, I think it's easier to start anew, there's less old code that interferes with new requirements. And, as stated previously, it's not like we can't still use it to some degree.
I agree that the new generator should use this design.
I liked not having to use external crates for any Vulkan specific business in erupt, it allowed me to be more flexible. |
Any update on this? |
Next step is getting #745 updated & merged. As I understand it, eddyb is not 100% satisfied with the C parser in its current state, but I think I should put it back in as is, so that the work can continue. Taking a step back: It's obvious that this whole ordeal is not at the highest priority. The current generator is far from perfect, but still workable. Writing a new one requires a lot of work and coordination. That time, passion, and energy I promise I will have someday :3 |
The current design of the generator has become almost unmaintainable. There have been lots of changes to vk.xml and how we use it in ash in the past 5 years.
I started a very early WIP branch a couple of months ago, but haven't had much time to work on it so far. But I now have more time to spare and hopefully I can finish this up in the next couple of months.
I am going to list some of the changes/additions I have been thinking about:
Fully switch to vk-parse, don't use the outdated vkxml anymore
Don't use syn and quote anymore. They don't really have many benefits for pure codegen. Instead we will write directly to the files ourselves.
The generator needs to be easily understandable and documented. Need to make it easier for people to contribute.
Feature flags all the things:
ash
gets slower to compile every release.ash
andash-sys
.Generate everything: Currently only the low level part is generated. Every high level function is written by hand. Instead we will now generate 95% and only handwrite functions that are particularly difficult to generate correctly.
No build.rs: I have been thinking about this for a while. Initially I wanted to move the generation into a build.rs file, but has some limitations. We can't autogenerate the feature flags for extensions, and it will introduce dev-depencies. I'd rather have
ash
remain a 0 dependency library for now.No huge files anymore: We need to split everything into multiple files. Github already can't show the diffs anymore for some files, and rustc/rustdoc struggle as well with files that are 50k loc.
...
The text was updated successfully, but these errors were encountered: