-
Notifications
You must be signed in to change notification settings - Fork 26
Improvements #29
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
Improvements #29
Conversation
…ion int. Add implicit conversion from Version to int.
|
If you want you can merge thoose improvements, I will add more later on |
|
I appreciate the Version changes - been using reflection to get at that value but I'd forgotten to open a PR. |
discosultan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Src/AllocationCallbacks.cs
Outdated
| /// <param name="allocationScope"> | ||
| /// Value specifying the allocation scope of the lifetime of the allocation. | ||
| /// </param> | ||
| [UnmanagedFunctionPointer(CallingConvention.Winapi)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The vulkan call is stdcall on windows and cdecl on non windows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the default behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None, if you dont mark without UnmanagedFunctionPointer, WinApi behave as I described, StdCall on windows Cdecl else where
| /// <param name="g">The green clear value.</param> | ||
| /// <param name="b">The blue clear value.</param> | ||
| /// <param name="a">The alpha clear value.</param> | ||
| public ClearColorValue(float r, float g, float b, float a = 1.0f) : this() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great addition 👍
| callbackHandle = Interop.GetFunctionPointerForDelegate(_callback); | ||
| } | ||
| createInfo.ToNative(out DebugReportCallbackCreateInfoExt.Native nativeCreateInfo, callbackHandle); | ||
| createInfo.ToNative(out DebugReportCallbackCreateInfoExt.Native nativeCreateInfo, callbackHandle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| /// number of the application. | ||
| /// </summary> | ||
| public int ApplicationVersion; | ||
| public Version ApplicationVersion; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I never realized these values were using the Version encoding scheme.
| /// </summary> | ||
| public static Version Zero => new Version(0, 0, 0); | ||
|
|
||
| public static implicit operator int(Version version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this implicit conversion useful?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't hurt and for debug purpose is good
| /// <summary> | ||
| /// Static vulkan library loaded from host platform. | ||
| /// </summary> | ||
| public static class VulkanLibrary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idea to make it public if it's useful outside this library.
|
Can we get this merged? I would love to work on 1.1 additions. |
|
@amerkoleci Yes, let's get this resolved today. I just have a few additional questions regarding the |
Src/CommandPool.cs
Outdated
| base.Dispose(); | ||
| } | ||
|
|
||
| [UnmanagedFunctionPointer(CallingConvention.Winapi)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Can you describe a use case where not having this attribute is an issue? I'm just trying to get a better overview of the problem here.
-
Why is the attribute applied only to those couple of delegate types in
AllocationCallbacks,CommandPoolandDeviceclasses?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I've added that as Mono Vulkan C# (https://github.com/mono/VulkanSharp/blob/master/src/Vulkan/Interop/ImportedCommands.cs), dunno what is the default calling convension.
- Didn't had time to add on rest of delegates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright. Before I could merge these kind of changes, I would need to get a clear understanding of what problem it solves. I wouldn't just blindly follow other implementations without reasoning. Also, if it's going into master branch, it shouldn't be just a partial fix, but should be applied everywhere.
Could you remove those attributes from this PR and I'd happily merge rest of the changes. We can tackle the UnmanagedFunctionPointer in a separate issue or PR if you're interested.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, will do ASAP
|
Thanks 👍 |
|
Solid, thank you! |
ApplicationInfo ApplicationVersion and EngineVersion are encoded Version int.
Add implicit conversion from Version to int.
Make VulkanLibrary public for external call extendibility.
Some UnmanagedFunctionPointer WinApi.
Add new ClearColorValue constructor taking r, g, b, a.