All Projects â†’ Traverse-Research â†’ hassle-rs

Traverse-Research / hassle-rs

Licence: MIT license
🦀 This crate provides an FFI layer and idiomatic rust wrappers for the new DirectXShaderCompiler library.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to hassle-rs

Pbr proj
Shader of PBR for Unity
Stars: ✭ 68 (+100%)
Mutual labels:  shader, hlsl
Unity Raymarching Framework
A framework to easy implement raymarching in unity. Include lots of hash,noise,fbm,SDF,rotate functions
Stars: ✭ 129 (+279.41%)
Mutual labels:  shader, hlsl
Hlslexplorer
See how hardware understands your HLSL
Stars: ✭ 91 (+167.65%)
Mutual labels:  shader, hlsl
Jl S Unity Blend Modes
👾 Collection of Unity shaders that support blend modes like photoshop layer style (Darken, Multiply, Linear Burn, etc)
Stars: ✭ 62 (+82.35%)
Mutual labels:  shader, hlsl
Bloodfx
Procedural blood stain shader
Stars: ✭ 170 (+400%)
Mutual labels:  shader, hlsl
Shaderconductor
ShaderConductor is a tool designed for cross-compiling HLSL to other shading languages
Stars: ✭ 1,146 (+3270.59%)
Mutual labels:  shader, hlsl
Proccharvfx
Procedural character generation with Unity Shader Graph and VFX Graph
Stars: ✭ 114 (+235.29%)
Mutual labels:  shader, hlsl
Unity3d Cg Programming
Various shaders.
Stars: ✭ 800 (+2252.94%)
Mutual labels:  shader, hlsl
Computestochasticreflections
Compute Stochastic Screen Space Reflections for unity post processing
Stars: ✭ 163 (+379.41%)
Mutual labels:  shader, hlsl
Unityurptoonlitshaderexample
A very simple toon lit shader example, for you to learn writing custom lit shader in Unity URP
Stars: ✭ 2,988 (+8688.24%)
Mutual labels:  shader, hlsl
Nnao
Neural Network Ambien Occlusion based on http://theorangeduck.com/page/neural-network-ambient-occlusion
Stars: ✭ 57 (+67.65%)
Mutual labels:  shader, hlsl
Water Shader
Procedural water shader for general use.
Stars: ✭ 183 (+438.24%)
Mutual labels:  shader, hlsl
Computesharp
A .NET 5 library to run C# code in parallel on the GPU through DX12 and dynamically generated HLSL compute shaders, with the goal of making GPU computing easy to use for all .NET developers! 🚀
Stars: ✭ 982 (+2788.24%)
Mutual labels:  shader, hlsl
3d Game Shaders For Beginners
🎮 A step-by-step guide to implementing SSAO, depth of field, lighting, normal mapping, and more for your 3D game.
Stars: ✭ 11,698 (+34305.88%)
Mutual labels:  shader, hlsl
Bonzomatic
Live shader coding tool and Shader Showdown workhorse
Stars: ✭ 829 (+2338.24%)
Mutual labels:  shader, hlsl
Gpu Planetary Rendering
GPU atmosphertic scattering and planet generation in Unity 3D
Stars: ✭ 92 (+170.59%)
Mutual labels:  shader, hlsl
Noiseshader
Noise shader library for Unity
Stars: ✭ 616 (+1711.76%)
Mutual labels:  shader, hlsl
Uraymarching
Raymarching Shader Generator in Unity
Stars: ✭ 793 (+2232.35%)
Mutual labels:  shader, hlsl
Glslang
Khronos-reference front end for GLSL/ESSL, partial front end for HLSL, and a SPIR-V generator.
Stars: ✭ 2,034 (+5882.35%)
Mutual labels:  shader, hlsl
Spirv Vm
Virtual machine for executing SPIR-V
Stars: ✭ 173 (+408.82%)
Mutual labels:  shader, hlsl

🌤 hassle-rs

Actions Status Latest version Documentation Lines of code MIT Contributor Covenant

Banner

This crate provides an FFI layer and idiomatic rust wrappers for the new DirectXShaderCompiler library.

Usage

Add this to your Cargo.toml:

[dependencies]
hassle-rs = "0.9.0"

Then acquire dxcompiler.dll on Windows or libdxcompiler.so on Linux directly from AppVeyor, or compile it from source according to the instructions in the DirectXShaderCompiler GitHub repository and make sure it's in the executable environment.

DxcValidator also requires dxil.dll which can be grabbed from any recent Windows 10 SDK flight. More info: https://www.wihlidal.com/blog/pipeline/2018-09-16-dxil-signing-post-compile/

Compile HLSL into SPIR-V:

let spirv = compile_hlsl(
    "shader_filename.hlsl",
    code,
    "copyCs",
    "cs_6_5",
    &vec!["-spirv"],
    &vec![
        ("MY_DEFINE", Some("Value")),
        ("OTHER_DEFINE", None)
    ],
);

Compile HLSL into DXIL and validate it:

let dxil = compile_hlsl("test.cs.hlsl", test_cs, "main", "cs_6_5", args, &[]).unwrap();
let result = validate_dxil(&dxil); // Only a Windows machine in Developer Mode can run non-validated DXIL

if let Some(err) = result.err() {
    println!("validation failed: {}", err);
}

macOS support

One can build libdxcompiler.dynlib from source with this commit for clang or the entire PR for GCC, by following the DXC Unix build guide. These patches have been merged to DXC and are available since release-1.6.2012.

Linux support

Linux shares the same requirements as macOS support when compiling from source but DXC provides prebuilt libraries for every commit on AppVeyor. These are linked from individual commits on GitHub too.

Furthermore semantics around BSTR (only used in intellisense) have changed since hassle-rs 0.5.1 and require libdxcompiler.so compiled from at least this commit, also included in release-1.6.2012. Intellisense on hassle-rs 0.5.0 and below is not compatible with these newer libraries.

License

Licensed under MIT license (LICENSE or http://opensource.org/licenses/MIT)

Contributions

  • Graham Wihlidal
  • Tiago Carvalho
  • Marijn Suijten
  • Tomasz Stachowiak

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, shall be licensed as above, without any additional terms or conditions.

Contributions are always welcome; please look at the issue tracker to see what known improvements are documented.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].