DirectXShaderCompiler
shaderc
Our great sponsors
DirectXShaderCompiler | shaderc | |
---|---|---|
33 | 11 | |
2,882 | 1,726 | |
3.0% | 2.4% | |
0.0 | 7.6 | |
5 days ago | 20 days ago | |
C++ | C++ | |
GNU General Public License v3.0 or later | GNU General Public License v3.0 or later |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
DirectXShaderCompiler
-
Building the DirectX shader compiler better than Microsoft?
Well... they are rewriting & upstreaming DXC to LLVM main (https://github.com/microsoft/DirectXShaderCompiler/wiki/Cont...) and want to kinda deprecate DCX. IIRC currently only compute shaders are supported but I may be very wrong.
> We may support DXBC generation in Clang in the future (we mentioned that in the original proposal to LLVM). That work is unlikely to begin for a few years as our focus will be on supporting DXIL and SPIR-V generation first.
I appreciate this quote[0] from the microsoft camp. Setting clear expectations that something will not be done is a nice bit of fresh air.
[0] https://github.com/microsoft/DirectXShaderCompiler/issues/57...
-
Vcc – The Vulkan Clang Compiler
Also Microsoft DirectX Shader Compiler[1] for HLSL. In fact, effort is ongoing to upstream HLSL support into Clang.[2][3][4]
To answer your other question—why LLVM instead of GCC:
- First-class support for non-Unix/Linux platforms. LLVM can be built on Windows and Visual Studio without ever needing a single GNU tool besides git[5]. Clang even has a MSVC-compatible interface that allows MSVC developers to switch to Clang without needing to change their command-line invocation[6].
- Written in C++ from the ground up, with a modular, first-class SSA IR-based interface.
- Permissive Apache 2.0 licence. As much as this might exasperate the open-source community, it allows for significantly faster iteration; things tend to be upstreamed when private/corporate developers realise it is hard to maintain separate forks.
All this allows LLVM to have a pretty mature infrastructure; some very large companies have contributed to its development.
[1]: https://github.com/microsoft/DirectXShaderCompiler
[2]: https://clang.llvm.org/docs/HLSL/HLSLDocs.html
[3]: https://github.com/microsoft/DirectXShaderCompiler/wiki/Cont...
[4]: https://discourse.llvm.org/t/rfc-adding-hlsl-and-directx-sup...
There's no need for transpilers these days, you can just compile HLSL to SPIR-V bytecode with dxc.
-
Shader Compilation
Use DXC and only HLSL for your main shader editing.
-
Proper way to access a read-only texture that has no sampler from an hlsl compute shader?
BTW, this problem can be reproduced as described below: - clone https://github.com/SaschaWillems/Vulkan.git - build the project and run it with arguments : -v - s hlsl to enable the validation layer and to use hlsl code - run ComputeShader project. The following validation error "Type mismatch on descriptor slot ..." will be shown in the console. - to fix it, as suggested above, you can replace the 3rd line of emboss.comp, sharpen.comp, and edgedetect.comp from: Texture2D inputImage : register(t0); //Creates validation errors to RWTexture2D inputImage : register(u0); //no validation errors (you'll then need to recompile the shaders to spv with a proper hlsl compiler such as Microsoft dxc)
-
Start project on Metal, port to DX11?
EDIT: There is also naga but it does not take HLSL as input: https://github.com/gfx-rs/naga but you can use DirectXShaderCompiler to compile to SpirV, then use naga to compile to Metal.
-
Is SPIRV-Cross a valid option to target Metal from HSSL?
I am starting work on a compute-driven rendering engine, and it seems that the best way to go around it will be to write code in HSSL, and then use DirectXShaderCompiler to generate SPIR-V, and SPIRV-Cross to then generate MSL. And while DXSC's repo has a page on incompatibilities, no such resource seems to exist for SPIRV-Cross targeting Metal.
-
Learning DirectX 12 in 2023
DirectX Shader Compiler
shaderc
-
2D Anime Computer Graphics. A humble beginning.
Do you mean how to compile Spir-V at runtime? shaderc repo has an example https://github.com/google/shaderc/tree/main/examples/online-compile
-
Shader package - First look at shader command-line tool
_ _ ___| |__ __ _ __| | ___ _ __ / __| '_ \ / _` |/ _` |/ _ \ '__| \__ \ | | | (_| | (_| | __/ | |___/_| |_|\__,_|\__,_|\___|_| shader helps you with compiling your GLSL files into SPIR-V byte code. Examples: | > shader --webservice | | Use webservice to automatically compile all *.glsl files in this project. | > shader --webservice --watch | | Watch for file system changes and use webservice to compile *.glsl files. | > shader --webservice --dart | | Generates a .dart-file with a loading function instead of byte code. | > shader --webservice --put-in-assets | | Places compiled files into the Flutter assets directory. | > shader --local /path/to/shaderc | | Use local executable of glslc by pointing to a directory to look for it. Usage: -s, --webservice Use a hosted webservice to compile local *.glsl files. -l, --local Use a local executable of the glslc compiler. Specify the path to a location where shader_cli should scan for the glslc executable. Download: https://github.com/google/shaderc -c, --custom-webservice Uses a self-hosted webservice to compile *.glsl files. You can download the webservice at: https://github.com/felixblaschke/shaderc_webservice -w, --watch Watches for file system changes and automatically recompiles the *.glsl files. -p, --path Defines a directory path to scan for files to compiler. If unset, it will use current working directory. -a, --put-in-assets Places the compiled files into this project's assets directory. -d, --dart Generates Dart-file with embedded SPR-V byte code and a simple shader loading function. -h, --help Shows this help text. Updates and more information: https://pub.dev/packages/shader_cli
-
What are your (dynamic) shader workflows when targeting multiple backends (Vulkan and Metal)?
I am working on an engine that targets Vulkan and Metal. I'm at the point now where I want to be able to dynamically update my shader at runtime to suit the type of data being sent in for drawing. I am currently using offline compilation for my GLSL (for Vulkan) and MSL (for Metal) shaders. What are your workflows for situations like this? For those using tools like SPIR-V Cross and shaderc, what has your experience been with these tools keeping up to date with the latest features in the specs?
-
This Week in Veloren #136: Economics, Naga
shaderc (https://github.com/google/shaderc) is one such shader compiler. It does the job well enough and lets us compile our GLSL shader code into the SPIR-V assembly that the graphics drivers need. However, it's written mostly in C++ and has a rather complicated build system. This means that people wanting to compile Veloren need to install a variety of extra things to get shaderc working with Veloren.
-
What HLSL->SPIR-V compiler to use?
From what I can tell, both glslang/shaderc and Microsoft's DirectXShaderCompiler can compile HLSL to SPIR-V code. Is there a consensus on which of these is the better compiler? (wrt to accuracy, optimisations, feature completeness, etc.)
What are some alternatives?
glslang - Khronos-reference front end for GLSL/ESSL, partial front end for HLSL, and a SPIR-V generator.
naga - Universal shader translation in Rust
glslcc - GLSL cross-compiler tool (GLSL->HLSL, MSL, GLES2, GLES3, GLSLv3), using SPIRV-cross and glslang
rust-gpu - 🐉 Making Rust a first-class language and ecosystem for GPU shaders 🚧
SPIRV-Cross - SPIRV-Cross is a practical tool and library for performing reflection on SPIR-V and disassembling SPIR-V back to high level languages.
slang - Making it easier to work with shaders
shaderc-rs - Rust bindings for the shaderc library.
macOS_Wine_builds - Official Winehq macOS Packages
uVkCompute - A micro Vulkan compute pipeline and a collection of benchmarking compute shaders
ShaderConductor - ShaderConductor is a tool designed for cross-compiling HLSL to other shading languages