{"id":15047677,"url":"https://github.com/bv7dev/wgpu-lab","last_synced_at":"2025-04-10T01:05:56.023Z","repository":{"id":257164600,"uuid":"827174725","full_name":"bv7dev/wgpu-lab","owner":"bv7dev","description":"Library for rapid prototyping of native WebGPU Apps in C++ using Dawn","archived":false,"fork":false,"pushed_at":"2024-11-06T23:05:07.000Z","size":1939,"stargazers_count":45,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T01:05:47.082Z","etag":null,"topics":["cpp20","dawn","glfw3","graphics-programming","library","rapid-prototyping","webgpu","wgsl-shader"],"latest_commit_sha":null,"homepage":"https://github.com/bv7dev/wgpu-lab","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/bv7dev.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":"2024-07-11T06:35:17.000Z","updated_at":"2025-04-08T23:07:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"605532ad-ab94-4d5c-a2bb-2c733b8fcf9b","html_url":"https://github.com/bv7dev/wgpu-lab","commit_stats":null,"previous_names":["bv7dev/wgpu-lab"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bv7dev%2Fwgpu-lab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bv7dev%2Fwgpu-lab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bv7dev%2Fwgpu-lab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bv7dev%2Fwgpu-lab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bv7dev","download_url":"https://codeload.github.com/bv7dev/wgpu-lab/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137888,"owners_count":21053775,"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":["cpp20","dawn","glfw3","graphics-programming","library","rapid-prototyping","webgpu","wgsl-shader"],"created_at":"2024-09-24T21:02:48.997Z","updated_at":"2025-04-10T01:05:56.002Z","avatar_url":"https://github.com/bv7dev.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WebGPU Lab\nwgpu-lab is a library designed for rapid prototyping of native WebGPU applications in C++.\nIts main goal is to provide convenient wrappers and intuitive tools for working with\n[WebGPU Dawn](https://dawn.googlesource.com/dawn),\nminimizing boilerplate code while remaining flexible and customizable.\n\nI’m developing this library in my free time as I learn the fundamentals of WebGPU.\nMy hope is that it will serve the open source community as a useful resource for learning\nand as a foundation for building creative projects.\n\nPlease note that wgpu-lab is in an early, heavily experimental stage,\nand the API is likely to undergo significant changes.\n\n**Contributions are welcome!**\n\n\n## Simple Usage Sample \n```c++\n#include \u003clab\u003e\n\nstruct MyVertexFormat {\n  float pos[2];\n  float color[3];\n};\n\nint main() {\n  lab::Webgpu webgpu(\"My WebGPU Context\");\n  lab::Shader shader(\"My Shader\", \"shaders/draw_colored.wgsl\");\n\n  lab::Pipeline pipeline(shader, webgpu); // the rendering pipeline\n\n  // colored triangle data\n  std::vector\u003cMyVertexFormat\u003e vertex_data = {\n      //         X      Y                R     G     B\n      {.pos = {-0.5f, -0.5f}, .color = {0.8f, 0.2f, 0.2f}},\n      {.pos = {+0.5f, -0.5f}, .color = {0.8f, 0.8f, 0.2f}},\n      {.pos = {+0.0f, +0.5f}, .color = {0.2f, 0.8f, 0.4f}},\n  };\n\n  // vertex buffer (sends copy of data to GPU memory)\n  lab::Buffer vertex_buffer(\"My Vertex Buffer\", vertex_data, webgpu);\n\n  // pipeline needs to know about buffers and their memory layouts (vertex attributes)\n  pipeline.add_vertex_buffer(vertex_buffer);\n  pipeline.add_vertex_attrib(wgpu::VertexFormat::Float32x2, 0); // position\n  pipeline.add_vertex_attrib(wgpu::VertexFormat::Float32x3, 1); // color\n  pipeline.finalize();                                          // make ready for rendering\n\n  lab::Window window(\"Hello Triangle\", 640, 400);\n\n  lab::Surface surface(window, webgpu); // surface to render onto\n\n  // main application loop\n  while (lab::tick()) {\n    pipeline.render_frame(surface, 3, 1); // 3 vertices, 1 instance\n  }\n}\n```\n\n\n## Getting Started\n\n### Windows\n\n**Setup:**\n1. Install [Visual Studio](https://visualstudio.microsoft.com/vs/community/) for MSVC compiler and CMake, or a C++ compiler and build tools of your choice (configure it yourself and feel free to share your setup by creating an issue or a pull request)\n1. Install [VS Code](https://code.visualstudio.com/) (optional - this project is configured to work well within VS Code)  \n   open VS Code and install recommended extensions (a pop-up should appear)  \n   look into the extensions tab to see if `C/C++`, `CMake` and `CMake Tools` are installed \n1. Install [Python](https://www.python.org/downloads/) which is required to download dependencies in wgpu-lab and dawn\n\n**Build:**\n1. Clone this repository:\n   ```sh\n   git clone https://github.com/bv7dev/wgpu-lab.git\n   ```\n   or alternatively, download a release build\n1. Open the cloned directory or the unzipped release in VS Code (File -\u003e Open Folder...)\n1. Hit the `⚙ Build` button in Code's bottom toolbar (provided by `CMake Tools` extension) or use `CMake` manually to configure and build\n\nThe first build takes a long time for downloading, generating and building dawn.\n\n### Linux (coming soon)\n\n### Mac (help wanted)\n\n**Run sample executables:**\n\nFor VS Code users, there's a shared `.vscode/launch.json` configuration file.\nThis setup allows you to build and run any `.cpp` source file that's located in the `samples/` directory,\nsimply by opening it in the editor and pressing `F5`. This runs the code in debug mode (set breakpoints and step through the code to learn how it works).\n\nTo get started, you can add your own `.cpp` file, tinker around and step through the code. Use CMake Tools to reconfigure the project after adding new files.\n\n### Dependencies\nThe library currently only depends on [WebGPU Dawn](https://dawn.googlesource.com/dawn) and uses\n[GLFW](https://www.glfw.org/) for windowing, which already comes included with dawn.\nwgpu-lab also makes heavy use of the C++ STL (see `src/extra/lab_public.h`).\nHowever, to build all of the sample executables, the libraries\n[GLM](https://github.com/g-truc/glm) and [tinygltf](https://github.com/syoyo/tinygltf)\nare also included.\n\n\n## Roadmap\n- [x] address build system issues\n- [ ] re-design render pipeline (too chaotic at the moment)\n- [ ] replace render_frame() function by smaller, composable mechanisms\n- [ ] add compute pipeline support\n- [ ] add emscripten support for WebAssembly\n- [ ] unify and finalize lab API \n- [ ] write documentation and tests \n- [ ] release stable 1.0 version\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbv7dev%2Fwgpu-lab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbv7dev%2Fwgpu-lab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbv7dev%2Fwgpu-lab/lists"}