{"id":15049197,"url":"https://github.com/permutationlock/vulkan_triangle","last_synced_at":"2026-04-10T10:32:15.273Z","repository":{"id":242964137,"uuid":"810784859","full_name":"permutationlock/vulkan_triangle","owner":"permutationlock","description":"A no dependency cross-compile friendly Vulkan triangle in C","archived":false,"fork":false,"pushed_at":"2024-06-27T12:19:03.000Z","size":1305,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-03T07:13:56.418Z","etag":null,"topics":["c11","c99","cproc","cross-compile","glfw3","mingw-w64","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-0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/permutationlock.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.MIT","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":"2024-06-05T10:54:48.000Z","updated_at":"2024-09-19T19:51:56.000Z","dependencies_parsed_at":"2024-06-05T23:49:39.766Z","dependency_job_id":"2d55b7bd-d014-48a4-83c7-ddd9f551b31a","html_url":"https://github.com/permutationlock/vulkan_triangle","commit_stats":null,"previous_names":["permutationlock/vulkan_hello_triangle_c99","permutationlock/vulkan_triangle"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/permutationlock/vulkan_triangle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/permutationlock%2Fvulkan_triangle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/permutationlock%2Fvulkan_triangle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/permutationlock%2Fvulkan_triangle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/permutationlock%2Fvulkan_triangle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/permutationlock","download_url":"https://codeload.github.com/permutationlock/vulkan_triangle/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/permutationlock%2Fvulkan_triangle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31638442,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T07:40:12.752Z","status":"ssl_error","status_checked_at":"2026-04-10T07:40:11.664Z","response_time":98,"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":["c11","c99","cproc","cross-compile","glfw3","mingw-w64","vulkan"],"created_at":"2024-09-24T21:19:01.977Z","updated_at":"2026-04-10T10:32:15.242Z","avatar_url":"https://github.com/permutationlock.png","language":"C","readme":"# A basic Vulkan application in C99 (or later)\n\nA C implementation of a simple rotating anti-aliased square based on\nthe [Vulkan Tutorial][10]. There are a few significant changes from the\ntutorial:\n\n - Vulkan 1.3 direct rendering is used in lieu of render pass objects;\n - the [volk][11] dynamic loader is used in lieu of directly linking\n   the `libvulkan.so` shared library.\n\nThe coding style and project organization was inpsired by [Zig][21],\n[Chris Wellons' blog][18], and [raylib][19].\n\n## Requirements\n\nTo build the project you will need a C compiler that supports C99 or later,\nas well as a [GLSL][5] to [SPIR-V][6] compiler.\nThe project supports Linux and Windows targets.\nThere are **ZERO** build dependencies beyond a `libc` for your target.\n\nThe project vendors and builds [volk][11], a slightly modified version\nof [GLFW][2], and optionally [winpthreads][23]. Also included are headers for\n[Vulkan][3], [xkbcommon][17], [X11][22], [Wayland][13], and the\n[Wayland protocols][14].\n\nTo run the application you will need the [Vulkan loader][4]\nand a Vulkan driver for your graphics card. To run executables built with\n`ENABLE_VALIDATION_LAYERS` defined (which is the case in the default `CFLAGS`)\nyou will need to have the [Vulkan validation layers][12] installed as well.\n\nTo run on Linux you will also need either an [X11][22] server or a\n[Wayland][13] compositor, along with the corresponding shared libraries.\n\n## Building\n\nThe project builds with a single simple `Makefile`.\n\n### Building on Linux\n\nBy default `make` will build a debug app with [gcc][7] as the C compiler and\n[glslc][8] as the shader compiler.\n\n```\nmake -j5\n./vulkan_app\n```\n\nTo use a different compiler you can modify the appropriate environment\nvariable.\n\n```\nmake CC=\"clang\" -j5\n./vulkan_app\n```\n\nWith a little define hack to wrangle the glibc headers, you can even\nbuild an application using the awesome and simple [cproc][1] compiler[^1].\n\n```\nmake CC=\"cproc\" CFLAGS=\"-D\\\"__attribute__(x)=\\\"\" \\\n    GLFW_FLAGS=\"-D\\\"__attribute__(x)=\\\"\" -j5\n./vulkan_app\n```\n\nYou can easily cross-compile a Windows application from Linux with the\n[Mingw-w64][9] toolchain.\n\n```\nmake CC=\"x86_64-w64-mingw32-gcc\" CFLAGS=\"-std=c99 -O2\" LDFLAGS=\"-mwindows\" \\\n    GLFW_CFLAGS=\"-std=c99 -O2 -DNDEBUG\" \\\n    SHADERFLAGS=\"--target-env=vulkan1.3 -O\" -j5\n```\n\nYou can also cross-compile a Windows application with [zig cc][21] (or any\nclang toolchain with a Windows Mingw target).\n\n```\nmake LOCALWINPTHREADS=\"YES\" CC=\"zig cc -target x86_64-windows-gnu\" \\\n    LDFLAGS=\"-lkernel32 -luser32 -lgdi32 -Wl,--subsystem,windows\"\n```\n\n### Building on Windows\n\nOn a Windows machine you can compile an application with [Mingw-w64][9].\n\n```\nmake CFLAGS=\"-std=c99 -O2\" GLFW_CFLAGS=\"-std=c99 -O2 -DNDEBUG\" \\\n    LDFLAGS=\"-mwindows\" SHADERFLAGS=\"--target-env=vulkan1.3 -O\" -j5\n./vulkan_app.exe\n```\n\nYou can also build a Windows app with [Zig][21].\n\n```\nmake LOCALWINPTHREADS=\"YES\" CC=\"zig cc\" \\\n    LDLFAGS=\"-lkernel32 -luser32 -lgdi32 -Wl,--subsystem,windows\"\nmv vulkan_app vulkan_app.exe\n./vulkan_app.exe\n```\n\nYou can also cross-compile a Linux application from Windows.\n\n```\nmake CC=\"zig cc -target x86_64-linux-gnu\" CFLAGS=\"-std=c99 -O2\" \\\n    GLFW_CFLAGS=\"-std=c99 -O2 -DNDEBUG\" \\\n    SHADERFLAGS=\"--target-env=vulkan1.3 -O\" -j5\n```\n\n[^1]: A [small patch][15] to [QBE][16] is required to increase the maximum\n    identifier length.\n\n[1]: https://sr.ht/~mcf/cproc/\n[2]: https://github.com/glfw/glfw\n[3]: https://github.com/KhronosGroup/Vulkan-Headers\n[4]: https://github.com/KhronosGroup/Vulkan-Loader\n[5]: https://www.khronos.org/opengl/wiki/Core_Language_(GLSL)\n[6]: https://registry.khronos.org/SPIR-V/\n[7]: https://gcc.gnu.org/\n[8]: https://github.com/google/shaderc\n[9]: https://www.mingw-w64.org/\n[10]: https://vulkan-tutorial.com/Drawing_a_triangle/Setup/Base_code\n[11]: https://github.com/zeux/volk\n[12]: https://github.com/KhronosGroup/Vulkan-ValidationLayers\n[13]: https://gitlab.freedesktop.org/wayland/wayland\n[14]: https://gitlab.freedesktop.org/wayland/wayland-protocols\n[15]: https://musing.permutationlock.com/static/qbe_identifier_len_expansion.patch\n[16]: https://c9x.me/compile/\n[17]: https://github.com/xkbcommon/libxkbcommon\n[18]: https://nullprogram.com\n[19]: https://github.com/raysan5/raylib\n[20]: https://clang.llvm.org/\n[21]: https://ziglang.org/\n[22]: https://www.x.org/wiki/\n[23]: https://github.com/mingw-w64/mingw-w64/tree/master/mingw-w64-libraries/winpthreads\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpermutationlock%2Fvulkan_triangle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpermutationlock%2Fvulkan_triangle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpermutationlock%2Fvulkan_triangle/lists"}