-
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
Add support for 1.1 #52
Comments
Maybe parameterize the implementation by revision number of the extension? So that when we go from a hypothetical |
I just add I think the bigger problem is that the KHX extensions won't be in the in the I guess KHX will be just for experimentation and they can be removed in |
Also I was wrong about the extension part, I should have looked at the spec directly. https://www.khronos.org/registry/vulkan/specs/1.1-khr-extensions/html/vkspec.html#versions-1.1 Promoted to core just means that the functions from the extensions are now normal core functions, and they will be added to the Perfect :) |
Any news on this? |
@cyres Currently blocked on NicolBolas/New-Vulkan-XML-Format#17 |
Quick update: I started to write my own xml parser because I can't wait any longer. After reading the xml file I discovered that there are conditional extensions, which is problematic. For example And now in |
@MaikKlein How does the official SDK handle this? Maybe we could expose everything in ash, but load the conditional functions lazily/on demand? To let the application developer resolve dependencies between extensions. I'm not sure if this makes sense, but if you need any help, let us know! |
@farnoy Thanks, I'll try to finish up the new generator until tomorrow. I think every other loader just silently fails to load the fp if it is not available and then crashes at runtime if it is used. I still kind of like the idea that in ash you can be sure that if you create a 1.0 context, you can't accidentally use 1.1 functions. But I'll worry about this after I finish up the generator. |
Hey @MaikKlein, any updates? |
Sorry, I am almost done but I couldn't finish it yet. I have a live presentation for rlsl tomorrow and I needed to implement a few things for it. I think I should be able to finish the generator branch this weekend. |
Of course, no worries! Thanks for the update and good luck tomorrow. Hope the presentation gets linked on /r/rust 😄 |
@farnoy It wasn't recorded and I only presented it 1 on 1. So the generator branch is mostly done, I think. I need to fix a few extensions names. I'll probably merge EntryFn and StaticFn together. There are also a few breaking changes for some static arrays where vk-rs previously did the wrong thing. There is the issue for platform dependent extensions. Ash currently just exposed every extension unconditionally but some extensions use types that are not simple typedefs, like the winapi and Android like I also want to make it easier for extensions to be used even if ash doesn't expose them directly. Currently it is awkward to load the raw version manually. The general idea is that even if ash doesn't expose a nicer interface for a function/extension you can always fall back to the raw Vulkan version. |
Do you plan to make the raw interface available in a seperate crate? Will it be possible to call functions, which do not require the device as parameter, without the device object? This would make it possible to use e.g. |
Ah I am not sure if that would be so great. Of course can do it, and I maybe should and will, but even if the device is not an explicit parameter, it is an implicit one, so you need to be careful on which device you record the commands on and don't accidentally send it to the wrong device. The function pointers here belong to one device, that is why they are in the device object. Of course as long as you only create one device, you should be fine. Good idea I'll probably separate |
Another small update. Ash now successfully compiles with the new generator branch. A few extension constants are still missing. I refactored the way Ash handled enums and bitflags. Everything is now a struct with constants. Sadly this is a breaking change, but the best possible way forward. A side effect of it is that racer can now complete bitflag variants for you.
See #71 for more information about why this was necessary. The 1.1 function pointers are also working but still have to be exposed on a higher level. The last missing part is now to make the examples work with the new generator branch. |
Just a minor nitpick: considering all of the bit flags are within a structure namespace, SomeStructureFlags::SOME_CONSTANT, is it necessary to have the |
Another upside to the new approach is that the rustdocs will now include the constants on the type's page. Speaking of docs, how difficult would it be to include them, too, at least for stuff like constants and types, which don't need further wrapping? |
@GabrielMajeri Good catch, no it is not necessary, I just missed it.
I am not sure what you mean. |
vk.xml often contains Going further, the spec itself is machine readable and it might be possible to generate long-form documentation from it similar to the official manpages, but on review it looks like that would be a large project. |
@Ralith Yeah that should be possible. I am using quote / syn for generation and the whole output is on a single line so any kind of comment will comment out everything. Also there is no real support for comments at all, I am on a dated version where I could technically "hack" it with I probably should open an issue for this one. |
Could you use the attribute form instead? |
@Ralith Done Also I discovered that the comments are not as extensive as I thought. A lot of documentation is maintained in a separate json file. It should be possible to integrate, but it is not a priority at the moment. But I will use all the available documentation that is inside the vk.xml file |
Do you need help converting the examples? I'd do it so you can focus on implementing the extension related things. |
@cyres Yes that would be great, someone else also wanted to work on it too. I just need to fix a few naming regressions and properly expose all the extension constants. I'll open an issue when the examples can be ported. |
Currently blocked on krolli/vk-parse#3 as I can't generate all the constants for the extensions. I could temporarily ignore these constants and hope that they are not needed right now. |
Update: Extension constants now seem to be properly generated, which means we should be able to update the examples. I'll push the changes shortly. The generator branch is a bit messy right now, there were a couple of edge cases that I didn't think about, and I definitely need to clean everything up, but the generated What is currently missing are extension constants that are not bitflags and aliases of those constants, because the vk.xml has some weird edge cases that might get fixed in KhronosGroup/Vulkan-Docs#747 but they shouldn't be required right now. If anyone wants to port examples, just let me know, otherwise I port them myself. It should be fairly straight forward to port them, just let the compiler guide you. Exension structs now have KHR, NV etc in their name, Bitflags and constants that were previously enums are now just constants inside a struct. As I posted above it will look like
Also racer can now complete those constants, which should make it easier to refactor. If anything is missing or you encounter some weird naming issue, just let me know I am sure there are a few edge cases that I missed. Bitflags also now contain their vendor name like After the examples have been ported, I'll start to expose |
As mentioned before, I'd port the samples. You may open an issue, as soon as you pushed the commits. |
@cyres Thanks, I pushed the changes into the generator branch. I ran into some git index issues with submodules but generating the |
Weren't we getting rid of the |
@Ralith Where do you see a |
I'm looking at the comment you posted 11 hours ago, but I'm guessing that was just copypasted from prior discussion. |
@Ralith Yes sorry I just copy pasted it from above. I also now implemented automatic detection and codegen for Debug and Default, where it can't be automatically derived. More derives are planed.
For default pointers are currently initialized with Also I wasn't sure what meaningful debug message I could output for unions. I also now generate disabled extensions because the spec is kinda weird and some types require types from disabled extensions. I also now generate all the bitflags and enum constants, previously I missed a few because they are defined at multiple locations, don't ask me why. |
|
We could always spell out |
Prefixing otherwise-illegal identifiers with |
@farnoy I think it would be nice for small numbers, but maybe a bit weird for bigger ones like I feel like
|
Since the examples are ported now and I have some free time, I'd like to help you out more. Is there something you need help with? |
@cyres Thanks, help is always appreciated. I paved the way for 1.1 a few commits ago
Alternatively, I think https://github.com/krolli/vk-parse/issues could probably use a few maintainers as well. vk-parse is essential for ash, and the newest version of the vk.xml doesn't parse. Also vk-parse isn't published yet on crates.io, which I want to have before I merge the generator branch into master and publish a new version. |
Sure, I'll start with wrapping the raw functions for Instance and Device. When exactly do you use an unsafe function? |
@cyres Almost everything is unsafe. Just mark everything unsafe, there are a few cases were it possibly can be removed. If you want a general guideline. I think if the function is stateless like Also any function that uses an Most instance level functions are probably safe, while almost every device level function is most likely unsafe. |
I like this better than |
Hi, vk-parse should now be available on crates.io (huge thanks to @GabrielMajeri for helping out with it). I also set-up nightly parsing of various spec versions including master to get heads-up when spec changes in unexpected ways. It's not as good as I'd like it to be, but still better than nothing. |
@MaikKlein I think we are missing EntryV1_1 along the new structures. There is no way to obtain an unsafe fn create_instance(
&self,
create_info: &InstanceCreateInfo,
allocation_callbacks: Option<&AllocationCallbacks>
) -> Result<Instance<Self::Fp>, InstanceError> EDIT: Workaround: let instance = unsafe { entry.create_instance(&create_info, None)? };
let fp_1_1 = unsafe {
InstanceFpV1_1::load(entry.static_fn(), instance.handle())
.expect("failed to load 1.1 instance functions")
};
let instance_1_1 = ash::Instance::<V1_1>::from_raw(instance.handle(), fp_1_1); |
Some issues that need to be addressed before we merge into master and release a new version:
Some things that are missing: IIRC some constants like extension names are still missing, I'll open an issue later. There are probably a lot of missing derived traits. It is just really annoying to detect which traits should be derived for which structs without any type information. I think we only derive I think I should open a milestone. I just want to thank all of you for supporting ash. Every contribution is greatly appreciated. |
Vulkan 1.1 has officially been released.
It seems they didn't actually add any new functionality to the core spec, but only moved some KHX extensions into core as KHR.
I think this means that the version specific loader in
ash
is almost useless, if Khronos continues to only add functionality with extensions.I think I will still add an
V1_1
struct, it will just not add any new functionality.The update should be relatively painless, although it would be really nice if
vk.rs
could be generated which means I am going to prioritize #7 now.I think this is interesting, and I am not sure how I should handle it. I don't think
ash
currently exposes any KHX extensions yet, so it is not a problem currently but the question is how shouldash
handle it in the future?The text was updated successfully, but these errors were encountered: