Skip to content

include macros #47

@cjhowe-us

Description

@cjhowe-us

Write function-like procedural macros to invoke compile_hlsl and validate_dxil at compile time. I think most users of this library will want to compile their shaders to SPIR-V/DXIL at compile time because it's unlikely that players will have dxil.dll available.

To kick off the conversation, I suggest we follow in the footsteps of inline-spirv in regards to the usage patterns:

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

let dxil= validate_dxil!(inline_hlsl!(
    r#"
        // your inline HLSL code here
    "#,
    "entry",
    "cs_6_5",
    &vec![],
    &vec![
        ("MY_DEFINE", Some("Value")),
        ("OTHER_DEFINE", None)
    ],
));

I'm not sure what the API for validation should look like or whether it's feasible, but we should consider whether we will need to validate DXIL at compile time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions