{"id":24096477,"url":"https://github.com/jrachele/wgsl-preprocessor","last_synced_at":"2026-05-17T08:31:21.146Z","repository":{"id":176208181,"uuid":"655139640","full_name":"jrachele/wgsl-preprocessor","owner":"jrachele","description":"Shader preprocessor for WGSL, written in Zig","archived":false,"fork":false,"pushed_at":"2023-06-26T21:06:44.000Z","size":14,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-27T17:32:04.775Z","etag":null,"topics":["bevy","mach","preprocessor","shaders","wgsl","zig"],"latest_commit_sha":null,"homepage":"","language":"Zig","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/jrachele.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":"2023-06-18T02:40:00.000Z","updated_at":"2023-06-24T20:08:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"60875dca-7146-4837-bc31-5f35b6eed683","html_url":"https://github.com/jrachele/wgsl-preprocessor","commit_stats":null,"previous_names":["jrachele/wgsl-preprocessor"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jrachele/wgsl-preprocessor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrachele%2Fwgsl-preprocessor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrachele%2Fwgsl-preprocessor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrachele%2Fwgsl-preprocessor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrachele%2Fwgsl-preprocessor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jrachele","download_url":"https://codeload.github.com/jrachele/wgsl-preprocessor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrachele%2Fwgsl-preprocessor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33131868,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T06:27:06.342Z","status":"ssl_error","status_checked_at":"2026-05-17T06:26:59.432Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["bevy","mach","preprocessor","shaders","wgsl","zig"],"created_at":"2025-01-10T12:55:02.308Z","updated_at":"2026-05-17T08:31:21.127Z","avatar_url":"https://github.com/jrachele.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WGSL Preprocessor\n\nDoes what it says on the tin. Written in Zig.\n\nInspired by Bevy's preprocessor.\n\n## Features\n### Import other files using the `#import` directive\n\n*shader.wgsl*:\n\n```wgsl \n#import \"other_shader.wgsl\"\n\nvar b = 10;\n```\n\n*other_shader.wgsl*:\n\n```wgsl\nvar a = 5;\n```\n\n*Result*:\n\n```wgsl \nvar a = 5;\n\nvar b = 10;\n```\n\n### `#if` directives with conditions at shader compile time\n\n```zig\n// ... somewhere in your Zig code\nconst processed_wgsl = ShaderPreprocessor.process(\"conditional.wgsl\", .{\n    .conditions = .{\n        .full_screen = global.config.full_screen,\n        .mouse_captured = false,\n        .foo = true,\n    }\n});\n```\n\n*conditional.wgsl*:\n\n```wgsl\n#if full_screen\nvar screen_dims = vec2\u003cu32\u003e(1920, 1080);\n#else\nvar screen_dims = vec2\u003cu32\u003e(1280, 720);\n#endif\n\n@compute @workgroup_size(8, 8, 1)\nfn main() {\n    #if mouse_captured\n    // Do something\n    #endif\n\n    #if foo\n    // Do something else\n    #endif \n}\n```\n\n### Constants to inject into the shader at compile time using `#(constant_ident)`\n```zig\n// ... somewhere in your Zig code\nconst processed_wgsl = ShaderPreprocessor.process(\"constants.wgsl\", .{\n    .constants = .{\n        .workgroup_x = app.config.workgroup_size,\n        .workgroup_y = app.config.workgroup_size, \n    }\n});\n```\n\n*constants.wgsl*:\n\n```wgsl\n@compute @workgroup_size(#(workgroup_x), #(workgroup_y), 1)\nfn main() {\n}\n```\n\n### Removing comments and whitespace\nThere are options available for removing comments and whitespace:\n```zig\n// ... somewhere in your Zig code\nconst processed_wgsl = ShaderPreprocessor.process(\"comment.wgsl\", .{\n    .options = .{\n      .remove_comments = true,\n      .remove_whitespace = true,\n    }\n});\n```\n\n*comment.wgsl*:\n\n```wgsl\nvar a = 1;\n/*\n* This is a block comment\n*\n*/\n\nvar b = 2;\n\n// This is a line comment\n// Here's another\n\nvar c = 3;\n// Comment at the end!\n```\n\n*Result with only remove_comments = true*:\n```wgsl\nvar a = 1;\n\nvar b = 2;\n\n\nvar c = 3;\n\n```\n\n*Result with both remove_comments = true and remove_whitespace = true*:\n```wgsl\nvar a = 1;var b = 2;var c = 3;\n```\n\n## Dependencies\n- Mecha - parser combinator library\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjrachele%2Fwgsl-preprocessor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjrachele%2Fwgsl-preprocessor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjrachele%2Fwgsl-preprocessor/lists"}