-
Notifications
You must be signed in to change notification settings - Fork 60
Support (at least) the 1.1.111 spec. #82
base: main
Are you sure you want to change the base?
Conversation
We could continue to use the old functions, but currently the code doesn't save any prototype information for functions. Thus our alias can't have the same prototype as the original, so can't have its full code generated. Instead, for now we just generate a very very simple import as:
```csharp
[Obsolete("{0} is deprecated, please use {1} instead.", true)]
[DllImport (VulkanLibrary, CallingConvention = CallingConvention.Winapi)]
private static unsafe extern void {0} ();
```
And hope that is sufficient.
I tried for a while to figure out how to support this. The fundamental issue is that `fixed` must (by definition) be a fixed size array. But this is an array of pointers, which varies in size by platform. In C that's not an issue, just compile for both, in C# you can't do that.
One set some types that didn't need to be hard-coded. The other fixed newlines within functions, but cluttered the resulting generated diff.
|
@Y-Less did you close the PR by a mistake? |
|
No, I realised a bug, I'm just working on fixing it. Bit flags moved from extensions to the main spec didn't generate their aliases properly. I was going to reopen it when that was done. |
|
It also doesn't currently generate complete enum aliases, so these lines are ignored: <type category="enum" name="VkPeerMemoryFeatureFlagBitsKHR" alias="VkPeerMemoryFeatureFlagBits"/>And thus |
|
OK, I started fixing the whitespace issues meanwhile, so that it is easier for me to review. Let me know when it is ready and I will get back to it. Thanks for all the work! |
|
Sorry about the whitespace. I've fixed that now, along with I hope the other bits. The main change being that it will now generate: [Flags]
public enum PeerMemoryFeatureFlags : int
{
CopySrc = 0x1,
CopyDst = 0x2,
GenericSrc = 0x4,
GenericDst = 0x8,
CopySrcKhr = CopySrc,
CopyDstKhr = CopyDst,
GenericSrcKhr = GenericSrc,
GenericDstKhr = GenericDst,
}
[Obsolete ("PeerMemoryFeatureFlagsKhr is deprecated, please use PeerMemoryFeatureFlags instead.")]
[Flags]
public enum PeerMemoryFeatureFlagsKhr : int
{
CopySrc = 0x1,
CopyDst = 0x2,
GenericSrc = 0x4,
GenericDst = 0x8,
CopySrcKhr = CopySrc,
CopyDstKhr = CopyDst,
GenericSrcKhr = GenericSrc,
GenericDstKhr = GenericDst,
} |
|
One thing I should flag is this: The old generated code contained three enum flag bits whose naming didn't match any others. Most enums have the |
|
I have created an I will go thru them hopefully tomorrow to see what to do with them. I am attaching the |
|
Unfortunately a lot of them it isn't obvious what the correct response is. Some of them they renamed the functions (for example The changed base objects in that report are just my method of aliasing some things, so it is still the same base object transitively, and the removed properties are instead now inherited. But for many of these decisions I think someone far more experienced should look at it, and compare to existing code. TBH I did this as a way to learn the library and Vulkan when I discovered that this library didn't support the new debugging interface in the main vulkan-tutorial. |
Major additions:
aliasattributes are parsed to generate new versions of commands/structs/enums pointing at the old versions. Usually when an extension has been moved in to the main spec. Also deprecates the old version. Commands will give a warning, structs are implicitly converted, enums reference each other.Examples:
featuretags are now parsed in much the same way asextensiontags.extnumberattributes are optionally used for determining enum values.Added a few more basic types:
zx_handle_t,DeviceAddress,HMONITOR,GgpStreamDescriptor, andGgpFrameToken.Recognise the
INTELvendor suffix.Currently just disables several android- and metal-specific extensions, as they couldn't be generated correctly.
Also disables a few commands that needed pointers to pointers, and fixed pointer arrays (was already listed as
TODOin the generator before I touched anything, so this isn't actually a change).Now pulls the latest
vk.xmlfile from the Vulkan docs, not just pinned to 1.0.