Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@amerkoleci
Copy link
Contributor

@amerkoleci amerkoleci commented Jun 18, 2018

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.

@amerkoleci
Copy link
Contributor Author

If you want you can merge thoose improvements, I will add more later on

@WardBenjamin
Copy link
Contributor

I appreciate the Version changes - been using reflection to get at that value but I'd forgotten to open a PR.

Copy link
Owner

@discosultan discosultan left a comment

Choose a reason for hiding this comment

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

Thanks!

/// <param name="allocationScope">
/// Value specifying the allocation scope of the lifetime of the allocation.
/// </param>
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
Copy link
Owner

Choose a reason for hiding this comment

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

Why is this needed?

Copy link
Contributor Author

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

Copy link
Owner

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?

Copy link
Contributor Author

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()
Copy link
Owner

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);
Copy link
Owner

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;
Copy link
Owner

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)
Copy link
Owner

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?

Copy link
Contributor Author

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
Copy link
Owner

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.

@amerkoleci
Copy link
Contributor Author

Can we get this merged? I would love to work on 1.1 additions.

@discosultan
Copy link
Owner

@amerkoleci Yes, let's get this resolved today. I just have a few additional questions regarding the UnmanagedFunctionPointer usage.

base.Dispose();
}

[UnmanagedFunctionPointer(CallingConvention.Winapi)]
Copy link
Owner

Choose a reason for hiding this comment

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

  1. 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.

  2. Why is the attribute applied only to those couple of delegate types in AllocationCallbacks, CommandPool and Device classes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. 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.
  2. Didn't had time to add on rest of delegates.

Copy link
Owner

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!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, will do ASAP

@discosultan discosultan merged commit d0388b6 into discosultan:master Jun 20, 2018
@discosultan
Copy link
Owner

Thanks 👍

@WardBenjamin
Copy link
Contributor

Solid, thank you!

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.

3 participants