Initial commit
This commit is contained in:
commit
8408f11ada
10 changed files with 1219 additions and 0 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
/target
|
||||
/Cargo.lock
|
7
.vscode/settings.json
vendored
Normal file
7
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"workbench.colorCustomizations": {
|
||||
"activityBar.background": "#053607",
|
||||
"titleBar.activeBackground": "#074B0A",
|
||||
"titleBar.activeForeground": "#F2FEF3"
|
||||
}
|
||||
}
|
14
.vscode/tasks.json
vendored
Normal file
14
.vscode/tasks.json
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "cargo",
|
||||
"command": "build",
|
||||
"problemMatcher": [
|
||||
"$rustc"
|
||||
],
|
||||
"group": "build",
|
||||
"label": "rust: cargo build"
|
||||
}
|
||||
]
|
||||
}
|
13
Cargo.toml
Normal file
13
Cargo.toml
Normal file
|
@ -0,0 +1,13 @@
|
|||
[package]
|
||||
name = "vk_layer_rs"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
vulkan-sys = { path = "/home/michael/Dokumente/Workspace/Gavania/vulkan-sys" }
|
||||
# vulkan_sys = { git = "ssh://gitea@gavania.de:23/Gavania/Gavania.git", branch = "0.2.0_dev" }
|
21
rFactorOverlay.json
Normal file
21
rFactorOverlay.json
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"file_format_version": "1.0.0",
|
||||
"layer": {
|
||||
"name": "VK_LAYER_rFactor2_overlay",
|
||||
"type": "GLOBAL",
|
||||
"api_version": "1.3.0",
|
||||
"library_path": "/home/michael/Dokumente/Workspace/vk_layer_rs/target/debug/libvk_layer_rs.so",
|
||||
"implementation_version": "1",
|
||||
"description": "Vulkan Hud Overlay",
|
||||
"functions": {
|
||||
"vkGetInstanceProcAddr": "get_instance_proc_addr",
|
||||
"vkGetDeviceProcAddr": "get_device_proc_addr"
|
||||
},
|
||||
"enable_environment": {
|
||||
"RFACTOR_HUD": "1"
|
||||
},
|
||||
"disable_environment": {
|
||||
"DISABLE_RFACTOR_HUD": "1"
|
||||
}
|
||||
}
|
||||
}
|
42
src/enums.rs
Normal file
42
src/enums.rs
Normal file
|
@ -0,0 +1,42 @@
|
|||
#![allow(non_camel_case_types)]
|
||||
|
||||
use std::{mem, ptr};
|
||||
use vulkan_sys::prelude::*;
|
||||
|
||||
pub use VkLayerFunction::*;
|
||||
pub use VkNegotiateLayerStructType::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum VkNegotiateLayerStructType {
|
||||
LAYER_NEGOTIATE_INTERFACE_STRUCT = 1,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Eq, PartialEq)]
|
||||
pub enum VkLayerFunction {
|
||||
VK_LAYER_LINK_INFO = 0,
|
||||
VK_LOADER_DATA_CALLBACK = 1,
|
||||
VK_LOADER_LAYER_CREATE_DEVICE_CALLBACK = 2,
|
||||
VK_LOADER_FEATURES = 3,
|
||||
}
|
||||
|
||||
pub enum Functions {
|
||||
Null,
|
||||
CreateInstance(PFN_vkCreateInstance),
|
||||
DestroyInstance(PFN_vkDestroyInstance),
|
||||
CreateDevice(PFN_vkCreateDevice),
|
||||
DestroyDevice(PFN_vkDestroyDevice),
|
||||
}
|
||||
|
||||
impl Functions {
|
||||
pub fn convert(self) -> PFN_vkVoidFunction {
|
||||
match self {
|
||||
Functions::Null => unsafe {
|
||||
mem::transmute::<*const (), PFN_vkVoidFunction>(ptr::null())
|
||||
},
|
||||
Functions::CreateInstance(func) => unsafe { mem::transmute(func) },
|
||||
Functions::DestroyInstance(func) => unsafe { mem::transmute(func) },
|
||||
Functions::CreateDevice(func) => unsafe { mem::transmute(func) },
|
||||
Functions::DestroyDevice(func) => unsafe { mem::transmute(func) },
|
||||
}
|
||||
}
|
||||
}
|
646
src/layer_device_dispatch_table.rs
Normal file
646
src/layer_device_dispatch_table.rs
Normal file
|
@ -0,0 +1,646 @@
|
|||
use vulkan_sys::prelude::*;
|
||||
|
||||
// Device function pointer dispatch table
|
||||
pub struct VkLayerDispatchTable {
|
||||
// ---- Core 1_0 commands
|
||||
GetDeviceProcAddr: PFN_vkGetDeviceProcAddr,
|
||||
DestroyDevice: PFN_vkDestroyDevice,
|
||||
GetDeviceQueue: PFN_vkGetDeviceQueue,
|
||||
QueueSubmit: PFN_vkQueueSubmit,
|
||||
QueueWaitIdle: PFN_vkQueueWaitIdle,
|
||||
DeviceWaitIdle: PFN_vkDeviceWaitIdle,
|
||||
AllocateMemory: PFN_vkAllocateMemory,
|
||||
FreeMemory: PFN_vkFreeMemory,
|
||||
MapMemory: PFN_vkMapMemory,
|
||||
UnmapMemory: PFN_vkUnmapMemory,
|
||||
FlushMappedMemoryRanges: PFN_vkFlushMappedMemoryRanges,
|
||||
InvalidateMappedMemoryRanges: PFN_vkInvalidateMappedMemoryRanges,
|
||||
GetDeviceMemoryCommitment: PFN_vkGetDeviceMemoryCommitment,
|
||||
BindBufferMemory: PFN_vkBindBufferMemory,
|
||||
BindImageMemory: PFN_vkBindImageMemory,
|
||||
GetBufferMemoryRequirements: PFN_vkGetBufferMemoryRequirements,
|
||||
GetImageMemoryRequirements: PFN_vkGetImageMemoryRequirements,
|
||||
GetImageSparseMemoryRequirements: PFN_vkGetImageSparseMemoryRequirements,
|
||||
QueueBindSparse: PFN_vkQueueBindSparse,
|
||||
CreateFence: PFN_vkCreateFence,
|
||||
DestroyFence: PFN_vkDestroyFence,
|
||||
ResetFences: PFN_vkResetFences,
|
||||
GetFenceStatus: PFN_vkGetFenceStatus,
|
||||
WaitForFences: PFN_vkWaitForFences,
|
||||
CreateSemaphore: PFN_vkCreateSemaphore,
|
||||
DestroySemaphore: PFN_vkDestroySemaphore,
|
||||
CreateEvent: PFN_vkCreateEvent,
|
||||
DestroyEvent: PFN_vkDestroyEvent,
|
||||
GetEventStatus: PFN_vkGetEventStatus,
|
||||
SetEvent: PFN_vkSetEvent,
|
||||
ResetEvent: PFN_vkResetEvent,
|
||||
CreateQueryPool: PFN_vkCreateQueryPool,
|
||||
DestroyQueryPool: PFN_vkDestroyQueryPool,
|
||||
GetQueryPoolResults: PFN_vkGetQueryPoolResults,
|
||||
CreateBuffer: PFN_vkCreateBuffer,
|
||||
DestroyBuffer: PFN_vkDestroyBuffer,
|
||||
CreateBufferView: PFN_vkCreateBufferView,
|
||||
DestroyBufferView: PFN_vkDestroyBufferView,
|
||||
CreateImage: PFN_vkCreateImage,
|
||||
DestroyImage: PFN_vkDestroyImage,
|
||||
GetImageSubresourceLayout: PFN_vkGetImageSubresourceLayout,
|
||||
CreateImageView: PFN_vkCreateImageView,
|
||||
DestroyImageView: PFN_vkDestroyImageView,
|
||||
CreateShaderModule: PFN_vkCreateShaderModule,
|
||||
DestroyShaderModule: PFN_vkDestroyShaderModule,
|
||||
CreatePipelineCache: PFN_vkCreatePipelineCache,
|
||||
DestroyPipelineCache: PFN_vkDestroyPipelineCache,
|
||||
GetPipelineCacheData: PFN_vkGetPipelineCacheData,
|
||||
MergePipelineCaches: PFN_vkMergePipelineCaches,
|
||||
CreateGraphicsPipelines: PFN_vkCreateGraphicsPipelines,
|
||||
CreateComputePipelines: PFN_vkCreateComputePipelines,
|
||||
DestroyPipeline: PFN_vkDestroyPipeline,
|
||||
CreatePipelineLayout: PFN_vkCreatePipelineLayout,
|
||||
DestroyPipelineLayout: PFN_vkDestroyPipelineLayout,
|
||||
CreateSampler: PFN_vkCreateSampler,
|
||||
DestroySampler: PFN_vkDestroySampler,
|
||||
CreateDescriptorSetLayout: PFN_vkCreateDescriptorSetLayout,
|
||||
DestroyDescriptorSetLayout: PFN_vkDestroyDescriptorSetLayout,
|
||||
CreateDescriptorPool: PFN_vkCreateDescriptorPool,
|
||||
DestroyDescriptorPool: PFN_vkDestroyDescriptorPool,
|
||||
ResetDescriptorPool: PFN_vkResetDescriptorPool,
|
||||
AllocateDescriptorSets: PFN_vkAllocateDescriptorSets,
|
||||
FreeDescriptorSets: PFN_vkFreeDescriptorSets,
|
||||
UpdateDescriptorSets: PFN_vkUpdateDescriptorSets,
|
||||
CreateFramebuffer: PFN_vkCreateFramebuffer,
|
||||
DestroyFramebuffer: PFN_vkDestroyFramebuffer,
|
||||
CreateRenderPass: PFN_vkCreateRenderPass,
|
||||
DestroyRenderPass: PFN_vkDestroyRenderPass,
|
||||
GetRenderAreaGranularity: PFN_vkGetRenderAreaGranularity,
|
||||
CreateCommandPool: PFN_vkCreateCommandPool,
|
||||
DestroyCommandPool: PFN_vkDestroyCommandPool,
|
||||
ResetCommandPool: PFN_vkResetCommandPool,
|
||||
AllocateCommandBuffers: PFN_vkAllocateCommandBuffers,
|
||||
FreeCommandBuffers: PFN_vkFreeCommandBuffers,
|
||||
BeginCommandBuffer: PFN_vkBeginCommandBuffer,
|
||||
EndCommandBuffer: PFN_vkEndCommandBuffer,
|
||||
ResetCommandBuffer: PFN_vkResetCommandBuffer,
|
||||
CmdBindPipeline: PFN_vkCmdBindPipeline,
|
||||
CmdSetViewport: PFN_vkCmdSetViewport,
|
||||
CmdSetScissor: PFN_vkCmdSetScissor,
|
||||
CmdSetLineWidth: PFN_vkCmdSetLineWidth,
|
||||
CmdSetDepthBias: PFN_vkCmdSetDepthBias,
|
||||
CmdSetBlendConstants: PFN_vkCmdSetBlendConstants,
|
||||
CmdSetDepthBounds: PFN_vkCmdSetDepthBounds,
|
||||
CmdSetStencilCompareMask: PFN_vkCmdSetStencilCompareMask,
|
||||
CmdSetStencilWriteMask: PFN_vkCmdSetStencilWriteMask,
|
||||
CmdSetStencilReference: PFN_vkCmdSetStencilReference,
|
||||
CmdBindDescriptorSets: PFN_vkCmdBindDescriptorSets,
|
||||
CmdBindIndexBuffer: PFN_vkCmdBindIndexBuffer,
|
||||
CmdBindVertexBuffers: PFN_vkCmdBindVertexBuffers,
|
||||
CmdDraw: PFN_vkCmdDraw,
|
||||
CmdDrawIndexed: PFN_vkCmdDrawIndexed,
|
||||
CmdDrawIndirect: PFN_vkCmdDrawIndirect,
|
||||
CmdDrawIndexedIndirect: PFN_vkCmdDrawIndexedIndirect,
|
||||
CmdDispatch: PFN_vkCmdDispatch,
|
||||
CmdDispatchIndirect: PFN_vkCmdDispatchIndirect,
|
||||
CmdCopyBuffer: PFN_vkCmdCopyBuffer,
|
||||
CmdCopyImage: PFN_vkCmdCopyImage,
|
||||
CmdBlitImage: PFN_vkCmdBlitImage,
|
||||
CmdCopyBufferToImage: PFN_vkCmdCopyBufferToImage,
|
||||
CmdCopyImageToBuffer: PFN_vkCmdCopyImageToBuffer,
|
||||
CmdUpdateBuffer: PFN_vkCmdUpdateBuffer,
|
||||
CmdFillBuffer: PFN_vkCmdFillBuffer,
|
||||
CmdClearColorImage: PFN_vkCmdClearColorImage,
|
||||
CmdClearDepthStencilImage: PFN_vkCmdClearDepthStencilImage,
|
||||
CmdClearAttachments: PFN_vkCmdClearAttachments,
|
||||
CmdResolveImage: PFN_vkCmdResolveImage,
|
||||
CmdSetEvent: PFN_vkCmdSetEvent,
|
||||
CmdResetEvent: PFN_vkCmdResetEvent,
|
||||
CmdWaitEvents: PFN_vkCmdWaitEvents,
|
||||
CmdPipelineBarrier: PFN_vkCmdPipelineBarrier,
|
||||
CmdBeginQuery: PFN_vkCmdBeginQuery,
|
||||
CmdEndQuery: PFN_vkCmdEndQuery,
|
||||
CmdResetQueryPool: PFN_vkCmdResetQueryPool,
|
||||
CmdWriteTimestamp: PFN_vkCmdWriteTimestamp,
|
||||
CmdCopyQueryPoolResults: PFN_vkCmdCopyQueryPoolResults,
|
||||
CmdPushConstants: PFN_vkCmdPushConstants,
|
||||
CmdBeginRenderPass: PFN_vkCmdBeginRenderPass,
|
||||
CmdNextSubpass: PFN_vkCmdNextSubpass,
|
||||
CmdEndRenderPass: PFN_vkCmdEndRenderPass,
|
||||
CmdExecuteCommands: PFN_vkCmdExecuteCommands,
|
||||
|
||||
// ---- Core 1_1 commands
|
||||
BindBufferMemory2: PFN_vkBindBufferMemory2,
|
||||
BindImageMemory2: PFN_vkBindImageMemory2,
|
||||
GetDeviceGroupPeerMemoryFeatures: PFN_vkGetDeviceGroupPeerMemoryFeatures,
|
||||
CmdSetDeviceMask: PFN_vkCmdSetDeviceMask,
|
||||
CmdDispatchBase: PFN_vkCmdDispatchBase,
|
||||
GetImageMemoryRequirements2: PFN_vkGetImageMemoryRequirements2,
|
||||
GetBufferMemoryRequirements2: PFN_vkGetBufferMemoryRequirements2,
|
||||
GetImageSparseMemoryRequirements2: PFN_vkGetImageSparseMemoryRequirements2,
|
||||
TrimCommandPool: PFN_vkTrimCommandPool,
|
||||
GetDeviceQueue2: PFN_vkGetDeviceQueue2,
|
||||
CreateSamplerYcbcrConversion: PFN_vkCreateSamplerYcbcrConversion,
|
||||
DestroySamplerYcbcrConversion: PFN_vkDestroySamplerYcbcrConversion,
|
||||
CreateDescriptorUpdateTemplate: PFN_vkCreateDescriptorUpdateTemplate,
|
||||
DestroyDescriptorUpdateTemplate: PFN_vkDestroyDescriptorUpdateTemplate,
|
||||
UpdateDescriptorSetWithTemplate: PFN_vkUpdateDescriptorSetWithTemplate,
|
||||
GetDescriptorSetLayoutSupport: PFN_vkGetDescriptorSetLayoutSupport,
|
||||
|
||||
// ---- Core 1_2 commands
|
||||
CmdDrawIndirectCount: PFN_vkCmdDrawIndirectCount,
|
||||
CmdDrawIndexedIndirectCount: PFN_vkCmdDrawIndexedIndirectCount,
|
||||
CreateRenderPass2: PFN_vkCreateRenderPass2,
|
||||
CmdBeginRenderPass2: PFN_vkCmdBeginRenderPass2,
|
||||
CmdNextSubpass2: PFN_vkCmdNextSubpass2,
|
||||
CmdEndRenderPass2: PFN_vkCmdEndRenderPass2,
|
||||
ResetQueryPool: PFN_vkResetQueryPool,
|
||||
GetSemaphoreCounterValue: PFN_vkGetSemaphoreCounterValue,
|
||||
WaitSemaphores: PFN_vkWaitSemaphores,
|
||||
SignalSemaphore: PFN_vkSignalSemaphore,
|
||||
GetBufferDeviceAddress: PFN_vkGetBufferDeviceAddress,
|
||||
GetBufferOpaqueCaptureAddress: PFN_vkGetBufferOpaqueCaptureAddress,
|
||||
GetDeviceMemoryOpaqueCaptureAddress: PFN_vkGetDeviceMemoryOpaqueCaptureAddress,
|
||||
|
||||
// ---- Core 1_3 commands
|
||||
CreatePrivateDataSlot: PFN_vkCreatePrivateDataSlot,
|
||||
DestroyPrivateDataSlot: PFN_vkDestroyPrivateDataSlot,
|
||||
SetPrivateData: PFN_vkSetPrivateData,
|
||||
GetPrivateData: PFN_vkGetPrivateData,
|
||||
CmdSetEvent2: PFN_vkCmdSetEvent2,
|
||||
CmdResetEvent2: PFN_vkCmdResetEvent2,
|
||||
CmdWaitEvents2: PFN_vkCmdWaitEvents2,
|
||||
CmdPipelineBarrier2: PFN_vkCmdPipelineBarrier2,
|
||||
CmdWriteTimestamp2: PFN_vkCmdWriteTimestamp2,
|
||||
QueueSubmit2: PFN_vkQueueSubmit2,
|
||||
CmdCopyBuffer2: PFN_vkCmdCopyBuffer2,
|
||||
CmdCopyImage2: PFN_vkCmdCopyImage2,
|
||||
CmdCopyBufferToImage2: PFN_vkCmdCopyBufferToImage2,
|
||||
CmdCopyImageToBuffer2: PFN_vkCmdCopyImageToBuffer2,
|
||||
CmdBlitImage2: PFN_vkCmdBlitImage2,
|
||||
CmdResolveImage2: PFN_vkCmdResolveImage2,
|
||||
CmdBeginRendering: PFN_vkCmdBeginRendering,
|
||||
CmdEndRendering: PFN_vkCmdEndRendering,
|
||||
CmdSetCullMode: PFN_vkCmdSetCullMode,
|
||||
CmdSetFrontFace: PFN_vkCmdSetFrontFace,
|
||||
CmdSetPrimitiveTopology: PFN_vkCmdSetPrimitiveTopology,
|
||||
CmdSetViewportWithCount: PFN_vkCmdSetViewportWithCount,
|
||||
CmdSetScissorWithCount: PFN_vkCmdSetScissorWithCount,
|
||||
CmdBindVertexBuffers2: PFN_vkCmdBindVertexBuffers2,
|
||||
CmdSetDepthTestEnable: PFN_vkCmdSetDepthTestEnable,
|
||||
CmdSetDepthWriteEnable: PFN_vkCmdSetDepthWriteEnable,
|
||||
CmdSetDepthCompareOp: PFN_vkCmdSetDepthCompareOp,
|
||||
CmdSetDepthBoundsTestEnable: PFN_vkCmdSetDepthBoundsTestEnable,
|
||||
CmdSetStencilTestEnable: PFN_vkCmdSetStencilTestEnable,
|
||||
CmdSetStencilOp: PFN_vkCmdSetStencilOp,
|
||||
CmdSetRasterizerDiscardEnable: PFN_vkCmdSetRasterizerDiscardEnable,
|
||||
CmdSetDepthBiasEnable: PFN_vkCmdSetDepthBiasEnable,
|
||||
CmdSetPrimitiveRestartEnable: PFN_vkCmdSetPrimitiveRestartEnable,
|
||||
GetDeviceBufferMemoryRequirements: PFN_vkGetDeviceBufferMemoryRequirements,
|
||||
GetDeviceImageMemoryRequirements: PFN_vkGetDeviceImageMemoryRequirements,
|
||||
GetDeviceImageSparseMemoryRequirements: PFN_vkGetDeviceImageSparseMemoryRequirements,
|
||||
|
||||
// ---- VK_KHR_swapchain extension commands
|
||||
CreateSwapchainKHR: PFN_vkCreateSwapchainKHR,
|
||||
DestroySwapchainKHR: PFN_vkDestroySwapchainKHR,
|
||||
GetSwapchainImagesKHR: PFN_vkGetSwapchainImagesKHR,
|
||||
AcquireNextImageKHR: PFN_vkAcquireNextImageKHR,
|
||||
QueuePresentKHR: PFN_vkQueuePresentKHR,
|
||||
GetDeviceGroupPresentCapabilitiesKHR: PFN_vkGetDeviceGroupPresentCapabilitiesKHR,
|
||||
GetDeviceGroupSurfacePresentModesKHR: PFN_vkGetDeviceGroupSurfacePresentModesKHR,
|
||||
AcquireNextImage2KHR: PFN_vkAcquireNextImage2KHR,
|
||||
|
||||
// ---- VK_KHR_display_swapchain extension commands
|
||||
CreateSharedSwapchainsKHR: PFN_vkCreateSharedSwapchainsKHR,
|
||||
|
||||
// ---- VK_KHR_dynamic_rendering extension commands
|
||||
CmdBeginRenderingKHR: PFN_vkCmdBeginRenderingKHR,
|
||||
CmdEndRenderingKHR: PFN_vkCmdEndRenderingKHR,
|
||||
|
||||
// ---- VK_KHR_device_group extension commands
|
||||
GetDeviceGroupPeerMemoryFeaturesKHR: PFN_vkGetDeviceGroupPeerMemoryFeaturesKHR,
|
||||
CmdSetDeviceMaskKHR: PFN_vkCmdSetDeviceMaskKHR,
|
||||
CmdDispatchBaseKHR: PFN_vkCmdDispatchBaseKHR,
|
||||
|
||||
// ---- VK_KHR_maintenance1 extension commands
|
||||
TrimCommandPoolKHR: PFN_vkTrimCommandPoolKHR,
|
||||
|
||||
// ---- VK_KHR_external_memory_fd extension commands
|
||||
GetMemoryFdKHR: PFN_vkGetMemoryFdKHR,
|
||||
GetMemoryFdPropertiesKHR: PFN_vkGetMemoryFdPropertiesKHR,
|
||||
|
||||
// ---- VK_KHR_external_semaphore_fd extension commands
|
||||
ImportSemaphoreFdKHR: PFN_vkImportSemaphoreFdKHR,
|
||||
GetSemaphoreFdKHR: PFN_vkGetSemaphoreFdKHR,
|
||||
|
||||
// ---- VK_KHR_push_descriptor extension commands
|
||||
CmdPushDescriptorSetKHR: PFN_vkCmdPushDescriptorSetKHR,
|
||||
CmdPushDescriptorSetWithTemplateKHR: PFN_vkCmdPushDescriptorSetWithTemplateKHR,
|
||||
|
||||
// ---- VK_KHR_descriptor_update_template extension commands
|
||||
CreateDescriptorUpdateTemplateKHR: PFN_vkCreateDescriptorUpdateTemplateKHR,
|
||||
DestroyDescriptorUpdateTemplateKHR: PFN_vkDestroyDescriptorUpdateTemplateKHR,
|
||||
UpdateDescriptorSetWithTemplateKHR: PFN_vkUpdateDescriptorSetWithTemplateKHR,
|
||||
|
||||
// ---- VK_KHR_create_renderpass2 extension commands
|
||||
CreateRenderPass2KHR: PFN_vkCreateRenderPass2KHR,
|
||||
CmdBeginRenderPass2KHR: PFN_vkCmdBeginRenderPass2KHR,
|
||||
CmdNextSubpass2KHR: PFN_vkCmdNextSubpass2KHR,
|
||||
CmdEndRenderPass2KHR: PFN_vkCmdEndRenderPass2KHR,
|
||||
|
||||
// ---- VK_KHR_shared_presentable_image extension commands
|
||||
GetSwapchainStatusKHR: PFN_vkGetSwapchainStatusKHR,
|
||||
|
||||
// ---- VK_KHR_external_fence_fd extension commands
|
||||
ImportFenceFdKHR: PFN_vkImportFenceFdKHR,
|
||||
GetFenceFdKHR: PFN_vkGetFenceFdKHR,
|
||||
|
||||
// ---- VK_KHR_performance_query extension commands
|
||||
AcquireProfilingLockKHR: PFN_vkAcquireProfilingLockKHR,
|
||||
ReleaseProfilingLockKHR: PFN_vkReleaseProfilingLockKHR,
|
||||
|
||||
// ---- VK_KHR_get_memory_requirements2 extension commands
|
||||
GetImageMemoryRequirements2KHR: PFN_vkGetImageMemoryRequirements2KHR,
|
||||
GetBufferMemoryRequirements2KHR: PFN_vkGetBufferMemoryRequirements2KHR,
|
||||
GetImageSparseMemoryRequirements2KHR: PFN_vkGetImageSparseMemoryRequirements2KHR,
|
||||
|
||||
// ---- VK_KHR_sampler_ycbcr_conversion extension commands
|
||||
CreateSamplerYcbcrConversionKHR: PFN_vkCreateSamplerYcbcrConversionKHR,
|
||||
DestroySamplerYcbcrConversionKHR: PFN_vkDestroySamplerYcbcrConversionKHR,
|
||||
|
||||
// ---- VK_KHR_bind_memory2 extension commands
|
||||
BindBufferMemory2KHR: PFN_vkBindBufferMemory2KHR,
|
||||
BindImageMemory2KHR: PFN_vkBindImageMemory2KHR,
|
||||
|
||||
// ---- VK_KHR_maintenance3 extension commands
|
||||
GetDescriptorSetLayoutSupportKHR: PFN_vkGetDescriptorSetLayoutSupportKHR,
|
||||
|
||||
// ---- VK_KHR_draw_indirect_count extension commands
|
||||
CmdDrawIndirectCountKHR: PFN_vkCmdDrawIndirectCountKHR,
|
||||
CmdDrawIndexedIndirectCountKHR: PFN_vkCmdDrawIndexedIndirectCountKHR,
|
||||
|
||||
// ---- VK_KHR_timeline_semaphore extension commands
|
||||
GetSemaphoreCounterValueKHR: PFN_vkGetSemaphoreCounterValueKHR,
|
||||
WaitSemaphoresKHR: PFN_vkWaitSemaphoresKHR,
|
||||
SignalSemaphoreKHR: PFN_vkSignalSemaphoreKHR,
|
||||
|
||||
// ---- VK_KHR_fragment_shading_rate extension commands
|
||||
CmdSetFragmentShadingRateKHR: PFN_vkCmdSetFragmentShadingRateKHR,
|
||||
|
||||
// ---- VK_KHR_present_wait extension commands
|
||||
WaitForPresentKHR: PFN_vkWaitForPresentKHR,
|
||||
|
||||
// ---- VK_KHR_buffer_device_address extension commands
|
||||
GetBufferDeviceAddressKHR: PFN_vkGetBufferDeviceAddressKHR,
|
||||
GetBufferOpaqueCaptureAddressKHR: PFN_vkGetBufferOpaqueCaptureAddressKHR,
|
||||
GetDeviceMemoryOpaqueCaptureAddressKHR: PFN_vkGetDeviceMemoryOpaqueCaptureAddressKHR,
|
||||
|
||||
// ---- VK_KHR_deferred_host_operations extension commands
|
||||
CreateDeferredOperationKHR: PFN_vkCreateDeferredOperationKHR,
|
||||
DestroyDeferredOperationKHR: PFN_vkDestroyDeferredOperationKHR,
|
||||
GetDeferredOperationMaxConcurrencyKHR: PFN_vkGetDeferredOperationMaxConcurrencyKHR,
|
||||
GetDeferredOperationResultKHR: PFN_vkGetDeferredOperationResultKHR,
|
||||
DeferredOperationJoinKHR: PFN_vkDeferredOperationJoinKHR,
|
||||
|
||||
// ---- VK_KHR_pipeline_executable_properties extension commands
|
||||
GetPipelineExecutablePropertiesKHR: PFN_vkGetPipelineExecutablePropertiesKHR,
|
||||
GetPipelineExecutableStatisticsKHR: PFN_vkGetPipelineExecutableStatisticsKHR,
|
||||
GetPipelineExecutableInternalRepresentationsKHR:
|
||||
PFN_vkGetPipelineExecutableInternalRepresentationsKHR,
|
||||
|
||||
// ---- VK_KHR_synchronization2 extension commands
|
||||
CmdSetEvent2KHR: PFN_vkCmdSetEvent2KHR,
|
||||
CmdResetEvent2KHR: PFN_vkCmdResetEvent2KHR,
|
||||
CmdWaitEvents2KHR: PFN_vkCmdWaitEvents2KHR,
|
||||
CmdPipelineBarrier2KHR: PFN_vkCmdPipelineBarrier2KHR,
|
||||
CmdWriteTimestamp2KHR: PFN_vkCmdWriteTimestamp2KHR,
|
||||
QueueSubmit2KHR: PFN_vkQueueSubmit2KHR,
|
||||
CmdWriteBufferMarker2AMD: PFN_vkCmdWriteBufferMarker2AMD,
|
||||
GetQueueCheckpointData2NV: PFN_vkGetQueueCheckpointData2NV,
|
||||
|
||||
// ---- VK_KHR_copy_commands2 extension commands
|
||||
CmdCopyBuffer2KHR: PFN_vkCmdCopyBuffer2KHR,
|
||||
CmdCopyImage2KHR: PFN_vkCmdCopyImage2KHR,
|
||||
CmdCopyBufferToImage2KHR: PFN_vkCmdCopyBufferToImage2KHR,
|
||||
CmdCopyImageToBuffer2KHR: PFN_vkCmdCopyImageToBuffer2KHR,
|
||||
CmdBlitImage2KHR: PFN_vkCmdBlitImage2KHR,
|
||||
CmdResolveImage2KHR: PFN_vkCmdResolveImage2KHR,
|
||||
|
||||
// ---- VK_KHR_ray_tracing_maintenance1 extension commands
|
||||
CmdTraceRaysIndirect2KHR: PFN_vkCmdTraceRaysIndirect2KHR,
|
||||
|
||||
// ---- VK_KHR_maintenance4 extension commands
|
||||
GetDeviceBufferMemoryRequirementsKHR: PFN_vkGetDeviceBufferMemoryRequirementsKHR,
|
||||
GetDeviceImageMemoryRequirementsKHR: PFN_vkGetDeviceImageMemoryRequirementsKHR,
|
||||
GetDeviceImageSparseMemoryRequirementsKHR: PFN_vkGetDeviceImageSparseMemoryRequirementsKHR,
|
||||
|
||||
// ---- VK_EXT_debug_marker extension commands
|
||||
DebugMarkerSetObjectTagEXT: PFN_vkDebugMarkerSetObjectTagEXT,
|
||||
DebugMarkerSetObjectNameEXT: PFN_vkDebugMarkerSetObjectNameEXT,
|
||||
CmdDebugMarkerBeginEXT: PFN_vkCmdDebugMarkerBeginEXT,
|
||||
CmdDebugMarkerEndEXT: PFN_vkCmdDebugMarkerEndEXT,
|
||||
CmdDebugMarkerInsertEXT: PFN_vkCmdDebugMarkerInsertEXT,
|
||||
|
||||
// ---- VK_EXT_transform_feedback extension commands
|
||||
CmdBindTransformFeedbackBuffersEXT: PFN_vkCmdBindTransformFeedbackBuffersEXT,
|
||||
CmdBeginTransformFeedbackEXT: PFN_vkCmdBeginTransformFeedbackEXT,
|
||||
CmdEndTransformFeedbackEXT: PFN_vkCmdEndTransformFeedbackEXT,
|
||||
CmdBeginQueryIndexedEXT: PFN_vkCmdBeginQueryIndexedEXT,
|
||||
CmdEndQueryIndexedEXT: PFN_vkCmdEndQueryIndexedEXT,
|
||||
CmdDrawIndirectByteCountEXT: PFN_vkCmdDrawIndirectByteCountEXT,
|
||||
|
||||
// ---- VK_NVX_binary_import extension commands
|
||||
CreateCuModuleNVX: PFN_vkCreateCuModuleNVX,
|
||||
CreateCuFunctionNVX: PFN_vkCreateCuFunctionNVX,
|
||||
DestroyCuModuleNVX: PFN_vkDestroyCuModuleNVX,
|
||||
DestroyCuFunctionNVX: PFN_vkDestroyCuFunctionNVX,
|
||||
CmdCuLaunchKernelNVX: PFN_vkCmdCuLaunchKernelNVX,
|
||||
|
||||
// ---- VK_NVX_image_view_handle extension commands
|
||||
GetImageViewHandleNVX: PFN_vkGetImageViewHandleNVX,
|
||||
GetImageViewAddressNVX: PFN_vkGetImageViewAddressNVX,
|
||||
|
||||
// ---- VK_AMD_draw_indirect_count extension commands
|
||||
CmdDrawIndirectCountAMD: PFN_vkCmdDrawIndirectCountAMD,
|
||||
CmdDrawIndexedIndirectCountAMD: PFN_vkCmdDrawIndexedIndirectCountAMD,
|
||||
|
||||
// ---- VK_AMD_shader_info extension commands
|
||||
GetShaderInfoAMD: PFN_vkGetShaderInfoAMD,
|
||||
|
||||
// ---- VK_EXT_conditional_rendering extension commands
|
||||
CmdBeginConditionalRenderingEXT: PFN_vkCmdBeginConditionalRenderingEXT,
|
||||
CmdEndConditionalRenderingEXT: PFN_vkCmdEndConditionalRenderingEXT,
|
||||
|
||||
// ---- VK_NV_clip_space_w_scaling extension commands
|
||||
CmdSetViewportWScalingNV: PFN_vkCmdSetViewportWScalingNV,
|
||||
|
||||
// ---- VK_EXT_display_control extension commands
|
||||
DisplayPowerControlEXT: PFN_vkDisplayPowerControlEXT,
|
||||
RegisterDeviceEventEXT: PFN_vkRegisterDeviceEventEXT,
|
||||
RegisterDisplayEventEXT: PFN_vkRegisterDisplayEventEXT,
|
||||
GetSwapchainCounterEXT: PFN_vkGetSwapchainCounterEXT,
|
||||
|
||||
// ---- VK_GOOGLE_display_timing extension commands
|
||||
GetRefreshCycleDurationGOOGLE: PFN_vkGetRefreshCycleDurationGOOGLE,
|
||||
GetPastPresentationTimingGOOGLE: PFN_vkGetPastPresentationTimingGOOGLE,
|
||||
|
||||
// ---- VK_EXT_discard_rectangles extension commands
|
||||
CmdSetDiscardRectangleEXT: PFN_vkCmdSetDiscardRectangleEXT,
|
||||
|
||||
// ---- VK_EXT_hdr_metadata extension commands
|
||||
SetHdrMetadataEXT: PFN_vkSetHdrMetadataEXT,
|
||||
|
||||
// ---- VK_EXT_debug_utils extension commands
|
||||
SetDebugUtilsObjectNameEXT: PFN_vkSetDebugUtilsObjectNameEXT,
|
||||
SetDebugUtilsObjectTagEXT: PFN_vkSetDebugUtilsObjectTagEXT,
|
||||
QueueBeginDebugUtilsLabelEXT: PFN_vkQueueBeginDebugUtilsLabelEXT,
|
||||
QueueEndDebugUtilsLabelEXT: PFN_vkQueueEndDebugUtilsLabelEXT,
|
||||
QueueInsertDebugUtilsLabelEXT: PFN_vkQueueInsertDebugUtilsLabelEXT,
|
||||
CmdBeginDebugUtilsLabelEXT: PFN_vkCmdBeginDebugUtilsLabelEXT,
|
||||
CmdEndDebugUtilsLabelEXT: PFN_vkCmdEndDebugUtilsLabelEXT,
|
||||
CmdInsertDebugUtilsLabelEXT: PFN_vkCmdInsertDebugUtilsLabelEXT,
|
||||
|
||||
// ---- VK_EXT_sample_locations extension commands
|
||||
CmdSetSampleLocationsEXT: PFN_vkCmdSetSampleLocationsEXT,
|
||||
|
||||
// ---- VK_EXT_image_drm_format_modifier extension commands
|
||||
GetImageDrmFormatModifierPropertiesEXT: PFN_vkGetImageDrmFormatModifierPropertiesEXT,
|
||||
|
||||
// ---- VK_EXT_validation_cache extension commands
|
||||
CreateValidationCacheEXT: PFN_vkCreateValidationCacheEXT,
|
||||
DestroyValidationCacheEXT: PFN_vkDestroyValidationCacheEXT,
|
||||
MergeValidationCachesEXT: PFN_vkMergeValidationCachesEXT,
|
||||
GetValidationCacheDataEXT: PFN_vkGetValidationCacheDataEXT,
|
||||
|
||||
// ---- VK_NV_shading_rate_image extension commands
|
||||
CmdBindShadingRateImageNV: PFN_vkCmdBindShadingRateImageNV,
|
||||
CmdSetViewportShadingRatePaletteNV: PFN_vkCmdSetViewportShadingRatePaletteNV,
|
||||
CmdSetCoarseSampleOrderNV: PFN_vkCmdSetCoarseSampleOrderNV,
|
||||
|
||||
// ---- VK_NV_ray_tracing extension commands
|
||||
CreateAccelerationStructureNV: PFN_vkCreateAccelerationStructureNV,
|
||||
DestroyAccelerationStructureNV: PFN_vkDestroyAccelerationStructureNV,
|
||||
GetAccelerationStructureMemoryRequirementsNV:
|
||||
PFN_vkGetAccelerationStructureMemoryRequirementsNV,
|
||||
BindAccelerationStructureMemoryNV: PFN_vkBindAccelerationStructureMemoryNV,
|
||||
CmdBuildAccelerationStructureNV: PFN_vkCmdBuildAccelerationStructureNV,
|
||||
CmdCopyAccelerationStructureNV: PFN_vkCmdCopyAccelerationStructureNV,
|
||||
CmdTraceRaysNV: PFN_vkCmdTraceRaysNV,
|
||||
CreateRayTracingPipelinesNV: PFN_vkCreateRayTracingPipelinesNV,
|
||||
GetRayTracingShaderGroupHandlesKHR: PFN_vkGetRayTracingShaderGroupHandlesKHR,
|
||||
GetRayTracingShaderGroupHandlesNV: PFN_vkGetRayTracingShaderGroupHandlesNV,
|
||||
GetAccelerationStructureHandleNV: PFN_vkGetAccelerationStructureHandleNV,
|
||||
CmdWriteAccelerationStructuresPropertiesNV: PFN_vkCmdWriteAccelerationStructuresPropertiesNV,
|
||||
CompileDeferredNV: PFN_vkCompileDeferredNV,
|
||||
|
||||
// ---- VK_EXT_external_memory_host extension commands
|
||||
GetMemoryHostPointerPropertiesEXT: PFN_vkGetMemoryHostPointerPropertiesEXT,
|
||||
|
||||
// ---- VK_AMD_buffer_marker extension commands
|
||||
CmdWriteBufferMarkerAMD: PFN_vkCmdWriteBufferMarkerAMD,
|
||||
|
||||
// ---- VK_EXT_calibrated_timestamps extension commands
|
||||
GetCalibratedTimestampsEXT: PFN_vkGetCalibratedTimestampsEXT,
|
||||
|
||||
// ---- VK_NV_mesh_shader extension commands
|
||||
CmdDrawMeshTasksNV: PFN_vkCmdDrawMeshTasksNV,
|
||||
CmdDrawMeshTasksIndirectNV: PFN_vkCmdDrawMeshTasksIndirectNV,
|
||||
CmdDrawMeshTasksIndirectCountNV: PFN_vkCmdDrawMeshTasksIndirectCountNV,
|
||||
|
||||
// ---- VK_NV_scissor_exclusive extension commands
|
||||
CmdSetExclusiveScissorNV: PFN_vkCmdSetExclusiveScissorNV,
|
||||
|
||||
// ---- VK_NV_device_diagnostic_checkpoints extension commands
|
||||
CmdSetCheckpointNV: PFN_vkCmdSetCheckpointNV,
|
||||
GetQueueCheckpointDataNV: PFN_vkGetQueueCheckpointDataNV,
|
||||
|
||||
// ---- VK_INTEL_performance_query extension commands
|
||||
InitializePerformanceApiINTEL: PFN_vkInitializePerformanceApiINTEL,
|
||||
UninitializePerformanceApiINTEL: PFN_vkUninitializePerformanceApiINTEL,
|
||||
CmdSetPerformanceMarkerINTEL: PFN_vkCmdSetPerformanceMarkerINTEL,
|
||||
CmdSetPerformanceStreamMarkerINTEL: PFN_vkCmdSetPerformanceStreamMarkerINTEL,
|
||||
CmdSetPerformanceOverrideINTEL: PFN_vkCmdSetPerformanceOverrideINTEL,
|
||||
AcquirePerformanceConfigurationINTEL: PFN_vkAcquirePerformanceConfigurationINTEL,
|
||||
ReleasePerformanceConfigurationINTEL: PFN_vkReleasePerformanceConfigurationINTEL,
|
||||
QueueSetPerformanceConfigurationINTEL: PFN_vkQueueSetPerformanceConfigurationINTEL,
|
||||
GetPerformanceParameterINTEL: PFN_vkGetPerformanceParameterINTEL,
|
||||
|
||||
// ---- VK_AMD_display_native_hdr extension commands
|
||||
SetLocalDimmingAMD: PFN_vkSetLocalDimmingAMD,
|
||||
|
||||
// ---- VK_EXT_buffer_device_address extension commands
|
||||
GetBufferDeviceAddressEXT: PFN_vkGetBufferDeviceAddressEXT,
|
||||
|
||||
// ---- VK_EXT_line_rasterization extension commands
|
||||
CmdSetLineStippleEXT: PFN_vkCmdSetLineStippleEXT,
|
||||
|
||||
// ---- VK_EXT_host_query_reset extension commands
|
||||
ResetQueryPoolEXT: PFN_vkResetQueryPoolEXT,
|
||||
|
||||
// ---- VK_EXT_extended_dynamic_state extension commands
|
||||
CmdSetCullModeEXT: PFN_vkCmdSetCullModeEXT,
|
||||
CmdSetFrontFaceEXT: PFN_vkCmdSetFrontFaceEXT,
|
||||
CmdSetPrimitiveTopologyEXT: PFN_vkCmdSetPrimitiveTopologyEXT,
|
||||
CmdSetViewportWithCountEXT: PFN_vkCmdSetViewportWithCountEXT,
|
||||
CmdSetScissorWithCountEXT: PFN_vkCmdSetScissorWithCountEXT,
|
||||
CmdBindVertexBuffers2EXT: PFN_vkCmdBindVertexBuffers2EXT,
|
||||
CmdSetDepthTestEnableEXT: PFN_vkCmdSetDepthTestEnableEXT,
|
||||
CmdSetDepthWriteEnableEXT: PFN_vkCmdSetDepthWriteEnableEXT,
|
||||
CmdSetDepthCompareOpEXT: PFN_vkCmdSetDepthCompareOpEXT,
|
||||
CmdSetDepthBoundsTestEnableEXT: PFN_vkCmdSetDepthBoundsTestEnableEXT,
|
||||
CmdSetStencilTestEnableEXT: PFN_vkCmdSetStencilTestEnableEXT,
|
||||
CmdSetStencilOpEXT: PFN_vkCmdSetStencilOpEXT,
|
||||
|
||||
// ---- VK_NV_device_generated_commands extension commands
|
||||
GetGeneratedCommandsMemoryRequirementsNV: PFN_vkGetGeneratedCommandsMemoryRequirementsNV,
|
||||
CmdPreprocessGeneratedCommandsNV: PFN_vkCmdPreprocessGeneratedCommandsNV,
|
||||
CmdExecuteGeneratedCommandsNV: PFN_vkCmdExecuteGeneratedCommandsNV,
|
||||
CmdBindPipelineShaderGroupNV: PFN_vkCmdBindPipelineShaderGroupNV,
|
||||
CreateIndirectCommandsLayoutNV: PFN_vkCreateIndirectCommandsLayoutNV,
|
||||
DestroyIndirectCommandsLayoutNV: PFN_vkDestroyIndirectCommandsLayoutNV,
|
||||
|
||||
// ---- VK_EXT_private_data extension commands
|
||||
CreatePrivateDataSlotEXT: PFN_vkCreatePrivateDataSlotEXT,
|
||||
DestroyPrivateDataSlotEXT: PFN_vkDestroyPrivateDataSlotEXT,
|
||||
SetPrivateDataEXT: PFN_vkSetPrivateDataEXT,
|
||||
GetPrivateDataEXT: PFN_vkGetPrivateDataEXT,
|
||||
|
||||
// ---- VK_NV_fragment_shading_rate_enums extension commands
|
||||
CmdSetFragmentShadingRateEnumNV: PFN_vkCmdSetFragmentShadingRateEnumNV,
|
||||
|
||||
// ---- VK_EXT_image_compression_control extension commands
|
||||
GetImageSubresourceLayout2EXT: PFN_vkGetImageSubresourceLayout2EXT,
|
||||
|
||||
// ---- VK_EXT_device_fault extension commands
|
||||
GetDeviceFaultInfoEXT: PFN_vkGetDeviceFaultInfoEXT,
|
||||
|
||||
// ---- VK_EXT_vertex_input_dynamic_state extension commands
|
||||
CmdSetVertexInputEXT: PFN_vkCmdSetVertexInputEXT,
|
||||
|
||||
// ---- VK_HUAWEI_subpass_shading extension commands
|
||||
GetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI:
|
||||
PFN_vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI,
|
||||
CmdSubpassShadingHUAWEI: PFN_vkCmdSubpassShadingHUAWEI,
|
||||
|
||||
// ---- VK_HUAWEI_invocation_mask extension commands
|
||||
CmdBindInvocationMaskHUAWEI: PFN_vkCmdBindInvocationMaskHUAWEI,
|
||||
|
||||
// ---- VK_NV_external_memory_rdma extension commands
|
||||
GetMemoryRemoteAddressNV: PFN_vkGetMemoryRemoteAddressNV,
|
||||
|
||||
// ---- VK_EXT_pipeline_properties extension commands
|
||||
GetPipelinePropertiesEXT: PFN_vkGetPipelinePropertiesEXT,
|
||||
|
||||
// ---- VK_EXT_extended_dynamic_state2 extension commands
|
||||
CmdSetPatchControlPointsEXT: PFN_vkCmdSetPatchControlPointsEXT,
|
||||
CmdSetRasterizerDiscardEnableEXT: PFN_vkCmdSetRasterizerDiscardEnableEXT,
|
||||
CmdSetDepthBiasEnableEXT: PFN_vkCmdSetDepthBiasEnableEXT,
|
||||
CmdSetLogicOpEXT: PFN_vkCmdSetLogicOpEXT,
|
||||
CmdSetPrimitiveRestartEnableEXT: PFN_vkCmdSetPrimitiveRestartEnableEXT,
|
||||
|
||||
// ---- VK_EXT_color_write_enable extension commands
|
||||
CmdSetColorWriteEnableEXT: PFN_vkCmdSetColorWriteEnableEXT,
|
||||
|
||||
// ---- VK_EXT_multi_draw extension commands
|
||||
CmdDrawMultiEXT: PFN_vkCmdDrawMultiEXT,
|
||||
CmdDrawMultiIndexedEXT: PFN_vkCmdDrawMultiIndexedEXT,
|
||||
|
||||
// ---- VK_EXT_opacity_micromap extension commands
|
||||
CreateMicromapEXT: PFN_vkCreateMicromapEXT,
|
||||
DestroyMicromapEXT: PFN_vkDestroyMicromapEXT,
|
||||
CmdBuildMicromapsEXT: PFN_vkCmdBuildMicromapsEXT,
|
||||
BuildMicromapsEXT: PFN_vkBuildMicromapsEXT,
|
||||
CopyMicromapEXT: PFN_vkCopyMicromapEXT,
|
||||
CopyMicromapToMemoryEXT: PFN_vkCopyMicromapToMemoryEXT,
|
||||
CopyMemoryToMicromapEXT: PFN_vkCopyMemoryToMicromapEXT,
|
||||
WriteMicromapsPropertiesEXT: PFN_vkWriteMicromapsPropertiesEXT,
|
||||
CmdCopyMicromapEXT: PFN_vkCmdCopyMicromapEXT,
|
||||
CmdCopyMicromapToMemoryEXT: PFN_vkCmdCopyMicromapToMemoryEXT,
|
||||
CmdCopyMemoryToMicromapEXT: PFN_vkCmdCopyMemoryToMicromapEXT,
|
||||
CmdWriteMicromapsPropertiesEXT: PFN_vkCmdWriteMicromapsPropertiesEXT,
|
||||
GetDeviceMicromapCompatibilityEXT: PFN_vkGetDeviceMicromapCompatibilityEXT,
|
||||
GetMicromapBuildSizesEXT: PFN_vkGetMicromapBuildSizesEXT,
|
||||
|
||||
// ---- VK_EXT_pageable_device_local_memory extension commands
|
||||
SetDeviceMemoryPriorityEXT: PFN_vkSetDeviceMemoryPriorityEXT,
|
||||
|
||||
// ---- VK_VALVE_descriptor_set_host_mapping extension commands
|
||||
GetDescriptorSetLayoutHostMappingInfoVALVE: PFN_vkGetDescriptorSetLayoutHostMappingInfoVALVE,
|
||||
GetDescriptorSetHostMappingVALVE: PFN_vkGetDescriptorSetHostMappingVALVE,
|
||||
|
||||
// ---- VK_EXT_extended_dynamic_state3 extension commands
|
||||
CmdSetTessellationDomainOriginEXT: PFN_vkCmdSetTessellationDomainOriginEXT,
|
||||
CmdSetDepthClampEnableEXT: PFN_vkCmdSetDepthClampEnableEXT,
|
||||
CmdSetPolygonModeEXT: PFN_vkCmdSetPolygonModeEXT,
|
||||
CmdSetRasterizationSamplesEXT: PFN_vkCmdSetRasterizationSamplesEXT,
|
||||
CmdSetSampleMaskEXT: PFN_vkCmdSetSampleMaskEXT,
|
||||
CmdSetAlphaToCoverageEnableEXT: PFN_vkCmdSetAlphaToCoverageEnableEXT,
|
||||
CmdSetAlphaToOneEnableEXT: PFN_vkCmdSetAlphaToOneEnableEXT,
|
||||
CmdSetLogicOpEnableEXT: PFN_vkCmdSetLogicOpEnableEXT,
|
||||
CmdSetColorBlendEnableEXT: PFN_vkCmdSetColorBlendEnableEXT,
|
||||
CmdSetColorBlendEquationEXT: PFN_vkCmdSetColorBlendEquationEXT,
|
||||
CmdSetColorWriteMaskEXT: PFN_vkCmdSetColorWriteMaskEXT,
|
||||
CmdSetRasterizationStreamEXT: PFN_vkCmdSetRasterizationStreamEXT,
|
||||
CmdSetConservativeRasterizationModeEXT: PFN_vkCmdSetConservativeRasterizationModeEXT,
|
||||
CmdSetExtraPrimitiveOverestimationSizeEXT: PFN_vkCmdSetExtraPrimitiveOverestimationSizeEXT,
|
||||
CmdSetDepthClipEnableEXT: PFN_vkCmdSetDepthClipEnableEXT,
|
||||
CmdSetSampleLocationsEnableEXT: PFN_vkCmdSetSampleLocationsEnableEXT,
|
||||
CmdSetColorBlendAdvancedEXT: PFN_vkCmdSetColorBlendAdvancedEXT,
|
||||
CmdSetProvokingVertexModeEXT: PFN_vkCmdSetProvokingVertexModeEXT,
|
||||
CmdSetLineRasterizationModeEXT: PFN_vkCmdSetLineRasterizationModeEXT,
|
||||
CmdSetLineStippleEnableEXT: PFN_vkCmdSetLineStippleEnableEXT,
|
||||
CmdSetDepthClipNegativeOneToOneEXT: PFN_vkCmdSetDepthClipNegativeOneToOneEXT,
|
||||
CmdSetViewportWScalingEnableNV: PFN_vkCmdSetViewportWScalingEnableNV,
|
||||
CmdSetViewportSwizzleNV: PFN_vkCmdSetViewportSwizzleNV,
|
||||
CmdSetCoverageToColorEnableNV: PFN_vkCmdSetCoverageToColorEnableNV,
|
||||
CmdSetCoverageToColorLocationNV: PFN_vkCmdSetCoverageToColorLocationNV,
|
||||
CmdSetCoverageModulationModeNV: PFN_vkCmdSetCoverageModulationModeNV,
|
||||
CmdSetCoverageModulationTableEnableNV: PFN_vkCmdSetCoverageModulationTableEnableNV,
|
||||
CmdSetCoverageModulationTableNV: PFN_vkCmdSetCoverageModulationTableNV,
|
||||
CmdSetShadingRateImageEnableNV: PFN_vkCmdSetShadingRateImageEnableNV,
|
||||
CmdSetRepresentativeFragmentTestEnableNV: PFN_vkCmdSetRepresentativeFragmentTestEnableNV,
|
||||
CmdSetCoverageReductionModeNV: PFN_vkCmdSetCoverageReductionModeNV,
|
||||
|
||||
// ---- VK_EXT_shader_module_identifier extension commands
|
||||
GetShaderModuleIdentifierEXT: PFN_vkGetShaderModuleIdentifierEXT,
|
||||
GetShaderModuleCreateInfoIdentifierEXT: PFN_vkGetShaderModuleCreateInfoIdentifierEXT,
|
||||
|
||||
// ---- VK_NV_optical_flow extension commands
|
||||
CreateOpticalFlowSessionNV: PFN_vkCreateOpticalFlowSessionNV,
|
||||
DestroyOpticalFlowSessionNV: PFN_vkDestroyOpticalFlowSessionNV,
|
||||
BindOpticalFlowSessionImageNV: PFN_vkBindOpticalFlowSessionImageNV,
|
||||
CmdOpticalFlowExecuteNV: PFN_vkCmdOpticalFlowExecuteNV,
|
||||
|
||||
// ---- VK_QCOM_tile_properties extension commands
|
||||
GetFramebufferTilePropertiesQCOM: PFN_vkGetFramebufferTilePropertiesQCOM,
|
||||
GetDynamicRenderingTilePropertiesQCOM: PFN_vkGetDynamicRenderingTilePropertiesQCOM,
|
||||
|
||||
// ---- VK_KHR_acceleration_structure extension commands
|
||||
CreateAccelerationStructureKHR: PFN_vkCreateAccelerationStructureKHR,
|
||||
DestroyAccelerationStructureKHR: PFN_vkDestroyAccelerationStructureKHR,
|
||||
CmdBuildAccelerationStructuresKHR: PFN_vkCmdBuildAccelerationStructuresKHR,
|
||||
CmdBuildAccelerationStructuresIndirectKHR: PFN_vkCmdBuildAccelerationStructuresIndirectKHR,
|
||||
BuildAccelerationStructuresKHR: PFN_vkBuildAccelerationStructuresKHR,
|
||||
CopyAccelerationStructureKHR: PFN_vkCopyAccelerationStructureKHR,
|
||||
CopyAccelerationStructureToMemoryKHR: PFN_vkCopyAccelerationStructureToMemoryKHR,
|
||||
CopyMemoryToAccelerationStructureKHR: PFN_vkCopyMemoryToAccelerationStructureKHR,
|
||||
WriteAccelerationStructuresPropertiesKHR: PFN_vkWriteAccelerationStructuresPropertiesKHR,
|
||||
CmdCopyAccelerationStructureKHR: PFN_vkCmdCopyAccelerationStructureKHR,
|
||||
CmdCopyAccelerationStructureToMemoryKHR: PFN_vkCmdCopyAccelerationStructureToMemoryKHR,
|
||||
CmdCopyMemoryToAccelerationStructureKHR: PFN_vkCmdCopyMemoryToAccelerationStructureKHR,
|
||||
GetAccelerationStructureDeviceAddressKHR: PFN_vkGetAccelerationStructureDeviceAddressKHR,
|
||||
CmdWriteAccelerationStructuresPropertiesKHR: PFN_vkCmdWriteAccelerationStructuresPropertiesKHR,
|
||||
GetDeviceAccelerationStructureCompatibilityKHR:
|
||||
PFN_vkGetDeviceAccelerationStructureCompatibilityKHR,
|
||||
GetAccelerationStructureBuildSizesKHR: PFN_vkGetAccelerationStructureBuildSizesKHR,
|
||||
|
||||
// ---- VK_KHR_ray_tracing_pipeline extension commands
|
||||
CmdTraceRaysKHR: PFN_vkCmdTraceRaysKHR,
|
||||
CreateRayTracingPipelinesKHR: PFN_vkCreateRayTracingPipelinesKHR,
|
||||
GetRayTracingCaptureReplayShaderGroupHandlesKHR:
|
||||
PFN_vkGetRayTracingCaptureReplayShaderGroupHandlesKHR,
|
||||
CmdTraceRaysIndirectKHR: PFN_vkCmdTraceRaysIndirectKHR,
|
||||
GetRayTracingShaderGroupStackSizeKHR: PFN_vkGetRayTracingShaderGroupStackSizeKHR,
|
||||
CmdSetRayTracingPipelineStackSizeKHR: PFN_vkCmdSetRayTracingPipelineStackSizeKHR,
|
||||
|
||||
// ---- VK_EXT_mesh_shader extension commands
|
||||
CmdDrawMeshTasksEXT: PFN_vkCmdDrawMeshTasksEXT,
|
||||
CmdDrawMeshTasksIndirectEXT: PFN_vkCmdDrawMeshTasksIndirectEXT,
|
||||
CmdDrawMeshTasksIndirectCountEXT: PFN_vkCmdDrawMeshTasksIndirectCountEXT,
|
||||
}
|
151
src/layer_instance_dispatch_table.rs
Normal file
151
src/layer_instance_dispatch_table.rs
Normal file
|
@ -0,0 +1,151 @@
|
|||
use vulkan_sys::prelude::*;
|
||||
|
||||
pub struct VkLayerInstanceDispatchTable {
|
||||
// Manually add in GetPhysicalDeviceProcAddr entry
|
||||
GetPhysicalDeviceProcAddr: PFN_GetPhysicalDeviceProcAddr,
|
||||
|
||||
// ---- Core 1_0 commands
|
||||
CreateInstance: PFN_vkCreateInstance,
|
||||
DestroyInstance: PFN_vkDestroyInstance,
|
||||
EnumeratePhysicalDevices: PFN_vkEnumeratePhysicalDevices,
|
||||
GetPhysicalDeviceFeatures: PFN_vkGetPhysicalDeviceFeatures,
|
||||
GetPhysicalDeviceFormatProperties: PFN_vkGetPhysicalDeviceFormatProperties,
|
||||
GetPhysicalDeviceImageFormatProperties: PFN_vkGetPhysicalDeviceImageFormatProperties,
|
||||
GetPhysicalDeviceProperties: PFN_vkGetPhysicalDeviceProperties,
|
||||
GetPhysicalDeviceQueueFamilyProperties: PFN_vkGetPhysicalDeviceQueueFamilyProperties,
|
||||
GetPhysicalDeviceMemoryProperties: PFN_vkGetPhysicalDeviceMemoryProperties,
|
||||
GetInstanceProcAddr: PFN_vkGetInstanceProcAddr,
|
||||
CreateDevice: PFN_vkCreateDevice,
|
||||
EnumerateInstanceExtensionProperties: PFN_vkEnumerateInstanceExtensionProperties,
|
||||
EnumerateDeviceExtensionProperties: PFN_vkEnumerateDeviceExtensionProperties,
|
||||
EnumerateInstanceLayerProperties: PFN_vkEnumerateInstanceLayerProperties,
|
||||
EnumerateDeviceLayerProperties: PFN_vkEnumerateDeviceLayerProperties,
|
||||
GetPhysicalDeviceSparseImageFormatProperties:
|
||||
PFN_vkGetPhysicalDeviceSparseImageFormatProperties,
|
||||
|
||||
// ---- Core 1_1 commands
|
||||
EnumerateInstanceVersion: PFN_vkEnumerateInstanceVersion,
|
||||
EnumeratePhysicalDeviceGroups: PFN_vkEnumeratePhysicalDeviceGroups,
|
||||
GetPhysicalDeviceFeatures2: PFN_vkGetPhysicalDeviceFeatures2,
|
||||
GetPhysicalDeviceProperties2: PFN_vkGetPhysicalDeviceProperties2,
|
||||
GetPhysicalDeviceFormatProperties2: PFN_vkGetPhysicalDeviceFormatProperties2,
|
||||
GetPhysicalDeviceImageFormatProperties2: PFN_vkGetPhysicalDeviceImageFormatProperties2,
|
||||
GetPhysicalDeviceQueueFamilyProperties2: PFN_vkGetPhysicalDeviceQueueFamilyProperties2,
|
||||
GetPhysicalDeviceMemoryProperties2: PFN_vkGetPhysicalDeviceMemoryProperties2,
|
||||
GetPhysicalDeviceSparseImageFormatProperties2:
|
||||
PFN_vkGetPhysicalDeviceSparseImageFormatProperties2,
|
||||
GetPhysicalDeviceExternalBufferProperties: PFN_vkGetPhysicalDeviceExternalBufferProperties,
|
||||
GetPhysicalDeviceExternalFenceProperties: PFN_vkGetPhysicalDeviceExternalFenceProperties,
|
||||
GetPhysicalDeviceExternalSemaphoreProperties:
|
||||
PFN_vkGetPhysicalDeviceExternalSemaphoreProperties,
|
||||
|
||||
// ---- Core 1_3 commands
|
||||
GetPhysicalDeviceToolProperties: PFN_vkGetPhysicalDeviceToolProperties,
|
||||
|
||||
// ---- VK_KHR_surface extension commands
|
||||
DestroySurfaceKHR: PFN_vkDestroySurfaceKHR,
|
||||
GetPhysicalDeviceSurfaceSupportKHR: PFN_vkGetPhysicalDeviceSurfaceSupportKHR,
|
||||
GetPhysicalDeviceSurfaceCapabilitiesKHR: PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR,
|
||||
GetPhysicalDeviceSurfaceFormatsKHR: PFN_vkGetPhysicalDeviceSurfaceFormatsKHR,
|
||||
GetPhysicalDeviceSurfacePresentModesKHR: PFN_vkGetPhysicalDeviceSurfacePresentModesKHR,
|
||||
|
||||
// ---- VK_KHR_swapchain extension commands
|
||||
GetPhysicalDevicePresentRectanglesKHR: PFN_vkGetPhysicalDevicePresentRectanglesKHR,
|
||||
|
||||
// ---- VK_KHR_display extension commands
|
||||
GetPhysicalDeviceDisplayPropertiesKHR: PFN_vkGetPhysicalDeviceDisplayPropertiesKHR,
|
||||
GetPhysicalDeviceDisplayPlanePropertiesKHR: PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR,
|
||||
GetDisplayPlaneSupportedDisplaysKHR: PFN_vkGetDisplayPlaneSupportedDisplaysKHR,
|
||||
GetDisplayModePropertiesKHR: PFN_vkGetDisplayModePropertiesKHR,
|
||||
CreateDisplayModeKHR: PFN_vkCreateDisplayModeKHR,
|
||||
GetDisplayPlaneCapabilitiesKHR: PFN_vkGetDisplayPlaneCapabilitiesKHR,
|
||||
CreateDisplayPlaneSurfaceKHR: PFN_vkCreateDisplayPlaneSurfaceKHR,
|
||||
|
||||
// ---- VK_KHR_get_physical_device_properties2 extension commands
|
||||
GetPhysicalDeviceFeatures2KHR: PFN_vkGetPhysicalDeviceFeatures2KHR,
|
||||
GetPhysicalDeviceProperties2KHR: PFN_vkGetPhysicalDeviceProperties2KHR,
|
||||
GetPhysicalDeviceFormatProperties2KHR: PFN_vkGetPhysicalDeviceFormatProperties2KHR,
|
||||
GetPhysicalDeviceImageFormatProperties2KHR: PFN_vkGetPhysicalDeviceImageFormatProperties2KHR,
|
||||
GetPhysicalDeviceQueueFamilyProperties2KHR: PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR,
|
||||
GetPhysicalDeviceMemoryProperties2KHR: PFN_vkGetPhysicalDeviceMemoryProperties2KHR,
|
||||
GetPhysicalDeviceSparseImageFormatProperties2KHR:
|
||||
PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR,
|
||||
|
||||
// ---- VK_KHR_device_group_creation extension commands
|
||||
EnumeratePhysicalDeviceGroupsKHR: PFN_vkEnumeratePhysicalDeviceGroupsKHR,
|
||||
|
||||
// ---- VK_KHR_external_memory_capabilities extension commands
|
||||
GetPhysicalDeviceExternalBufferPropertiesKHR:
|
||||
PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR,
|
||||
|
||||
// ---- VK_KHR_external_semaphore_capabilities extension commands
|
||||
GetPhysicalDeviceExternalSemaphorePropertiesKHR:
|
||||
PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR,
|
||||
|
||||
// ---- VK_KHR_external_fence_capabilities extension commands
|
||||
GetPhysicalDeviceExternalFencePropertiesKHR: PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR,
|
||||
|
||||
// ---- VK_KHR_performance_query extension commands
|
||||
EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR:
|
||||
PFN_vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR,
|
||||
GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR:
|
||||
PFN_vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR,
|
||||
|
||||
// ---- VK_KHR_get_surface_capabilities2 extension commands
|
||||
GetPhysicalDeviceSurfaceCapabilities2KHR: PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR,
|
||||
GetPhysicalDeviceSurfaceFormats2KHR: PFN_vkGetPhysicalDeviceSurfaceFormats2KHR,
|
||||
|
||||
// ---- VK_KHR_get_display_properties2 extension commands
|
||||
GetPhysicalDeviceDisplayProperties2KHR: PFN_vkGetPhysicalDeviceDisplayProperties2KHR,
|
||||
GetPhysicalDeviceDisplayPlaneProperties2KHR: PFN_vkGetPhysicalDeviceDisplayPlaneProperties2KHR,
|
||||
GetDisplayModeProperties2KHR: PFN_vkGetDisplayModeProperties2KHR,
|
||||
GetDisplayPlaneCapabilities2KHR: PFN_vkGetDisplayPlaneCapabilities2KHR,
|
||||
|
||||
// ---- VK_KHR_fragment_shading_rate extension commands
|
||||
GetPhysicalDeviceFragmentShadingRatesKHR: PFN_vkGetPhysicalDeviceFragmentShadingRatesKHR,
|
||||
|
||||
// ---- VK_EXT_debug_report extension commands
|
||||
CreateDebugReportCallbackEXT: PFN_vkCreateDebugReportCallbackEXT,
|
||||
DestroyDebugReportCallbackEXT: PFN_vkDestroyDebugReportCallbackEXT,
|
||||
DebugReportMessageEXT: PFN_vkDebugReportMessageEXT,
|
||||
|
||||
// ---- VK_NV_external_memory_capabilities extension commands
|
||||
GetPhysicalDeviceExternalImageFormatPropertiesNV:
|
||||
PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV,
|
||||
|
||||
// ---- VK_EXT_display_surface_counter extension commands
|
||||
GetPhysicalDeviceSurfaceCapabilities2EXT: PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT,
|
||||
|
||||
// ---- VK_EXT_debug_utils extension commands
|
||||
CreateDebugUtilsMessengerEXT: PFN_vkCreateDebugUtilsMessengerEXT,
|
||||
DestroyDebugUtilsMessengerEXT: PFN_vkDestroyDebugUtilsMessengerEXT,
|
||||
SubmitDebugUtilsMessageEXT: PFN_vkSubmitDebugUtilsMessageEXT,
|
||||
|
||||
// ---- VK_EXT_sample_locations extension commands
|
||||
GetPhysicalDeviceMultisamplePropertiesEXT: PFN_vkGetPhysicalDeviceMultisamplePropertiesEXT,
|
||||
|
||||
// ---- VK_EXT_calibrated_timestamps extension commands
|
||||
GetPhysicalDeviceCalibrateableTimeDomainsEXT:
|
||||
PFN_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT,
|
||||
|
||||
// ---- VK_EXT_tooling_info extension commands
|
||||
GetPhysicalDeviceToolPropertiesEXT: PFN_vkGetPhysicalDeviceToolPropertiesEXT,
|
||||
|
||||
// ---- VK_NV_cooperative_matrix extension commands
|
||||
GetPhysicalDeviceCooperativeMatrixPropertiesNV:
|
||||
PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesNV,
|
||||
|
||||
// ---- VK_NV_coverage_reduction_mode extension commands
|
||||
GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV:
|
||||
PFN_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV,
|
||||
|
||||
// ---- VK_EXT_headless_surface extension commands
|
||||
CreateHeadlessSurfaceEXT: PFN_vkCreateHeadlessSurfaceEXT,
|
||||
|
||||
// ---- VK_EXT_acquire_drm_display extension commands
|
||||
AcquireDrmDisplayEXT: PFN_vkAcquireDrmDisplayEXT,
|
||||
GetDrmDisplayEXT: PFN_vkGetDrmDisplayEXT,
|
||||
|
||||
// ---- VK_NV_optical_flow extension commands
|
||||
GetPhysicalDeviceOpticalFlowImageFormatsNV: PFN_vkGetPhysicalDeviceOpticalFlowImageFormatsNV,
|
||||
}
|
155
src/lib.rs
Normal file
155
src/lib.rs
Normal file
|
@ -0,0 +1,155 @@
|
|||
pub mod enums;
|
||||
pub mod structs;
|
||||
|
||||
use std::{fs::OpenOptions, io::Write, mem, os::raw::c_char, ptr};
|
||||
|
||||
use enums::*;
|
||||
use structs::*;
|
||||
use vulkan_sys::prelude::*;
|
||||
|
||||
#[no_mangle]
|
||||
#[allow(non_snake_case)]
|
||||
pub extern "C" fn vkNegotiateLoaderLayerInterfaceVersion(
|
||||
pVersionStruct: *mut VkNegotiateLayerInterface,
|
||||
) -> VkResult {
|
||||
write_log("======================================================");
|
||||
write_log("================= New Negotiation ====================");
|
||||
write_log("======================================================");
|
||||
|
||||
unsafe {
|
||||
*pVersionStruct = VkNegotiateLayerInterface {
|
||||
sType: enums::VkNegotiateLayerStructType::LAYER_NEGOTIATE_INTERFACE_STRUCT,
|
||||
pNext: ptr::null_mut(),
|
||||
loaderLayerInterfaceVersion: 2,
|
||||
pfnGetInstanceProcAddr: Some(get_instance_proc_addr),
|
||||
pfnGetDeviceProcAddr: Some(get_device_proc_addr),
|
||||
pfnGetPhysicalDeviceProcAddr: None,
|
||||
}
|
||||
};
|
||||
|
||||
VK_SUCCESS
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
extern "system" fn get_device_proc_addr(
|
||||
device: VkDevice,
|
||||
function_name: *const c_char,
|
||||
) -> PFN_vkVoidFunction {
|
||||
write_log("vulkan layer device proc addr");
|
||||
|
||||
let func_string = match VkString::try_from(function_name) {
|
||||
Ok(func) => func,
|
||||
Err(_) => {
|
||||
write_log("Err: failed creating string");
|
||||
return Functions::Null.convert();
|
||||
}
|
||||
};
|
||||
|
||||
write_log(format!("requested function: {}", func_string.as_str()));
|
||||
|
||||
match func_string.as_str() {
|
||||
"vkCreateDevice" => Functions::CreateDevice(create_device),
|
||||
"vkDestroyDevice" => Functions::DestroyDevice(destroy_device),
|
||||
"vkCreateInstance" => Functions::CreateInstance(create_instance),
|
||||
"vkDestroyInstance" => Functions::DestroyInstance(destroy_instance),
|
||||
|
||||
_ => Functions::Null,
|
||||
}
|
||||
.convert()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
extern "system" fn get_instance_proc_addr(
|
||||
instance: VkInstance,
|
||||
function_name: *const c_char,
|
||||
) -> PFN_vkVoidFunction {
|
||||
write_log("vulkan layer instance proc addr");
|
||||
|
||||
let func_string = match VkString::try_from(function_name) {
|
||||
Ok(func) => func,
|
||||
Err(_) => {
|
||||
write_log("Err: failed creating string");
|
||||
return Functions::Null.convert();
|
||||
}
|
||||
};
|
||||
|
||||
match func_string.as_str() {
|
||||
"vkCreateDevice" => Functions::CreateDevice(create_device),
|
||||
"vkDestroyDevice" => Functions::DestroyDevice(destroy_device),
|
||||
"vkCreateInstance" => Functions::CreateInstance(create_instance),
|
||||
"vkDestroyInstance" => Functions::DestroyInstance(destroy_instance),
|
||||
|
||||
_ => Functions::Null,
|
||||
}
|
||||
.convert()
|
||||
}
|
||||
|
||||
extern "system" fn create_instance(
|
||||
create_info: *const VkInstanceCreateInfo,
|
||||
allocator: *const VkAllocationCallbacks,
|
||||
instance: *mut VkInstance,
|
||||
) -> VkResult {
|
||||
write_log("vulkan layer create instance");
|
||||
|
||||
let chain_info = match VkLayerInstanceCreateInfo::get_chain_info(
|
||||
unsafe { &*create_info },
|
||||
VK_LAYER_LINK_INFO,
|
||||
) {
|
||||
Some(info) => info,
|
||||
None => {
|
||||
write_log("chain info not found.");
|
||||
return VK_ERROR_LAYER_NOT_PRESENT;
|
||||
}
|
||||
};
|
||||
|
||||
let proc_addr = chain_info.layer_info().next_instance_proc_addr;
|
||||
let create_instance = match unsafe {
|
||||
mem::transmute::<PFN_vkVoidFunction, Option<PFN_vkCreateInstance>>(proc_addr(
|
||||
VkInstance::NULL_HANDLE,
|
||||
VkString::new("vkCreateInstance").as_ptr(),
|
||||
))
|
||||
} {
|
||||
Some(pfn) => pfn,
|
||||
None => return VK_ERROR_INITIALIZATION_FAILED,
|
||||
};
|
||||
|
||||
chain_info.advance_layer_info();
|
||||
let result = create_instance(create_info, allocator, instance);
|
||||
if result != VK_SUCCESS {
|
||||
return result;
|
||||
}
|
||||
|
||||
write_log("successfully created instance.");
|
||||
|
||||
VK_SUCCESS
|
||||
}
|
||||
|
||||
extern "system" fn destroy_instance(instance: VkInstance, allocator: *const VkAllocationCallbacks) {
|
||||
write_log("vulkan layer destroy instance");
|
||||
}
|
||||
|
||||
extern "system" fn create_device(
|
||||
physical_device: VkPhysicalDevice,
|
||||
create_info: *const VkDeviceCreateInfo<'_>,
|
||||
allocator: *const VkAllocationCallbacks,
|
||||
device: *mut VkDevice,
|
||||
) -> VkResult {
|
||||
write_log("vulkan layer create device");
|
||||
|
||||
VK_SUCCESS
|
||||
}
|
||||
|
||||
extern "system" fn destroy_device(device: VkDevice, allocator: *const VkAllocationCallbacks) {
|
||||
write_log("vulkan layer destroy device");
|
||||
}
|
||||
|
||||
fn write_log(msg: impl ToString) {
|
||||
let mut file = OpenOptions::new()
|
||||
.append(true)
|
||||
.create(true)
|
||||
.open("/home/michael/rf2_vk_hud.log")
|
||||
.unwrap();
|
||||
|
||||
file.write_all(format!("{}\n", msg.to_string()).as_bytes())
|
||||
.unwrap();
|
||||
}
|
168
src/structs.rs
Normal file
168
src/structs.rs
Normal file
|
@ -0,0 +1,168 @@
|
|||
#![allow(non_snake_case)]
|
||||
|
||||
use crate::enums::*;
|
||||
|
||||
use vulkan_sys::prelude::*;
|
||||
|
||||
use std::{
|
||||
mem::{self, ManuallyDrop},
|
||||
os::raw::{c_char, c_void},
|
||||
};
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
pub type PFN_GetPhysicalDeviceProcAddr =
|
||||
extern "system" fn(instance: VkInstance, pName: *const c_char);
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone)]
|
||||
pub struct VkNegotiateLayerInterface {
|
||||
pub sType: VkNegotiateLayerStructType,
|
||||
pub pNext: *mut c_void,
|
||||
pub loaderLayerInterfaceVersion: u32,
|
||||
pub pfnGetInstanceProcAddr: Option<PFN_vkGetInstanceProcAddr>,
|
||||
pub pfnGetDeviceProcAddr: Option<PFN_vkGetDeviceProcAddr>,
|
||||
pub pfnGetPhysicalDeviceProcAddr: Option<PFN_GetPhysicalDeviceProcAddr>,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct VkLayerInstanceInfo {
|
||||
pub instance_info: *mut c_void,
|
||||
pub next_instance_proc_addr: PFN_vkGetInstanceProcAddr,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct VkLayerInstanceLink {
|
||||
pub next: *mut VkLayerInstanceLink,
|
||||
pub next_instance_proc_addr: PFN_vkGetInstanceProcAddr,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct VkLayerDeviceInfo {
|
||||
pub device_info: *mut c_void,
|
||||
pub next_instance_proc_addr: PFN_vkGetInstanceProcAddr,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct VkLayerDeviceLink {
|
||||
pub next: *mut VkLayerDeviceLink,
|
||||
pub next_instance_proc_addr: PFN_vkGetInstanceProcAddr,
|
||||
pub next_device_proc_addr: PFN_vkGetDeviceProcAddr,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub union InstanceLayerInfo {
|
||||
pub layer_info: *const VkLayerInstanceLink,
|
||||
pub instance_info: ManuallyDrop<VkLayerInstanceInfo>,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone)]
|
||||
pub struct VkLayerInstanceCreateInfo {
|
||||
pub sType: VkStructureType,
|
||||
pub next: *const c_void,
|
||||
pub function: VkLayerFunction,
|
||||
pub u: InstanceLayerInfo,
|
||||
}
|
||||
|
||||
impl VkLayerInstanceCreateInfo {
|
||||
pub fn get_chain_info<'a>(
|
||||
create_info: &'a VkInstanceCreateInfo,
|
||||
function: VkLayerFunction,
|
||||
) -> Option<&'a mut Self> {
|
||||
let mut chain_info: Option<&mut VkLayerInstanceCreateInfo> =
|
||||
unsafe { mem::transmute(create_info.pNext) };
|
||||
|
||||
loop {
|
||||
match &chain_info {
|
||||
Some(info) => {
|
||||
if info.sType == VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO
|
||||
&& info.function == function
|
||||
{
|
||||
break;
|
||||
} else {
|
||||
chain_info = unsafe { mem::transmute(info.next) };
|
||||
}
|
||||
}
|
||||
None => break,
|
||||
}
|
||||
}
|
||||
|
||||
chain_info
|
||||
}
|
||||
|
||||
pub fn layer_info(&self) -> &VkLayerInstanceLink {
|
||||
debug_assert!(self.function == VK_LAYER_LINK_INFO);
|
||||
unsafe { &*self.u.layer_info }
|
||||
}
|
||||
|
||||
pub fn advance_layer_info(&mut self) {
|
||||
debug_assert!(self.function == VK_LAYER_LINK_INFO);
|
||||
|
||||
unsafe { self.u.layer_info = (*self.u.layer_info).next }
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for VkLayerInstanceCreateInfo {
|
||||
fn drop(&mut self) {
|
||||
// TODO manually drop self.u.instance_info
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub union DeviceLayerInfo {
|
||||
pub layer_info: *const VkLayerDeviceLink,
|
||||
pub device_info: ManuallyDrop<VkLayerDeviceInfo>,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone)]
|
||||
pub struct VkLayerDeviceCreateInfo {
|
||||
pub sType: VkStructureType,
|
||||
pub next: *const c_void,
|
||||
pub function: VkLayerFunction,
|
||||
pub u: DeviceLayerInfo,
|
||||
}
|
||||
|
||||
impl VkLayerDeviceCreateInfo {
|
||||
pub fn get_chain_info<'a>(
|
||||
create_info: &'a VkDeviceCreateInfo,
|
||||
function: VkLayerFunction,
|
||||
) -> Option<&'a mut Self> {
|
||||
let mut chain_info: Option<&mut VkLayerDeviceCreateInfo> =
|
||||
unsafe { mem::transmute(create_info.pNext) };
|
||||
|
||||
loop {
|
||||
match &chain_info {
|
||||
Some(info) => {
|
||||
if info.sType == VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO
|
||||
&& info.function == function
|
||||
{
|
||||
break;
|
||||
} else {
|
||||
chain_info = unsafe { mem::transmute(info.next) };
|
||||
}
|
||||
}
|
||||
None => break,
|
||||
}
|
||||
}
|
||||
|
||||
chain_info
|
||||
}
|
||||
|
||||
pub fn layer_info(&self) -> &VkLayerDeviceLink {
|
||||
debug_assert!(self.function == VK_LAYER_LINK_INFO);
|
||||
unsafe { &*self.u.layer_info }
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for VkLayerDeviceCreateInfo {
|
||||
fn drop(&mut self) {
|
||||
// TODO manually drop self.u.device_info
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue