{"id":22661646,"url":"https://github.com/wpmed92/shaderpulse","last_synced_at":"2025-10-29T08:52:37.518Z","repository":{"id":154118964,"uuid":"627428724","full_name":"wpmed92/shaderpulse","owner":"wpmed92","description":"🚧 A work-in-progress GLSL compiler targeting SPIR-V mlir 🚧","archived":false,"fork":false,"pushed_at":"2024-10-18T16:35:51.000Z","size":412,"stargazers_count":22,"open_issues_count":13,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-22T10:40:01.964Z","etag":null,"topics":["compiler","cpp","glsl","llvm","mlir","shaders","spirv"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wpmed92.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2023-04-13T12:56:39.000Z","updated_at":"2025-10-03T03:49:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"9ab4889a-1ca4-4dbd-9235-51c88f788b2b","html_url":"https://github.com/wpmed92/shaderpulse","commit_stats":null,"previous_names":["softwiredtech/shaderpulse","wpmed92/shaderpulse"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wpmed92/shaderpulse","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpmed92%2Fshaderpulse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpmed92%2Fshaderpulse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpmed92%2Fshaderpulse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpmed92%2Fshaderpulse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wpmed92","download_url":"https://codeload.github.com/wpmed92/shaderpulse/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpmed92%2Fshaderpulse/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281592577,"owners_count":26527518,"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","status":"online","status_checked_at":"2025-10-29T02:00:06.901Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["compiler","cpp","glsl","llvm","mlir","shaders","spirv"],"created_at":"2024-12-09T11:18:57.885Z","updated_at":"2025-10-29T08:52:37.444Z","avatar_url":"https://github.com/wpmed92.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ShaderPulse\n\nShaderPulse is an experimental GLSL to SPIR-V dialect frontend. It consists of a lexer, a parser, a semantic analyzer and a code generator. The different parts of the compiler are at different stages of completion. The work is based on the [GLSL 4.60.8 specifications](https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.pdf).\n\n## Lexer\n\nThe lexer takes in the source code in text format and outputs valid GLSL tokens. It supports all the keyword, punctuator, identifier and literal tokens defined in the specs. There are tests for this component in `test/Lexer/LexerTest`.\n\n## Parser\n\nTakes in the token stream generated by the `Lexer` and outputs an Abstract Syntax Tree. It is top-down recursive descent parser. It supports variable declarations, assignments, function declarations, function calls, unary and binary expressions, constructor expressions, member access (incomplete), structs (incomplete), and arrays (incomplete). There is a lot of work to do on this front to match sepcs.\n\n## Analysis\n\nIt supports basic type checking, `break`, `continue`, `case` placement check, function return type checking, `if`/`while`/`do-while` condition type checking. See examples for what is supported in `test/Analysis`. It works based on the visitor pattern, just like code generation. There is a lot of work to do on this front to match sepcs.\n\n## CodeGen\n\nIt takes in the AST generated by the parser, and using the visitor pattern visits the AST constructs and generates code for them. Check `CodeGen/MLIRCodeGen.cpp` for constructs that are supported.\n\nThe compute shader `/example/compute.glsl` compiles to the following `spir-v mlir` code:\n\n```glsl\nlayout(local_size_x = 16, local_size_y = 8, local_size_z = 4) in;\n\nlayout(binding = 0) buffer InputBuffer {\n    float data[];\n};\n\nlayout(binding = 1) buffer OutputBuffer {\n    float result[];\n};\n\nvoid main() {\n    uint index = gl_GlobalInvocationID.x;\n    result[index] = data[index] * 2.0;\n}\n```\n\n```mlir\nspirv.module Logical GLSL450 requires #spirv.vce\u003cv1.0, [Shader], []\u003e {\n  spirv.GlobalVariable @gl_GlobalInvocationID built_in(\"GlobalInvocationId\") : !spirv.ptr\u003cvector\u003c3xui32\u003e, Input\u003e\n  spirv.GlobalVariable @gl_WorkGroupID built_in(\"WorkgroupId\") : !spirv.ptr\u003cvector\u003c3xui32\u003e, Input\u003e\n  spirv.GlobalVariable @gl_WorkGroupSize built_in(\"WorkgroupSize\") : !spirv.ptr\u003cvector\u003c3xui32\u003e, Input\u003e\n  spirv.GlobalVariable @gl_LocalInvocationID built_in(\"LocalInvocationId\") : !spirv.ptr\u003cvector\u003c3xui32\u003e, Input\u003e\n  spirv.GlobalVariable @data {binding = 0 : i32} : !spirv.ptr\u003c!spirv.rtarray\u003cf32\u003e, StorageBuffer\u003e\n  spirv.GlobalVariable @result {binding = 1 : i32} : !spirv.ptr\u003c!spirv.rtarray\u003cf32\u003e, StorageBuffer\u003e\n  spirv.func @main() \"None\" {\n    %gl_GlobalInvocationID_addr = spirv.mlir.addressof @gl_GlobalInvocationID : !spirv.ptr\u003cvector\u003c3xui32\u003e, Input\u003e\n    %0 = spirv.Load \"Input\" %gl_GlobalInvocationID_addr : vector\u003c3xui32\u003e\n    %1 = spirv.CompositeExtract %0[0 : i32] : vector\u003c3xui32\u003e\n    %2 = spirv.Variable : !spirv.ptr\u003cui32, Function\u003e\n    spirv.Store \"Function\" %2, %1 : ui32\n    %result_addr = spirv.mlir.addressof @result : !spirv.ptr\u003c!spirv.rtarray\u003cf32\u003e, StorageBuffer\u003e\n    %3 = spirv.Load \"Function\" %2 : ui32\n    %4 = spirv.AccessChain %result_addr[%3] : !spirv.ptr\u003c!spirv.rtarray\u003cf32\u003e, StorageBuffer\u003e, ui32\n    %data_addr = spirv.mlir.addressof @data : !spirv.ptr\u003c!spirv.rtarray\u003cf32\u003e, StorageBuffer\u003e\n    %5 = spirv.Load \"Function\" %2 : ui32\n    %6 = spirv.AccessChain %data_addr[%5] : !spirv.ptr\u003c!spirv.rtarray\u003cf32\u003e, StorageBuffer\u003e, ui32\n    %cst_f32 = spirv.Constant 2.000000e+00 : f32\n    %7 = spirv.Load \"StorageBuffer\" %6 : f32\n    %8 = spirv.FMul %7, %cst_f32 : f32\n    spirv.Store \"StorageBuffer\" %4, %8 : f32\n    spirv.Return\n  }\n  spirv.ExecutionMode @main \"LocalSize\", 16, 8, 4\n  spirv.EntryPoint \"GLCompute\" @main, @gl_GlobalInvocationID, @result, @data\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwpmed92%2Fshaderpulse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwpmed92%2Fshaderpulse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwpmed92%2Fshaderpulse/lists"}