{"id":19198858,"url":"https://github.com/rustgd/glsl-layout","last_synced_at":"2025-04-04T19:10:44.850Z","repository":{"id":49380755,"uuid":"132515050","full_name":"rustgd/glsl-layout","owner":"rustgd","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-28T16:04:43.000Z","size":73,"stargazers_count":24,"open_issues_count":6,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-03T11:53:21.337Z","etag":null,"topics":["glsl","rust"],"latest_commit_sha":null,"homepage":null,"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/rustgd.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2018-05-07T20:50:26.000Z","updated_at":"2025-01-28T16:04:46.000Z","dependencies_parsed_at":"2025-02-15T15:20:16.969Z","dependency_job_id":"a66b7bf7-c385-4c73-a786-6fe54b9751e0","html_url":"https://github.com/rustgd/glsl-layout","commit_stats":{"total_commits":49,"total_committers":6,"mean_commits":8.166666666666666,"dds":0.4285714285714286,"last_synced_commit":"91b23f6d225cef2da360100cfb88e9ecea0ca5c9"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustgd%2Fglsl-layout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustgd%2Fglsl-layout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustgd%2Fglsl-layout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustgd%2Fglsl-layout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rustgd","download_url":"https://codeload.github.com/rustgd/glsl-layout/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247234921,"owners_count":20905854,"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","rust"],"created_at":"2024-11-09T12:24:30.286Z","updated_at":"2025-04-04T19:10:44.828Z","avatar_url":"https://github.com/rustgd.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# GLSL-LAYOUT\n\nThis crates provides data types and traits to build structures ready to upload into UBO.\n\n## Usage\n\nDeriving `Uniform` with proc-macro will produce associated type `Std140`\nwith same data layout as uniform blocks declared with `layout(std140)`.\nAll members of structure that derives `Uniform` must implement `Uniform` as well.\n\nImplementing `Uniform` should be done via deriving.\nImplementing it manually is possible.\nIt requires to provide associated type `Std140` which must implement `Std140` trait.\nBut trait `Std140` is marked unsafe so be careful.\n\nTrait `Uniform` also requires `Copy`.\n\nTypical usage scenario is:\n```rust\n#[derive(Copy, Clone, Uniform)]\nstruct FragmentArgs {\n    pos: vec3,\n    dir: vec3,\n    count: uint,\n}\n\nwrite_to_buffer(\u0026FragmentArgs {\n    pos: [0.0, 1.0, 2.0].into(),\n    dir: [3.0, 4.0, 5.0].into(),\n    count: 42,\n}.std140());\n\n```\n\n### Data types\n\nThere are basic data types from glsl:\n* boolean (name `bool` is already occupied)\n* int\n* uint\n* float\n* double\n\nAlso more complex types:\n* vectors   - (vec2, vec3, vec4, bvec2, ivec2, uvec2, dvec2 etc)\n* matrices  - (mat2x3, dmat4 etc)\n* arrays    - \n\n## License\n\n`glsl-layout` is free and open source software distributed under the terms of both\nthe [MIT License][lm] and the [Apache License 2.0][la].\n\n[lm]: LICENSE-MIT\n[la]: LICENSE-APACHE\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any\nadditional terms or conditions.\n\n## Known issues\n\n### On MacOS\nIf uniform block contains array of structures and this array accessed with dynamic index (variable instead of literal)\nit may load wrong bytes for members not aligned to size of `vec4` (16 bytes). In this case manual padding can be the fix.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frustgd%2Fglsl-layout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frustgd%2Fglsl-layout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frustgd%2Fglsl-layout/lists"}