Giter VIP home page Giter VIP logo

Comments (16)

ad184hl avatar ad184hl commented on May 26, 2024 2

Ah, Great! I finally got it to work!
Thanks @rbnpontes for the step by step debugging.

Summary Instruction for Mac M2 Chip:

  1. Switch to diligent branch;
  2. Comment out (or delete) the whole file Source/ThirdParty/crunch/CMakeList.txt file to disable crnlib;
  3. Use the following cmake config:
      cmake -G Xcode -T buildsystem=1  \
        -S. -Bcmake-build-macos    \
        -DCMAKE_BUILD_TYPE=Release \
        -DURHO3D_SAMPLES=ON -DCMAKE_OSX_ARCHITECTURES=arm64 \
        -DURHO3D_GLOW=OFF -DURHO3D_SSE=OFF \
        -DURHO3D_TOOL=OFF\
    
  4. Build with cmake --build cmake-build-macos.

However, I found there are some rendering issues by quickly browsing through the samples.
Probably it's better to start another thread, but I'll attach my screen record video here to make it more clearer.
Video Link

Generally, rendering for terrains/cars/water has some issue; Physics scene has som glitch when rotating camera; Physics stress test and some other scenes could not render completely; The cube did not render for the Ragdoll sample, etc.
I'll probably take a deeper look in several weeks when I have time, so I can setup some sample project with more error log printing to identify the issue. But let me know if you need to test with M2 chips sometime.

from rbfx.

rbnpontes avatar rbnpontes commented on May 26, 2024

We don't had tested on Mac M2, and the new macOS has some issues that we need to fix like SSE.
Try to use this argument on cmake: -DCMAKE_OSX_ARCHITECTURES=arm64 -DURHO3D_GLOW=OFF -DURHO3D_SSE=OFF

from rbfx.

ad184hl avatar ad184hl commented on May 26, 2024

Unfortunately, still not working, thanks though since this repo is being updated frequently.

We don't had tested on Mac M2, and the new macOS has some issues that we need to fix like SSE.
Try to use this argument on cmake: -DCMAKE_OSX_ARCHITECTURES=arm64 -DURHO3D_GLOW=OFF -DURHO3D_SSE=OFF

from rbfx.

rbnpontes avatar rbnpontes commented on May 26, 2024

Does the error still persist or has the error changed?

from rbfx.

ad184hl avatar ad184hl commented on May 26, 2024

Does the error still persist or has the error changed?

still persist, the same error, with some sample context:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -ivfsstatcache /var/folders/hb/z303fv6x1cg0r1v9ltfvqh0h0000gp/C/com.apple.DeveloperTools/14.3-14E222b/Xcode/SDKStatCaches.noindex/macosx13.3-22E245-.sdkstatcache -target arm64-apple-macos13.3 -fmessage-length\=179 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -fcolor-diagnostics -Wno-trigraphs -fpascal-strings -O3 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -Wno-implicit-fallthrough -DCMAKE_INTDIR\=\"Debug\" -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -g -Wno-sign-conversion -Wno-infinite-recursion -Wno-move -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-range-loop-analysis -Wno-semicolon-before-method-body -I/Users/xxx/git_folder/rbfx/cmake-build-macos/lib/Debug/include -isystem /Users/xxx/git_folder/rbfx/Source/ThirdParty/crunch/include -isystem /Users/xxx/git_folder/rbfx/Source/ThirdParty/crunch/include/crunch -isystem /Users/xxx/git_folder/rbfx/Source/ThirdParty/crunch/crnlib -I/Users/xxx/git_folder/rbfx/cmake-build-macos/build/crnlib.build/Debug/DerivedSources-normal/arm64 -I/Users/xxx/git_folder/rbfx/cmake-build-macos/build/crnlib.build/Debug/DerivedSources/arm64 -I/Users/xxx/git_folder/rbfx/cmake-build-macos/build/crnlib.build/Debug/DerivedSources -F/Users/xxx/git_folder/rbfx/cmake-build-macos/lib/Debug -mcpu\=apple-m1 -arch arm64 -march\=armv8-a -w -std\=gnu++17 -fPIC -fomit-frame-pointer -ffast-math -fno-math-errno -fno-strict-aliasing -Wall -Wno-unused-value -Wno-unused -march\=core2 -MMD -MT dependencies -MF /Users/xxx/git_folder/rbfx/cmake-build-macos/build/crnlib.build/Debug/Objects-normal/arm64/lzma_LzmaLib.d --serialize-diagnostics /Users/xxx/git_folder/rbfx/cmake-build-macos/build/crnlib.build/Debug/Objects-normal/arm64/lzma_LzmaLib.dia -c /Users/xxx/git_folder/rbfx/Source/ThirdParty/crunch/crnlib/lzma_LzmaLib.cpp -o /Users/xxx/git_folder/rbfx/cmake-build-macos/build/crnlib.build/Debug/Objects-normal/arm64/lzma_LzmaLib.o
clang: error: the clang compiler does not support '-march=core2'

from rbfx.

rbnpontes avatar rbnpontes commented on May 26, 2024

It seems this property is included by the crunch lib, try to disable tools URHO3D_TOOL=OFF and build again, lets see if this work

from rbfx.

ad184hl avatar ad184hl commented on May 26, 2024

still not working.
I found the error mostly comes from the crnlib:

The following build commands failed:
	CompileC /Users/xxx/git_folder/rbfx/cmake-build-macos/build/crnlib.build/Debug/Objects-normal/arm64/lzma_LzmaLib.o /Users/xxx/git_folder/rbfx/Source/ThirdParty/crunch/crnlib/lzma_LzmaLib.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'crnlib' from project 'rbfx')

do you know any other feature I can disable for that crnlib? I checked that lib and I am not familiar with what this DXT feature is doing.

from rbfx.

rbnpontes avatar rbnpontes commented on May 26, 2024

This error comes from crunch lib, you can disable this lib at Source/ThirdParty/crunch/CMakeList.txt on line 55, you can comment and generate again the project.
Make sure you have deleted cmake cache and use -DURHO3D_TOOL=OFF as option and let's see whats happen

from rbfx.

ad184hl avatar ad184hl commented on May 26, 2024

Somehow I have to comment out the whole Source/ThirdParty/crunch/CMakeList.txt file, not sure why.
But got new error.

In file included from /Users/xxx/git_folder/rbfx/Source/Urho3D/Graphics/View.cpp:36:
In file included from /Users/xxx/git_folder/rbfx/Source/Urho3D/Graphics/../Graphics/GraphicsImpl.h:29:
/Users/xxx/git_folder/rbfx/Source/Urho3D/Graphics/OpenGL/OGLGraphicsImpl.h:46:10: fatal error: 'GLES2/gl2.h' file not found
#include <GLES2/gl2.h>
         ^~~~~~~~~~~~~
1 warning and 1 error generated.

I briefly checked the build option, does not know anything could disable the GLES.

I found another thread claiming upgrading SDL version could resolve the Apple Mx Chip support, not sure if that is the same issue here.

from rbfx.

rbnpontes avatar rbnpontes commented on May 26, 2024

Great, you've reached an important point. This problem occurs because include headers on MacOS is different.
Basically you must change #include <GLES2/gl2.h> to #include<OpenGL/gl3.h>, unfortunately this error is not easy to be solved.
I really high recommend you to use diligent branch instead of master, otherwise you will reach resolving a lot of problems that will be discarded in the future by the diligent feature.
Diligent branch is currently experimental and we don't have any release date soon, but it works very well on new Mac(a least on my Mac M1) and diligent branch is very active by the @eugeneko, he's the owner of this project.
Diligent branch brings a whole new backend rendering like Vulkan and D3D12 (Vulkan runs on top of MoltenVk) and we have fix this OpenGL issues. You can see our work here Diligent Renderer integration

Before you go to diligent branch, read this first:

  • If you have any problem about crunch on diligent branch you can use the workaround of disable crunch
  • You must install VulkanSDK if you need Vulkan, basically you need to setup vulkan sdk in you environment paths and run cmake
  • If you deal with any other problems, feel free to share here or use our Discord channel and feel free to send me message if you want. Due to expensive mac machines we really need persons that is testing diligent branch.

from rbfx.

eugeneko avatar eugeneko commented on May 26, 2024

but I'll attach my screen record video here to make it more clearer

Holy shit that looks broken xD
Do you have similar issues with master branch?

from rbfx.

rbnpontes avatar rbnpontes commented on May 26, 2024

but I'll attach my screen record video here to make it more clearer

Holy shit that looks broken xD

Do you have similar issues with master branch?

Master branch is completely broken on new Mac, I tried to help him but it has a mountain of issues that needs to be solved to make build works, diligent branch seems very stable on new Mac

from rbfx.

ad184hl avatar ad184hl commented on May 26, 2024

I just took a quick look at the default log print

[23:05:10] [info] [main] : ConfigFile 'EngineParameters.json' is not found
[23:05:10] [info] [main] : ConfigFile overrides 'conf://EngineParameters.json' are loaded
2023-08-17 23:05:10.030713-0700 Samples[70252:10013844] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x60000163a640> F8BB1C28-BAE8-11D6-9C31-00039315CD46
[23:05:10] [info] [main] : Loaded static plugin 'Builtin.SceneViewer'
[23:05:10] [info] [main] : Created 11 worker threads
2023-08-17 23:05:10.248295-0700 Samples[70252:10013844] [Window] Warning: Window SDLWindow 0x14c7437f0 ordered front from a non-active application and may order beneath the active application's windows.
[23:05:10] [info] [main] : [diligent] User-defined allocator is not provided. Using default allocator.
[23:05:10] [info] [main] : [diligent] Attached to OpenGL 4.1 context (4.1 Metal - 83.1, Apple M2 Pro)
[23:05:10] [info] [main] : [diligent] GPU Vendor: apple
[23:05:10] [info] [main] : [diligent] Disabling separable shader programs
[23:05:10] [info] [main] : RenderDevice is initialized for OpenGL: size=2048x1536px (1024x768dp), color=TEX_FORMAT_RGBA8_UNORM_SRGB, depth=TEX_FORMAT_D32_FLOAT_S8X24_UINT
[23:05:10] [info] [main] : Set screen mode: 2048x1536 pixels at 120 Hz at monitor 0 [Windowed] [Resizable]
[23:05:10] [info] [main] : Initialized input
[23:05:10] [info] [main] : Initialized renderer
[23:05:10] [error] [main] : Failed to create GPU Pipeline State Cache.
[23:05:11] [info] [main] : Set audio mode 44100 Hz 5.1 Surround interpolated
[23:05:11] [info] [main] : Initialized engine
[23:05:11] [error] [main] : Individual file watching not supported by this OS version, can not start watching path /Users/xxx/Library/Application Support/Urho3D Rebel Fork/Built-in Samples/
[23:05:11] [error] [main] : Individual file watching not supported by this OS version, can not start watching path /Users/xxx/git_folder/rbfx/cmake-build-clion/bin/Debug/Samples.app/Contents/MacOS/../Resources/Data/
[23:05:11] [error] [main] : Individual file watching not supported by this OS version, can not start watching path /Users/xxx/git_folder/rbfx/cmake-build-clion/bin/Debug/Samples.app/Contents/MacOS/../Resources/CoreData/
[23:05:11] [info] [main] : Loaded font face 'Noto Sans' [regular] from 'Fonts/NotoSans-Condensed.ttf'.
[23:05:11] [info] [main] : Loaded font face 'Noto Sans' [bold] from 'Fonts/NotoSans-CondensedBold.ttf'.
[23:05:11] [info] [main] : Loaded font face 'Noto Sans' [italic, bold] from 'Fonts/NotoSans-CondensedBoldItalic.ttf'.
[23:05:11] [info] [main] : Loaded font face 'Noto Sans' [italic] from 'Fonts/NotoSans-CondensedItalic.ttf'.
2023-08-17 23:05:11.456890-0700 Samples[70252:10013844] AudioHardware-mac-imp.cpp:660    AudioObjectGetPropertyData: no object with given ID 0
[23:05:11] [info] [main] : Set audio mode 44100 Hz 5.1 Surround interpolated
[23:05:11] [info] [main] : [diligent] Resizing the swap chain to 2918x1832
[23:05:11] [info] [main] : Swap chain is resized to 2918x1832px (1459x916dp)
[23:05:17] [info] [main] : [diligent] Resizing the swap chain to 1644x934
[23:05:17] [info] [main] : Swap chain is resized to 1644x934px (822x467dp)
[23:05:40] [error] [main] : [diligent] glDrawElementsInstancedBaseInstance is not supported on MacOS
[23:05:45] [error] [main] : [diligent] glDrawElementsInstancedBaseInstance is not supported on MacOS
[23:05:50] [error] [main] : [diligent] glDrawElementsInstancedBaseInstance is not supported on MacOS
[23:05:53] [warning] [main] : Image 'Models/Kachujin/Textures/Kachujin_normal.png' is converted to RGBA8 format on upload to GPU
[23:05:53] [warning] [main] : Image 'Models/Kachujin/Textures/Kachujin_specular.png' is converted to RGBA8 format on upload to GPU
[23:05:56] [error] [main] : [diligent] glDrawElementsInstancedBaseInstance is not supported on MacOS
[23:06:01] [error] [main] : [diligent] glDrawElementsInstancedBaseInstance is not supported on MacOS
[23:06:05] [warning] [main] : Image 'Models/Mutant/Textures/Mutant_diffuse.jpg' is converted to RGBA8 format on upload to GPU
[23:06:06] [warning] [main] : Image 'Models/Mutant/Textures/Mutant_normal.jpg' is converted to RGBA8 format on upload to GPU
[23:06:06] [error] [main] : [diligent] glDrawElementsInstancedBaseInstance is not supported on MacOS
[23:06:19] [error] [main] : [diligent] glDrawElementsInstancedBaseInstance is not supported on MacOS

I think there is some issue with the glDrawElementsInstancedBaseInstance not supported.

from rbfx.

eugeneko avatar eugeneko commented on May 26, 2024

That's interesting.
We already have a fallback in case this function is not supported, we probably should extend it:
image

from rbfx.

eugeneko avatar eugeneko commented on May 26, 2024

@ad184hl Can you try hardcoding drawBaseInstance_ to false and check if it fixes the issue for you?

from rbfx.

ad184hl avatar ad184hl commented on May 26, 2024

@ad184hl Can you try hardcoding drawBaseInstance_ to false and check if it fixes the issue for you?

@eugeneko
Yes! It works! All the Sample project works now (only the Ribbon one crash, I'll check later).
Interesting, so should we also mark the MacOS as the OpenGLBackend directly?

from rbfx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.