2018-08-24 17:33:09 +10:00
|
|
|
#include "vendor.hpp"
|
|
|
|
|
|
|
|
#include <cruft/json/tree.hpp>
|
|
|
|
|
|
|
|
using cruft::vk::icd::vendor;
|
|
|
|
|
|
|
|
|
2019-01-05 23:30:52 +11:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2018-08-24 17:33:09 +10:00
|
|
|
template <>
|
|
|
|
cruft::vk::icd::icd_t
|
|
|
|
json::tree::io<cruft::vk::icd::icd_t>::deserialise (json::tree::node const &obj)
|
|
|
|
{
|
|
|
|
return {
|
2018-09-08 12:31:43 +10:00
|
|
|
.file_format_version = obj["file_format_version"].as_string (),
|
2018-08-24 17:33:09 +10:00
|
|
|
.icd = {
|
|
|
|
.library_path = obj["ICD"]["library_path"].as_string ().native (),
|
|
|
|
.api_version = obj["ICD"]["api_version"].as_string (),
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-01-05 23:30:52 +11:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
cruft::vk::icd::global_table const *cruft::vk::icd::g_table;
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-08-24 17:33:09 +10:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
vendor::vendor (icd_t const &_icd):
|
|
|
|
vendor (cruft::library (_icd.icd.library_path))
|
|
|
|
{ ; }
|
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
vendor::vendor (::cruft::library &&_library)
|
|
|
|
: m_library (std::move (_library))
|
2019-01-05 23:30:52 +11:00
|
|
|
, m_get_proc (
|
|
|
|
m_library.symbol<decltype(m_get_proc)> ("vk_icdGetInstanceProcAddr")
|
|
|
|
)
|
2018-08-24 17:33:09 +10:00
|
|
|
{
|
2019-01-05 23:30:52 +11:00
|
|
|
#define LOADFN(name) \
|
|
|
|
vtable.name = reinterpret_cast< \
|
|
|
|
decltype(vtable.name) \
|
|
|
|
> ( \
|
|
|
|
m_get_proc(nullptr, #name) \
|
|
|
|
);
|
|
|
|
|
|
|
|
MAP_INSTANCE_COMMANDS (LOADFN)
|
|
|
|
}
|