Skip to content

Commit

Permalink
Ensure VkPrivateDataSlot has a transparent struct wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
tannergooding committed Feb 15, 2022
1 parent 58719a4 commit 692ff7f
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 8 deletions.
1 change: 1 addition & 0 deletions generation/remap-transparent.rsp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ VkPhysicalDevice=void*;Handle
VkPipeline=ulong;HandleVulkan
VkPipelineCache=ulong;HandleVulkan
VkPipelineLayout=ulong;HandleVulkan
VkPrivateDataSlot=ulong;HandleVulkan
VkPrivateDataSlotEXT=ulong;HandleVulkan
VkQueryPool=ulong;HandleVulkan
VkQueue=void*;Handle
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.

using System;

namespace
TerraFX.Interop.Vulkan
{
public partial struct VkPrivateDataSlot : IComparable, IComparable<VkPrivateDataSlot>, IEquatable<VkPrivateDataSlot>, IFormattable
{
public readonly ulong Value;

public VkPrivateDataSlot(ulong value)
{
Value = value;
}

public static VkPrivateDataSlot NULL => new VkPrivateDataSlot(0);

public static bool operator ==(VkPrivateDataSlot left, VkPrivateDataSlot right) => left.Value == right.Value;

public static bool operator !=(VkPrivateDataSlot left, VkPrivateDataSlot right) => left.Value != right.Value;

public static bool operator <(VkPrivateDataSlot left, VkPrivateDataSlot right) => left.Value < right.Value;

public static bool operator <=(VkPrivateDataSlot left, VkPrivateDataSlot right) => left.Value <= right.Value;

public static bool operator >(VkPrivateDataSlot left, VkPrivateDataSlot right) => left.Value > right.Value;

public static bool operator >=(VkPrivateDataSlot left, VkPrivateDataSlot right) => left.Value >= right.Value;

public static implicit operator VkPrivateDataSlot(byte value) => new VkPrivateDataSlot(value);

public static explicit operator byte(VkPrivateDataSlot value) => (byte)(value.Value);

public static explicit operator VkPrivateDataSlot(short value) => new VkPrivateDataSlot((ulong)(value));

public static explicit operator short(VkPrivateDataSlot value) => (short)(value.Value);

public static explicit operator VkPrivateDataSlot(int value) => new VkPrivateDataSlot((ulong)(value));

public static explicit operator int(VkPrivateDataSlot value) => (int)(value.Value);

public static explicit operator VkPrivateDataSlot(long value) => new VkPrivateDataSlot((ulong)(value));

public static explicit operator long(VkPrivateDataSlot value) => (long)(value.Value);

public static explicit operator VkPrivateDataSlot(nint value) => new VkPrivateDataSlot((ulong)(value));

public static explicit operator nint(VkPrivateDataSlot value) => (nint)(value.Value);

public static explicit operator VkPrivateDataSlot(sbyte value) => new VkPrivateDataSlot((ulong)(value));

public static explicit operator sbyte(VkPrivateDataSlot value) => (sbyte)(value.Value);

public static implicit operator VkPrivateDataSlot(ushort value) => new VkPrivateDataSlot(value);

public static explicit operator ushort(VkPrivateDataSlot value) => (ushort)(value.Value);

public static implicit operator VkPrivateDataSlot(uint value) => new VkPrivateDataSlot(value);

public static explicit operator uint(VkPrivateDataSlot value) => (uint)(value.Value);

public static implicit operator VkPrivateDataSlot(ulong value) => new VkPrivateDataSlot(value);

public static implicit operator ulong(VkPrivateDataSlot value) => value.Value;

public static implicit operator VkPrivateDataSlot(nuint value) => new VkPrivateDataSlot(value);

public static explicit operator nuint(VkPrivateDataSlot value) => (nuint)(value.Value);

public int CompareTo(object? obj)
{
if (obj is VkPrivateDataSlot other)
{
return CompareTo(other);
}

return (obj is null) ? 1 : throw new ArgumentException("obj is not an instance of VkPrivateDataSlot.");
}

public int CompareTo(VkPrivateDataSlot other) => Value.CompareTo(other.Value);

public override bool Equals(object? obj) => (obj is VkPrivateDataSlot other) && Equals(other);

public bool Equals(VkPrivateDataSlot other) => Value.Equals(other.Value);

public override int GetHashCode() => Value.GetHashCode();

public override string ToString() => Value.ToString();

public string ToString(string? format, IFormatProvider? formatProvider) => Value.ToString(format, formatProvider);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,13 @@ public unsafe partial struct VkDeviceManualImports

public delegate* unmanaged<VkDevice, VkIndirectCommandsLayoutNV, VkAllocationCallbacks*, void> vkDestroyIndirectCommandsLayoutNV;

public delegate* unmanaged<VkDevice, VkPrivateDataSlotCreateInfoEXT*, VkAllocationCallbacks*, VkPrivateDataSlot_T**, VkResult> vkCreatePrivateDataSlotEXT;
public delegate* unmanaged<VkDevice, VkPrivateDataSlotCreateInfoEXT*, VkAllocationCallbacks*, VkPrivateDataSlot*, VkResult> vkCreatePrivateDataSlotEXT;

public delegate* unmanaged<VkDevice, VkPrivateDataSlot_T*, VkAllocationCallbacks*, void> vkDestroyPrivateDataSlotEXT;
public delegate* unmanaged<VkDevice, VkPrivateDataSlot, VkAllocationCallbacks*, void> vkDestroyPrivateDataSlotEXT;

public delegate* unmanaged<VkDevice, VkObjectType, ulong, VkPrivateDataSlot_T*, ulong, VkResult> vkSetPrivateDataEXT;
public delegate* unmanaged<VkDevice, VkObjectType, ulong, VkPrivateDataSlot, ulong, VkResult> vkSetPrivateDataEXT;

public delegate* unmanaged<VkDevice, VkObjectType, ulong, VkPrivateDataSlot_T*, ulong*, void> vkGetPrivateDataEXT;
public delegate* unmanaged<VkDevice, VkObjectType, ulong, VkPrivateDataSlot, ulong*, void> vkGetPrivateDataEXT;

public delegate* unmanaged<VkDevice, VkRenderPass, VkExtent2D*, VkResult> vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI;

Expand Down
8 changes: 4 additions & 4 deletions sources/Interop/Vulkan/Vulkan/vulkan/vulkan_core/Vulkan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1096,16 +1096,16 @@ public static unsafe partial class Vulkan
public static extern VkResult vkGetPhysicalDeviceToolProperties(VkPhysicalDevice physicalDevice, [NativeTypeName("uint32_t *")] uint* pToolCount, [NativeTypeName("VkPhysicalDeviceToolProperties *")] VkPhysicalDeviceToolPropertiesEXT* pToolProperties);

[DllImport("vulkan", ExactSpelling = true)]
public static extern VkResult vkCreatePrivateDataSlot(VkDevice device, [NativeTypeName("const VkPrivateDataSlotCreateInfo *")] VkPrivateDataSlotCreateInfoEXT* pCreateInfo, [NativeTypeName("const VkAllocationCallbacks *")] VkAllocationCallbacks* pAllocator, [NativeTypeName("VkPrivateDataSlot *")] VkPrivateDataSlot_T** pPrivateDataSlot);
public static extern VkResult vkCreatePrivateDataSlot(VkDevice device, [NativeTypeName("const VkPrivateDataSlotCreateInfo *")] VkPrivateDataSlotCreateInfoEXT* pCreateInfo, [NativeTypeName("const VkAllocationCallbacks *")] VkAllocationCallbacks* pAllocator, VkPrivateDataSlot* pPrivateDataSlot);

[DllImport("vulkan", ExactSpelling = true)]
public static extern void vkDestroyPrivateDataSlot(VkDevice device, [NativeTypeName("VkPrivateDataSlot")] VkPrivateDataSlot_T* privateDataSlot, [NativeTypeName("const VkAllocationCallbacks *")] VkAllocationCallbacks* pAllocator);
public static extern void vkDestroyPrivateDataSlot(VkDevice device, VkPrivateDataSlot privateDataSlot, [NativeTypeName("const VkAllocationCallbacks *")] VkAllocationCallbacks* pAllocator);

[DllImport("vulkan", ExactSpelling = true)]
public static extern VkResult vkSetPrivateData(VkDevice device, VkObjectType objectType, [NativeTypeName("uint64_t")] ulong objectHandle, [NativeTypeName("VkPrivateDataSlot")] VkPrivateDataSlot_T* privateDataSlot, [NativeTypeName("uint64_t")] ulong data);
public static extern VkResult vkSetPrivateData(VkDevice device, VkObjectType objectType, [NativeTypeName("uint64_t")] ulong objectHandle, VkPrivateDataSlot privateDataSlot, [NativeTypeName("uint64_t")] ulong data);

[DllImport("vulkan", ExactSpelling = true)]
public static extern void vkGetPrivateData(VkDevice device, VkObjectType objectType, [NativeTypeName("uint64_t")] ulong objectHandle, [NativeTypeName("VkPrivateDataSlot")] VkPrivateDataSlot_T* privateDataSlot, [NativeTypeName("uint64_t *")] ulong* pData);
public static extern void vkGetPrivateData(VkDevice device, VkObjectType objectType, [NativeTypeName("uint64_t")] ulong objectHandle, VkPrivateDataSlot privateDataSlot, [NativeTypeName("uint64_t *")] ulong* pData);

[DllImport("vulkan", ExactSpelling = true)]
public static extern void vkCmdSetEvent2(VkCommandBuffer commandBuffer, VkEvent @event, [NativeTypeName("const VkDependencyInfo *")] VkDependencyInfoKHR* pDependencyInfo);
Expand Down

0 comments on commit 692ff7f

Please sign in to comment.