Load symbols from files
This commit is contained in:
parent
30dc69d277
commit
4af14c9278
5 changed files with 117 additions and 574 deletions
|
@ -9,5 +9,5 @@ edition = "2021"
|
||||||
crate-type = ["cdylib"]
|
crate-type = ["cdylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
vulkan-sys = { path = "/home/michael/Dokumente/Workspace/Gavania/vulkan-sys" }
|
vulkan-sys = { git = "https://gavania.de/Gavania/Gavania.git", branch = "0.2.0_dev" }
|
||||||
# vulkan_sys = { git = "ssh://gitea@gavania.de:23/Gavania/Gavania.git", branch = "0.2.0_dev" }
|
anyhow = { version = "1.0.68", features = ["backtrace"] }
|
|
@ -1,65 +0,0 @@
|
||||||
use crate::instance_handles::instance_fns;
|
|
||||||
use vulkan_sys::prelude::*;
|
|
||||||
|
|
||||||
static mut DEVICE_FN_HANDLES: Option<VkDeviceHandles> = None;
|
|
||||||
|
|
||||||
pub fn is_device_fns_initialized() -> bool {
|
|
||||||
unsafe { DEVICE_FN_HANDLES.is_some() }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn device_fns() -> &'static VkDeviceHandles {
|
|
||||||
unsafe { DEVICE_FN_HANDLES.as_ref().unwrap() }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn set_device_fns(handles: VkDeviceHandles) {
|
|
||||||
unsafe { DEVICE_FN_HANDLES = Some(handles) };
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct VkDeviceHandles {
|
|
||||||
pub device: VkDevice,
|
|
||||||
|
|
||||||
pub device_functions: DeviceFunctions,
|
|
||||||
pub device_wsi_functions: DeviceWSIFunctions,
|
|
||||||
pub maintenance3_functions: Maintenance3Functions,
|
|
||||||
|
|
||||||
pub acceleration_structure_functions: AccelerationStructureFunctions,
|
|
||||||
pub ray_tracing_pipeline_functions: RayTracingPipelineFunctions,
|
|
||||||
|
|
||||||
pub deferred_operation_functions: DeferredOperationsFunctions,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl VkDeviceHandles {
|
|
||||||
pub fn new(device: VkDevice) -> Self {
|
|
||||||
let instance = &instance_fns().instance_functions;
|
|
||||||
|
|
||||||
Self {
|
|
||||||
device,
|
|
||||||
|
|
||||||
device_functions: DeviceFunctions::new(instance, device),
|
|
||||||
device_wsi_functions: DeviceWSIFunctions::new(instance, device),
|
|
||||||
maintenance3_functions: Maintenance3Functions::new(instance, device),
|
|
||||||
acceleration_structure_functions: AccelerationStructureFunctions::new(instance, device),
|
|
||||||
ray_tracing_pipeline_functions: RayTracingPipelineFunctions::new(instance, device),
|
|
||||||
deferred_operation_functions: DeferredOperationsFunctions::new(instance, device),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! cmp_device_fn {
|
|
||||||
($name:ident, {$([$fns:ident, $fn_name:ident],)*}) => {
|
|
||||||
match $name {
|
|
||||||
$(
|
|
||||||
stringify!($fn_name) => return unsafe {
|
|
||||||
mem::transmute(
|
|
||||||
device_fns()
|
|
||||||
.$fns
|
|
||||||
.$fn_name,
|
|
||||||
)
|
|
||||||
},
|
|
||||||
)*
|
|
||||||
|
|
||||||
_ => ()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,86 +0,0 @@
|
||||||
use vulkan_sys::prelude::*;
|
|
||||||
|
|
||||||
static mut INSTANCE_FN_HANDLES: Option<VkInstanceHandles> = None;
|
|
||||||
|
|
||||||
pub fn is_instance_fns_initialized() -> bool {
|
|
||||||
unsafe { INSTANCE_FN_HANDLES.is_some() }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn instance_fns() -> &'static VkInstanceHandles {
|
|
||||||
unsafe { INSTANCE_FN_HANDLES.as_ref().unwrap() }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn set_instance_fns(handles: VkInstanceHandles) {
|
|
||||||
unsafe { INSTANCE_FN_HANDLES = Some(handles) };
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn replace_device_proc_addr(proc_addr: PFN_vkGetDeviceProcAddr) {
|
|
||||||
unsafe {
|
|
||||||
INSTANCE_FN_HANDLES
|
|
||||||
.as_mut()
|
|
||||||
.unwrap()
|
|
||||||
.instance_functions
|
|
||||||
.vkGetDeviceProcAddr = proc_addr
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct VkInstanceHandles {
|
|
||||||
pub instance: VkInstance,
|
|
||||||
|
|
||||||
pub static_functions: StaticFunctions,
|
|
||||||
pub entry_functions: EntryFunctions,
|
|
||||||
|
|
||||||
pub instance_functions: InstanceFunctions,
|
|
||||||
pub instance_wsi_functions: InstanceWSIFunctions,
|
|
||||||
pub physical_device_properties2_functions: PhysicalDeviceProperties2Functions,
|
|
||||||
pub debug_report_callback_functions: DebugReportCallbackFunctions,
|
|
||||||
pub debug_utils_messenger_functions: DebugUtilsMessengerFunctions,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl VkInstanceHandles {
|
|
||||||
pub fn load_instance(
|
|
||||||
static_functions: StaticFunctions,
|
|
||||||
entry_functions: EntryFunctions,
|
|
||||||
instance: VkInstance,
|
|
||||||
) -> Self {
|
|
||||||
Self {
|
|
||||||
instance_functions: InstanceFunctions::new(&static_functions, instance),
|
|
||||||
instance_wsi_functions: InstanceWSIFunctions::new(&static_functions, instance),
|
|
||||||
physical_device_properties2_functions: PhysicalDeviceProperties2Functions::new(
|
|
||||||
&static_functions,
|
|
||||||
instance,
|
|
||||||
),
|
|
||||||
debug_report_callback_functions: DebugReportCallbackFunctions::new(
|
|
||||||
&static_functions,
|
|
||||||
instance,
|
|
||||||
),
|
|
||||||
debug_utils_messenger_functions: DebugUtilsMessengerFunctions::new(
|
|
||||||
&static_functions,
|
|
||||||
instance,
|
|
||||||
),
|
|
||||||
|
|
||||||
instance,
|
|
||||||
static_functions,
|
|
||||||
entry_functions,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! cmp_instance_fn {
|
|
||||||
($name:ident, {$([$fns:ident, $fn_name:ident],)*}) => {
|
|
||||||
match $name {
|
|
||||||
$(
|
|
||||||
stringify!($fn_name) => return unsafe {
|
|
||||||
mem::transmute(
|
|
||||||
instance_fns()
|
|
||||||
.$fns
|
|
||||||
.$fn_name,
|
|
||||||
)
|
|
||||||
},
|
|
||||||
)*
|
|
||||||
|
|
||||||
_ => ()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
446
src/lib.rs
446
src/lib.rs
|
@ -1,14 +1,9 @@
|
||||||
pub mod enums;
|
pub mod enums;
|
||||||
pub mod structs;
|
pub mod structs;
|
||||||
|
|
||||||
#[macro_use]
|
mod vk_handles;
|
||||||
mod instance_handles;
|
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
mod device_handles;
|
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
ffi::c_void,
|
|
||||||
fs::{File, OpenOptions},
|
fs::{File, OpenOptions},
|
||||||
io::Write,
|
io::Write,
|
||||||
mem,
|
mem,
|
||||||
|
@ -16,10 +11,9 @@ use std::{
|
||||||
ptr,
|
ptr,
|
||||||
};
|
};
|
||||||
|
|
||||||
use device_handles::*;
|
|
||||||
use enums::*;
|
use enums::*;
|
||||||
use instance_handles::*;
|
|
||||||
use structs::*;
|
use structs::*;
|
||||||
|
use vk_handles::*;
|
||||||
use vulkan_sys::prelude::*;
|
use vulkan_sys::prelude::*;
|
||||||
|
|
||||||
const LOG_FILE: &'static str = "/home/michael/rf2_vk_hud.log";
|
const LOG_FILE: &'static str = "/home/michael/rf2_vk_hud.log";
|
||||||
|
@ -46,6 +40,16 @@ pub extern "C" fn vkNegotiateLoaderLayerInterfaceVersion(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
set_vk_handles(
|
||||||
|
VkTypedefHandles::new(&[
|
||||||
|
"vulkan_symbols/vulkan_core_symbols",
|
||||||
|
"vulkan_symbols/vulkan_wayland_symbols",
|
||||||
|
"vulkan_symbols/vulkan_xcb_symbols",
|
||||||
|
"vulkan_symbols/vulkan_xlib_symbols",
|
||||||
|
])
|
||||||
|
.unwrap(),
|
||||||
|
);
|
||||||
|
|
||||||
VK_SUCCESS
|
VK_SUCCESS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,187 +68,6 @@ extern "system" fn get_device_proc_addr(
|
||||||
|
|
||||||
let s = func_string.as_str();
|
let s = func_string.as_str();
|
||||||
|
|
||||||
cmp_instance_fn!(s, {
|
|
||||||
[debug_utils_messenger_functions, vkCreateDebugUtilsMessengerEXT],
|
|
||||||
[debug_utils_messenger_functions, vkDestroyDebugUtilsMessengerEXT],
|
|
||||||
[debug_report_callback_functions, vkCreateDebugReportCallbackEXT],
|
|
||||||
[debug_report_callback_functions, vkDestroyDebugReportCallbackEXT],
|
|
||||||
[instance_functions, vkEnumeratePhysicalDevices],
|
|
||||||
[instance_functions, vkGetPhysicalDeviceFeatures],
|
|
||||||
[instance_functions, vkGetPhysicalDeviceFormatProperties],
|
|
||||||
[instance_functions, vkGetPhysicalDeviceImageFormatProperties],
|
|
||||||
[instance_functions, vkGetPhysicalDeviceProperties],
|
|
||||||
[instance_functions, vkGetPhysicalDeviceQueueFamilyProperties],
|
|
||||||
[instance_functions, vkGetPhysicalDeviceMemoryProperties],
|
|
||||||
[instance_functions, vkEnumerateDeviceExtensionProperties],
|
|
||||||
// [instance_functions, vkEnumerateDeviceLayerProperties],
|
|
||||||
[instance_functions, vkGetPhysicalDeviceSparseImageFormatProperties],
|
|
||||||
// [instance_functions, vkEnumeratePhysicalDeviceGroups],
|
|
||||||
[physical_device_properties2_functions, vkGetPhysicalDeviceFeatures2KHR],
|
|
||||||
[physical_device_properties2_functions, vkGetPhysicalDeviceProperties2KHR],
|
|
||||||
[physical_device_properties2_functions, vkGetPhysicalDeviceFormatProperties2KHR],
|
|
||||||
[physical_device_properties2_functions, vkGetPhysicalDeviceFeatures2KHR],
|
|
||||||
[physical_device_properties2_functions, vkGetPhysicalDeviceFeatures2KHR],
|
|
||||||
[instance_wsi_functions, vkDestroySurfaceKHR],
|
|
||||||
[instance_wsi_functions, vkGetPhysicalDeviceSurfaceSupportKHR],
|
|
||||||
[instance_wsi_functions, vkGetPhysicalDeviceSurfaceCapabilitiesKHR],
|
|
||||||
[instance_wsi_functions, vkGetPhysicalDeviceSurfaceFormatsKHR],
|
|
||||||
[instance_wsi_functions, vkGetPhysicalDeviceSurfacePresentModesKHR],
|
|
||||||
[instance_wsi_functions, vkGetPhysicalDeviceDisplayPropertiesKHR],
|
|
||||||
[instance_wsi_functions, vkGetPhysicalDeviceDisplayPlanePropertiesKHR],
|
|
||||||
[instance_wsi_functions, vkGetDisplayPlaneSupportedDisplaysKHR],
|
|
||||||
[instance_wsi_functions, vkGetDisplayModePropertiesKHR],
|
|
||||||
[instance_wsi_functions, vkCreateDisplayModeKHR],
|
|
||||||
[instance_wsi_functions, vkGetDisplayPlaneCapabilitiesKHR],
|
|
||||||
[instance_wsi_functions, vkCreateDisplayPlaneSurfaceKHR],
|
|
||||||
[instance_wsi_functions, vkCreateXlibSurfaceKHR],
|
|
||||||
[instance_wsi_functions, vkGetPhysicalDeviceXlibPresentationSupportKHR],
|
|
||||||
[instance_wsi_functions, vkCreateXcbSurfaceKHR],
|
|
||||||
[instance_wsi_functions, vkGetPhysicalDeviceXcbPresentationSupportKHR],
|
|
||||||
[instance_wsi_functions, vkCreateWaylandSurfaceKHR],
|
|
||||||
[instance_wsi_functions, vkGetPhysicalDeviceWaylandPresentationSupportKHR],
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
cmp_device_fn!(s, {
|
|
||||||
[device_functions, vkGetDeviceQueue],
|
|
||||||
[device_functions, vkQueueSubmit],
|
|
||||||
[device_functions, vkQueueWaitIdle],
|
|
||||||
[device_functions, vkDeviceWaitIdle],
|
|
||||||
[device_functions, vkAllocateMemory],
|
|
||||||
[device_functions, vkFreeMemory],
|
|
||||||
[device_functions, vkMapMemory],
|
|
||||||
[device_functions, vkUnmapMemory],
|
|
||||||
[device_functions, vkBindBufferMemory],
|
|
||||||
[device_functions, vkBindImageMemory],
|
|
||||||
[device_functions, vkGetBufferMemoryRequirements],
|
|
||||||
[device_functions, vkGetImageMemoryRequirements],
|
|
||||||
[device_functions, vkCreateFence],
|
|
||||||
[device_functions, vkDestroyFence],
|
|
||||||
[device_functions, vkResetFences],
|
|
||||||
[device_functions, vkWaitForFences],
|
|
||||||
[device_functions, vkCreateSemaphore],
|
|
||||||
[device_functions, vkDestroySemaphore],
|
|
||||||
[device_functions, vkCreateEvent],
|
|
||||||
[device_functions, vkDestroyEvent],
|
|
||||||
[device_functions, vkGetEventStatus],
|
|
||||||
[device_functions, vkSetEvent],
|
|
||||||
[device_functions, vkResetEvent],
|
|
||||||
[device_functions, vkCreateBuffer],
|
|
||||||
[device_functions, vkDestroyBuffer],
|
|
||||||
[device_functions, vkCreateBufferView],
|
|
||||||
[device_functions, vkDestroyBufferView],
|
|
||||||
[device_functions, vkCreateImage],
|
|
||||||
[device_functions, vkDestroyImage],
|
|
||||||
[device_functions, vkGetImageSubresourceLayout],
|
|
||||||
[device_functions, vkCreateImageView],
|
|
||||||
[device_functions, vkDestroyImageView],
|
|
||||||
[device_functions, vkCreateShaderModule],
|
|
||||||
[device_functions, vkDestroyShaderModule],
|
|
||||||
[device_functions, vkCreatePipelineCache],
|
|
||||||
[device_functions, vkDestroyPipelineCache],
|
|
||||||
[device_functions, vkGetPipelineCacheData],
|
|
||||||
[device_functions, vkMergePipelineCaches],
|
|
||||||
[device_functions, vkCreateGraphicsPipelines],
|
|
||||||
[device_functions, vkCreateComputePipelines],
|
|
||||||
[device_functions, vkDestroyPipeline],
|
|
||||||
[device_functions, vkCreatePipelineLayout],
|
|
||||||
[device_functions, vkDestroyPipelineLayout],
|
|
||||||
[device_functions, vkCreateSampler],
|
|
||||||
[device_functions, vkDestroySampler],
|
|
||||||
[device_functions, vkCreateDescriptorSetLayout],
|
|
||||||
[device_functions, vkDestroyDescriptorSetLayout],
|
|
||||||
[device_functions, vkCreateDescriptorPool],
|
|
||||||
[device_functions, vkDestroyDescriptorPool],
|
|
||||||
[device_functions, vkResetDescriptorPool],
|
|
||||||
[device_functions, vkAllocateDescriptorSets],
|
|
||||||
[device_functions, vkFreeDescriptorSets],
|
|
||||||
[device_functions, vkUpdateDescriptorSets],
|
|
||||||
[device_functions, vkCreateFramebuffer],
|
|
||||||
[device_functions, vkDestroyFramebuffer],
|
|
||||||
[device_functions, vkCreateRenderPass],
|
|
||||||
[device_functions, vkDestroyRenderPass],
|
|
||||||
[device_functions, vkCreateCommandPool],
|
|
||||||
[device_functions, vkDestroyCommandPool],
|
|
||||||
[device_functions, vkResetCommandPool],
|
|
||||||
[device_functions, vkAllocateCommandBuffers],
|
|
||||||
[device_functions, vkFreeCommandBuffers],
|
|
||||||
[device_functions, vkBeginCommandBuffer],
|
|
||||||
[device_functions, vkEndCommandBuffer],
|
|
||||||
[device_functions, vkResetCommandBuffer],
|
|
||||||
[device_functions, vkCmdBindPipeline],
|
|
||||||
[device_functions, vkCmdSetViewport],
|
|
||||||
[device_functions, vkCmdSetScissor],
|
|
||||||
[device_functions, vkCmdSetLineWidth],
|
|
||||||
[device_functions, vkCmdSetDepthBias],
|
|
||||||
[device_functions, vkCmdSetBlendConstants],
|
|
||||||
[device_functions, vkCmdSetDepthBounds],
|
|
||||||
[device_functions, vkCmdSetStencilCompareMask],
|
|
||||||
[device_functions, vkCmdSetStencilWriteMask],
|
|
||||||
[device_functions, vkCmdSetStencilReference],
|
|
||||||
[device_functions, vkCmdBindDescriptorSets],
|
|
||||||
[device_functions, vkCmdBindIndexBuffer],
|
|
||||||
[device_functions, vkCmdBindVertexBuffers],
|
|
||||||
[device_functions, vkCmdDraw],
|
|
||||||
[device_functions, vkCmdDispatch],
|
|
||||||
[device_functions, vkCmdCopyBuffer],
|
|
||||||
[device_functions, vkCmdCopyImage],
|
|
||||||
[device_functions, vkCmdBlitImage],
|
|
||||||
[device_functions, vkCmdCopyBufferToImage],
|
|
||||||
[device_functions, vkCmdCopyImageToBuffer],
|
|
||||||
[device_functions, vkCmdUpdateBuffer],
|
|
||||||
[device_functions, vkCmdFillBuffer],
|
|
||||||
[device_functions, vkCmdClearColorImage],
|
|
||||||
[device_functions, vkCmdClearDepthStencilImage],
|
|
||||||
[device_functions, vkCmdClearAttachments],
|
|
||||||
[device_functions, vkCmdResolveImage],
|
|
||||||
[device_functions, vkCmdSetEvent],
|
|
||||||
[device_functions, vkCmdResetEvent],
|
|
||||||
[device_functions, vkCmdWaitEvents],
|
|
||||||
[device_functions, vkCmdPipelineBarrier],
|
|
||||||
[device_functions, vkCmdPushConstants],
|
|
||||||
[device_functions, vkCmdBeginRenderPass],
|
|
||||||
[device_functions, vkCmdNextSubpass],
|
|
||||||
[device_functions, vkCmdEndRenderPass],
|
|
||||||
[device_functions, vkCmdExecuteCommands],
|
|
||||||
[device_functions, vkTrimCommandPool],
|
|
||||||
[device_functions, vkGetBufferDeviceAddress],
|
|
||||||
[device_functions, vkGetBufferMemoryRequirements2],
|
|
||||||
[device_functions, vkGetImageMemoryRequirements2],
|
|
||||||
[device_functions, vkBindBufferMemory2],
|
|
||||||
[device_functions, vkBindImageMemory2],
|
|
||||||
[device_wsi_functions, vkCreateSwapchainKHR],
|
|
||||||
[device_wsi_functions, vkDestroySwapchainKHR],
|
|
||||||
[device_wsi_functions, vkAcquireNextImageKHR],
|
|
||||||
[device_wsi_functions, vkQueuePresentKHR],
|
|
||||||
[device_wsi_functions, vkGetSwapchainImagesKHR],
|
|
||||||
[acceleration_structure_functions, vkBuildAccelerationStructuresKHR],
|
|
||||||
[acceleration_structure_functions, vkCmdBuildAccelerationStructuresIndirectKHR],
|
|
||||||
[acceleration_structure_functions, vkCmdBuildAccelerationStructuresKHR],
|
|
||||||
[acceleration_structure_functions, vkCmdCopyAccelerationStructureKHR],
|
|
||||||
[acceleration_structure_functions, vkCmdCopyAccelerationStructureToMemoryKHR],
|
|
||||||
[acceleration_structure_functions, vkCmdCopyMemoryToAccelerationStructureKHR],
|
|
||||||
[acceleration_structure_functions, vkCmdWriteAccelerationStructuresPropertiesKHR],
|
|
||||||
[acceleration_structure_functions, vkCopyAccelerationStructureKHR],
|
|
||||||
[acceleration_structure_functions, vkCopyAccelerationStructureToMemoryKHR],
|
|
||||||
[acceleration_structure_functions, vkCopyMemoryToAccelerationStructureKHR],
|
|
||||||
[acceleration_structure_functions, vkCreateAccelerationStructureKHR],
|
|
||||||
[acceleration_structure_functions, vkDestroyAccelerationStructureKHR],
|
|
||||||
[acceleration_structure_functions, vkGetAccelerationStructureBuildSizesKHR],
|
|
||||||
[acceleration_structure_functions, vkGetAccelerationStructureDeviceAddressKHR],
|
|
||||||
[acceleration_structure_functions, vkGetDeviceAccelerationStructureCompatibilityKHR],
|
|
||||||
[acceleration_structure_functions, vkWriteAccelerationStructuresPropertiesKHR],
|
|
||||||
[ray_tracing_pipeline_functions, vkCmdSetRayTracingPipelineStackSizeKHR],
|
|
||||||
[ray_tracing_pipeline_functions, vkCmdTraceRaysIndirectKHR],
|
|
||||||
[ray_tracing_pipeline_functions, vkCmdTraceRaysKHR],
|
|
||||||
[ray_tracing_pipeline_functions, vkCreateRayTracingPipelinesKHR],
|
|
||||||
[ray_tracing_pipeline_functions, vkGetRayTracingCaptureReplayShaderGroupHandlesKHR],
|
|
||||||
[ray_tracing_pipeline_functions, vkGetRayTracingShaderGroupHandlesKHR],
|
|
||||||
[ray_tracing_pipeline_functions, vkGetRayTracingShaderGroupStackSizeKHR],
|
|
||||||
[maintenance3_functions, vkGetDescriptorSetLayoutSupport],
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
match s {
|
match s {
|
||||||
"vkCreateDevice" => return Functions::CreateDevice(create_device).convert(),
|
"vkCreateDevice" => return Functions::CreateDevice(create_device).convert(),
|
||||||
"vkDestroyDevice" => return Functions::DestroyDevice(destroy_device).convert(),
|
"vkDestroyDevice" => return Functions::DestroyDevice(destroy_device).convert(),
|
||||||
|
@ -254,18 +77,6 @@ extern "system" fn get_device_proc_addr(
|
||||||
_ => (),
|
_ => (),
|
||||||
};
|
};
|
||||||
|
|
||||||
unsafe {
|
|
||||||
if is_device_fns_initialized() {
|
|
||||||
let device_fn = instance_fns()
|
|
||||||
.instance_functions
|
|
||||||
.vkGetDeviceProcAddr(device_fns().device, func_string.as_ptr());
|
|
||||||
|
|
||||||
if mem::transmute::<PFN_vkVoidFunction, *const c_void>(device_fn) != ptr::null() {
|
|
||||||
return device_fn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
write_log(format!("\trequested fn: {} in device proc addr", s));
|
write_log(format!("\trequested fn: {} in device proc addr", s));
|
||||||
write_log(format!("\t-> not found"));
|
write_log(format!("\t-> not found"));
|
||||||
Functions::Null.convert()
|
Functions::Null.convert()
|
||||||
|
@ -286,187 +97,6 @@ extern "system" fn get_instance_proc_addr(
|
||||||
|
|
||||||
let s = func_string.as_str();
|
let s = func_string.as_str();
|
||||||
|
|
||||||
cmp_instance_fn!(s, {
|
|
||||||
[debug_utils_messenger_functions, vkCreateDebugUtilsMessengerEXT],
|
|
||||||
[debug_utils_messenger_functions, vkDestroyDebugUtilsMessengerEXT],
|
|
||||||
[debug_report_callback_functions, vkCreateDebugReportCallbackEXT],
|
|
||||||
[debug_report_callback_functions, vkDestroyDebugReportCallbackEXT],
|
|
||||||
[instance_functions, vkEnumeratePhysicalDevices],
|
|
||||||
[instance_functions, vkGetPhysicalDeviceFeatures],
|
|
||||||
[instance_functions, vkGetPhysicalDeviceFormatProperties],
|
|
||||||
[instance_functions, vkGetPhysicalDeviceImageFormatProperties],
|
|
||||||
[instance_functions, vkGetPhysicalDeviceProperties],
|
|
||||||
[instance_functions, vkGetPhysicalDeviceQueueFamilyProperties],
|
|
||||||
[instance_functions, vkGetPhysicalDeviceMemoryProperties],
|
|
||||||
[instance_functions, vkEnumerateDeviceExtensionProperties],
|
|
||||||
// [instance_functions, vkEnumerateDeviceLayerProperties],
|
|
||||||
[instance_functions, vkGetPhysicalDeviceSparseImageFormatProperties],
|
|
||||||
// [instance_functions, vkEnumeratePhysicalDeviceGroups],
|
|
||||||
[physical_device_properties2_functions, vkGetPhysicalDeviceFeatures2KHR],
|
|
||||||
[physical_device_properties2_functions, vkGetPhysicalDeviceProperties2KHR],
|
|
||||||
[physical_device_properties2_functions, vkGetPhysicalDeviceFormatProperties2KHR],
|
|
||||||
[physical_device_properties2_functions, vkGetPhysicalDeviceFeatures2KHR],
|
|
||||||
[physical_device_properties2_functions, vkGetPhysicalDeviceFeatures2KHR],
|
|
||||||
[instance_wsi_functions, vkDestroySurfaceKHR],
|
|
||||||
[instance_wsi_functions, vkGetPhysicalDeviceSurfaceSupportKHR],
|
|
||||||
[instance_wsi_functions, vkGetPhysicalDeviceSurfaceCapabilitiesKHR],
|
|
||||||
[instance_wsi_functions, vkGetPhysicalDeviceSurfaceFormatsKHR],
|
|
||||||
[instance_wsi_functions, vkGetPhysicalDeviceSurfacePresentModesKHR],
|
|
||||||
[instance_wsi_functions, vkGetPhysicalDeviceDisplayPropertiesKHR],
|
|
||||||
[instance_wsi_functions, vkGetPhysicalDeviceDisplayPlanePropertiesKHR],
|
|
||||||
[instance_wsi_functions, vkGetDisplayPlaneSupportedDisplaysKHR],
|
|
||||||
[instance_wsi_functions, vkGetDisplayModePropertiesKHR],
|
|
||||||
[instance_wsi_functions, vkCreateDisplayModeKHR],
|
|
||||||
[instance_wsi_functions, vkGetDisplayPlaneCapabilitiesKHR],
|
|
||||||
[instance_wsi_functions, vkCreateDisplayPlaneSurfaceKHR],
|
|
||||||
[instance_wsi_functions, vkCreateXlibSurfaceKHR],
|
|
||||||
[instance_wsi_functions, vkGetPhysicalDeviceXlibPresentationSupportKHR],
|
|
||||||
[instance_wsi_functions, vkCreateXcbSurfaceKHR],
|
|
||||||
[instance_wsi_functions, vkGetPhysicalDeviceXcbPresentationSupportKHR],
|
|
||||||
[instance_wsi_functions, vkCreateWaylandSurfaceKHR],
|
|
||||||
[instance_wsi_functions, vkGetPhysicalDeviceWaylandPresentationSupportKHR],
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
cmp_device_fn!(s, {
|
|
||||||
[device_functions, vkGetDeviceQueue],
|
|
||||||
[device_functions, vkQueueSubmit],
|
|
||||||
[device_functions, vkQueueWaitIdle],
|
|
||||||
[device_functions, vkDeviceWaitIdle],
|
|
||||||
[device_functions, vkAllocateMemory],
|
|
||||||
[device_functions, vkFreeMemory],
|
|
||||||
[device_functions, vkMapMemory],
|
|
||||||
[device_functions, vkUnmapMemory],
|
|
||||||
[device_functions, vkBindBufferMemory],
|
|
||||||
[device_functions, vkBindImageMemory],
|
|
||||||
[device_functions, vkGetBufferMemoryRequirements],
|
|
||||||
[device_functions, vkGetImageMemoryRequirements],
|
|
||||||
[device_functions, vkCreateFence],
|
|
||||||
[device_functions, vkDestroyFence],
|
|
||||||
[device_functions, vkResetFences],
|
|
||||||
[device_functions, vkWaitForFences],
|
|
||||||
[device_functions, vkCreateSemaphore],
|
|
||||||
[device_functions, vkDestroySemaphore],
|
|
||||||
[device_functions, vkCreateEvent],
|
|
||||||
[device_functions, vkDestroyEvent],
|
|
||||||
[device_functions, vkGetEventStatus],
|
|
||||||
[device_functions, vkSetEvent],
|
|
||||||
[device_functions, vkResetEvent],
|
|
||||||
[device_functions, vkCreateBuffer],
|
|
||||||
[device_functions, vkDestroyBuffer],
|
|
||||||
[device_functions, vkCreateBufferView],
|
|
||||||
[device_functions, vkDestroyBufferView],
|
|
||||||
[device_functions, vkCreateImage],
|
|
||||||
[device_functions, vkDestroyImage],
|
|
||||||
[device_functions, vkGetImageSubresourceLayout],
|
|
||||||
[device_functions, vkCreateImageView],
|
|
||||||
[device_functions, vkDestroyImageView],
|
|
||||||
[device_functions, vkCreateShaderModule],
|
|
||||||
[device_functions, vkDestroyShaderModule],
|
|
||||||
[device_functions, vkCreatePipelineCache],
|
|
||||||
[device_functions, vkDestroyPipelineCache],
|
|
||||||
[device_functions, vkGetPipelineCacheData],
|
|
||||||
[device_functions, vkMergePipelineCaches],
|
|
||||||
[device_functions, vkCreateGraphicsPipelines],
|
|
||||||
[device_functions, vkCreateComputePipelines],
|
|
||||||
[device_functions, vkDestroyPipeline],
|
|
||||||
[device_functions, vkCreatePipelineLayout],
|
|
||||||
[device_functions, vkDestroyPipelineLayout],
|
|
||||||
[device_functions, vkCreateSampler],
|
|
||||||
[device_functions, vkDestroySampler],
|
|
||||||
[device_functions, vkCreateDescriptorSetLayout],
|
|
||||||
[device_functions, vkDestroyDescriptorSetLayout],
|
|
||||||
[device_functions, vkCreateDescriptorPool],
|
|
||||||
[device_functions, vkDestroyDescriptorPool],
|
|
||||||
[device_functions, vkResetDescriptorPool],
|
|
||||||
[device_functions, vkAllocateDescriptorSets],
|
|
||||||
[device_functions, vkFreeDescriptorSets],
|
|
||||||
[device_functions, vkUpdateDescriptorSets],
|
|
||||||
[device_functions, vkCreateFramebuffer],
|
|
||||||
[device_functions, vkDestroyFramebuffer],
|
|
||||||
[device_functions, vkCreateRenderPass],
|
|
||||||
[device_functions, vkDestroyRenderPass],
|
|
||||||
[device_functions, vkCreateCommandPool],
|
|
||||||
[device_functions, vkDestroyCommandPool],
|
|
||||||
[device_functions, vkResetCommandPool],
|
|
||||||
[device_functions, vkAllocateCommandBuffers],
|
|
||||||
[device_functions, vkFreeCommandBuffers],
|
|
||||||
[device_functions, vkBeginCommandBuffer],
|
|
||||||
[device_functions, vkEndCommandBuffer],
|
|
||||||
[device_functions, vkResetCommandBuffer],
|
|
||||||
[device_functions, vkCmdBindPipeline],
|
|
||||||
[device_functions, vkCmdSetViewport],
|
|
||||||
[device_functions, vkCmdSetScissor],
|
|
||||||
[device_functions, vkCmdSetLineWidth],
|
|
||||||
[device_functions, vkCmdSetDepthBias],
|
|
||||||
[device_functions, vkCmdSetBlendConstants],
|
|
||||||
[device_functions, vkCmdSetDepthBounds],
|
|
||||||
[device_functions, vkCmdSetStencilCompareMask],
|
|
||||||
[device_functions, vkCmdSetStencilWriteMask],
|
|
||||||
[device_functions, vkCmdSetStencilReference],
|
|
||||||
[device_functions, vkCmdBindDescriptorSets],
|
|
||||||
[device_functions, vkCmdBindIndexBuffer],
|
|
||||||
[device_functions, vkCmdBindVertexBuffers],
|
|
||||||
[device_functions, vkCmdDraw],
|
|
||||||
[device_functions, vkCmdDispatch],
|
|
||||||
[device_functions, vkCmdCopyBuffer],
|
|
||||||
[device_functions, vkCmdCopyImage],
|
|
||||||
[device_functions, vkCmdBlitImage],
|
|
||||||
[device_functions, vkCmdCopyBufferToImage],
|
|
||||||
[device_functions, vkCmdCopyImageToBuffer],
|
|
||||||
[device_functions, vkCmdUpdateBuffer],
|
|
||||||
[device_functions, vkCmdFillBuffer],
|
|
||||||
[device_functions, vkCmdClearColorImage],
|
|
||||||
[device_functions, vkCmdClearDepthStencilImage],
|
|
||||||
[device_functions, vkCmdClearAttachments],
|
|
||||||
[device_functions, vkCmdResolveImage],
|
|
||||||
[device_functions, vkCmdSetEvent],
|
|
||||||
[device_functions, vkCmdResetEvent],
|
|
||||||
[device_functions, vkCmdWaitEvents],
|
|
||||||
[device_functions, vkCmdPipelineBarrier],
|
|
||||||
[device_functions, vkCmdPushConstants],
|
|
||||||
[device_functions, vkCmdBeginRenderPass],
|
|
||||||
[device_functions, vkCmdNextSubpass],
|
|
||||||
[device_functions, vkCmdEndRenderPass],
|
|
||||||
[device_functions, vkCmdExecuteCommands],
|
|
||||||
[device_functions, vkTrimCommandPool],
|
|
||||||
[device_functions, vkGetBufferDeviceAddress],
|
|
||||||
[device_functions, vkGetBufferMemoryRequirements2],
|
|
||||||
[device_functions, vkGetImageMemoryRequirements2],
|
|
||||||
[device_functions, vkBindBufferMemory2],
|
|
||||||
[device_functions, vkBindImageMemory2],
|
|
||||||
[device_wsi_functions, vkCreateSwapchainKHR],
|
|
||||||
[device_wsi_functions, vkDestroySwapchainKHR],
|
|
||||||
[device_wsi_functions, vkAcquireNextImageKHR],
|
|
||||||
[device_wsi_functions, vkQueuePresentKHR],
|
|
||||||
[device_wsi_functions, vkGetSwapchainImagesKHR],
|
|
||||||
[acceleration_structure_functions, vkBuildAccelerationStructuresKHR],
|
|
||||||
[acceleration_structure_functions, vkCmdBuildAccelerationStructuresIndirectKHR],
|
|
||||||
[acceleration_structure_functions, vkCmdBuildAccelerationStructuresKHR],
|
|
||||||
[acceleration_structure_functions, vkCmdCopyAccelerationStructureKHR],
|
|
||||||
[acceleration_structure_functions, vkCmdCopyAccelerationStructureToMemoryKHR],
|
|
||||||
[acceleration_structure_functions, vkCmdCopyMemoryToAccelerationStructureKHR],
|
|
||||||
[acceleration_structure_functions, vkCmdWriteAccelerationStructuresPropertiesKHR],
|
|
||||||
[acceleration_structure_functions, vkCopyAccelerationStructureKHR],
|
|
||||||
[acceleration_structure_functions, vkCopyAccelerationStructureToMemoryKHR],
|
|
||||||
[acceleration_structure_functions, vkCopyMemoryToAccelerationStructureKHR],
|
|
||||||
[acceleration_structure_functions, vkCreateAccelerationStructureKHR],
|
|
||||||
[acceleration_structure_functions, vkDestroyAccelerationStructureKHR],
|
|
||||||
[acceleration_structure_functions, vkGetAccelerationStructureBuildSizesKHR],
|
|
||||||
[acceleration_structure_functions, vkGetAccelerationStructureDeviceAddressKHR],
|
|
||||||
[acceleration_structure_functions, vkGetDeviceAccelerationStructureCompatibilityKHR],
|
|
||||||
[acceleration_structure_functions, vkWriteAccelerationStructuresPropertiesKHR],
|
|
||||||
[ray_tracing_pipeline_functions, vkCmdSetRayTracingPipelineStackSizeKHR],
|
|
||||||
[ray_tracing_pipeline_functions, vkCmdTraceRaysIndirectKHR],
|
|
||||||
[ray_tracing_pipeline_functions, vkCmdTraceRaysKHR],
|
|
||||||
[ray_tracing_pipeline_functions, vkCreateRayTracingPipelinesKHR],
|
|
||||||
[ray_tracing_pipeline_functions, vkGetRayTracingCaptureReplayShaderGroupHandlesKHR],
|
|
||||||
[ray_tracing_pipeline_functions, vkGetRayTracingShaderGroupHandlesKHR],
|
|
||||||
[ray_tracing_pipeline_functions, vkGetRayTracingShaderGroupStackSizeKHR],
|
|
||||||
[maintenance3_functions, vkGetDescriptorSetLayoutSupport],
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
match s {
|
match s {
|
||||||
"vkCreateDevice" => return Functions::CreateDevice(create_device).convert(),
|
"vkCreateDevice" => return Functions::CreateDevice(create_device).convert(),
|
||||||
"vkDestroyDevice" => return Functions::DestroyDevice(destroy_device).convert(),
|
"vkDestroyDevice" => return Functions::DestroyDevice(destroy_device).convert(),
|
||||||
|
@ -476,16 +106,6 @@ extern "system" fn get_instance_proc_addr(
|
||||||
_ => (),
|
_ => (),
|
||||||
};
|
};
|
||||||
|
|
||||||
unsafe {
|
|
||||||
let instance_fn = instance_fns()
|
|
||||||
.static_functions
|
|
||||||
.vkGetInstanceProcAddr(instance_fns().instance, func_string.as_ptr());
|
|
||||||
|
|
||||||
if mem::transmute::<PFN_vkVoidFunction, *const c_void>(instance_fn) != ptr::null() {
|
|
||||||
return instance_fn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
write_log(format!("\trequested fn: {} in instance proc addr", s));
|
write_log(format!("\trequested fn: {} in instance proc addr", s));
|
||||||
write_log(format!("\t-> not found"));
|
write_log(format!("\t-> not found"));
|
||||||
Functions::Null.convert()
|
Functions::Null.convert()
|
||||||
|
@ -510,24 +130,20 @@ extern "system" fn create_instance(
|
||||||
};
|
};
|
||||||
|
|
||||||
let proc_addr = chain_info.layer_info().next_instance_proc_addr;
|
let proc_addr = chain_info.layer_info().next_instance_proc_addr;
|
||||||
|
let create_instance: PFN_vkCreateInstance = unsafe {
|
||||||
let static_functions = StaticFunctions {
|
mem::transmute(proc_addr(
|
||||||
_lib: None,
|
VkInstance::NULL_HANDLE,
|
||||||
vkGetInstanceProcAddr: proc_addr,
|
VkString::new("vkCreateInstance").as_ptr(),
|
||||||
|
))
|
||||||
};
|
};
|
||||||
let entry_functions = EntryFunctions::new(&static_functions);
|
|
||||||
|
|
||||||
chain_info.advance_layer_info();
|
chain_info.advance_layer_info();
|
||||||
let result = unsafe { entry_functions.vkCreateInstance(create_info, allocator, instance) };
|
let result = create_instance(create_info, allocator, instance);
|
||||||
if result != VK_SUCCESS {
|
if result != VK_SUCCESS {
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
set_instance_fns(VkInstanceHandles::load_instance(
|
vk_handles_mut().load_instance_functions(unsafe { *instance }, proc_addr);
|
||||||
static_functions,
|
|
||||||
entry_functions,
|
|
||||||
unsafe { *instance },
|
|
||||||
));
|
|
||||||
|
|
||||||
write_log("-> successfully created instance.");
|
write_log("-> successfully created instance.");
|
||||||
|
|
||||||
|
@ -536,12 +152,6 @@ extern "system" fn create_instance(
|
||||||
|
|
||||||
extern "system" fn destroy_instance(instance: VkInstance, allocator: *const VkAllocationCallbacks) {
|
extern "system" fn destroy_instance(instance: VkInstance, allocator: *const VkAllocationCallbacks) {
|
||||||
write_log(" ================== vulkan layer destroy instance ==================");
|
write_log(" ================== vulkan layer destroy instance ==================");
|
||||||
|
|
||||||
unsafe {
|
|
||||||
instance_fns()
|
|
||||||
.instance_functions
|
|
||||||
.vkDestroyInstance(instance, allocator)
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "system" fn create_device(
|
extern "system" fn create_device(
|
||||||
|
@ -562,34 +172,28 @@ extern "system" fn create_device(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
replace_device_proc_addr(chain_info.layer_info().next_device_proc_addr);
|
let proc_addr = chain_info.layer_info().next_device_proc_addr;
|
||||||
let instance = instance_fns();
|
|
||||||
|
|
||||||
chain_info.advance_layer_info();
|
chain_info.advance_layer_info();
|
||||||
|
|
||||||
let result = unsafe {
|
let result = unsafe {
|
||||||
instance
|
let create_device: PFN_vkCreateDevice =
|
||||||
.instance_functions
|
mem::transmute(vk_handles().handle("vkCreateDevice").unwrap());
|
||||||
.vkCreateDevice(physical_device, create_info, allocator, device)
|
|
||||||
|
create_device(physical_device, create_info, allocator, device)
|
||||||
};
|
};
|
||||||
|
|
||||||
if result != VK_SUCCESS {
|
if result != VK_SUCCESS {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_device_fns(VkDeviceHandles::new(unsafe { *device }));
|
vk_handles_mut().load_device_functions(unsafe { *device }, proc_addr);
|
||||||
|
|
||||||
VK_SUCCESS
|
VK_SUCCESS
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "system" fn destroy_device(device: VkDevice, allocator: *const VkAllocationCallbacks) {
|
extern "system" fn destroy_device(device: VkDevice, allocator: *const VkAllocationCallbacks) {
|
||||||
write_log(" ================== vulkan layer destroy device ==================");
|
write_log(" ================== vulkan layer destroy device ==================");
|
||||||
|
|
||||||
unsafe {
|
|
||||||
device_fns()
|
|
||||||
.device_functions
|
|
||||||
.vkDestroyDevice(device, allocator)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_log(msg: impl ToString) {
|
fn write_log(msg: impl ToString) {
|
||||||
|
|
90
src/vk_handles.rs
Normal file
90
src/vk_handles.rs
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
use anyhow::Result;
|
||||||
|
use std::{collections::HashMap, ffi::c_void, fs, mem, path::Path, ptr};
|
||||||
|
use vulkan_sys::prelude::*;
|
||||||
|
|
||||||
|
static mut FN_HANDLES: Option<VkTypedefHandles> = None;
|
||||||
|
|
||||||
|
pub fn vk_handles() -> &'static VkTypedefHandles {
|
||||||
|
unsafe { FN_HANDLES.as_ref().unwrap() }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn vk_handles_mut() -> &'static mut VkTypedefHandles {
|
||||||
|
unsafe { FN_HANDLES.as_mut().unwrap() }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_vk_handles(handles: VkTypedefHandles) {
|
||||||
|
unsafe { FN_HANDLES = Some(handles) };
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct VkTypedefHandles {
|
||||||
|
typedefs: Vec<String>,
|
||||||
|
functions: HashMap<String, PFN_vkVoidFunction>,
|
||||||
|
instance: VkInstance,
|
||||||
|
device: VkDevice,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl VkTypedefHandles {
|
||||||
|
pub fn new(symbol_files: &[impl AsRef<Path>]) -> Result<Self> {
|
||||||
|
let mut symbols = Vec::new();
|
||||||
|
|
||||||
|
for symbol_file in symbol_files {
|
||||||
|
let s = fs::read_to_string(symbol_file)?;
|
||||||
|
|
||||||
|
symbols.append(&mut s.lines().map(|s| s.to_string()).collect());
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(Self {
|
||||||
|
typedefs: symbols,
|
||||||
|
functions: HashMap::new(),
|
||||||
|
|
||||||
|
instance: VkInstance::NULL_HANDLE,
|
||||||
|
device: VkDevice::NULL_HANDLE,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn load_instance_functions(
|
||||||
|
&mut self,
|
||||||
|
instance: VkInstance,
|
||||||
|
proc_addr: PFN_vkGetInstanceProcAddr,
|
||||||
|
) {
|
||||||
|
self.instance = instance;
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
for symbol in &self.typedefs {
|
||||||
|
let name = VkString::new(symbol);
|
||||||
|
let function = proc_addr(instance, name.as_ptr());
|
||||||
|
|
||||||
|
if mem::transmute::<PFN_vkVoidFunction, *const c_void>(function) != ptr::null() {
|
||||||
|
self.functions.insert(symbol.clone(), function);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn load_device_functions(&mut self, device: VkDevice, proc_addr: PFN_vkGetDeviceProcAddr) {
|
||||||
|
self.device = device;
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
for symbol in &self.typedefs {
|
||||||
|
let name = VkString::new(symbol);
|
||||||
|
let function = proc_addr(device, name.as_ptr());
|
||||||
|
|
||||||
|
if mem::transmute::<PFN_vkVoidFunction, *const c_void>(function) != ptr::null() {
|
||||||
|
self.functions.insert(symbol.clone(), function);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn handle(&self, symbol_name: impl ToString) -> Option<PFN_vkVoidFunction> {
|
||||||
|
self.functions.get(&symbol_name.to_string()).cloned()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn instance(&self) -> VkInstance {
|
||||||
|
self.instance
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn device(&self) -> VkDevice {
|
||||||
|
self.device
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue