{"id":17169663,"url":"https://github.com/swiftcoder/spirv-struct-layout","last_synced_at":"2025-04-13T16:06:29.100Z","repository":{"id":57668140,"uuid":"230534700","full_name":"swiftcoder/spirv-struct-layout","owner":"swiftcoder","description":null,"archived":false,"fork":false,"pushed_at":"2020-08-01T18:22:50.000Z","size":23,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"trunk","last_synced_at":"2025-02-05T21:00:18.910Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://crates.io/crates/spirv-struct-layout","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/swiftcoder.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}},"created_at":"2019-12-27T23:57:16.000Z","updated_at":"2020-11-25T06:53:55.000Z","dependencies_parsed_at":"2022-09-07T15:50:33.089Z","dependency_job_id":null,"html_url":"https://github.com/swiftcoder/spirv-struct-layout","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swiftcoder%2Fspirv-struct-layout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swiftcoder%2Fspirv-struct-layout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swiftcoder%2Fspirv-struct-layout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swiftcoder%2Fspirv-struct-layout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swiftcoder","download_url":"https://codeload.github.com/swiftcoder/spirv-struct-layout/tar.gz/refs/heads/trunk","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240100514,"owners_count":19747683,"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":"2024-10-14T23:26:58.610Z","updated_at":"2025-02-23T16:33:20.243Z","avatar_url":"https://github.com/swiftcoder.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spirv-struct-layout\n\nAttempts to ensure that a rust struct used as a uniform buffer matches the layout of the struct declared in spirv.\n\nUsage example:\n```\nuse spirv_struct_layout::{CheckSpirvStruct, SpirvLayout};\n\n#[repr(C)]\n#[derive(SpirvLayout)]\nstruct Uniforms {\n    model_view: [f32; 16],\n    light_dir: [f32; 3],\n    // _padding: f32, // uncomment this line, and the alignment will match the spirv\n    position: [f32; 4],\n}\n\n\nfn main() {\n    let spirv = Vec::from(cast_slice(include_bytes!(\"simple.frag.spv\")));\n\n    Uniforms::check_spirv_layout(\"buf\", spirv);\n}\n```\n\nWhich fails like so, becuase SPIR-V mandates that vec3 is aligned to 16 bytes:\n```\nThe application panicked (crashed).\nMessage:  assertion failed: `(left == right)`\n  left: `80`,\n right: `76`: field buf.position should have an offset of 80 bytes, but was 76 bytes\nLocation: spirv_struct_layout/examples/simple/main.rs:19\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswiftcoder%2Fspirv-struct-layout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswiftcoder%2Fspirv-struct-layout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswiftcoder%2Fspirv-struct-layout/lists"}