diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f3dbe8..e28c518 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ add_compile_options( -fdiagnostics-color=always -fansi-escape-codes -ferror-limit=1 - -march=native + # -march=native ${BB_IS_CI_C_FLAG} -DCOMPILER_NAME=\"${COMPILER_NAME}\" -DBUILD_DIR=\"${CMAKE_BINARY_DIR}\" -DBB_DIR=\"${BB_DIR}\" ${SHADER_COMPILATION_USE_SOURCE_C_FLAG} ) include_directories("bootstrap/include") @@ -213,10 +213,19 @@ if (NOT BB_IS_CI) set(VOLK_STATIC_DEFINES VK_USE_PLATFORM_XLIB_KHR) target_compile_definitions(${COMPILER_NAME} PRIVATE GLFW_EXPOSE_NATIVE_X11) elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin) - set(VOLK_STATIC_DEFINES VK_USE_PLATFORM_MACOS_MVK) + set(VOLK_STATIC_DEFINES VK_USE_PLATFORM_METAL_EXT) target_compile_definitions(${COMPILER_NAME} PRIVATE GLFW_EXPOSE_NATIVE_COCOA) endif() + if (APPLE) + execute_process( + COMMAND brew --prefix vulkan-headers + OUTPUT_VARIABLE VULKAN_HEADERS_PREFIX + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + include_directories("${VULKAN_HEADERS_PREFIX}/include") + endif() + add_subdirectory(dependencies/volk-1.3.301 volk) target_link_libraries(${COMPILER_NAME} PRIVATE volk) target_sources(${COMPILER_NAME} PRIVATE diff --git a/bootstrap/bloat-buster/bb_core.c b/bootstrap/bloat-buster/bb_core.c index 3de57fa..43be09a 100644 --- a/bootstrap/bloat-buster/bb_core.c +++ b/bootstrap/bloat-buster/bb_core.c @@ -146,6 +146,8 @@ void run_app() strlit("C:/Users/David/Downloads/Fira_Sans/FiraSans-Regular.ttf"); #elif defined(__linux__) strlit("/usr/share/fonts/TTF/FiraSans-Regular.ttf"); +#elif defined(__APPLE__) +strlit("/Users/david/Library/Fonts/FiraSans-Regular.ttf"); #else strlit("WRONG_PATH"); #endif diff --git a/bootstrap/std/render.c b/bootstrap/std/render.c index 909ce1e..961993f 100644 --- a/bootstrap/std/render.c +++ b/bootstrap/std/render.c @@ -840,12 +840,12 @@ Renderer* renderer_initialize(Arena* arena) #ifdef VK_USE_PLATFORM_WAYLAND_KHR VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME, #endif -#ifdef VK_USE_PLATFORM_MACOS_MVK - VK_KHR_COCOA_SURFACE_EXTENSION_NAME, +#ifdef VK_USE_PLATFORM_METAL_EXT + VK_EXT_METAL_SURFACE_EXTENSION_NAME, + VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME, #endif }; - #if BB_DEBUG VkValidationFeatureEnableEXT enabled_validation_features[] = { @@ -855,7 +855,6 @@ Renderer* renderer_initialize(Arena* arena) VkDebugUtilsMessengerCreateInfoEXT msg_ci = { .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT, .pNext = 0, - .flags = 0, .messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT, .messageType = VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_TYPE_DEVICE_ADDRESS_BINDING_BIT_EXT, .pfnUserCallback = debug_callback, @@ -884,12 +883,17 @@ Renderer* renderer_initialize(Arena* arena) }; VkInstanceCreateInfo ci = { .sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, + .pNext = pNext, +#if __APPLE__ + .flags = VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR, +#else + .flags = 0, +#endif .pApplicationInfo = &app_info, .ppEnabledLayerNames = layers, .enabledLayerCount = layer_count, .ppEnabledExtensionNames = extensions, .enabledExtensionCount = array_length(extensions), - .pNext = pNext, }; vkok(vkCreateInstance(&ci, renderer->allocator, &renderer->instance)); @@ -1080,6 +1084,7 @@ Renderer* renderer_initialize(Arena* arena) strlit("bootstrap/shaders/font.vert"), strlit("bootstrap/shaders/font.frag"), }; + PipelineLayoutCreate pipeline_layouts[] = { (PipelineLayoutCreate) { .push_constant_ranges = array_to_slice(((PushConstantRange[]){ diff --git a/project.sh b/project.sh index e5e85be..7c595e8 100755 --- a/project.sh +++ b/project.sh @@ -23,10 +23,9 @@ if [[ -z "${BIRTH_OS-}" ]]; then fi if [[ "$BIRTH_OS" == "macos" ]]; then - MY_HOMEBREW_PREFIX=$(brew --prefix llvm) - C_COMPILER_PATH=$MY_HOMEBREW_PREFIX/bin/clang - CXX_COMPILER_PATH=$MY_HOMEBREW_PREFIX/bin/clang++ - ASM_COMPILER_PATH=$MY_HOMEBREW_PREFIX/bin/clang + VK_LOADER_PREFIX=$(brew --prefix vulkan-loader) + VK_VALIDATION_PREFIX=$(brew --prefix vulkan-validationlayers) + export DYLD_LIBRARY_PATH=$VK_LOADER_PREFIX/lib:$VK_VALIDATION_PREFIX/lib fi if [[ -z "${BIRTH_ARCH-}" ]]; then