Preferences
Primal: preferences and conventions
This file collects every standing preference of the user (Chuck) for working on Primal: how to work, how code
looks, and which tool findings are accepted. CLAUDE.md imports it, so every Claude session loads it on both
machines. Project state, build commands and backend notes stay in CLAUDE.md. When the user decides something new
that should hold beyond the current task, add it here, with the date and the issue if there is one.
Working with the user
-
Never
git commit. The user commits manually. Leave changes in the working tree and summarize them. Don't stage or unstage files unless something would otherwise go wrong (for example, gigabytes staged by accident). -
Keep docs current as you go: the plan doc's Open items (
Docs/LinuxVulkanPort.md), the Gitea issues,CLAUDE.mdand this file. Add every new Windows-only risk, unverified item or known bug to "Open items". -
The Forgejo issues are the backlog (Gitea until 2026-11-16). Record progress as a comment or a body edit, close an issue when it is done, and add new ideas as new issues. The repo is public: no personal paths, hostnames or tokens in issues, and never print the API token.
-
Copyright headers:
- New files get
// Copyright (c) 2026 Charles Smith/// Distributed under the MIT license. See the LICENSE file in the project root for more information.(or the same as#comments in scripts and config files). - Never remove Arash Khatami's header from files he wrote. A port of one of his files says so on line 3.
- New files get
-
No full-desktop screenshots. The screen shows private apps. For visual checks, rely on logs and validation and ask the user to look. Screenshots of the Windows VM's own screen are fine (
winvm.sh screenshot, user 2026-11-13). -
Ask the user only for what a script can't do, in short numbered steps (for example, in the editor:
Tools/EditorAutomation/EditorUi.psm1does the clicking). -
On Linux, Windows-only edits are made blind. Flag them clearly, check them in the Windows VM (
Tools/WinVM/) when it is enough, and otherwise add them to the Windows checklist. Use#if PRIMAL_PLATFORM_WINDOWS/PRIMAL_PLATFORM_LINUX(Engine/Common/PlatformDetection.h), not_WIN64. -
File renames: plain
mvon Linux; the user stages them. -
Scope: don't mass-reformat or modernize code beyond the task unless asked. New rules apply to new code and to code a task already touches (see "const" below for an example).
-
No backwards compatibility for game projects (user, 2026-11-13): when an engine API changes, game projects are rebuilt instead of kept working with old macros.
-
Third-party code is downloaded, not committed, where a build system can fetch it (doctest: CMake at configure time, MSBuild in
UnitTests.vcxproj, same version and SHA-256 in both; ufbx and MikkTSpace: CMake +ContentTools/ThirdParty.targets, 2026-11-23). A repository without tags is pinned to a commit. -
The editor is C++ on Dear ImGui, inside the engine (user, 2026-11-24, #13,
Docs/Editor.md):Editor/, linkingPrimalEnginedirectly, ImGui only behind the editor's ownui::widget layer. Not Avalonia (paid features, Arch is commercial-only support), Uno, Qt (LGPL) or a C# ImGui binding (Docs/Editor.mdsection 4).- Side by side: the WPF editor stays on Windows, frozen (bug fixes only), until the new one reaches parity.
- Same files: both editors read and write the same project XML and asset binaries while both live; a format change goes into both.
- The old "Editor (AvaloniaUI) compatibility constraints" (plan doc) only matter for the WPF editor's EngineDLL API until it retires.
-
The editor's look improves as it's built (user, 2026-11-24): a modern, low-contrast tool rather than ImGui's default debug look. Direction: an anti-aliased TTF UI font (not ProggyClean) with merged vector icons, more padding and spacing, light rounding (docked panes flush), neutral dark grays with desaturated accents (bright colours only for warnings, gizmos and primary actions), two-column property grids, grouped sections, colour-coded axis fields, no collapse button on docked panels. Examples the user likes: VarunKhambhata/Clean-Imgui-Window, vayn1337/Clean-imgui-menu. Designed as we go, not copied.
Language
- C++23 only, no C++26. Use only features that clang, GCC and MSVC all support. CMake uses
cxx_std_23; the.vcxprojfiles and the editor's game project templates usestdcpp23(notstdcpplatest), which the current MSVC toolsets compile as/std:c++23(older ones:/std:c++23preview). clang-cl 23 understands only/std:c++23preview, soTools/WindowsCompileDb/gen_windb.pypasses that (checked 2026-11-21). - Prefer modern C++ (within C++23) when it makes the code clearer: structured bindings,
std::span,std::string_view, ranges and range-for,constexpr/consteval,enum class,[[nodiscard]], designated initializers,std::optional/std::expected,std::bit_cast, concepts instead of SFINAE,contains()on associative containers, andautowhere the type is obvious. Use them in new code and in code a task already rewrites. Broad modernization is tracked in issues #4 and #5, so don't do it unasked elsewhere.
Error handling (user, 2026-11-15, #4)
- Prefer
std::expectedgoing forward: a function that can fail returnsstd::expected<T, E>, orstd::expected<void, E>instead ofbool, in new code and in code a task touches. No pass over the existingbool+ log functions: they're converted as they're worked on. The first places a caller acts on the reason: EngineDLL's init for the editor,load_game(), reading shader packs, asset import. Eis anenum classof the reasons a caller can act on (LoadError::missing_file,bad_format). Log the details where the failure is found, as today; the error value doesn't carry text.- Never call
.value(): it throwsbad_expected_access, and the engine has no exceptions on MSVC. Useif (result)/has_value(),*result,result.error()after the check, andand_then()/transform()/or_else(). (MSVC compiles<expected>with/std:c++23previewand exceptions off: checked 2026-11-15.) - Functions that return one are
[[nodiscard]].
Containers and headers (user, 2026-11-15, #4)
utl::vectoris the engine's container (theUSE_STL_VECTORswitch is gone since 2026-11-15).std::vectoris fine in tools, tests, ContentTools and at API edges where it's the natural type.utl::free_listnever moves its items (issue #48, 2026-11-16): any type can go in, also one that points into itself or can't be moved, and references to an item stay valid until it's removed.remove()of an id that isn't in the list is refused in every build;contains(id)checks.- Headers include what they use, not the
CommonHeaders.humbrella (it expands to about 130,000 lines): new headers, and headers a task touches..cppfiles may keep the umbrella. No pass.
Layers and the game API (user, 2026-11-15, #4)
- The engine's folders are layers with an allowed dependency table in
Tools/check_layers.py(part ofci.sh checks;--graphprints them). A new dependency between layers fails the check: change the code, or add it to the table with the reason. The application glue (Core/Engine.cpp,Core/Main*.cpp,Core/Frame.*) is the top layer,App, and may use everything; the rest ofCore/(Log, Jobs) sits at the bottom. Known tangles, for #3:Content↔Graphics, andComponents→Graphics/App. CMake targets per layer come after those are broken. - Three APIs:
Engine/EngineAPI/is the game API: game projects have only that folder on their include path and force-includeGameEntity.h. Its headers include onlyEngineAPI/and a small public set (ids, primitive types, math,utl::vector, Log; the list is incheck_layers.py), with paths relative to themselves ("../Common/Id.h").- EngineDLL's exports (
EDITOR_INTERFACE, a C ABI with UTF-8 strings) are the editor API. - Everything else is internal.
The engine library (2026-11-19, #59 step 1, Docs/Actors.md section 17)
- The engine is one shared library,
PrimalEngine.dll/libPrimalEngine.so, that every program and the game code link (decided by the user with #59: one world, one reflection registry in a process). A game executable also linksEngineMain(itsmain()/WinMain), a static library. - What other binaries call is marked
PRIMAL_API(Engine/Common/CommonDefinitions.h), in front like the other macros:PRIMAL_API auto f() -> T,[[nodiscard]] PRIMAL_API auto f() -> T(a standard attribute must come first). In a class, member by member (PRIMAL_API auto width() const -> u32;), never on the class itself: an exported class makes MSVC warn about each member whose type isn't exported (C4251), and those warnings stay on. Not on functions defined in the header (inline, constexpr, templates). - Linux builds the engine with hidden visibility, so a missing mark fails the Linux link like it would on Windows. New engine API: mark it, build the tests on Linux.
- One export macro,
PRIMAL_API, while the engine is one library (user, 2026-11-19). Per-library macros (Unreal'sCORE_API,ENGINE_API) only mean something when there are several DLLs: if the layers ever become separate shared libraries, each gets its own then (Tools/check_layers.pyknows the folders). One macro is also the one switch a static, monolithic game build (#60) needs. - A class that game code derives from has no out-of-line virtual function (a virtual destructor is
= defaultin the header, likeGameScript's,actor::Actor's): the first out-of-line one would put the vtable and type info in the engine library only, hidden on Linux. - A named module's exported functions are marked in the interface (
.ixx); members of its classes are writteninlinein the class (not implicitly inline there), so the class needs no export.
Entities and components (user, 2026-11-16, #31)
-
Primal gets its own archetype ECS (
Docs/Ecs.md): 16 KB chunks with one array per component, queries, systems scheduled onprimal.jobsby their declared read/write access inside theprimal.framephases. No ECS library (EnTT and flecs were measured and not chosen). -
Scripts stay objects (
GameScript; per-object logic is actor behaviors since #59 step 7) next to the ECS and reach components through the entity API (the Unreal Mass model). -
Structural changes (create/remove entities, add/remove components) inside a frame are queued and applied at the sync point. Change detection is per chunk and component (versions). Hierarchy: a parent component and a depth-ordered transform update. Entity ids stay 32 bits (24-bit index, 8-bit generation) for now.
-
The typed ECS API is a header (templates that game scripts and other headers use), with the type-erased core in a
.cpp(theimportrule of "Modules" below). Components are plain data (trivially copyable). -
Scripts reach components through their entity (user, 2026-11-18, #52 step 2,
Docs/Ecs.mdsection 9):get<T>()/write<T>()immediate, structural changesqueue_*; transform writes are immediate (no caches); an entity may have several scripts;late_update()exists,fixed_update()comes with physics. -
Transforms have a hierarchy (user, 2026-11-18, #52,
Docs/Ecs.mdsection 8): the short names are world space (position(),set_position()),local_*is relative to the parent (Unity's and Unreal's convention); reparenting keeps the world transform unless told otherwise; removing an entity removes its children.
Actors (user, 2026-11-19, #59, Docs/Actors.md)
- Editor-first actors on top of the ECS. Prefabs (made in the editor, saved as assets) are the unit of reuse; an
actor may have a C++ class (
PRIMAL_ACTOR()) with the logic and typed access to its parts by name; a constructor may add default parts, matched to prefabs by name. - Our own names: Actor, Behavior (logic, today's scripts), Part (a piece with a transform:
MeshPart, the light parts,CameraPart), Prefab; Entity stays the ECS-level handle. Not Unreal's names. - Every part owns one entity: its transform (attachment = the entity hierarchy) and its data (
MeshRenderer, light types,Camera) are ECS components; objects cache none of it. Engine systems never see the objects. - Behaviors belong to the actor and reach a part through a
PartReffield. Tick order: each actor, then its behaviors. Spawning and destroying inside a frame wait for the sync point. - Plain entities stay public for mass gameplay; promotion/demotion (adopt/release) is designed for, built when needed.
- No entity scripts (user, 2026-11-21, #59 step 7): behaviors are the per-object logic,
GameScriptthe game-level logic, ECS systems the logic of plain entities. Editor scenes hold actors only; old scenes' plain entities are dropped on load with a warning. - First version: instance overrides are transform, name and the actor's and behaviors' fields; nested prefabs later; prefab editing in the WPF editor now; an adapter feeds today's renderer until #3; one engine as a shared library first.
Renderer (user, 2026-11-21, #3, Docs/Renderer.md)
- Shared CPU-side modules, two backends (option A): the API-free code (camera math, lights, content bookkeeping, render preparation, the frame packet) is written once; each backend keeps its resources and records its own passes from the frame packet. A render graph (#66) and a thin RHI (#67) are later tickets, each with its condition.
- The renderer reads the ECS components (
render::MeshRenderer, the lights,render::Camera) into a frame packet; it has no light, camera or render-item objects of its own. Content (meshes, textures, materials, shaders) stays a backend API. - Direct draws only (the D3D12
ExecuteIndirectpath goes); render targets per surface; content read under a shared lock while preparing; Vulkan records into secondary command buffers; lights rebuilt each frame until a measurement says otherwise; the shared code is headers +.cppinEngine/Graphics/, not a module. - Step 2's decisions (user, 2026-11-22,
Docs/Renderer.mdsection 9):render::MeshRendereris the only way to draw a mesh (the old geometry component goes); LOD by distance to the surface's camera; the preparation keeps one backend render item per mesh entity; nographics::Camera/graphics::Lighthandles in the game API.
ContentTools (user, 2026-11-23, #12, Docs/ContentTools.md)
- DirectXTex stays on both OSes, downloaded and pinned; stb_image loads PNG/JPEG on Linux (no WIC there). Replacing DirectXTex: #81.
- IBL runs on the GPU through Vulkan compute, on both OSes, from the existing HLSL (no CPU port). No D3D11 in ContentTools: BC6H/BC7 use DirectXTex's CPU encoders until a custom encoder (#81).
- BC7 in DirectXTex's quick mode (
TEX_COMPRESS_BC7_QUICK, user 2026-11-23) until #81, which comes right after #13.
Reflection (user, 2026-11-18, #41, Docs/Reflection.md)
- Types declare themselves with marker macros that
PrimalReflectGenreads before compiling (Unreal's model): a marker before the type (PRIMAL_COMPONENT(),PRIMAL_GAME_SCRIPT(),PRIMAL_ACTOR(),PRIMAL_PART(),PRIMAL_BEHAVIOR(),PRIMAL_ENUM(), with the type's options in the parentheses) andPRIMAL_GENERATED_BODY()inside classes and structs.#include "X.generated.h"is the header's last include. - Components reflect every field; classes (game scripts, actors, parts, behaviors) only
PRIMAL_PROPERTY(...)fields.PRIMAL_PROPERTY(.min = 0.f, .tooltip = "...")is the metadata. - Types are registered by name (the class name,
.name = "..."to override) and known by the name's FNV-1a hash, never by an index, across binaries and in files. - C++26 reflection replaces the generator once clang and MSVC support it; the markers map to annotations.
- 64-bit integers are reflected field types (user, 2026-11-20):
s64andu64, for name hashes, seeds and counters (a component holds a name hash, not a string). The editor keeps them as text, never as adouble. - Standard library types for reflected fields (user, 2026-11-18):
std::array(components and scripts),std::vector/utl::vectorandstd::string(classes only). No C arrays. Own containers or strings only when a measurement shows the need.
C# (the editor) (user, 2026-11-20)
The rules for the editor's C# (WPF, .NET 10, C# 14). .editorconfig's [*.cs] section holds what an IDE can check; new
and touched code follows all of it, no pass over existing code.
- Newer C# syntax where it fits: file-scoped namespaces, primary constructors, collection expressions (
[],[.. x]), pattern matching (is { Length: > 0 },is not,or), switch expressions,??=, target-typednew(), ranges and indices. - C# 14 first (user, 2026-11-20): the
fieldkeyword instead of a backing field that only stores the value (get; set { field = value; OnPropertyChanged(); }), andextensionblocks (static class X { extension(T t) { ... } }, members and properties) instead of classicthis T textension methods, in new and touched code. - The not-null pattern (user, 2026-11-20):
x is { } t/x is not { } t(and{ Scene: { } s }in a property pattern) where the type test would succeed for any non-null value ofx's type; a type pattern (x is Foo f) only when it narrows the type (Rider: "Use not null pattern instead of a type check succeeding on any not-null value"). - Braces on every
if/else/for/foreach/whilebody, even a one-line one (as in C++). - LINQ in method syntax only (
.Where(...).Select(...)), never query syntax (from x in ... select). - Nullable reference types (user, 2026-11-20): on for the whole project (
<Nullable>enable</Nullable>inPrimalEditor.csproj, strings included), so files need no#nullable enable; old code's warnings are fixed as the code is worked on. Mark what may be null (string?,Actor?) and handle it at the access (is { } x,?.,??, an early return). Don't silence a warning: no!null-forgiving operator, no#pragma warning disable, no= null!to quiet a field. No pass over existing code; it changes as it is worked on. - Tests (user, 2026-11-23, #61):
PrimalEditor.Tests(xUnit v3) references the WPF editor and runs on Windows (the VM, Windows CI). View models reach the engine, the UI thread and dialogs only through seams (EngineAPI.EntityAPI/ActorAPIinterfaces,EditorServices), neverApplication.Current,MessageBoxor WPF types likeThicknessandVisibility(converters in the views do that). The plain view-model library and #78 (statics into instances, DI) are dropped: the WPF editor is frozen since 2026-11-24 (the new editor is C++). - Names follow .NET's conventions as the existing editor code does (PascalCase types, methods and properties,
_camelCaseprivate fields), not the C++ snake_case below. Comments follow the C++ rules (no issue numbers, the copyright header).
Naming
- PascalCase for class, struct, union and enum names. That includes nested enums (
Type) and typed ids (EntityId,CameraId). - snake_case for functions, variables, members, enumerators and namespaces. Macros are UPPER_CASE.
- These keep their lowercase names: primitive and math aliases (
u32,f32,v3,m4x4) and the std-likeutlcontainers (vector,deque,free_list).
Functions and calls
- Trailing return types everywhere, including
auto f() -> void. The exceptions are calling-convention functions (WinMain,DllMain, the window proc, the Vulkan debug callback), marked withNOLINT. - Attributes and macros go in front:
PRIMAL_NOINLINE auto f() -> T(never__declspec(noinline)directly);EDITOR_INTERFACE auto F() -> T(the C exports for the editor: EngineDLL, ContentTools and a game DLL's; defined once inEngine/Common/CommonDefinitions.h, neverextern "C" __declspec(dllexport)written out);- GCC
__attribute__s also go in front.
- Global functions are called as
::Foo(). That covers Win32, Vulkan, SDL, VMA and our own globals. (CLion's "redundant qualifier" inspection disagrees, and is off in the shared profile.) - C library calls go through
std::(std::memcpy). Macros and_-prefixed intrinsics stay unprefixed. - No C-style casts:
static_cast/reinterpret_cast/const_cast/std::bit_cast. clang-tidy doesn't checkextern "C"functions (EDITOR_INTERFACE), macro arguments (assert,DEBUG_OP,DXCall) or disabled#ifbranches, so watch those by hand. Vulkan handles ↔u64go throughvulkan::handle_to_u64()/handle_from_u64<T>(). std::to_underlying(e), notstatic_cast<u32>(e), for enums (the engine's were converted 2026-11-15, #4). CLion flags them, clang-tidy 23 doesn't. Astatic_castthat narrows (u32flags into au8) stays.- A cast that only narrows
size_t/u64tou32is not "redundant" even when CLion says so: MSVC (C4267) and GCC warn without it. Keep it.
const (user, 2026-11-14)
const everywhere it fits, in new code and in code a task touches. No pass over existing code: it's fixed as
the code is worked on.
- Locals that aren't modified:
const T x{...}, withconstwritten first (west const). - Value parameters in definitions:
auto f(const u32 count) -> void { ... }. Not in declarations, where it means nothing (CLion: "const-qualified parameter in a function declaration"). - Pointers and references that aren't written through:
const T *,const T &. - Member functions that don't change the object are
const(readability-make-member-function-const). constexprinstead ofconstwhere the value is known at compile time; noconstnext toconstexpr.- Exceptions: a
std::atomic, mutex or anything a lambda or a job modifies through a capture is notconst, even when a tool says it could be. Functions called through the backends' function-pointer tables keep their signatures (aconstthat one backend allows can break the other).
Statements and initialization
- Braces on every
if/else/for/whilebody, multi-line, even for one statement (the user chose this). clang-format can't allow one-line{ goto _error; }without collapsing all short blocks. - Designated initializers in new code (user, 2026-11-14) for structs with more than one or two fields:
WindowInitInfo{.caption = "...", .width = 800}. No pass over existing brace initializers. - Declare a variable in the narrowest scope, in an
if/forinit statement where that reads well.
Modules
- New, self-contained engine systems are C++20 named modules (user, 2026-11-11). The job system
(
primal.jobs,Engine/Core/Jobs.ixx) is the first. Logging stays a header (Engine/Core/Log.h): it was tried as a module on 2026-11-11 and reverted, because headers, macros (DXCall) and game scripts all need to call it. Existing headers are not converted unasked. importcomes after every#include, and only in.cppfiles, never in a header. GCC 16 fails with "redefinition" errors in the standard library when a#includefollows animport(clang and clang-cl accept it). So a system that header-inline code has to call is a poor fit for a module.- An interface unit includes what it needs in its global module fragment (
module;…export module x;), and so does the implementation unit (module x;): nothing leaks out, so importers includePrimitiveTypes.h,<string>, … for themselves. Noimport std;(not usable on all three compilers yet). Modules can't export macros. - An exported declaration can only name a header constant that is
inline constexpr. A plain namespace-scopeconstexprhas internal linkage, and GCC 16 fails with-Wexpose-global-module-tu-local(also in a default argument). The*_invalid_idconstants inPrimitiveTypes.hareinline constexprsince 2026-11-12; make another oneinlinewhen a module needs it (math::epsilonisn't yet). - The engine has no exceptions on MSVC (
Engine.vcxproj, Arash's setting; CMake leaves them on). Atryin engine code needs#if defined(__cpp_exceptions) || defined(_CPPUNWIND), and an engine.cppthat includes<chrono>needs it inside#pragma warning(disable : 4530)(seeLog.cpp): MSVC's<chrono>has atry. Projects that import an engine module turn C5050 off (Engine/Modules.props), since their/GR /EHsc /sdldiffer. - A new module goes in
Engine/CMakeLists.txt(target_sources(Engine PUBLIC FILE_SET CXX_MODULES BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES Core/X.ixx)) andEngine.vcxproj+.filters(<ClCompile Include="Core\X.ixx" />).Engine/Modules.propsgives the other Windows projects the engine's modules. - The tools are ready:
ci.sh tidybuilds the compiled interfaces before clang-tidy (by hand: build the preset first),gen_windb.pyprecompiles them for the Windows databases (re-run it after changing an.ixx), and the check scripts read.ixxfiles.
Math
- No DirectXMath outside
Engine/Utilities/Math*.h(Tools/check_math_usage.py, part ofci.sh checks). Usemath::vec/math::matfor calculations andmath::load()/math::store()/math::to_v3()to convert from and to the storage types (v3,v4,m4x4, …). A function that is missing gets a thin forwarder inMathSimd.hand a case inUnitTests/MathTests.cpp. vecoperators (a - b,2.f * a) work anywhere inside namespaceprimalor afterusing namespace primal;.- DirectXMath stays the SIMD implementation behind
math::; the storage types are the engine's own (user, 2026-11-17, #6,Docs/Math.md): plain aggregates inMathTypes.hwith DirectXMath's layout, matrices with members_11..._44. A function is replaced by own code only when it measures faster (rotate3(),Frustum), with a test against the previous result. Whether game scripts stop seeing DirectXMath (math::vecin the game API) is decided with #41/#52. - The three DirectXTex files in ContentTools may still say
using namespace DirectX;.
Logging
- Everything logs through
primal::log(log::info(log::Category::x, "format {}", args)), neverprintf/OutputDebugString/std::cout(Tools/check_log_usage.py). No trailing\n, no "Vulkan:" prefix: the category says it. Details:CLAUDE.md, "Backend notes".
Comments and headers
- No issue numbers or doc links in code comments (user, 2026-11-18): no "(#41)", "issue #52" or "Docs/Reflection.md" in source, build or script files. A comment explains the code on its own; the history and the reasons live in the docs and the issues, which point to the code, not the other way round. New and touched code; no pass over existing comments.
- No trailing comments after a closing namespace brace or after
#endif/#else. - Headers are self-contained and there are no include cycles (#20). A header includes what it needs to compile
alone.
CommonHeaders.his an umbrella that only includes; the headers it includes (Id.h,Vector.h,FreeList.h,Math.h, …) must not include it back: they useCommonDefinitions.h(macros,Version) andPrimitiveTypes.h. Check withcmake --build --preset linux-debug --target header_checkandTools/check_include_cycles.py. - clang-format sorts includes into groups: own header, project (
"..."), system/third-party (<x.h>), std (<x>). A#definethat must come before an include (WIN32_LEAN_AND_MEAN) keeps its place.
Formatting, lint and warnings
- Format: the repo
.clang-format(nathan-baggs/ufps style, plusInsertBracesand sorted, grouped includes). ThirdParty and MikkTSpace are excluded.AlignAfterOpenBracket: AlwaysBreakis the old spelling; clang-format 23 still reads it (astrueplus theBreakAfterOpenBracket*options), so it stays until every machine has clang-format 23 or newer. - Lint: the repo
.clang-tidy. Keep it at 0 warnings (Tools/CI/ci.sh tidy). Run the Windows databases with-checks=-readability-duplicate-include(false positives on thewindows-msvctarget, clang-tidy 23). - Warnings:
- Linux:
-Wall -Wextra -Wpedantic …with-Werror(PRIMAL_WARNINGS_AS_ERRORS, default ON). - Windows:
/W4 /WX /permissive-(PrimalWarningsAsErrors, default on;/p:PrimalWarningsAsErrors=falseopts out). Compiler warnings only; the editor's game projects don't use/WX. - New code must be clean on clang, GCC and MSVC. Check with
-Wshadow-alltoo: MSVC's C4458 at/W4catches the same thing.
- Linux:
- Mechanical commits go in
.git-blame-ignore-revs.
CLion inspections (2026-11-14, issue #2)
The shared settings are in the repo; the rest of .idea/ stays ignored:
-
.idea/inspectionProfiles/Project_Default.xml: the project profile. Off:CppRedundantQualifier: our::Foo()calls (270 of its 364 findings).CppUseAuto: we write the type unless it is obvious (modernize-use-autois off in.clang-tidytoo).
Everything else keeps CLion's default.
CppParameterMayBeConstandCppUseDesignatedInitializersstay on on purpose: they point at new code that misses the rules above. Their hits in old code are accepted until that code is touched. -
.idea/scopes/Primal_sources.xml: the scope "Primal sources", our files withoutbuild/,x64/,packages/, ThirdParty, MikkTSpace, the editor'sobj//bin/andDocs/Inspections/. Pick it in Code | Inspect Code: without it, 93% of the findings are in generated code underbuild/. -
.idea/dictionaries/project.xml: project words (Khatami, swapchain, lavapipe, gpass, …). Add a word there, not to the per-user dictionary. Real typos are fixed, not added. -
Exports go in
Docs/Inspections/(ignored by git: an export was 2.2 GB). Delete them after review. -
CLion on Linux doesn't inspect Windows-only C++ (D3D12, Win32, ContentTools) or the editor's C#. clang-tidy with
Tools/WindowsCompileDb/covers the C++.
Findings that are known false positives (seen 2026-11-14; don't "fix" them):
ArgumentSelectionDefectsonperspective_fov_rh/orthographic_rh: near and far are swapped on purpose (reversed Z).CppUnreachableCodeafterassert(false): that's the Release fallback.CppNotAllPathsReturnValueon aconstevalif constexprchain (vulkan::object_type()).- ClangTidy "type
int &can be const" in code that uses a module type (Jobs.cpp,JobTests.cpp): CLion's clang-tidy can't see throughimport. Also: "can be declared const" on atomics that jobs modify. CppUninitializedNonStaticDataMemberonCompiledShader: an overlay on a blob, never constructed.CppDeclaratorNeverUsedon an RAII local (VulkanMaterialStream stream{buffer, info}).RadGlobal"call to consteval function …_S_to_enum" in astd::formatcall: a clangd bug.CppUnusedIncludeDirective: only "possibly". Check withheader_checkbefore removing one.CppNonInlineFunctionDefinitionInHeaderFileinEngineTest/Test*.h: each is included by one.cpponly.- The Dockerfile "missing continuation" on comment lines inside a
RUN: Docker drops those lines. - clang-tidy's
readability-redundant-inline-specifieron a member function defined in a named module's class (jobs::Counter): there it isn't implicitly inline, so theinlineis needed (NOLINTwith the reason).