{"id":18133140,"url":"https://github.com/cemderv/cppgfx","last_synced_at":"2025-04-06T16:20:38.932Z","repository":{"id":258173842,"uuid":"860576946","full_name":"cemderv/cppgfx","owner":"cemderv","description":"CPU-based graphics library for C++","archived":false,"fork":false,"pushed_at":"2024-09-20T17:57:40.000Z","size":459,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-17T22:56:44.321Z","etag":null,"topics":["cpp","graphics","modern-cpp","software-rendering"],"latest_commit_sha":null,"homepage":"https://dervis.de/cppgfx.html","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/cemderv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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-09-20T17:42:05.000Z","updated_at":"2024-09-23T09:33:15.000Z","dependencies_parsed_at":"2024-10-17T23:08:08.520Z","dependency_job_id":null,"html_url":"https://github.com/cemderv/cppgfx","commit_stats":null,"previous_names":["cemderv/cppgfx"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemderv%2Fcppgfx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemderv%2Fcppgfx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemderv%2Fcppgfx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemderv%2Fcppgfx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cemderv","download_url":"https://codeload.github.com/cemderv/cppgfx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222576170,"owners_count":17005447,"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":["cpp","graphics","modern-cpp","software-rendering"],"created_at":"2024-11-01T13:07:01.832Z","updated_at":"2024-11-01T13:07:02.748Z","avatar_url":"https://github.com/cemderv.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cppgfx\n\n_- \"Look mom, no GPU!\"_\n\n![demo](demo/cppgfx.png)\n\ncppgfx is a CPU-based graphics library for C++.\n\n[Online Demo](https://dervis.de/cppgfx.html)\n\n## Features\n\n- Draw directly into a surface pointer\n- Write vertex and pixel shaders directly in C++ as functors, including state\n  - Instant access to uniform data\n  - Arbitrary vertex inputs and outputs\n- Stateless drawing functions\n- Alpha blending (blend states)\n- Depth buffering\n- Image sampling (samplers) including optional linear filtering\n- Multiple render targets\n- Standalone, no dependencies beside the C++ STL\n    - Plug \u0026 play\n- Multithreaded rasterization using OpenMP if available\n- Pretty fast!\n\nFor a draw call, almost the entire pipeline state is specified. Where possible, the library infers some information for you. This allows the library to decide which code paths to take at compile time. You therefore only pay for what you use. \n\n## Usage\n\nEither\n\n  1) `add_subdirectory(cppgfx)`, then\n  2) `target_link_libraries(MyApp PRIVATE cppgfx)`\n  3) `#include \u003ccppgfx.hpp\u003e`\n\nor\n\n  - copy `cppgfx.hpp` to your project and `#include` from there.\n\n## Example\n\nSee the `demo` folder for an example application. It uses CMake and downloads all dependencies automatically. Configure \u0026 build as usual:\n\n```bash\n\u003e cd cppgfx\n\u003e cmake -S . -B build\n\u003e cmake --build build --parallel\n```\n\n## Why software rasterization?\n\nWell, sometimes, especially in the medical field (e.g. hospitals or radiology practices), you have workstations without any sort of GPU. Even if there's a GPU, you cannot fully trust the driver to be bug-free or have deterministic behavior. If you're for example required to use OpenGL and can't trust the target drivers, you could circumvent this by using [Mesa/llvmpipe](https://docs.mesa3d.org/drivers/llvmpipe.html) as a drop-in replacement. Same goes for Direct3D with [WARP](https://learn.microsoft.com/en-us/windows/win32/direct3darticles/directx-warp).\n\nThis works fine for most cases. However, there are also cases where you need a minimal renderer that is platform-independent, does not require upfront work such as setting up a context, and is just happy to take some geometry and render target pointer; no state management necessary.\n\nAnother case would be for cheap rendering tasks where CPU ⇄ GPU synchronization would be too expensive or when the CPU has some spare idle time. See [DICE's Occlusion Culling Method](https://www.slideshare.net/DICEStudio/culling-the-battlefield-data-oriented-design-in-practice) in Battlefield 3 for example, where they determined occluded geometry CPU-side before sending it to the GPU. A similar method has also been [used in Crytek's CryENGINE 3](https://www.slideshare.net/TiagoAlexSousa/secrets-of-cryengine-3-graphics-technology).\n\n**TL;DR**: Software renderers to this day have their use, especially in cases where no GPU is available. Even though GPUs are feature-rich, software renderers provide hassle-free and highly-flexible drawing operations, down to the pixel. Additionally, they may be used to support and relieve the GPU, instead of replacing it. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcemderv%2Fcppgfx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcemderv%2Fcppgfx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcemderv%2Fcppgfx/lists"}