{"id":16886316,"url":"https://github.com/penguinliong/inline-spirv-rs","last_synced_at":"2025-10-15T09:29:45.096Z","repository":{"id":49230282,"uuid":"288201187","full_name":"PENGUINLIONG/inline-spirv-rs","owner":"PENGUINLIONG","description":"Compile GLSL/HLSL/WGSL and inline SPIR-V right inside your crate.","archived":false,"fork":false,"pushed_at":"2024-08-02T19:07:26.000Z","size":51,"stargazers_count":34,"open_issues_count":0,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-28T18:09:49.374Z","etag":null,"topics":["glsl","hlsl","rust","spirv","wgsl"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PENGUINLIONG.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-17T14:24:46.000Z","updated_at":"2025-01-22T06:48:00.000Z","dependencies_parsed_at":"2024-03-27T17:06:16.675Z","dependency_job_id":null,"html_url":"https://github.com/PENGUINLIONG/inline-spirv-rs","commit_stats":{"total_commits":17,"total_committers":5,"mean_commits":3.4,"dds":"0.23529411764705888","last_synced_commit":"abbd172997e15034098b7efd196e319ae34bdfec"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PENGUINLIONG%2Finline-spirv-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PENGUINLIONG%2Finline-spirv-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PENGUINLIONG%2Finline-spirv-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PENGUINLIONG%2Finline-spirv-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PENGUINLIONG","download_url":"https://codeload.github.com/PENGUINLIONG/inline-spirv-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237263193,"owners_count":19281381,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["glsl","hlsl","rust","spirv","wgsl"],"created_at":"2024-10-13T16:39:01.562Z","updated_at":"2025-10-15T09:29:40.043Z","avatar_url":"https://github.com/PENGUINLIONG.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Inline SPIR-V \u0026 JIT SPIR-V\n\n[![Crate](https://img.shields.io/crates/v/inline-spirv)](https://crates.io/crates/inline-spirv)\n[![Documentation](https://docs.rs/inline-spirv/badge.svg)](https://docs.rs/inline-spirv)\n\n`inline-spirv` and `jit-spirv` ease the way you write shaders. Although as game developers, we usually compile a permutation of shader stages for different objects and materials at runtime for the best flexibility; sometimes we *do* want to try out some new ideas and start up dirty. This crate helps you compile GLSL/HLSL shader in your Rust code, or in external files, into SPIR-V; and embed them right inside the binary, so you are freed from all the compilation hassle.\n\n## How to Use\n\nTo inline shader source:\n\n```rust\nuse inline_spirv::include_spirv;\n\nlet spv: \u0026'static [u32] = inline_spirv!(r#\"\n    #version 450 core\n    void main() { gl_Position = vec4(0, 0, 0, 1); }\n\"#, vert);\n```\n\nTo include a external shader source file:\n\n```rust\nuse inline_spirv::include_spirv;\n\nlet spv: \u0026'static [u32] = include_spirv!(\"assets/vert.hlsl\", vert, hlsl, entry=\"Main\");\n```\n\n\u003e Note: File paths consumed by `inline-spirv` are relative to the crate, i.e., the container directory of the project `Cargo.toml`.\n\nTo compile a runtime shader source just-in-time:\n\n```rust\nuse jit_spirv::{jit_spirv, CompilationFeedback};\n\nlet feedback: CompilationFeedback = jit_spirv!(r#\"\n    #version 450\n    layout(binding=0) writeonly buffer _0 { float data[]; };\n    void main() {\n        data[gl_GlobalInvocationID.x] = 1.0;\n    }\n\"#, comp).unwrap();\nlet spv: \u0026[u32] = \u0026feedback.spv;\n```\n\nTo include a precompiled SPIR-V binary:\n\n```rust\nuse inline_spirv::include_spirv;\n\nlet spv: \u0026'static [u32] = include_spirv!(\"assets/vert.spv\");\n```\n\nFor the full list of options please refer to the [documentation](https://docs.rs/inline-spirv).\n\n## Tips\n\nThe macro can be verbose especially you have a bunch of `#include`s, so please be aware of that you can alias and define a more customized macro for yourself:\n\n```rust\nuse inline_spirv::include_spirv as include_spirv_raw;\n\nmacro_rules! include_spirv {\n    ($path:expr, $stage:ident) =\u003e {\n        include_spirv_raw!(\n            $path,\n            $stage, hlsl,\n            entry=\"my_entry_pt\",\n            D VERBOSE_DEFINITION,\n            D ANOTHER_VERBOSE_DEFINITION=\"verbose definition substitution\",\n            I \"long/path/to/include/directory\",\n        )\n    }\n}\n\n// ...\nlet vert: \u0026[u32] = include_spirv!(\"examples/demo/assets/demo.hlsl\", vert);\n```\n\n## License\n\nThis project is licensed under either of\n\n* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpenguinliong%2Finline-spirv-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpenguinliong%2Finline-spirv-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpenguinliong%2Finline-spirv-rs/lists"}