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

Compiling DirectXShaderCompiler on Linux/macOS #1236

Closed
Cry-Mory opened this Issue Apr 17, 2018 · 26 comments

Comments

Projects
None yet
9 participants
@Cry-Mory

Cry-Mory commented Apr 17, 2018

Do you know if is it possible to compile DirectXShaderCompiler on Linux? It is mainly for having the compiler to generate SPIR-V shaders for Vulkan from HLSL sources on Linux.

@Zingam

This comment has been minimized.

Zingam commented Apr 19, 2018

I thought of asking the same. You should support Linux and possibly MacOS as the latter got a VulkanSDK.
One of my worst work experiences were having to compile the resources and run the code generation tools on Windows and then transferring them over to MacOS every morning and sometimes multiple time per day. The project itself was an iOS one.

@oscarbg

This comment has been minimized.

oscarbg commented Apr 19, 2018

DXC doesn't work with wine in the meanwhile?

@gwihlidal

This comment has been minimized.

gwihlidal commented Apr 20, 2018

Also see: #1082

@antiagainst

This comment has been minimized.

Collaborator

antiagainst commented May 8, 2018

Our primary goal is to get DXC/SPIR-V production ready on Windows. With that said, we consider DXC/SPIR-V as mature-ish ATM. So we started looking into Linux support. @ehsannas is driving the effort. So, stay tuned. ;-P

@ehsannas ehsannas self-assigned this May 8, 2018

@ehsannas

This comment has been minimized.

Collaborator

ehsannas commented May 8, 2018

We have started looking into porting DXC to Linux. We have reached some promising initial results, but there is a lot of work to be done to make things production quality.

Over the coming weeks/months we will be communicating with Microsoft to make sure we reach a robust and clean solution. Stay tuned :)

@Zingam

This comment has been minimized.

Zingam commented May 8, 2018

@ehsannas Great! BTW. Would it make sense to add DXC as a package to vcpkg as the latter is supported on Linux/Mac now?

@antiagainst

This comment has been minimized.

Collaborator

antiagainst commented May 8, 2018

@Zingam: We can discuss vkpkg support in #715 and leave this issue focusing on Linux support. ;-P

@Zingam

This comment has been minimized.

Zingam commented May 9, 2018

Will the Linux version output SPIRV or also DXIL?

@antiagainst

This comment has been minimized.

Collaborator

antiagainst commented May 9, 2018

The plan of record is to support both.

@biojppm

This comment has been minimized.

biojppm commented May 10, 2018

I am also interested in this and I'd like to help. Have you made any progress so far, or do you have some suggestions where to start?

@antiagainst antiagainst changed the title from Question: Compiling DirectXShaderCompiler on Linux to Compiling DirectXShaderCompiler on Linux May 10, 2018

@ehsannas

This comment has been minimized.

Collaborator

ehsannas commented Jun 25, 2018

Hi all, thanks for your patience while we worked on getting DXC working on Linux!

I'm pleased to say that our fork has reached the point where you can compile and run DXC on Linux (and macOS)! You can give it a try by checking out the linux branch in our fork. For complete details on how to build and run, please see our documentation.

We have already started, and will continue to post pull-requests to the Microsoft repository in order to get the Microsoft/master branch working on Linux! At that point, we will stop development on our fork, and contribute directly to the Microsoft repository.

@hekota

This comment has been minimized.

Member

hekota commented Jun 25, 2018

That is great news! And my apologies for some of the code reviews taking so long. Two people left our team so we are quite busy.

@gwihlidal

This comment has been minimized.

gwihlidal commented Jun 25, 2018

Thank you so much! This is excellent news

@ehsannas

This comment has been minimized.

Collaborator

ehsannas commented Jun 25, 2018

Thanks @hekota for the code reviews :)

@hekota

This comment has been minimized.

Member

hekota commented Jun 25, 2018

Np :)

@antiagainst

This comment has been minimized.

Collaborator

antiagainst commented Jun 25, 2018

And we must thank @pow2clk for all his awesome work, without which we definitely cannot achieve it so quickly. Kudos to @pow2clk!

@ehsannas

This comment has been minimized.

Collaborator

ehsannas commented Jun 25, 2018

Absolutely! Thank you @pow2clk!

@Zingam

This comment has been minimized.

Zingam commented Jun 25, 2018

@ehsannas Will the Linux build be available on AppVayor?

@gwihlidal

This comment has been minimized.

gwihlidal commented Jun 25, 2018

For anyone interested, I've containerized this in Docker now and pushed an image to Docker Hub

docker run --rm gwihlidal/dxc -help
docker run --rm -v $(pwd):$(pwd) -w $(pwd) gwihlidal/dxc -T <target> -E <entry-point-name> <input-hlsl-file>
@antiagainst

This comment has been minimized.

Collaborator

antiagainst commented Jun 25, 2018

@Zingam: we'll coordinate with Microsoft to see how we can proceed with that.

@pow2clk

This comment has been minimized.

Contributor

pow2clk commented Jun 25, 2018

Thanks to all involved as well! You made it easy and fun to contribute and I appreciate it. 😄

@antiagainst antiagainst changed the title from Compiling DirectXShaderCompiler on Linux to Compiling DirectXShaderCompiler on Unix Jun 26, 2018

@antiagainst antiagainst changed the title from Compiling DirectXShaderCompiler on Unix to Compiling DirectXShaderCompiler on Linux/macOS Jun 26, 2018

@ehsannas

This comment has been minimized.

Collaborator

ehsannas commented Jun 28, 2018

Hi all,

The Microsoft/master branch is now in sync with our fork. I am able to successfully build and run the current Microsoft/master branch on Linux.
Thanks @marcelolr for your support of this effort. Thanks @hekota , @antiagainst, and @pow2clk for all the code reviews and contributions.

We will contribute directly to the Microsoft repository in case any improvements are needed.

@ehsannas ehsannas closed this Jun 29, 2018

@antiagainst

This comment has been minimized.

Collaborator

antiagainst commented Jul 9, 2018

@Zingam: As per #1407, we now have Traivs CI enabled for Linux and macOS. However, unlike Appveyor CI, Travis CI does not support hosting artifacts after the build. Besides, libraries compiled on Linux tightly relates to the host environment. So we may not be able to provide downloads for Linux/macOS. The steps for building it is quite straightforward CMake steps, though: https://github.com/Microsoft/DirectXShaderCompiler/blob/master/docs/DxcOnUnix.rst#building-dxc.

@antiagainst

This comment has been minimized.

Collaborator

antiagainst commented Jul 9, 2018

Hey @gwihlidal, would you mind contribute the Docker configuration file to the upstream repo? It can be useful for others trying to dockerize DXC. :)

@gwihlidal

This comment has been minimized.

gwihlidal commented Sep 15, 2018

Hi @antiagainst,

I'll look at doing that (any preference on location in the tree for the Dockerfile?).

In the meantime, I've written a brief blog post about this: https://wihlidal.com/blog/pipeline/2018-09-15-linux-dxc-docker/

@antiagainst

This comment has been minimized.

Collaborator

antiagainst commented Sep 15, 2018

Awesome write up! Cloud based shader compilation sounds really neat!

I don't have a strong preference as for the location of the Dockerfile. I think project root should be good?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment