Skip to main content

Crate concinnity_device

Crate concinnity_device 

Source
Expand description

The device backends. The proprietary, hardware-facing renderers - Metal (macOS), DirectX 12 (Windows), Vulkan (Windows/Linux) - plus the shared native Win32 window/input layer. Exactly one backend compiles per build (resolved by build.rs into a single backend_* cfg). Depends on concinnity-core, whose render module holds the RenderBackend/SceneControl trait seam these implement plus the render-prep feeding it; owns no gameplay, ECS-runtime, audio, or physics. The client drives these through a Box<dyn RenderBackend> obtained from init_backend, never naming a concrete context type.

Modules§

precompile
Export-time compilation of the engine’s built-in shaders. The DirectX and Vulkan backends declare their compile set as static data (each backend’s builtins.rs); this module iterates those declarations and makes sure every enumerable variant’s artifact exists in a bundle’s shader-cache/ directory. Compilation is pure CPU (FXC / DXC / shaderc need no GPU device), so this runs inside cn export with no window, no adapter, and no child process. Renderer init compiles through the same declarations and the same cache keys, so a shipped bundle’s first launch reuses every artifact written here; anything not enumerable (a world-authored SdfVolume fragment, an unusual runtime parameter) still compiles at init exactly as before.

Functions§

init_backend
Route the assembled BackendInit to the backend selected at compile time. Construction inputs are documented on BackendInit itself.
probe_gpu_profile
Probe a cheap throwaway device handle to classify the GPU, so the auto-config quality ceiling can influence the render targets / effect pipelines the backend sizes at init. Each backend creates only the cheap handle it needs and classifies it: Metal the default-device handle, DirectX the DXGI adapter (no device / swapchain), Vulkan a surface-free instance (destroyed immediately).