// Copyright (C) 2018-2025, Tellusim Technologies Inc. All rights reserved
// https://tellusim.com/

#ifndef __TELLUSIM_PLUGINS_PLATFORM_VK_H__
#define __TELLUSIM_PLUGINS_PLATFORM_VK_H__

#ifndef VK_NO_PROTOTYPES
	#define VK_NO_PROTOTYPES	1
#endif

#include <vulkan/vulkan.h>

/*
 */
namespace Tellusim {
	
	/**
	 * Vulkan
	 */
	namespace VK {
		
		/// initialize Vulkan functions
		bool init();
	}
	
	/// Vulkan 10 functions
	extern PFN_vkCreateInstance vkCreateInstance;
	extern PFN_vkDestroyInstance vkDestroyInstance;
	extern PFN_vkEnumeratePhysicalDevices vkEnumeratePhysicalDevices;
	extern PFN_vkGetPhysicalDeviceFeatures vkGetPhysicalDeviceFeatures;
	extern PFN_vkGetPhysicalDeviceFormatProperties vkGetPhysicalDeviceFormatProperties;
	extern PFN_vkGetPhysicalDeviceImageFormatProperties vkGetPhysicalDeviceImageFormatProperties;
	extern PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties;
	extern PFN_vkGetPhysicalDeviceQueueFamilyProperties vkGetPhysicalDeviceQueueFamilyProperties;
	extern PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties;
	extern PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;
	extern PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr;
	extern PFN_vkCreateDevice vkCreateDevice;
	extern PFN_vkDestroyDevice vkDestroyDevice;
	extern PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties;
	extern PFN_vkEnumerateDeviceExtensionProperties vkEnumerateDeviceExtensionProperties;
	extern PFN_vkEnumerateInstanceLayerProperties vkEnumerateInstanceLayerProperties;
	extern PFN_vkEnumerateDeviceLayerProperties vkEnumerateDeviceLayerProperties;
	extern PFN_vkGetDeviceQueue vkGetDeviceQueue;
	extern PFN_vkQueueSubmit vkQueueSubmit;
	extern PFN_vkQueueWaitIdle vkQueueWaitIdle;
	extern PFN_vkDeviceWaitIdle vkDeviceWaitIdle;
	extern PFN_vkAllocateMemory vkAllocateMemory;
	extern PFN_vkFreeMemory vkFreeMemory;
	extern PFN_vkMapMemory vkMapMemory;
	extern PFN_vkUnmapMemory vkUnmapMemory;
	extern PFN_vkFlushMappedMemoryRanges vkFlushMappedMemoryRanges;
	extern PFN_vkInvalidateMappedMemoryRanges vkInvalidateMappedMemoryRanges;
	extern PFN_vkGetDeviceMemoryCommitment vkGetDeviceMemoryCommitment;
	extern PFN_vkBindBufferMemory vkBindBufferMemory;
	extern PFN_vkBindImageMemory vkBindImageMemory;
	extern PFN_vkGetBufferMemoryRequirements vkGetBufferMemoryRequirements;
	extern PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements;
	extern PFN_vkGetImageSparseMemoryRequirements vkGetImageSparseMemoryRequirements;
	extern PFN_vkGetPhysicalDeviceSparseImageFormatProperties vkGetPhysicalDeviceSparseImageFormatProperties;
	extern PFN_vkQueueBindSparse vkQueueBindSparse;
	extern PFN_vkCreateFence vkCreateFence;
	extern PFN_vkDestroyFence vkDestroyFence;
	extern PFN_vkResetFences vkResetFences;
	extern PFN_vkGetFenceStatus vkGetFenceStatus;
	extern PFN_vkWaitForFences vkWaitForFences;
	extern PFN_vkCreateSemaphore vkCreateSemaphore;
	extern PFN_vkDestroySemaphore vkDestroySemaphore;
	extern PFN_vkCreateEvent vkCreateEvent;
	extern PFN_vkDestroyEvent vkDestroyEvent;
	extern PFN_vkGetEventStatus vkGetEventStatus;
	extern PFN_vkSetEvent vkSetEvent;
	extern PFN_vkResetEvent vkResetEvent;
	extern PFN_vkCreateQueryPool vkCreateQueryPool;
	extern PFN_vkDestroyQueryPool vkDestroyQueryPool;
	extern PFN_vkGetQueryPoolResults vkGetQueryPoolResults;
	extern PFN_vkCreateBuffer vkCreateBuffer;
	extern PFN_vkDestroyBuffer vkDestroyBuffer;
	extern PFN_vkCreateBufferView vkCreateBufferView;
	extern PFN_vkDestroyBufferView vkDestroyBufferView;
	extern PFN_vkCreateImage vkCreateImage;
	extern PFN_vkDestroyImage vkDestroyImage;
	extern PFN_vkGetImageSubresourceLayout vkGetImageSubresourceLayout;
	extern PFN_vkCreateImageView vkCreateImageView;
	extern PFN_vkDestroyImageView vkDestroyImageView;
	extern PFN_vkCreateShaderModule vkCreateShaderModule;
	extern PFN_vkDestroyShaderModule vkDestroyShaderModule;
	extern PFN_vkCreatePipelineCache vkCreatePipelineCache;
	extern PFN_vkDestroyPipelineCache vkDestroyPipelineCache;
	extern PFN_vkGetPipelineCacheData vkGetPipelineCacheData;
	extern PFN_vkMergePipelineCaches vkMergePipelineCaches;
	extern PFN_vkCreateGraphicsPipelines vkCreateGraphicsPipelines;
	extern PFN_vkCreateComputePipelines vkCreateComputePipelines;
	extern PFN_vkDestroyPipeline vkDestroyPipeline;
	extern PFN_vkCreatePipelineLayout vkCreatePipelineLayout;
	extern PFN_vkDestroyPipelineLayout vkDestroyPipelineLayout;
	extern PFN_vkCreateSampler vkCreateSampler;
	extern PFN_vkDestroySampler vkDestroySampler;
	extern PFN_vkCreateDescriptorSetLayout vkCreateDescriptorSetLayout;
	extern PFN_vkDestroyDescriptorSetLayout vkDestroyDescriptorSetLayout;
	extern PFN_vkCreateDescriptorPool vkCreateDescriptorPool;
	extern PFN_vkDestroyDescriptorPool vkDestroyDescriptorPool;
	extern PFN_vkResetDescriptorPool vkResetDescriptorPool;
	extern PFN_vkAllocateDescriptorSets vkAllocateDescriptorSets;
	extern PFN_vkFreeDescriptorSets vkFreeDescriptorSets;
	extern PFN_vkUpdateDescriptorSets vkUpdateDescriptorSets;
	extern PFN_vkCreateFramebuffer vkCreateFramebuffer;
	extern PFN_vkDestroyFramebuffer vkDestroyFramebuffer;
	extern PFN_vkCreateRenderPass vkCreateRenderPass;
	extern PFN_vkDestroyRenderPass vkDestroyRenderPass;
	extern PFN_vkGetRenderAreaGranularity vkGetRenderAreaGranularity;
	extern PFN_vkCreateCommandPool vkCreateCommandPool;
	extern PFN_vkDestroyCommandPool vkDestroyCommandPool;
	extern PFN_vkResetCommandPool vkResetCommandPool;
	extern PFN_vkAllocateCommandBuffers vkAllocateCommandBuffers;
	extern PFN_vkFreeCommandBuffers vkFreeCommandBuffers;
	extern PFN_vkBeginCommandBuffer vkBeginCommandBuffer;
	extern PFN_vkEndCommandBuffer vkEndCommandBuffer;
	extern PFN_vkResetCommandBuffer vkResetCommandBuffer;
	extern PFN_vkCmdBindPipeline vkCmdBindPipeline;
	extern PFN_vkCmdSetViewport vkCmdSetViewport;
	extern PFN_vkCmdSetScissor vkCmdSetScissor;
	extern PFN_vkCmdSetLineWidth vkCmdSetLineWidth;
	extern PFN_vkCmdSetDepthBias vkCmdSetDepthBias;
	extern PFN_vkCmdSetBlendConstants vkCmdSetBlendConstants;
	extern PFN_vkCmdSetDepthBounds vkCmdSetDepthBounds;
	extern PFN_vkCmdSetStencilCompareMask vkCmdSetStencilCompareMask;
	extern PFN_vkCmdSetStencilWriteMask vkCmdSetStencilWriteMask;
	extern PFN_vkCmdSetStencilReference vkCmdSetStencilReference;
	extern PFN_vkCmdBindDescriptorSets vkCmdBindDescriptorSets;
	extern PFN_vkCmdBindIndexBuffer vkCmdBindIndexBuffer;
	extern PFN_vkCmdBindVertexBuffers vkCmdBindVertexBuffers;
	extern PFN_vkCmdDraw vkCmdDraw;
	extern PFN_vkCmdDrawIndexed vkCmdDrawIndexed;
	extern PFN_vkCmdDrawIndirect vkCmdDrawIndirect;
	extern PFN_vkCmdDrawIndexedIndirect vkCmdDrawIndexedIndirect;
	extern PFN_vkCmdDispatch vkCmdDispatch;
	extern PFN_vkCmdDispatchIndirect vkCmdDispatchIndirect;
	extern PFN_vkCmdCopyBuffer vkCmdCopyBuffer;
	extern PFN_vkCmdCopyImage vkCmdCopyImage;
	extern PFN_vkCmdBlitImage vkCmdBlitImage;
	extern PFN_vkCmdCopyBufferToImage vkCmdCopyBufferToImage;
	extern PFN_vkCmdCopyImageToBuffer vkCmdCopyImageToBuffer;
	extern PFN_vkCmdUpdateBuffer vkCmdUpdateBuffer;
	extern PFN_vkCmdFillBuffer vkCmdFillBuffer;
	extern PFN_vkCmdClearColorImage vkCmdClearColorImage;
	extern PFN_vkCmdClearDepthStencilImage vkCmdClearDepthStencilImage;
	extern PFN_vkCmdClearAttachments vkCmdClearAttachments;
	extern PFN_vkCmdResolveImage vkCmdResolveImage;
	extern PFN_vkCmdSetEvent vkCmdSetEvent;
	extern PFN_vkCmdResetEvent vkCmdResetEvent;
	extern PFN_vkCmdWaitEvents vkCmdWaitEvents;
	extern PFN_vkCmdPipelineBarrier vkCmdPipelineBarrier;
	extern PFN_vkCmdBeginQuery vkCmdBeginQuery;
	extern PFN_vkCmdEndQuery vkCmdEndQuery;
	extern PFN_vkCmdResetQueryPool vkCmdResetQueryPool;
	extern PFN_vkCmdWriteTimestamp vkCmdWriteTimestamp;
	extern PFN_vkCmdCopyQueryPoolResults vkCmdCopyQueryPoolResults;
	extern PFN_vkCmdPushConstants vkCmdPushConstants;
	extern PFN_vkCmdBeginRenderPass vkCmdBeginRenderPass;
	extern PFN_vkCmdNextSubpass vkCmdNextSubpass;
	extern PFN_vkCmdEndRenderPass vkCmdEndRenderPass;
	extern PFN_vkCmdExecuteCommands vkCmdExecuteCommands;
	
	/// Vulkan 11 functions
	extern PFN_vkEnumerateInstanceVersion vkEnumerateInstanceVersion;
	extern PFN_vkBindBufferMemory2 vkBindBufferMemory2;
	extern PFN_vkBindImageMemory2 vkBindImageMemory2;
	extern PFN_vkGetDeviceGroupPeerMemoryFeatures vkGetDeviceGroupPeerMemoryFeatures;
	extern PFN_vkCmdSetDeviceMask vkCmdSetDeviceMask;
	extern PFN_vkCmdDispatchBase vkCmdDispatchBase;
	extern PFN_vkEnumeratePhysicalDeviceGroups vkEnumeratePhysicalDeviceGroups;
	extern PFN_vkGetImageMemoryRequirements2 vkGetImageMemoryRequirements2;
	extern PFN_vkGetBufferMemoryRequirements2 vkGetBufferMemoryRequirements2;
	extern PFN_vkGetImageSparseMemoryRequirements2 vkGetImageSparseMemoryRequirements2;
	extern PFN_vkGetPhysicalDeviceFeatures2 vkGetPhysicalDeviceFeatures2;
	extern PFN_vkGetPhysicalDeviceProperties2 vkGetPhysicalDeviceProperties2;
	extern PFN_vkGetPhysicalDeviceFormatProperties2 vkGetPhysicalDeviceFormatProperties2;
	extern PFN_vkGetPhysicalDeviceImageFormatProperties2 vkGetPhysicalDeviceImageFormatProperties2;
	extern PFN_vkGetPhysicalDeviceQueueFamilyProperties2 vkGetPhysicalDeviceQueueFamilyProperties2;
	extern PFN_vkGetPhysicalDeviceMemoryProperties2 vkGetPhysicalDeviceMemoryProperties2;
	extern PFN_vkGetPhysicalDeviceSparseImageFormatProperties2 vkGetPhysicalDeviceSparseImageFormatProperties2;
	extern PFN_vkTrimCommandPool vkTrimCommandPool;
	extern PFN_vkGetDeviceQueue2 vkGetDeviceQueue2;
	extern PFN_vkCreateSamplerYcbcrConversion vkCreateSamplerYcbcrConversion;
	extern PFN_vkDestroySamplerYcbcrConversion vkDestroySamplerYcbcrConversion;
	extern PFN_vkCreateDescriptorUpdateTemplate vkCreateDescriptorUpdateTemplate;
	extern PFN_vkDestroyDescriptorUpdateTemplate vkDestroyDescriptorUpdateTemplate;
	extern PFN_vkUpdateDescriptorSetWithTemplate vkUpdateDescriptorSetWithTemplate;
	extern PFN_vkGetPhysicalDeviceExternalBufferProperties vkGetPhysicalDeviceExternalBufferProperties;
	extern PFN_vkGetPhysicalDeviceExternalFenceProperties vkGetPhysicalDeviceExternalFenceProperties;
	extern PFN_vkGetPhysicalDeviceExternalSemaphoreProperties vkGetPhysicalDeviceExternalSemaphoreProperties;
	extern PFN_vkGetDescriptorSetLayoutSupport vkGetDescriptorSetLayoutSupport;
	
	/// Vulkan 12 functions
	extern PFN_vkCmdDrawIndirectCount vkCmdDrawIndirectCount;
	extern PFN_vkCmdDrawIndexedIndirectCount vkCmdDrawIndexedIndirectCount;
	extern PFN_vkCreateRenderPass2 vkCreateRenderPass2;
	extern PFN_vkCmdBeginRenderPass2 vkCmdBeginRenderPass2;
	extern PFN_vkCmdNextSubpass2 vkCmdNextSubpass2;
	extern PFN_vkCmdEndRenderPass2 vkCmdEndRenderPass2;
	extern PFN_vkResetQueryPool vkResetQueryPool;
	extern PFN_vkGetSemaphoreCounterValue vkGetSemaphoreCounterValue;
	extern PFN_vkWaitSemaphores vkWaitSemaphores;
	extern PFN_vkSignalSemaphore vkSignalSemaphore;
	extern PFN_vkGetBufferDeviceAddress vkGetBufferDeviceAddress;
	extern PFN_vkGetBufferOpaqueCaptureAddress vkGetBufferOpaqueCaptureAddress;
	extern PFN_vkGetDeviceMemoryOpaqueCaptureAddress vkGetDeviceMemoryOpaqueCaptureAddress;
	
	/// Vulkan 13 functions
	extern PFN_vkGetPhysicalDeviceToolProperties vkGetPhysicalDeviceToolProperties;
	extern PFN_vkCreatePrivateDataSlot vkCreatePrivateDataSlot;
	extern PFN_vkDestroyPrivateDataSlot vkDestroyPrivateDataSlot;
	extern PFN_vkSetPrivateData vkSetPrivateData;
	extern PFN_vkGetPrivateData vkGetPrivateData;
	extern PFN_vkCmdSetEvent2 vkCmdSetEvent2;
	extern PFN_vkCmdResetEvent2 vkCmdResetEvent2;
	extern PFN_vkCmdWaitEvents2 vkCmdWaitEvents2;
	extern PFN_vkCmdPipelineBarrier2 vkCmdPipelineBarrier2;
	extern PFN_vkCmdWriteTimestamp2 vkCmdWriteTimestamp2;
	extern PFN_vkQueueSubmit2 vkQueueSubmit2;
	extern PFN_vkCmdCopyBuffer2 vkCmdCopyBuffer2;
	extern PFN_vkCmdCopyImage2 vkCmdCopyImage2;
	extern PFN_vkCmdCopyBufferToImage2 vkCmdCopyBufferToImage2;
	extern PFN_vkCmdCopyImageToBuffer2 vkCmdCopyImageToBuffer2;
	extern PFN_vkCmdBlitImage2 vkCmdBlitImage2;
	extern PFN_vkCmdResolveImage2 vkCmdResolveImage2;
	extern PFN_vkCmdBeginRendering vkCmdBeginRendering;
	extern PFN_vkCmdEndRendering vkCmdEndRendering;
	extern PFN_vkCmdSetCullMode vkCmdSetCullMode;
	extern PFN_vkCmdSetFrontFace vkCmdSetFrontFace;
	extern PFN_vkCmdSetPrimitiveTopology vkCmdSetPrimitiveTopology;
	extern PFN_vkCmdSetViewportWithCount vkCmdSetViewportWithCount;
	extern PFN_vkCmdSetScissorWithCount vkCmdSetScissorWithCount;
	extern PFN_vkCmdBindVertexBuffers2 vkCmdBindVertexBuffers2;
	extern PFN_vkCmdSetDepthTestEnable vkCmdSetDepthTestEnable;
	extern PFN_vkCmdSetDepthWriteEnable vkCmdSetDepthWriteEnable;
	extern PFN_vkCmdSetDepthCompareOp vkCmdSetDepthCompareOp;
	extern PFN_vkCmdSetDepthBoundsTestEnable vkCmdSetDepthBoundsTestEnable;
	extern PFN_vkCmdSetStencilTestEnable vkCmdSetStencilTestEnable;
	extern PFN_vkCmdSetStencilOp vkCmdSetStencilOp;
	extern PFN_vkCmdSetRasterizerDiscardEnable vkCmdSetRasterizerDiscardEnable;
	extern PFN_vkCmdSetDepthBiasEnable vkCmdSetDepthBiasEnable;
	extern PFN_vkCmdSetPrimitiveRestartEnable vkCmdSetPrimitiveRestartEnable;
	extern PFN_vkGetDeviceBufferMemoryRequirements vkGetDeviceBufferMemoryRequirements;
	extern PFN_vkGetDeviceImageMemoryRequirements vkGetDeviceImageMemoryRequirements;
	extern PFN_vkGetDeviceImageSparseMemoryRequirements vkGetDeviceImageSparseMemoryRequirements;
	
	/// KHR draw indirect count
	extern PFN_vkCmdDrawIndirectCountKHR vkCmdDrawIndirectCountKHR;
	extern PFN_vkCmdDrawIndexedIndirectCountKHR vkCmdDrawIndexedIndirectCountKHR;
	
	/// KHR buffer device address
	extern PFN_vkGetBufferDeviceAddressKHR vkGetBufferDeviceAddressKHR;
	
	/// KHR acceleration structure
	extern PFN_vkCreateAccelerationStructureKHR vkCreateAccelerationStructureKHR;
	extern PFN_vkDestroyAccelerationStructureKHR vkDestroyAccelerationStructureKHR;
	extern PFN_vkCmdBuildAccelerationStructuresKHR vkCmdBuildAccelerationStructuresKHR;
	extern PFN_vkCmdBuildAccelerationStructuresIndirectKHR vkCmdBuildAccelerationStructuresIndirectKHR;
	extern PFN_vkBuildAccelerationStructuresKHR vkBuildAccelerationStructuresKHR;
	extern PFN_vkCopyAccelerationStructureKHR vkCopyAccelerationStructureKHR;
	extern PFN_vkCopyAccelerationStructureToMemoryKHR vkCopyAccelerationStructureToMemoryKHR;
	extern PFN_vkCopyMemoryToAccelerationStructureKHR vkCopyMemoryToAccelerationStructureKHR;
	extern PFN_vkWriteAccelerationStructuresPropertiesKHR vkWriteAccelerationStructuresPropertiesKHR;
	extern PFN_vkCmdCopyAccelerationStructureKHR vkCmdCopyAccelerationStructureKHR;
	extern PFN_vkCmdCopyAccelerationStructureToMemoryKHR vkCmdCopyAccelerationStructureToMemoryKHR;
	extern PFN_vkCmdCopyMemoryToAccelerationStructureKHR vkCmdCopyMemoryToAccelerationStructureKHR;
	extern PFN_vkGetAccelerationStructureDeviceAddressKHR vkGetAccelerationStructureDeviceAddressKHR;
	extern PFN_vkCmdWriteAccelerationStructuresPropertiesKHR vkCmdWriteAccelerationStructuresPropertiesKHR;
	extern PFN_vkGetDeviceAccelerationStructureCompatibilityKHR vkGetDeviceAccelerationStructureCompatibilityKHR;
	extern PFN_vkGetAccelerationStructureBuildSizesKHR vkGetAccelerationStructureBuildSizesKHR;
	
	/// KHR ray tracing pipeline
	extern PFN_vkCmdTraceRaysKHR vkCmdTraceRaysKHR;
	extern PFN_vkCreateRayTracingPipelinesKHR vkCreateRayTracingPipelinesKHR;
	extern PFN_vkGetRayTracingShaderGroupHandlesKHR vkGetRayTracingShaderGroupHandlesKHR;
	extern PFN_vkGetRayTracingCaptureReplayShaderGroupHandlesKHR vkGetRayTracingCaptureReplayShaderGroupHandlesKHR;
	extern PFN_vkCmdTraceRaysIndirectKHR vkCmdTraceRaysIndirectKHR;
	extern PFN_vkGetRayTracingShaderGroupStackSizeKHR vkGetRayTracingShaderGroupStackSizeKHR;
	extern PFN_vkCmdSetRayTracingPipelineStackSizeKHR vkCmdSetRayTracingPipelineStackSizeKHR;
	
	/// EXT external memory host
	extern PFN_vkGetMemoryHostPointerPropertiesEXT vkGetMemoryHostPointerPropertiesEXT;
	
	/// EXT conditional rendering
	extern PFN_vkCmdBeginConditionalRenderingEXT vkCmdBeginConditionalRenderingEXT;
	extern PFN_vkCmdEndConditionalRenderingEXT vkCmdEndConditionalRenderingEXT;
	
	/// EXT mesh shader
	extern PFN_vkCmdDrawMeshTasksEXT vkCmdDrawMeshTasksEXT;
	extern PFN_vkCmdDrawMeshTasksIndirectEXT vkCmdDrawMeshTasksIndirectEXT;
	extern PFN_vkCmdDrawMeshTasksIndirectCountEXT vkCmdDrawMeshTasksIndirectCountEXT;
}

#endif /* __TELLUSIM_PLUGINS_PLATFORM_VK_H__ */
