ok it works on macos now yay

This commit is contained in:
Mars 2024-09-30 15:25:22 -04:00
parent 329eeb76c7
commit ee96290c80
Signed by untrusted user: pupbrained
GPG key ID: 874E22DF2F9DFCB5
4 changed files with 34 additions and 24 deletions

View file

@ -1,6 +1,7 @@
# This file was generated by nvfetcher, please do not modify it manually. # This file was generated by nvfetcher, please do not modify it manually.
{ fetchgit, fetchurl, fetchFromGitHub, dockerTools }:
{ {
fetchFromGitHub,
}: {
fmt = { fmt = {
pname = "fmt"; pname = "fmt";
version = "11.0.2"; version = "11.0.2";

View file

@ -112,6 +112,10 @@
VULKAN_SDK = "${vulkan-headers}"; VULKAN_SDK = "${vulkan-headers}";
VK_LAYER_PATH = "${vulkan-validation-layers}/share/vulkan/explicit_layer.d"; VK_LAYER_PATH = "${vulkan-validation-layers}/share/vulkan/explicit_layer.d";
VK_ICD_FILENAMES =
if stdenv.isDarwin
then "${darwin.moltenvk}/share/vulkan/icd.d/MoltenVK_icd.json"
else "";
shellHook = '' shellHook = ''
export PATH="${llvmPackages_18.clang-tools.override {enableLibcxx = true;}}/bin:$PATH" export PATH="${llvmPackages_18.clang-tools.override {enableLibcxx = true;}}/bin:$PATH"

View file

@ -101,6 +101,7 @@ class VulkanApp {
// Enable the portability extension and set flags // Enable the portability extension and set flags
extensions.push_back("VK_KHR_portability_enumeration"); extensions.push_back("VK_KHR_portability_enumeration");
extensions.push_back("VK_KHR_get_physical_device_properties2");
vk::InstanceCreateInfo createInfo { vk::InstanceCreateInfo createInfo {
.flags = vk::InstanceCreateFlagBits::eEnumeratePortabilityKHR, .flags = vk::InstanceCreateFlagBits::eEnumeratePortabilityKHR,
@ -145,7 +146,6 @@ class VulkanApp {
fn createSurface() -> void { fn createSurface() -> void {
VkSurfaceKHR surface = nullptr; VkSurfaceKHR surface = nullptr;
// FIXME: This is failing on macOS for some reason
VkResult result = glfwCreateWindowSurface(mInstance.get(), mWindow, nullptr, &surface); VkResult result = glfwCreateWindowSurface(mInstance.get(), mWindow, nullptr, &surface);
if (result != VK_SUCCESS) if (result != VK_SUCCESS)
@ -200,15 +200,19 @@ class VulkanApp {
vk::PhysicalDeviceFeatures deviceFeatures; vk::PhysicalDeviceFeatures deviceFeatures;
// Add the portability subset extension
std::vector<const char*> deviceExtensions = { "VK_KHR_portability_subset" };
vk::DeviceCreateInfo createInfo { .queueCreateInfoCount = static_cast<u32>(queueCreateInfos.size()), vk::DeviceCreateInfo createInfo { .queueCreateInfoCount = static_cast<u32>(queueCreateInfos.size()),
.pQueueCreateInfos = queueCreateInfos.data(), .pQueueCreateInfos = queueCreateInfos.data(),
.enabledExtensionCount = 0, .enabledExtensionCount = static_cast<u32>(deviceExtensions.size()),
.ppEnabledExtensionNames = nullptr, .ppEnabledExtensionNames = deviceExtensions.data(),
.pEnabledFeatures = &deviceFeatures }; .pEnabledFeatures = &deviceFeatures };
mDevice = mPhysicalDevice.createDeviceUnique(createInfo); mDevice = mPhysicalDevice.createDeviceUnique(createInfo);
mGraphicsQueue = mDevice->getQueue(indices.graphics_family.value(), 0); mGraphicsQueue = mDevice->getQueue(indices.graphics_family.value(), 0);
mPresentQueue = mDevice->getQueue(indices.present_family.value(), 0);
} }
fn isDeviceSuitable(vk::PhysicalDevice device) -> bool { fn isDeviceSuitable(vk::PhysicalDevice device) -> bool {

View file

@ -752,26 +752,27 @@ namespace magic_enum {
#define MAGIC_ENUM_FOR_EACH_256(T) \ #define MAGIC_ENUM_FOR_EACH_256(T) \
T(0) \ T(0) \
T(1) \ T(1) \
T(2) T(3) T(4) T(5) T(6) T(7) T(8) T(9) T(10) T(11) T(12) T(13) T(14) T(15) T(16) T(17) T(18) T(19) T(20) \ T(2) \
T(21) T(22) T(23) T(24) T(25) T(26) T(27) T(28) T(29) T(30) T(31) T(32) T(33) T(34) T(35) T(36) T(37) \ T(3) T(4) T(5) T(6) T(7) T(8) T(9) T(10) T(11) T(12) T(13) T(14) T(15) T(16) T(17) T(18) T(19) T(20) T(21) \
T(38) T(39) T(40) T(41) T(42) T(43) T(44) T(45) T(46) T(47) T(48) T(49) T(50) T(51) T(52) T(53) T(54) \ T(22) T(23) T(24) T(25) T(26) T(27) T(28) T(29) T(30) T(31) T(32) T(33) T(34) T(35) T(36) T(37) T(38) \
T(55) T(56) T(57) T(58) T(59) T(60) T(61) T(62) T(63) T(64) T(65) T(66) T(67) T(68) T(69) T(70) \ T(39) T(40) T(41) T(42) T(43) T(44) T(45) T(46) T(47) T(48) T(49) T(50) T(51) T(52) T(53) T(54) T(55) \
T(71) T(72) T(73) T(74) T(75) T(76) T(77) T(78) T(79) T(80) T(81) T(82) T(83) T(84) T(85) T(86) \ T(56) T(57) T(58) T(59) T(60) T(61) T(62) T(63) T(64) T(65) T(66) T(67) T(68) T(69) T(70) T(71) \
T(87) T(88) T(89) T(90) T(91) T(92) T(93) T(94) T(95) T(96) T(97) T(98) T(99) T(100) T(101) \ T(72) T(73) T(74) T(75) T(76) T(77) T(78) T(79) T(80) T(81) T(82) T(83) T(84) T(85) T(86) T(87) \
T(102) T(103) T(104) T(105) T(106) T(107) T(108) T(109) T(110) T(111) T(112) T(113) T(114) \ T(88) T(89) T(90) T(91) T(92) T(93) T(94) T(95) T(96) T(97) T(98) T(99) T(100) T(101) T(102) \
T(115) T(116) T(117) T(118) T(119) T(120) T(121) T(122) T(123) T(124) T(125) T(126) T(127) \ T(103) T(104) T(105) T(106) T(107) T(108) T(109) T(110) T(111) T(112) T(113) T(114) T(115) \
T(128) T(129) T(130) T(131) T(132) T(133) T(134) T(135) T(136) T(137) T(138) T(139) T(140) \ T(116) T(117) T(118) T(119) T(120) T(121) T(122) T(123) T(124) T(125) T(126) T(127) T(128) \
T(141) T(142) T(143) T(144) T(145) T(146) T(147) T(148) T(149) T(150) T(151) T(152) \ T(129) T(130) T(131) T(132) T(133) T(134) T(135) T(136) T(137) T(138) T(139) T(140) T(141) \
T(153) T(154) T(155) T(156) T(157) T(158) T(159) T(160) T(161) T(162) T(163) T(164) \ T(142) T(143) T(144) T(145) T(146) T(147) T(148) T(149) T(150) T(151) T(152) T(153) \
T(165) T(166) T(167) T(168) T(169) T(170) T(171) T(172) T(173) T(174) T(175) T(176) \ T(154) T(155) T(156) T(157) T(158) T(159) T(160) T(161) T(162) T(163) T(164) T(165) \
T(177) T(178) T(179) T(180) T(181) T(182) T(183) T(184) T(185) T(186) T(187) \ T(166) T(167) T(168) T(169) T(170) T(171) T(172) T(173) T(174) T(175) T(176) T(177) \
T(188) T(189) T(190) T(191) T(192) T(193) T(194) T(195) T(196) T(197) T(198) \ T(178) T(179) T(180) T(181) T(182) T(183) T(184) T(185) T(186) T(187) T(188) \
T(199) T(200) T(201) T(202) T(203) T(204) T(205) T(206) T(207) T(208) T(209) \ T(189) T(190) T(191) T(192) T(193) T(194) T(195) T(196) T(197) T(198) T(199) \
T(210) T(211) T(212) T(213) T(214) T(215) T(216) T(217) T(218) T(219) T(220) \ T(200) T(201) T(202) T(203) T(204) T(205) T(206) T(207) T(208) T(209) T(210) \
T(221) T(222) T(223) T(224) T(225) T(226) T(227) T(228) T(229) T(230) \ T(211) T(212) T(213) T(214) T(215) T(216) T(217) T(218) T(219) T(220) T(221) \
T(231) T(232) T(233) T(234) T(235) T(236) T(237) T(238) T(239) T(240) \ T(222) T(223) T(224) T(225) T(226) T(227) T(228) T(229) T(230) T(231) \
T(241) T(242) T(243) T(244) T(245) T(246) T(247) T(248) T(249) T(250) \ T(232) T(233) T(234) T(235) T(236) T(237) T(238) T(239) T(240) T(241) \
T(251) T(252) T(253) T(254) T(255) T(242) T(243) T(244) T(245) T(246) T(247) T(248) T(249) T(250) T(251) \
T(252) T(253) T(254) T(255)
template <typename E, enum_subtype S, std::size_t Size, int Min, std::size_t I> template <typename E, enum_subtype S, std::size_t Size, int Min, std::size_t I>
constexpr void valid_count(bool* valid, std::size_t& count) noexcept { constexpr void valid_count(bool* valid, std::size_t& count) noexcept {