Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

Commit

Permalink
fix failure in instance creation on macos
Browse files Browse the repository at this point in the history
  • Loading branch information
hanyangl5 committed Aug 17, 2023
1 parent 62a9205 commit cdb1e4c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/runtime/core/log/Log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ Log::~Log() {
spdlog::drop_all();
}

void Log::CheckVulkanResult(VkResult _res) const noexcept {
void Log::CheckVulkanResult(VkResult _res, const char *function, u32 line) const noexcept {
if (_res != VK_SUCCESS) {
m_logger->error("vulkan result checking failed");
m_logger->error("vulkan result checking failed {}, {} {}", _res, std::string(function), line);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/runtime/core/log/Log.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Log : public PublicSingleton<Log> {
m_logger->error(std::forward<args>(_args)...);
}

void CheckVulkanResult(VkResult _res) const noexcept;
void CheckVulkanResult(VkResult _res, const char* function, u32 line) const noexcept;

private:
std::shared_ptr<spdlog::logger> m_logger;
Expand All @@ -51,5 +51,5 @@ class Log : public PublicSingleton<Log> {

#define LOG_ERROR(...) Log::GetInstance().Error("[" + std::string(__FUNCTION__) + "] " + __VA_ARGS__);

#define CHECK_VK_RESULT(res) Log::GetInstance().CheckVulkanResult(res);
#define CHECK_VK_RESULT(res) Log::GetInstance().CheckVulkanResult(res, __FUNCTION__, __LINE__);
} // namespace Horizon
7 changes: 6 additions & 1 deletion src/runtime/function/rhi/vulkan/Instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ void Instance::createInstance() {
instance_create_info.pApplicationInfo = &appInfo;
instance_create_info.flags = 0;
auto extensions = m_validation_layer.getRequiredExtensions();
instance_create_info.enabledExtensionCount = static_cast<u32>(extensions.size());

#if defined(__APPLE__)
instance_create_info.flags |= VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;
extensions.push_back("VK_KHR_portability_enumeration");
#endif
instance_create_info.enabledExtensionCount = static_cast<u32>(extensions.size());
instance_create_info.ppEnabledExtensionNames = extensions.data();

VkDebugUtilsMessengerCreateInfoEXT debugCreateInfo{};
Expand Down

0 comments on commit cdb1e4c

Please sign in to comment.