{"id":24746443,"url":"https://github.com/Rust-GPU/cargo-gpu","last_synced_at":"2025-10-10T14:32:53.508Z","repository":{"id":260875398,"uuid":"874957141","full_name":"Rust-GPU/cargo-gpu","owner":"Rust-GPU","description":"Command line tool for building Rust shaders using rust-gpu","archived":false,"fork":false,"pushed_at":"2025-01-27T18:50:55.000Z","size":166,"stargazers_count":18,"open_issues_count":11,"forks_count":6,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-01-27T19:51:06.646Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rust-GPU.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-10-18T19:25:39.000Z","updated_at":"2025-01-27T18:51:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"b98f88cc-52b2-4ae3-8457-fb131d0c4581","html_url":"https://github.com/Rust-GPU/cargo-gpu","commit_stats":null,"previous_names":["rust-gpu/cargo-gpu"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rust-GPU%2Fcargo-gpu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rust-GPU%2Fcargo-gpu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rust-GPU%2Fcargo-gpu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rust-GPU%2Fcargo-gpu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rust-GPU","download_url":"https://codeload.github.com/Rust-GPU/cargo-gpu/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235960287,"owners_count":19072728,"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":[],"created_at":"2025-01-28T04:07:04.964Z","updated_at":"2025-10-10T14:32:43.495Z","avatar_url":"https://github.com/Rust-GPU.png","language":"Rust","readme":"# cargo-gpu\n\nCommand line tool for building Rust shaders using rust-gpu.\n\n## Getting Started\n\n### Installation\n\nTo install the tool ensure you have `rustup`. Then run:\n\n```\ncargo install --git https://github.com/rust-gpu/cargo-gpu\n```\n\nAfter that you can use `cargo gpu` to compile your shader crates with:\n\n```\ncargo gpu build\n```\n\nThis plain invocation will compile the crate in the current directory and\nplace the compiled shaders in the current directory.\n\nUse `cargo gpu help` to see other options :)\n\n### Next Steps\n\nYou can try this out using the example repo at \u003chttps://github.com/rust-GPU/shader-crate-template\u003e.\nKeep in mind \u003chttps://github.com/rust-GPU/shader-crate-template\u003e is _not_ yet a cargo generate template,\nit's just a normal repo.\n\n```\ngit clone https://github.com/rust-GPU/shader-crate-template\ncd shader-crate-template\ncargo gpu build\n```\n\n## How it works\n\nBehind the scenes `cargo gpu` compiles a custom [codegen backend](https://doc.rust-lang.org/beta/unstable-book/compiler-flags/codegen-backend.html)\nfor `rustc` that allows emitting [SPIR-V](https://www.khronos.org/spir/) assembly, instead of the conventional LLVM assembly. SPIR-V is a dedicated\ngraphics language that is aimed to be open and portable so that it works with as many drivers and devices as possible.\n\nWith the custom codegen backend (`rustc_codegen_spirv`) `cargo gpu` then compiles the shader it is pointed to. However, because custom codegen backends\nare currently [an unstable feature](https://github.com/rust-lang/rust/issues/77933), `cargo gpu` also needs to install a \"nightly\" version of Rust. In\nthe usage instructions the backend and nightly Rust version are referred to as \"artefacts\" and can be explicitly managed with the arguments to the\n`install` subcommand.\n\n\u003e [!TIP]\n\u003e Whilst `cargo gpu` attempts to isolate shader compilation as much possible, if the shader crate is contained in a workspace then it's possible that\n\u003e the nightly version required by the shader is, ironically, older than the Rust/Cargo versions required by the workspace. Say for instance the\n\u003e workspace might use a newer `Cargo.lock` layout not supported by the pinned version of the shader crate's custom codegen backend. The solution to\n\u003e this is to either exclude the shader from the workspace, or upgrade the shader's `spirv-std` dependency to the latest.\n\n## Usage\n\nAll the following arguments for the `build` and `install` commands can also be set in the shader crate's `Cargo.toml`\nfile. In general usage that would be the recommended way to set config. See `crates/shader-crate-template/Cargo.toml`\nfor an example.\n\n````\n  Commands:\n    install  Install rust-gpu compiler artifacts\n    build    Compile a shader crate to SPIR-V\n    show     Show some useful values\n    help     Print this message or the help of the given subcommand(s)\n\n  Options:\n    -h, --help\n            Print help\n\n    -V, --version\n            Print version\n\n\n* Install\n  Install rust-gpu compiler artifacts\n\n  Usage: cargo-gpu install [OPTIONS]\n\n  Options:\n        --shader-crate \u003cSHADER_CRATE\u003e\n            Directory containing the shader crate to compile\n\n            [default: ./]\n\n        --spirv-builder-source \u003cSPIRV_BUILDER_SOURCE\u003e\n            Source of `spirv-builder` dependency Eg: \"https://github.com/Rust-GPU/rust-gpu\"\n\n        --spirv-builder-version \u003cSPIRV_BUILDER_VERSION\u003e\n            Version of `spirv-builder` dependency.\n            * If `--spirv-builder-source` is not set, then this is assumed to be a crates.io semantic\n              version such as \"0.9.0\".\n            * If `--spirv-builder-source` is set, then this is assumed to be a Git \"commitsh\", such\n              as a Git commit hash or a Git tag, therefore anything that `git checkout` can resolve.\n\n        --rust-toolchain \u003cRUST_TOOLCHAIN\u003e\n            Rust toolchain channel to use to build `spirv-builder`.\n\n            This must be compatible with the `spirv_builder` argument as defined in the `rust-gpu` repo.\n\n        --force-spirv-cli-rebuild\n            Force `spirv-builder-cli` and `rustc_codegen_spirv` to be rebuilt\n\n        --auto-install-rust-toolchain\n            Assume \"yes\" to \"Install Rust toolchain: [y/n]\" prompt\n\n    -h, --help\n            Print help (see a summary with '-h')\n\n\n* Build\n  Compile a shader crate to SPIR-V\n\n  Usage: cargo-gpu build [OPTIONS]\n\n  Options:\n        --shader-crate \u003cSHADER_CRATE\u003e\n            Directory containing the shader crate to compile\n\n            [default: ./]\n\n        --spirv-builder-source \u003cSPIRV_BUILDER_SOURCE\u003e\n            Source of `spirv-builder` dependency Eg: \"https://github.com/Rust-GPU/rust-gpu\"\n\n        --spirv-builder-version \u003cSPIRV_BUILDER_VERSION\u003e\n            Version of `spirv-builder` dependency.\n            * If `--spirv-builder-source` is not set, then this is assumed to be a crates.io semantic\n              version such as \"0.9.0\".\n            * If `--spirv-builder-source` is set, then this is assumed to be a Git \"commitsh\", such\n              as a Git commit hash or a Git tag, therefore anything that `git checkout` can resolve.\n\n        --rust-toolchain \u003cRUST_TOOLCHAIN\u003e\n            Rust toolchain channel to use to build `spirv-builder`.\n\n            This must be compatible with the `spirv_builder` argument as defined in the `rust-gpu` repo.\n\n        --force-spirv-cli-rebuild\n            Force `spirv-builder-cli` and `rustc_codegen_spirv` to be rebuilt\n\n        --auto-install-rust-toolchain\n            Assume \"yes\" to \"Install Rust toolchain: [y/n]\" prompt\n\n    -o, --output-dir \u003cOUTPUT_DIR\u003e\n            Path to the output directory for the compiled shaders\n\n            [default: ./]\n\n        --no-default-features\n            Set cargo default-features\n\n        --features \u003cFEATURES\u003e\n            Set cargo features\n\n        --target \u003cTARGET\u003e\n            `rust-gpu` compile target\n\n            [default: spirv-unknown-vulkan1.2]\n\n        --shader-target \u003cSHADER_TARGET\u003e\n            Shader target\n\n            [default: spirv-unknown-vulkan1.2]\n\n        --deny-warnings\n            Treat warnings as errors during compilation\n\n        --debug\n            Compile shaders in debug mode\n\n        --capability \u003cCAPABILITY\u003e\n            Enables the provided SPIR-V capabilities. See: `impl core::str::FromStr for spirv_builder::Capability`\n\n        --extension \u003cEXTENSION\u003e\n            Enables the provided SPIR-V extensions. See \u003chttps://github.com/KhronosGroup/SPIRV-Registry\u003e for all extensions\n\n        --multimodule\n            Compile one .spv file per entry point\n\n        --spirv-metadata \u003cSPIRV_METADATA\u003e\n            Set the level of metadata included in the SPIR-V binary\n\n            [default: none]\n\n        --relax-struct-store\n            Allow store from one struct type to a different type with compatible layout and members\n\n        --relax-logical-pointer\n            Allow allocating an object of a pointer type and returning a pointer value from a function in logical addressing mode\n\n        --relax-block-layout\n            Enable `VK_KHR_relaxed_block_layout` when checking standard uniform, storage buffer, and push constant layouts. This is the default when targeting Vulkan 1.1 or later\n\n        --uniform-buffer-standard-layout\n            Enable `VK_KHR_uniform_buffer_standard_layout` when checking standard uniform buffer layouts\n\n        --scalar-block-layout\n            Enable `VK_EXT_scalar_block_layout` when checking standard uniform, storage buffer, and push constant layouts. Scalar layout rules are more permissive than relaxed block layout so in effect this will override the --relax-block-layout option\n\n        --skip-block-layout\n            Skip checking standard uniform / storage buffer layout. Overrides any --relax-block-layout or --scalar-block-layout option\n\n        --preserve-bindings\n            Preserve unused descriptor bindings. Useful for reflection\n\n    -h, --help\n            Print help (see a summary with '-h')\n\n\n* Show\n  Show some useful values\n\n  Usage: cargo-gpu show \u003cCOMMAND\u003e\n\n  Commands:\n    cache-directory  Displays the location of the cache directory\n    spirv-source     The source location of spirv-std\n    help             Print this message or the help of the given subcommand(s)\n\n  Options:\n    -h, --help\n            Print help\n\n\n        * Cache-directory\n          Displays the location of the cache directory\n\n          Usage: cargo-gpu show cache-directory\n\n          Options:\n            -h, --help\n                    Print help\n\n\n        * Spirv-source\n          The source location of spirv-std\n\n          Usage: cargo-gpu show spirv-source [OPTIONS]\n\n          Options:\n                --shader-crate \u003cSHADER_CRATE\u003e\n                    The location of the shader-crate to inspect to determine its spirv-std dependency\n\n                    [default: ./]\n\n            -h, --help\n                    Print help\n````\n","funding_links":[],"categories":["Rust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRust-GPU%2Fcargo-gpu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRust-GPU%2Fcargo-gpu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRust-GPU%2Fcargo-gpu/lists"}