EQMG / Acid

A high speed C++17 Vulkan game engine
https://equilibrium.games
MIT License
1.72k stars 154 forks source link

Failed to compile on macOS 10.15.3 #92

Closed f32by closed 3 years ago

f32by commented 4 years ago

Describe the bug

1. compiler complains about missing including <unordered_map>.

2. ld: can't map file, errno=22 file '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenAL.framework' for architecture x86_64

To Reproduce

  1. Follow the build instructions in this wiki page
  2. Open Acid.xcodeproj
  3. Build target TestTourial1

Expected behaviour build should succeed

Screenshots No

Hardware:

Additional context I noticed this commit fixes this issue but build still fails :(

mattparks commented 4 years ago

Looks like I just forgot to include in a few spots, and msdf-c inline methods also failed to be found. Also in macOS 10.14+ releases OpenAL soft must be installed. I made those changes here: https://github.com/EQMG/Acid/commit/29320ed3d74af9c7be2703bc3e2362a4d923b157

Fixed to macOS are not complete yet, the upgrade from GLFW 3.3.1 to 3.3.2 has broke glfwCreateWindowSurface, and DPI scaling on macOS displays the engine at the wrong resolution.

f32by commented 4 years ago

Thanks! I tried latest commit from ui branch and now tutorial 1 can run. However only 1/4 window is being rendered. Is it a bug caused by glfw? I tried glfw 3.3.1 but got the same result...


Update: I found some explanations about incorrect viewport from glfw faq (https://www.glfw.org/faq.html). glfw developers recommend to use framebuffer size instead of window size on macOS. After glfw window creation, I called glfwGetFramebufferSize() to overwrite window size with actual framebuffer size. Now it can be rendered correctly:)

--- a/Sources/Devices/Window.cpp
+++ b/Sources/Devices/Window.cpp
@@ -125,6 +125,8 @@ Window::Window() :
                throw std::runtime_error("GLFW failed to create the window");
        }

+       glfwGetFramebufferSize(window, reinterpret_cast<int *>(&size.x), reinterpret_cast<int *>(&size.y));
+
        // Sets the user pointer.
        glfwSetWindowUserPointer(window, this);