{"id":20161598,"url":"https://github.com/stablecoder/vksbc","last_synced_at":"2025-03-03T02:43:25.290Z","repository":{"id":99244143,"uuid":"154040982","full_name":"StableCoder/vksbc","owner":"StableCoder","description":"Program that takes in a Vulkan shader SPIR-V program and converts it to uint32_t's that can be used directly in the source code of a program. Can also generate C/C++ headers directly.","archived":false,"fork":false,"pushed_at":"2020-08-06T13:17:51.000Z","size":15,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-13T13:52:29.314Z","etag":null,"topics":["shader","spir-v","vulkan"],"latest_commit_sha":null,"homepage":"","language":"C++","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/StableCoder.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":"2018-10-21T18:45:28.000Z","updated_at":"2024-03-27T08:59:07.000Z","dependencies_parsed_at":"2023-07-15T23:01:05.108Z","dependency_job_id":null,"html_url":"https://github.com/StableCoder/vksbc","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/StableCoder%2Fvksbc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StableCoder%2Fvksbc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StableCoder%2Fvksbc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StableCoder%2Fvksbc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StableCoder","download_url":"https://codeload.github.com/StableCoder/vksbc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241600483,"owners_count":19988713,"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":["shader","spir-v","vulkan"],"created_at":"2024-11-14T00:19:46.918Z","updated_at":"2025-03-03T02:43:25.271Z","avatar_url":"https://github.com/StableCoder.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vulkan Binary Converter\n\n[![pipeline status](https://git.stabletec.com/utilities/vksbc/badges/master/pipeline.svg)](https://git.stabletec.com/utilities/vksbc/commits/master)\n[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://git.stabletec.com/utilities/vksbc/blob/master/LICENSE)\n[![GitHub tag](https://img.shields.io/github/tag/stablecoder/vksbc.svg)](https://git.stabletec.com/utilities/vksbc/commits/master)\n\nThis program is used to convert a SPIR-V binary code file into a set of hexadecimal 4-byte values that can be pasted as an array on unsigned integers in code and used.\n\nThis is meant mostly for embedding non-changing shaders directly into code, mostly for testing purposes.\n\n### Usage\n\nGenerate a Vulkan bytecode file (typically .spv) from a shader using the glslangvalidator program provided with the Vulkan SDK:\n\n```bash\nglslangvalidator -V -o fragShader.frag.spv fragShader.frag\n```\n\nThen, run this program on the output file of the above.\n\n```bash\nvksbc fragShader.frag.spv\n```\n\nA file should have been created, with content similar to this:\n\n```\n0x07230203, 0x00010000, 0x00080001, 0x0000000D, 0x00000000, 0x00020011, 0x00000001, 0x0006000B, \n0x00000001, 0x4C534C47, 0x6474732E, 0x3035342E, 0x00000000, 0x0003000E, 0x00000000, 0x00000001, \n0x0006000F, ...\n```\n\n## C/C++ style headers\n\nNew options allow for genenrating ready-to-use C and C++ style headers, by adding the `--ch` or `--cpph` options to running the program, generated standalone headers with the arrays and required header incudes for use.\n\n```bash\n./vksbc --ch --cpph fragShader.frag.spv\n```\n\n```c\n// C header\n#include \u003cstdint.h\u003e\n\nstatic const uint32_t vk_fragShader_size = 572;\nstatic const uint32_t vk_fragShader[] = {\n    ...\n};\n```\n\n```c++\n// C++ header\n#include \u003carray\u003e\n#include \u003ccstdint\u003e\n\nconstexpr uint32_t vk_fragShader_size = 572;\nconstexpr std::array\u003cuint32_t, 143\u003e vk_fragShader = {\n    ...\n};\n```\n\nUsage of such a header can be as simple as\n```c\n#include \"vk_shader.h\"\n\n...\n\nVkShaderModuleCreateInfo moduleCI = {};\nmoduleCI.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;\nmoduleCI.pCode = vk_fragShader;\nmoduleCI.codeSize = vk_fragShader_size;\n\nVkShaderModule shaderModule;\nvkCreateShaderModule(device, \u0026moduleCI, nullptr, \u0026shaderModule);\n```\n\nAnd it should be ready to be used in the creation of Vulkan shaders in the program.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstablecoder%2Fvksbc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstablecoder%2Fvksbc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstablecoder%2Fvksbc/lists"}