New DirectX Shader Compiler based on Clang/LLVM now available as Open Source -
https://devblogs.microsoft.com/directx/new-directx-shader-compiler-based-on-clangllvm-now-available-as-open-source/DX Compiler -
https://github.com/microsoft/DirectXShaderCompiler DX Compiler release for July 2019 -
https://github.com/microsoft/DirectXShaderCompiler/releasesThe DirectX Shader Compiler project includes a compiler and related tools used to compile High-Level Shader Language (HLSL) programs into DirectX Intermediate Language (DXIL) representation. Applications that make use of DirectX for graphics, games, and computation can use it to generate shader programs.
Features and Goals
The starting point of the project is a fork of the LLVM and Clang projects, modified to accept HLSL and emit a validated container that can be consumed by GPU drivers. At the moment, the DirectX HLSL Compiler provides the following components: dxc.exe, a command-line tool that can compile HLSL programs for
shader model 6.0 or higher dxcompiler.dll,
a DLL providing a componentized compiler, assembler, disassembler, and validator various other tools based on the above components
The Microsoft Windows SDK releases include a supported version of the compiler and validator.
The goal of the project is to allow the broader community of shader developers to contribute to the language and representation of shader programs, maintaining the principles of compatibility and supportability for the platform. It's currently in active development across two axes: language evolution (with no impact to DXIL representation), and surfacing hardware capabilities (with impact to DXIL, and thus requiring coordination with GPU implementations).
ShaderFlex™ is a powerful stand-alone GPU shader authoring environment for
DirectX 11 similar to legacy tools like NVidia FX Composer and AMD RenderMonkey.
Whether you're a beginner looking to learn about shaders, a graphics hobbyist wanting to sandbox and share your latest creations or a seasoned graphics engineer prototyping some killer special effects for an upcoming AAA game, ShaderFlex is the tool for you.
Scroll down for an overview of ShaderFlex or check out the Features page for more in-depth information.
NOTE: ShaderFlex is still in development and a beta program is planned for later this year.
Above is an image of ShaderFlex rendering over 500,000 dynamic blades of grass, with depth of field and HDR blooming
Main FeaturesDirectX 11 support ( extensive control of the API through ShaderFlex's material definitions )
Shader models ( 4_0_level_0_1, 4_0_level_0_3, 4_0, 4_1 and 5_0 )
Shader types ( compute, vertex, geometry, hull, domain, pixel )
Complex non-linear multi-pass support ( for rendering effects like smooth particle hydrodynamics or fluid simulations which require many scattered passes )
Uses proprietary 100% GPU accelerated user interface ( runs smooth on 4K+ displays, dockable, supports HiDPI scaling, abstracted from Windows )
NodeFlex support ( use NodeFlex and our customizable DX11 graph system to auto-generate your shaders and create your own reusable code generating logic )
Oculus Rift DK1 and DK2 support ( using Direct HMD Access and latest SDK )
3DConnexion SpaceMouse support ( and related products )
Debugging capabilities ( live preview, resources, ASM, timing, passes, shader feedback )
Scene scripting ( setup render targets, feed values to shaders, animated objects, and control the scene and rendering per frame )
Material definitions ( easy to use C++ style material definition for setting up resources, views, shaders, states, passes, etc. )
RenderFlex ( export your scenes in binary format to share with other using RenderFlex )
Simulation and Animation ( ability to run simulation passes at different frequencies than other rendering or compute passes )
Texture support ( .jpg, .png, .dds, .tga, .ppm, .bmp.dib, .pfm, .hdr, .tif, .gif )
ShaderFlex Material API ( lightweight API to access all data from a material )
ShaderFlex Rendering API ( integration API to load and render ShaderFlex materials in your rendering pipeline )
AutoDesk FBX support ( .fbx, .obj, .3ds, animation and CPU skinning )
Stream-output support ( render geometry to buffers for later use )
indirect draw/compute ( keep the GPU from stalling by initiating draw/dispatch calls using values from a DX Buffer )
Data Caching ( generate data from a compute shader in an INIT pass and save the data to file for future quick loading )
Pass iterations ( simply tell a pass how many times it should execute and access the iteration count and iteration index from your shaders )
Compute generated vertex and index buffers ( generate and render geometry entirely on the GPU )
Access mesh data from compute shaders ( get the position, normal and other data for processing in a compute shader, for example generating static ambient occlusion )
Flexible viewport ( go full screen, full window, choose from a selection of standard resolutions or choose your own )
Full access to mouse/touch input data from shaders
Auto-draw ( tell a rendering pass how many fake vertices to render, and use the SV_VertexID to dynamically generate geometry like grass blades for example )
Geometry instancing
Tweaks and presets ( shader variable overrides and per-material presets )
Supports WARP software rendering
Code Editing ( Intellisense style code editing, auto-completion tips and other helpers, code preview )
Multiple projects ( open multiple projects at the same time )
Scene editor ( build hierarchical scenes using frame/camera/light/mesh entities and post fx filters, each entity can have unlimited materials attached )
Auto generate mip map levels on the GPU
Volume Texture Targets ( render into volume slices or use a compute shader to do the same )
Cube Texture Targets ( render into cube faces or use a compute shader to do the same )
2D/3D/Volume texture arrays ( use them as shader resources, unordered access buffers or render targets )
Resource Views ( over 31 different types of shader resource, unordered access and render target views )
USING UNITY AS AN FX COMPOSER REPLACEMENT FOR SHADER PROTOTYPING -
https://interplayoflight.wordpress.com/2013/02/04/unity-as-an-fx-composer-replacement-for-shader-prototyping/ShaderMan ShaderToy to ShaderLab Converter -
https://github.com/smkplus/ShaderManIf you’ve tried dabbling with shaders at all, you’ve probably come across ShaderToy – an online shader showcase with some pretty amazing examples of what’s possible in a few lines of shader code, inspired greatly by classic demoscene coding. Here’s just two examples:
https://www.shadertoy.com/view/4dl3znIt’s an amazing resource, not only for inspiration but for learning how to create shaders, since every example comes with full source code which you can edit and immediately test online in your browser, alter parameters, supply different inputs etc.
The shaders exhibited on ShaderToy are exclusively written in GLSL, and run in your browser using WebGL.I write an automatic conversion tool to turn a GLSL shader into an HLSL shader that help you fast convert ShaderToy to ShaderLab unity.
GLSL-to-HLSL reference -
https://docs.microsoft.com/en-us/previous-versions/windows/apps/dn166865(v=win.10)Open-sourcing the Microsoft Edge WebGL GLSL transpiler -
https://blogs.windows.com/msedgedev/2016/06/09/open-sourcing-the-microsoft-edge-webgl-glsl-transpiler/Microsoft Edge WebGL Implementation -
https://github.com/MicrosoftEdge/WebGLWhat is a GLSL::HLSL transpiler?
WebGL web pages run ‘programs’ (shaders) on your GPU to render 3D content; these programs are written in the GLSL shading language. Microsoft Edge uses the DirectX subsystem in Windows (and HLSL, a different Windows-specific shading language) to render content.
Microsoft Edge converts WebGL content to DirectX equivalents to display it; the WebGL renderer converts WebGL calls into DirectX equivalents, and the transpiler converts GLSL shaders to HLSL shaders.
The ANGLE project -
https://github.com/google/angle – as used in Chrome and Firefox – has similar functionality.
As an example of this conversion, here’s a super-simple program that paints a red pixel:
GLSL:
void main()
{
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); // r g b a
}
HLSL:
float4 main() : SV_Target
{
return float4(1.0f, 0.0f, 0.0f, 1); // r g b a
}
The transpiler (like any compiler) parses the GLSL program, checks for correctness and security constraints, and applies a conversion process to produce HLSL output.