How nikgeneburn/prim32 works
Prim32 is an immediate-mode GUI and 2D renderer integrated into an application’s Direct3D 12 frame loop. The app builds widgets or issues draw-list commands; core text and resource handling emit compact primitives, which the D3D12 backend submits for GPU expansion and shading. The README also documents cached layers and a built-in CPU/GPU/system profiler. Arrows use only relationships shown in excerpts or README; unsampled subsystem details are represented by their existing directories, and links without direct evidence are omitted.
Main entry points: prim32_dx12.cpp D3D12 backend · prim32.h Draw-list primitives · prim32.cpp Context and widgets · p32prof.cpp Metrics and history
Components 15
UI and drawing
- Context and widgets
src/prim32.cpp - Draw-list primitives
include/prim32/prim32.h - Persistent UI state
src/prim32_state.cpp - Text emission
src/prim32.cpp - Shared runtime internals
src/prim32_internal.h
Fonts and images
- Image and font handles
src/prim32_resources.cpp - FreeType rasterizer
src/prim32_freetype.cpp
GPU rendering
- D3D12 backend
src/backends/prim32_dx12.cpp - Cached primitive layers
include/prim32/prim32.h - GPU pipeline
Profiling
- Profiler API
include/prim32/p32prof.h - Metrics and history
src/profiler/p32prof.cpp - Profiler window
src/profiler/p32prof_ui.cpp
Other components
- D3D12 application
- OS and GPU metrics
Connections 17
- D3D12 application → Context and widgets: builds UI
README.md - D3D12 application → Draw-list primitives: issues commands
README.md - Context and widgets → Draw-list primitives: emits primitives
README.md - Context and widgets → Text emission: draws text
src/prim32.cpp - Text emission → Shared runtime internals: uses glyph cache
src/prim32_internal.h - Image and font handles → Shared runtime internals: resolves fonts
src/prim32_internal.h - Image and font handles → D3D12 backend: uploads textures
- FreeType rasterizer → Shared runtime internals: initializes atlas
src/prim32_freetype.cpp - Draw-list primitives → D3D12 backend: submits primitives
README.md - D3D12 backend → GPU pipeline: draws and shades
src/backends/prim32_dx12.cpp - Draw-list primitives → Cached primitive layers: records layers
README.md - D3D12 backend → Cached primitive layers: uploads cached layers
src/backends/prim32_dx12.cpp - D3D12 backend → Metrics and history: reports GPU zones
- Profiler window → Metrics and history: reads metrics
src/profiler/p32prof_ui.cpp - Profiler window → Draw-list primitives: draws profiler UI
src/profiler/p32prof_ui.cpp - Metrics and history → OS and GPU metrics: samples process metrics
- Context and widgets → Persistent UI state: maintains UI state