Skip to content

Commit

Permalink
Simplify API for binding to extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
xoofx committed Jun 27, 2024
1 parent eb0ff2b commit e318fc1
Show file tree
Hide file tree
Showing 20 changed files with 670 additions and 680 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,10 @@ private void ProcessVulkanFunction(CSharpMethod csFunction)

pfn.BaseTypes.Add(new CSharpGenericTypeReference("IvkFunctionPointer", [pfn]));

var csProperty = new CSharpProperty("Prototype")
var csProperty = new CSharpProperty("Name")
{
ReturnType = new CSharpGenericTypeReference($"vkFunctionPointerPrototype", [pfn]),
GetBodyInlined = $"new(\"{csFunction.Name}\"u8)",
ReturnType = new CSharpFreeType($"ReadOnlyMemoryUtf8"),
GetBodyInlined = $"\"{csFunction.Name}\"u8",
Visibility = CSharpVisibility.Public,
Modifiers = CSharpModifiers.Static,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ public partial struct VkIcdSurfaceImagePipe
/// <summary>
/// Gets the prototype of the function `vk_icdNegotiateLoaderICDInterfaceVersion`.
/// </summary>
public static vkFunctionPointerPrototype<vulkan.PFN_vk_icdNegotiateLoaderICDInterfaceVersion> Prototype => new("vk_icdNegotiateLoaderICDInterfaceVersion"u8);
public static ReadOnlyMemoryUtf8 Name => "vk_icdNegotiateLoaderICDInterfaceVersion"u8;

public vulkan.VkResult Invoke(uint* pVersion)
{
Expand Down Expand Up @@ -345,7 +345,7 @@ public vulkan.VkResult Invoke(uint* pVersion)
/// <summary>
/// Gets the prototype of the function `vk_icdGetInstanceProcAddr`.
/// </summary>
public static vkFunctionPointerPrototype<vulkan.PFN_vk_icdGetInstanceProcAddr> Prototype => new("vk_icdGetInstanceProcAddr"u8);
public static ReadOnlyMemoryUtf8 Name => "vk_icdGetInstanceProcAddr"u8;

public vulkan.PFN_vkVoidFunction Invoke(vulkan.VkInstance instance, byte* pName)
{
Expand Down Expand Up @@ -382,7 +382,7 @@ public vulkan.PFN_vkVoidFunction Invoke(vulkan.VkInstance instance, byte* pName)
/// <summary>
/// Gets the prototype of the function `vk_icdGetPhysicalDeviceProcAddr`.
/// </summary>
public static vkFunctionPointerPrototype<vulkan.PFN_vk_icdGetPhysicalDeviceProcAddr> Prototype => new("vk_icdGetPhysicalDeviceProcAddr"u8);
public static ReadOnlyMemoryUtf8 Name => "vk_icdGetPhysicalDeviceProcAddr"u8;

public vulkan.PFN_vkVoidFunction Invoke(vulkan.VkInstance instance, byte* pName)
{
Expand Down Expand Up @@ -419,7 +419,7 @@ public vulkan.PFN_vkVoidFunction Invoke(vulkan.VkInstance instance, byte* pName)
/// <summary>
/// Gets the prototype of the function `vk_icdEnumerateAdapterPhysicalDevices`.
/// </summary>
public static vkFunctionPointerPrototype<vulkan.PFN_vk_icdEnumerateAdapterPhysicalDevices> Prototype => new("vk_icdEnumerateAdapterPhysicalDevices"u8);
public static ReadOnlyMemoryUtf8 Name => "vk_icdEnumerateAdapterPhysicalDevices"u8;

public vulkan.VkResult Invoke(vulkan.VkInstance instance, ulong adapterLUID, uint* pPhysicalDeviceCount, vulkan.VkPhysicalDevice* pPhysicalDevices)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ public partial struct VkEnumerateInstanceVersionChain
/// <summary>
/// Gets the prototype of the function `vkNegotiateLoaderLayerInterfaceVersion`.
/// </summary>
public static vkFunctionPointerPrototype<vulkan.PFN_vkNegotiateLoaderLayerInterfaceVersion> Prototype => new("vkNegotiateLoaderLayerInterfaceVersion"u8);
public static ReadOnlyMemoryUtf8 Name => "vkNegotiateLoaderLayerInterfaceVersion"u8;

public vulkan.VkResult Invoke(vulkan.VkNegotiateLayerInterface* pVersionStruct)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ public partial struct VkAndroidHardwareBufferFormatProperties2ANDROID()
/// <summary>
/// Gets the prototype of the function `vkCreateAndroidSurfaceKHR`.
/// </summary>
public static vkFunctionPointerPrototype<vulkan.PFN_vkCreateAndroidSurfaceKHR> Prototype => new("vkCreateAndroidSurfaceKHR"u8);
public static ReadOnlyMemoryUtf8 Name => "vkCreateAndroidSurfaceKHR"u8;

/// <summary>
/// Create a <see cref="T:VkSurfaceKHR"/> object for an Android native window
Expand Down Expand Up @@ -416,7 +416,7 @@ public vulkan.VkResult Invoke(vulkan.VkInstance instance, in vulkan.VkAndroidSur
/// <summary>
/// Gets the prototype of the function `vkGetAndroidHardwareBufferPropertiesANDROID`.
/// </summary>
public static vkFunctionPointerPrototype<vulkan.PFN_vkGetAndroidHardwareBufferPropertiesANDROID> Prototype => new("vkGetAndroidHardwareBufferPropertiesANDROID"u8);
public static ReadOnlyMemoryUtf8 Name => "vkGetAndroidHardwareBufferPropertiesANDROID"u8;

/// <summary>
/// Get Properties of External Memory Android Hardware Buffers
Expand Down Expand Up @@ -468,7 +468,7 @@ public vulkan.VkResult Invoke(vulkan.VkDevice device, vulkan.AHardwareBuffer buf
/// <summary>
/// Gets the prototype of the function `vkGetMemoryAndroidHardwareBufferANDROID`.
/// </summary>
public static vkFunctionPointerPrototype<vulkan.PFN_vkGetMemoryAndroidHardwareBufferANDROID> Prototype => new("vkGetMemoryAndroidHardwareBufferANDROID"u8);
public static ReadOnlyMemoryUtf8 Name => "vkGetMemoryAndroidHardwareBufferANDROID"u8;

/// <summary>
/// Get an Android hardware buffer for a memory object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3358,7 +3358,7 @@ public partial struct VkAccelerationStructureTrianglesDisplacementMicromapNV()
/// <summary>
/// Gets the prototype of the function `vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR`.
/// </summary>
public static vkFunctionPointerPrototype<vulkan.PFN_vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR> Prototype => new("vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR"u8);
public static ReadOnlyMemoryUtf8 Name => "vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR"u8;

/// <summary>
/// Query video encode quality level properties
Expand Down Expand Up @@ -3432,7 +3432,7 @@ public vulkan.VkResult Invoke(vulkan.VkPhysicalDevice physicalDevice, in vulkan.
/// <summary>
/// Gets the prototype of the function `vkGetEncodedVideoSessionParametersKHR`.
/// </summary>
public static vkFunctionPointerPrototype<vulkan.PFN_vkGetEncodedVideoSessionParametersKHR> Prototype => new("vkGetEncodedVideoSessionParametersKHR"u8);
public static ReadOnlyMemoryUtf8 Name => "vkGetEncodedVideoSessionParametersKHR"u8;

/// <summary>
/// Get encoded parameter sets from a video session parameters object
Expand Down Expand Up @@ -3509,7 +3509,7 @@ public vulkan.VkResult Invoke(vulkan.VkDevice device, in vulkan.VkVideoEncodeSes
/// <summary>
/// Gets the prototype of the function `vkCmdEncodeVideoKHR`.
/// </summary>
public static vkFunctionPointerPrototype<vulkan.PFN_vkCmdEncodeVideoKHR> Prototype => new("vkCmdEncodeVideoKHR"u8);
public static ReadOnlyMemoryUtf8 Name => "vkCmdEncodeVideoKHR"u8;

/// <summary>
/// Encode operation for bitstream generation
Expand Down Expand Up @@ -3568,7 +3568,7 @@ public void Invoke(vulkan.VkCommandBuffer commandBuffer, in vulkan.VkVideoEncode
/// <summary>
/// Gets the prototype of the function `vkCreateExecutionGraphPipelinesAMDX`.
/// </summary>
public static vkFunctionPointerPrototype<vulkan.PFN_vkCreateExecutionGraphPipelinesAMDX> Prototype => new("vkCreateExecutionGraphPipelinesAMDX"u8);
public static ReadOnlyMemoryUtf8 Name => "vkCreateExecutionGraphPipelinesAMDX"u8;

/// <summary>
/// Creates a new execution graph pipeline object
Expand Down Expand Up @@ -3649,7 +3649,7 @@ public vulkan.VkResult Invoke(vulkan.VkDevice device, vulkan.VkPipelineCache pip
/// <summary>
/// Gets the prototype of the function `vkGetExecutionGraphPipelineScratchSizeAMDX`.
/// </summary>
public static vkFunctionPointerPrototype<vulkan.PFN_vkGetExecutionGraphPipelineScratchSizeAMDX> Prototype => new("vkGetExecutionGraphPipelineScratchSizeAMDX"u8);
public static ReadOnlyMemoryUtf8 Name => "vkGetExecutionGraphPipelineScratchSizeAMDX"u8;

/// <summary>
/// Query scratch space required to dispatch an execution graph
Expand Down Expand Up @@ -3722,7 +3722,7 @@ public vulkan.VkResult Invoke(vulkan.VkDevice device, vulkan.VkPipeline executio
/// <summary>
/// Gets the prototype of the function `vkGetExecutionGraphPipelineNodeIndexAMDX`.
/// </summary>
public static vkFunctionPointerPrototype<vulkan.PFN_vkGetExecutionGraphPipelineNodeIndexAMDX> Prototype => new("vkGetExecutionGraphPipelineNodeIndexAMDX"u8);
public static ReadOnlyMemoryUtf8 Name => "vkGetExecutionGraphPipelineNodeIndexAMDX"u8;

/// <summary>
/// Query internal id of a node in an execution graph
Expand Down Expand Up @@ -3798,7 +3798,7 @@ public vulkan.VkResult Invoke(vulkan.VkDevice device, vulkan.VkPipeline executio
/// <summary>
/// Gets the prototype of the function `vkCmdInitializeGraphScratchMemoryAMDX`.
/// </summary>
public static vkFunctionPointerPrototype<vulkan.PFN_vkCmdInitializeGraphScratchMemoryAMDX> Prototype => new("vkCmdInitializeGraphScratchMemoryAMDX"u8);
public static ReadOnlyMemoryUtf8 Name => "vkCmdInitializeGraphScratchMemoryAMDX"u8;

/// <summary>
/// Initialize scratch memory for an execution graph
Expand Down Expand Up @@ -3843,7 +3843,7 @@ public void Invoke(vulkan.VkCommandBuffer commandBuffer, vulkan.VkDeviceAddress
/// <summary>
/// Gets the prototype of the function `vkCmdDispatchGraphAMDX`.
/// </summary>
public static vkFunctionPointerPrototype<vulkan.PFN_vkCmdDispatchGraphAMDX> Prototype => new("vkCmdDispatchGraphAMDX"u8);
public static ReadOnlyMemoryUtf8 Name => "vkCmdDispatchGraphAMDX"u8;

/// <summary>
/// Dispatch an execution graph
Expand Down Expand Up @@ -3904,7 +3904,7 @@ public void Invoke(vulkan.VkCommandBuffer commandBuffer, vulkan.VkDeviceAddress
/// <summary>
/// Gets the prototype of the function `vkCmdDispatchGraphIndirectAMDX`.
/// </summary>
public static vkFunctionPointerPrototype<vulkan.PFN_vkCmdDispatchGraphIndirectAMDX> Prototype => new("vkCmdDispatchGraphIndirectAMDX"u8);
public static ReadOnlyMemoryUtf8 Name => "vkCmdDispatchGraphIndirectAMDX"u8;

/// <summary>
/// Dispatch an execution graph with node and payload parameters read on the device
Expand Down Expand Up @@ -3965,7 +3965,7 @@ public void Invoke(vulkan.VkCommandBuffer commandBuffer, vulkan.VkDeviceAddress
/// <summary>
/// Gets the prototype of the function `vkCmdDispatchGraphIndirectCountAMDX`.
/// </summary>
public static vkFunctionPointerPrototype<vulkan.PFN_vkCmdDispatchGraphIndirectCountAMDX> Prototype => new("vkCmdDispatchGraphIndirectCountAMDX"u8);
public static ReadOnlyMemoryUtf8 Name => "vkCmdDispatchGraphIndirectCountAMDX"u8;

/// <summary>
/// Dispatch an execution graph with all parameters read on the device
Expand Down
Loading

0 comments on commit e318fc1

Please sign in to comment.