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

Skip to content
12 changes: 12 additions & 0 deletions Src/CommandBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1963,6 +1963,18 @@ public ClearColorValue(ColorU4 value) : this()
{
UInt4 = value;
}

/// <summary>
/// Initializes a new instance of the <see cref="ClearColorValue"/> structure.
/// </summary>
/// <param name="r">The red clear value.</param>
/// <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 👍

{
Float4 = new ColorF4(r, g, b, a);
}
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Src/CommandPool.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Runtime.InteropServices;

namespace VulkanCore
Expand Down
2 changes: 1 addition & 1 deletion Src/Ext/DebugReportCallbackExt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ internal DebugReportCallbackExt(Instance parent,
});
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.

👍


long handle;
Result result = vkCreateDebugReportCallbackEXT(Parent)(Parent, &nativeCreateInfo, NativeAllocator, &handle);
Expand Down
10 changes: 5 additions & 5 deletions Src/Instance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public unsafe struct ApplicationInfo
/// The unsigned integer variable containing the developer-supplied version
/// 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>
/// The unicode string containing the name of the engine (if any) used to create the application.
/// </summary>
Expand All @@ -316,7 +316,7 @@ public unsafe struct ApplicationInfo
/// The unsigned integer variable containing the developer-supplied version
/// number of the engine used to create the application.
/// </summary>
public int EngineVersion;
public Version EngineVersion;
/// <summary>
/// The version of the Vulkan API against which the application expects to run. If <see
/// cref="ApiVersion"/> is <see cref="Version.Zero"/> the implementation must ignore it,
Expand Down Expand Up @@ -350,8 +350,8 @@ public unsafe struct ApplicationInfo
/// the major and minor versions of the instance must match those requested in <see cref="ApiVersion"/>.
/// </param>
public ApplicationInfo(
string applicationName = null, int applicationVersion = 0,
string engineName = null, int engineVersion = 0,
string applicationName = null, Version applicationVersion = default(Version),
string engineName = null, Version engineVersion = default(Version),
Version apiVersion = default(Version))
{
ApplicationName = applicationName;
Expand All @@ -370,7 +370,7 @@ internal struct Native
public int ApplicationVersion;
public IntPtr EngineName;
public int EngineVersion;
public Version ApiVersion;
public int ApiVersion;

public void Free()
{
Expand Down
5 changes: 5 additions & 0 deletions Src/Version.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,10 @@ public Version(int major, int minor, int patch)
/// A shorthand for writing <c>new Version(0, 0, 0)</c>.
/// </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

{
return version._value;
}
}
}
5 changes: 4 additions & 1 deletion Src/VulkanLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@

namespace VulkanCore
{
internal static class VulkanLibrary
/// <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.

{
private static readonly IntPtr _handle;

Expand Down
2 changes: 1 addition & 1 deletion Tests/InstanceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void Constructor()
public void ConstructorWithApplicationInfo()
{
var createInfo1 = new InstanceCreateInfo(new ApplicationInfo());
var createInfo2 = new InstanceCreateInfo(new ApplicationInfo("app name", 1, "engine name", 2));
var createInfo2 = new InstanceCreateInfo(new ApplicationInfo("app name", new Version(1, 0, 0), "engine name", new Version(2, 0, 0)));
using (new Instance(createInfo1)) { }
using (new Instance(createInfo2)) { }
}
Expand Down