New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
skshaderc
for MacOS
#772
Comments
I unfortunately don't ship a This is on my radar though, I've just been hoping to build this with something like Hermit so I don't have to ship a permutation of binaries. So, slightly more involved than just making a mac friendly build. |
skshaderc
for MacOS
Ah that's good to know, thanks! I couldn't find this in the documentation. So are there any shaders in the project currently that will compile on Mac for Android? Thanks for the awesome work on this project. I saw a live demo done on the GlobalXR conference and I was so inspired! |
The shaders can compile, it's more that I just don't build or ship the mac flavored shader compiler binary for it! The simulator won't run on mac yet, I don't have a mac myself, and haven't met a lot of mac XR developers, so it's been a lower priority for me! Apple finally announcing their Vision Pro has made it a bit more common lately, which is why I'm much more interested in it now. But there's still a good pile of work to make that a good experience. In theory, you could compile the shaders on Windows or Linux, and just grab the compiled .sks files, load those directly. It would work fine, it would just be a lot less fun to iterate on! |
Thanks for the explanation! However, I'm not fully understanding it yet. So if I want to build to the Quest, and skip the Aside from this, would you know anything the guy in this tutorial might have done differently? He's happily compiling from your repo directly to the Quest from his Mac. He doesn't seem to take any other additional steps to make it work. He uses the XPlat template from a couple of years ago, but for me that results in the same issue as I have with a current commit. |
@mrstruijk, my work colleague had the same build issue pop up, it turns out we had a .hlsl file in the project. Since this wasn't used and so just removing the .hlsl file mean the StereoKit build.targets won't attempt to execute the shader compile at build time. The build issue you see is because shader compilation is done on the build machine. We've been happily building and debugging a StereoKit app on a Quest 2 from an ARM64 Mac, just without any custom shader hlsl files. However, if you are using the custom shader then you'd be best to do the work around Nick's mentioned (aka, compile the shader on windows/linux, maybe even a linux docker image would work). |
StereoKit's NuGet comes with a tool for compiling .hlsl files into more platform appropriate shader data. Currently this comes in the form of I'm not currently sure why that previous demo would have worked, it's been a while and a lot has changed since then! If x64 Macs can run a Linux x64 executable (plausible for CLI stuff? I have no idea though), that could account for it. It's also possible that automatic shader compilation may have been working a bit differently back then 😅 But yeah, as rayperkins mentioned, removing .hlsl files from your project will get you past this for now. You would need to compile them manually on a different OS, and copy the resulting .sks files, you can load those directly instead. |
You guys are the best, thank you @rayperkins and @maluoi! I'm slowly starting to understand what is happening, and that Is very satisfying. This is why I love these open source communities so much! Ok final thing for me to wrap my head around: I remove the .hlsl from the project then it should work, fine. But some shader is used, right? This may be because I've been "raised" in Unity, but you gotta have some shader I presume? What is the cube using? Or the hands? And how about if I import any model, and wouldn't need to use any specific shader, is it still going to render? |
StereoKit does ship with a number of shaders that are "built-in", pre-compiled on Github Actions and packaged into the StereoKit library as binary data :) You can see a list of those over in this folder. This usually covers the majority of common cases, so you'll only need custom shaders if you need custom rendering or special effects! You can access the builtin shaders via like But for example, when loading a GLTF, StereoKit will match up the model's materials to an appropriate built-in shader that StereoKit always has. Generally that's the PBR one, but there's a few others GLTFs will sometimes use! |
@maluoi This is excellent! Thank you so much for taking the time to explain it al so clearly! |
v0.4 preview builds should be able to compile shaders on Mac now. This isn't robustly tested, but may work. |
Description
What's happening? What are you expecting? More details are better.
When I'm trying to publish the sk-multi template to the Quest 2 as standalone, it gives the error below.
I'm running the steps as in the StereoKit VSCode guide,
and then run
dotnet add package StereoKit.Templates
,dotnet new sk-multi --force
.When I
dotnet run
I get the error below, same as when I'm trying to publish to the Quest.Platform / Environment
Windows/Linux/Android? Which OpenXR runtime, or is this the flatscreen simulator? What XR device is involved? C# or C++? Are you using StereoKit templates, or are you building SK from scratch? Are your graphics drivers up-to-date? Etc.
I'm working on M1 macOS 14.1, I'm using latest VS Code 1.84.1 (but same issue with Visual Studio 2022).
I've installed dotnet 7.0.483, the android workload, openJDK 17, Android API level 33 via Android Studio, Xamarin via VS.
Stereokit was installed (latest), as was the Templates (latest)
Logs or exception details
The text was updated successfully, but these errors were encountered: