Runtime divides all modules into xx layers to represent dependencies between different modules. For each layer:
- is a module(e.g., 02Rhi), or a bundle of modules(e.g., 00Core, 08System)
- is compiled as a static library
- is not allowed to call functions from higher layers
List the features of all modules(alphabetically) in this layer:
a wrapper for spdlog.
Axe has lots of configurable options, which can be grouped into a few types:
Type | Loading&Saving | Example |
---|---|---|
compile-time options | load from CMakeLists.txt and Config.hpp of each layer; No saving |
build type is release or debug |
per-engine(runtime) | yaml files saved under engine source folders(Configs/**/*.yaml ) |
|
per-game(runtime) | yaml files saved under game project source folders | player's maximum walk speed |
per-player (runtime) | yaml files saved under environment variable folders(e.g., getenv("AppData") ) |
quality option of anti-aliasing |
- regular file formats
- json(structured formats, has formal spec, easy to read, but not text-compact, not recommended since it is intend for data transport and no comments)
- xml(structured formats, has formal spec, not recommended due to verbose, not easy to read)
- toml (open source spec, advance of ini, easy to learn, good for trivial file, but not recommended for complex configures )
- yaml, a superset of json, an example of tomal vs yaml
- ini(widely used on Windows, compact text, not recommended because no formal spec, many INI dialects)
- compressed-binary(useful on limited device, such as embedded system, not recommended due to readability)
- Windows registry(more dependence on OS, not recommended, see Was The Windows Registry a Good Idea? below for its weakness )
- command line(usually for exposing a small subset of options)
- online user profiles
- your language (used for dynamic language that does not need to be compiled&linked. e.g., python)
a header-only module that defines lots of useful macros. It is also all global macros of axe. That is to say: All global macros of axe are placed here. In other words, It is not allowed to define any global macros outside of the header.
a wrapper for glm
there are three kinds of memory resource:
- DefaultMemoryResource, overloads operator
new
/delete
andstd::pmr::get_default_memory_resource()
. - MonoMemoryResource, allocates memory from a single block of memory(heap or stack), assigned by programmer, which can be used to implement various memory allocation strategy.
- PoolMemoryResource, allocates memory from a pre-allocated, system-assigned, fixed-size pool of memory blocks.
Goal:
- No dangling/inivalid deref(use after delete)
- No null ref (including acceptable and unacceptable)
- No leaks(delete objects when no longer used, and delete only once)
Usage:
- use
unique_ptr
if it has ownership, otherwise use raw ptr, to avoid memory leaks (Goal 3) - use assertion to check unacceptable nullptr in Debug mode, and if-else for acceptable nullptr (Goal 2)
- use
owner_ptr
&observer_ptr
, to avoid dangling pinter (Goal 1)owner_ptr
is a warper ofshared_ptr
, but ref count always equals 0 or 1, which means it is not allowed to be copiedobserver_ptr
is a warper ofweak_ptr
, but it is not allowed to generate aowner_ptr
from it
Goal:
- Detect all memory leaks
- Report source for each leak point
- Notified immediately
- Free to set begin_detection/end_detection point at runtime
For achieving Goal 1 and Goal 3, we can:
- make sure all memory alloc/free will passed to a set of specified interface(internal counter for
new
/delete
+ VLD formalloc()
/free()
) (Goal 1) - print info above(only in MEMORY_DEBUG_ENABLE mode) when program exits (Goal 3)
NOTE: For third party libraries that use syscalls (e.g., malloc()/free(), etc), tracker above cannot work, using external executable tools instead: (using dynamic library injection to hook malloc/free, can also stat these syscall, but it's not the intention to detect memory of third party - Visual C++, WinDbg, UMDH - Visual Leak Detector
Reference:
all os-specified code
Concepts:
- process: on a single computer, multiple processes can run, each process has its own memory space
- thread, within a process, multiple threads pre-emptively scheduled by OS kernel can run, all threads of a process share its memory space
- fiber, similar to a thread, within a single thread, multiple fibers scheduled by programer can run, has a lifespan independent of the code that launched it
- coroutine, more similar to a function, cooperative controlled by programer, has not concepts about "lifespan independent of its invoker", "blocking", "detaching", "scheduler"
N4024: Distinguishing coroutines and fibers
a wrapper for SDL_Window
Based on webGPU draft(online doc) and open source framework The-Forge(github).
NOTE: "Resource" refers to all files except for source code; "Asset" and "Resource" have similar meanings, but "Asset" emphasizes more on art resources.
-
Resource Manager (runtime)
- Resource registry and GUIDs, which ensures that only one copy of each unique resource is loaded into memory at any given time
- Resource lifetime, or management of the memory usage
- [NEVER ADD] packaging, loading of composite resources, and (de)compression of resources
- [NEVER ADD] Maintains referential integrity between files or within a file
- [NEVER ADD] Permits custom processing to be performed on a resource before/after it has been loaded, on a per-resource-type basis
- provides a single unified interface through which a wide variety of resource types can be managed.
- handles streaming (i.e., asynchronous resource loading)
-
ACP(Asset Conditioning Pipeline) (off-line)
- asset compilers, or asset converter
- asset linkers, or asset packager
- resource dependencies and build/compile/convert rules
-
[NEVER ADD] Resource Database, to upload/download/create/delete/inspect/move all types of resources, search/query resources in various way, maintain revision history
Choose one of hlsl and glsl as handwritten, and then run it on all platforms.