icd/dispatch: add init method to extract proc query function
This commit is contained in:
parent
7e6e5dc1b1
commit
d80fff482b
@ -15,7 +15,6 @@ endif ()
|
||||
|
||||
###############################################################################
|
||||
file (MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/icd")
|
||||
include_directories ("${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
|
||||
if (WIN32)
|
||||
@ -48,7 +47,6 @@ DEPENDS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/specs/xml/vk.xml"
|
||||
)
|
||||
|
||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/specs/include/vulkan")
|
||||
|
||||
|
||||
###############################################################################
|
||||
@ -66,12 +64,20 @@ add_library (cruft-vk-icd STATIC
|
||||
icd/fwd.hpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/icd/vtable.hpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/icd/dispatch.cpp
|
||||
icd/dispatch.hpp
|
||||
icd/vendor.hpp
|
||||
icd/vendor.cpp
|
||||
icd/vendor_${VK_LOADER_VENDOR}
|
||||
icd/vtable.cpp
|
||||
)
|
||||
|
||||
target_include_directories (cruft-vk-icd
|
||||
PUBLIC
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/specs/include/vulkan"
|
||||
)
|
||||
|
||||
target_link_libraries (cruft-vk-icd cruft-json cruft)
|
||||
|
||||
###############################################################################
|
||||
@ -135,6 +141,12 @@ list (APPEND sources
|
||||
##-----------------------------------------------------------------------------
|
||||
add_library (cruft-vk STATIC ${sources})
|
||||
target_link_libraries (cruft-vk cruft-vk-icd cruft)
|
||||
target_include_directories (cruft-vk
|
||||
PUBLIC
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/specs/include/vulkan"
|
||||
)
|
||||
|
||||
|
||||
###############################################################################
|
||||
|
7
icd/dispatch.hpp
Normal file
7
icd/dispatch.hpp
Normal file
@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "vendor.hpp"
|
||||
|
||||
namespace cruft::vk::icd {
|
||||
void init (vendor const&);
|
||||
}
|
@ -34,6 +34,8 @@ namespace cruft::vk::icd {
|
||||
VkAllocationCallbacks const*,
|
||||
VkInstance*
|
||||
) noexcept;
|
||||
|
||||
void (*GetInstanceProc) (VkInstance instance, const char* pName) noexcept;
|
||||
} vtable;
|
||||
|
||||
private:
|
||||
|
@ -876,12 +876,25 @@ if __name__ == '__main__':
|
||||
#include "../vk.hpp"
|
||||
#include "vtable.hpp"
|
||||
|
||||
#include "icd/dispatch.hpp"
|
||||
|
||||
#include <cruft/util/debug.hpp>
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
|
||||
static cruft::vk::icd::instance_table const *i_table = nullptr;
|
||||
static cruft::vk::icd::device_table const *d_table = nullptr;
|
||||
|
||||
void (*cruft_vk_icdGetInstanceProcAddr) (
|
||||
VkInstance instance,
|
||||
const char* pName
|
||||
) = nullptr;
|
||||
|
||||
void cruft::vk::icd::init (vendor const &impl)
|
||||
{
|
||||
cruft_vk_icdGetInstanceProcAddr = impl.vtable.GetInstanceProc;
|
||||
}
|
||||
|
||||
""")
|
||||
|
||||
for obj in commands:
|
||||
|
Loading…
Reference in New Issue
Block a user