{"id":16254306,"url":"https://github.com/celer/gshaderc","last_synced_at":"2026-04-30T10:10:11.903Z","repository":{"id":57509301,"uuid":"232678938","full_name":"celer/gshaderc","owner":"celer","description":"Golang API for Shaderc - or to allow shader compilation in Golang (SPIRV / SPR)","archived":false,"fork":false,"pushed_at":"2020-01-09T01:49:47.000Z","size":45,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-14T09:23:54.458Z","etag":null,"topics":["golang","opengl","spirv","vulkan"],"latest_commit_sha":null,"homepage":null,"language":"Go","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/celer.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":"2020-01-08T23:16:06.000Z","updated_at":"2022-07-24T16:58:06.000Z","dependencies_parsed_at":"2022-08-30T07:11:12.553Z","dependency_job_id":null,"html_url":"https://github.com/celer/gshaderc","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/celer%2Fgshaderc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/celer%2Fgshaderc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/celer%2Fgshaderc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/celer%2Fgshaderc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/celer","download_url":"https://codeload.github.com/celer/gshaderc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247847611,"owners_count":21006100,"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":["golang","opengl","spirv","vulkan"],"created_at":"2024-10-10T15:21:02.605Z","updated_at":"2026-04-30T10:10:06.849Z","avatar_url":"https://github.com/celer.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GoDoc](https://godoc.org/github.com/celer/gshaderc?status.svg)](https://godoc.org/github.com/celer/gshaderc) [![Go Report Card](https://goreportcard.com/badge/github.com/celer/gshaderc)](https://goreportcard.com/report/github.com/celer/gshaderc)\n\n# Introduction\n\nGshaderc is a golang wrapper to for https://github.com/google/shaderc. It's a pretty straight forward mapping of the C API\n\nThe goal in providing this wrapper primarily is for allowing golang Vulkan applications to compile shaders as need.\n\n# Getting started\n\n * You'll need to install and compile https://github.com/google/shaderc [1]\n * go get -u github.com/celer/gshaderc\n\n\n# Examples\n\nHere is the simplest example:\n\n```go\nsource := \"#version 450\\nvoid main() {}\"\n// This will assume you're targeting Vulkan, with an entry point of 'main' and infers the shader type based upon filename\ndata, err := CompileShader(source, \"main.vert\", \"\")\n\n```\n\nHere is a more complex example:\n\n```go\noptions := gs.NewCompilerOptions()\ndefer options.Release()\ncompiler := gs.NewCompiler()\ndefer compiler.Release()\ndata, err := ioutil.ReadFile(*input)\n\nif err != nil {\n\tpanic(err)\n}\n\noptions.SetOptimizationLevel(gs.Performance)\n\nresult := compiler.CompileIntoSPV(string(data), shaderType, filename, entryPoint, options)\ndefer result.Release()\n\nif result.Error() == nil {\n\terr := ioutil.WriteFile(\"output\", result.Bytes(), 0644)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n} else {\n\tpanic(result.Error())\n}\n\n```\n\n# Tools\n\nThere cmd/gsc.go is a tool to either manually or automatically compile shaders based off of changes. The default output name is to \nappend .spv to compile files, and it will look for the extensions .vert, .frag, .comp, .tesc, .geom and .tese and automatically compile\nthese files into shaders for the given target when they change.\n\n```console\nceler@bear:~/go/src/github.com/celer/vkg/examples/sdf$ gsc -watch shaders/\n2020/01/08 18:35:23 watching directory shaders/ for changes\nshaders/sdf.comp:336: error: '' :  syntax error, unexpected INT, expecting COMMA or SEMICOLON\n2020/01/08 18:35:26 error compiling shader 'shaders/sdf.comp': compilation error\nshaders/sdf.comp:336: error: '' :  syntax error, unexpected INT, expecting COMMA or SEMICOLON\n2020/01/08 18:35:26 error compiling shader 'shaders/sdf.comp': compilation error\nshaders/sdf.comp:336: error: '' :  syntax error, unexpected INT, expecting COMMA or SEMICOLON\n2020/01/08 18:35:26 error compiling shader 'shaders/sdf.comp': compilation error\nshaders/sdf.comp:341: error: '' :  syntax error, unexpected SEMICOLON, expecting LEFT_PAREN\n2020/01/08 18:35:27 error compiling shader 'shaders/sdf.comp': compilation error\n2020/01/08 18:35:27 compiled shaders/sdf.comp -\u003e shaders/sdf.comp.spv\n```\n\nSee cmd/gsc.go for a basic example\n\n# Foot notes\n\n[1] Tested against commit 0b9a2992c73d41debe4924d9f39260f773b5840a\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fceler%2Fgshaderc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fceler%2Fgshaderc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fceler%2Fgshaderc/lists"}