hassle_rs/
lib.rs

1#![allow(dead_code)]
2#![allow(non_upper_case_globals)]
3#![allow(
4    clippy::transmute_ptr_to_ptr, // Introduced by com-rs
5    clippy::too_many_arguments, // We're wrapping an API outside of our control
6    clippy::uninlined_format_args, // Unfavourable format; implies unneeded MSRV bump
7)]
8
9//! # Hassle
10//!
11//! This crate provides an FFI layer and idiomatic rust wrappers for the new [DirectXShaderCompiler](https://github.com/Microsoft/DirectXShaderCompiler) library.
12//!
13//! ## Simple example
14//!
15//! ```rust
16//! use hassle_rs::compile_hlsl;
17//!
18//! let code = "
19//!     Texture2D<float4> g_input    : register(t0, space0);
20//!     RWTexture2D<float4> g_output : register(u0, space0);
21//!
22//!     [numthreads(8, 8, 1)]
23//!     void copyCs(uint3 dispatchThreadId : SV_DispatchThreadID)
24//!     {
25//!         g_output[dispatchThreadId.xy] = g_input[dispatchThreadId.xy];
26//!     }";
27//!
28//! let ir = compile_hlsl(
29//!     "shader_filename.hlsl",
30//!     code,
31//!     "copyCs",
32//!     "cs_6_1",
33//!     &vec!["-spirv"],
34//!     &vec![
35//!         ("MY_DEFINE", Some("Value")),
36//!         ("OTHER_DEFINE", None)
37//!     ],
38//! );
39//! ```
40
41pub mod fake_sign;
42pub mod ffi;
43pub mod os;
44pub mod utils;
45pub mod wrapper;
46
47pub mod intellisense;
48
49pub use crate::ffi::*;
50pub use crate::utils::{compile_hlsl, fake_sign_dxil_in_place, validate_dxil, HassleError, Result};
51pub use crate::wrapper::*;