ROADMAP.md

This commit is contained in:
2026-01-09 18:52:52 +00:00
parent 8c76553de9
commit 72c84ac64b
6 changed files with 101 additions and 24 deletions

View File

@@ -248,6 +248,15 @@ endif()
if(TARGET shaderc::shaderc)
target_link_libraries(shaderc_local PUBLIC shaderc::shaderc)
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
target_compile_options(shaderc_local PRIVATE
-Wno-old-style-cast
-Wno-sign-conversion
-Wno-conversion
-Wno-format
-Wno-extra
-Wno-unused-parameter)
endif()
## Build geometryc tool
# add_executable(geometryc

View File

@@ -7,6 +7,7 @@ echo ""
BUILD_DIR="${1:-build-ninja}"
SRC_DIRS="src/"
ERRORS_FOUND=0
CACHE_FILE="$BUILD_DIR/CMakeCache.txt"
# Colors for output
RED='\033[0;31m'
@@ -28,6 +29,29 @@ print_status() {
fi
}
TOOLCHAIN_ARGS=()
PREFIX_PATH_ARGS=()
SHADERC_DIR_ARGS=()
BUILD_TYPE="Debug"
if [ -f "$CACHE_FILE" ]; then
TOOLCHAIN_FILE=$(grep -E "^CMAKE_TOOLCHAIN_FILE:" "$CACHE_FILE" | cut -d= -f2- || true)
if [ -n "$TOOLCHAIN_FILE" ]; then
TOOLCHAIN_ARGS=(-DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN_FILE")
fi
PREFIX_PATH_VALUE=$(grep -E "^CMAKE_PREFIX_PATH:" "$CACHE_FILE" | cut -d= -f2- || true)
if [ -n "$PREFIX_PATH_VALUE" ]; then
PREFIX_PATH_ARGS=(-DCMAKE_PREFIX_PATH="$PREFIX_PATH_VALUE")
fi
SHADERC_DIR_VALUE=$(grep -E "^shaderc_DIR:" "$CACHE_FILE" | cut -d= -f2- || true)
if [ -n "$SHADERC_DIR_VALUE" ] && [ "$SHADERC_DIR_VALUE" != "shaderc_DIR-NOTFOUND" ]; then
SHADERC_DIR_ARGS=(-Dshaderc_DIR="$SHADERC_DIR_VALUE")
fi
BUILD_TYPE_VALUE=$(grep -E "^CMAKE_BUILD_TYPE:" "$CACHE_FILE" | cut -d= -f2- || true)
if [ -n "$BUILD_TYPE_VALUE" ]; then
BUILD_TYPE="$BUILD_TYPE_VALUE"
fi
fi
# 1. Clang-Tidy (Static Analysis)
echo "=== Layer 1: Clang-Tidy Static Analysis ==="
if command -v clang-tidy &> /dev/null; then
@@ -84,15 +108,28 @@ else
print_status "WARN" "Cppcheck: not installed (install with: sudo dnf install cppcheck)"
fi
# Helper to read cached build type
cached_build_type() {
local cache_file="$1"
if [ -f "$cache_file" ]; then
grep -E "^CMAKE_BUILD_TYPE:" "$cache_file" | cut -d= -f2-
fi
}
# 3. Compiler Warnings (Maximum strictness)
echo ""
echo "=== Layer 3: Compiler Warning Check ==="
echo "Rebuilding with maximum warnings enabled..."
if [ ! -d "$BUILD_DIR-lint" ]; then
LINT_CACHE="$BUILD_DIR-lint/CMakeCache.txt"
LINT_BUILD_TYPE=$(cached_build_type "$LINT_CACHE")
if [ ! -f "$BUILD_DIR-lint/build.ninja" ] || [ "$LINT_BUILD_TYPE" != "$BUILD_TYPE" ]; then
cmake -B "$BUILD_DIR-lint" -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Werror -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wconversion -Wsign-conversion -Wmisleading-indentation -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wnull-dereference -Wuseless-cast -Wdouble-promotion -Wformat=2" \
"${TOOLCHAIN_ARGS[@]}" \
"${PREFIX_PATH_ARGS[@]}" \
"${SHADERC_DIR_ARGS[@]}" \
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
-DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Werror -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wconversion -Wsign-conversion -Wmisleading-indentation -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wno-null-dereference -Wuseless-cast -Wdouble-promotion -Wformat=2" \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
fi
@@ -118,17 +155,33 @@ echo ""
echo "=== Layer 5: Sanitizer Build Check ==="
echo "Building with AddressSanitizer + UndefinedBehaviorSanitizer..."
if [ ! -d "$BUILD_DIR-asan" ]; then
cmake -B "$BUILD_DIR-asan" -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer -g" \
-DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address,undefined"
HAS_ASAN=0
if compgen -G "/usr/lib64/libasan.so*" > /dev/null; then
HAS_ASAN=1
elif compgen -G "/usr/lib/libasan.so*" > /dev/null; then
HAS_ASAN=1
fi
if cmake --build "$BUILD_DIR-asan" --target sdl3_app 2>&1 | tee /tmp/asan-build-$$.txt; then
print_status "OK" "Sanitizer build succeeded (run with: $BUILD_DIR-asan/sdl3_app)"
if [ $HAS_ASAN -eq 0 ]; then
print_status "WARN" "Sanitizer build skipped (libasan not found)"
else
print_status "ERROR" "Sanitizer build failed"
ASAN_CACHE="$BUILD_DIR-asan/CMakeCache.txt"
ASAN_BUILD_TYPE=$(cached_build_type "$ASAN_CACHE")
if [ ! -f "$BUILD_DIR-asan/build.ninja" ] || [ "$ASAN_BUILD_TYPE" != "$BUILD_TYPE" ]; then
cmake -B "$BUILD_DIR-asan" -G Ninja \
"${TOOLCHAIN_ARGS[@]}" \
"${PREFIX_PATH_ARGS[@]}" \
"${SHADERC_DIR_ARGS[@]}" \
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
-DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer -g" \
-DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address,undefined"
fi
if cmake --build "$BUILD_DIR-asan" --target sdl3_app 2>&1 | tee /tmp/asan-build-$$.txt; then
print_status "OK" "Sanitizer build succeeded (run with: $BUILD_DIR-asan/sdl3_app)"
else
print_status "ERROR" "Sanitizer build failed"
fi
fi
# Summary

View File

@@ -815,6 +815,9 @@ const BgfxGuiService::TextTexture* BgfxGuiService::GetTextTexture(const std::str
if (text.empty()) {
return nullptr;
}
if (fontSize <= 0) {
return nullptr;
}
EnsureFontReady();
if (!freeType_ || !freeType_->ready || !freeType_->face) {
@@ -829,20 +832,23 @@ const BgfxGuiService::TextTexture* BgfxGuiService::GetTextTexture(const std::str
}
FT_Face face = freeType_->face;
if (FT_Set_Pixel_Sizes(face, 0, fontSize) != 0) {
const FT_UInt fontSizePixels = static_cast<FT_UInt>(fontSize);
if (FT_Set_Pixel_Sizes(face, 0, fontSizePixels) != 0) {
return nullptr;
}
int ascent = face->size->metrics.ascender >> 6;
int descent = face->size->metrics.descender >> 6;
int ascent = static_cast<int>(face->size->metrics.ascender >> 6);
int descent = static_cast<int>(face->size->metrics.descender >> 6);
int height = ascent - descent;
int width = 0;
for (unsigned char ch : text) {
if (FT_Load_Char(face, ch, FT_LOAD_RENDER) != 0) {
for (char ch : text) {
const FT_ULong codepoint = static_cast<FT_ULong>(static_cast<unsigned char>(ch));
if (FT_Load_Char(face, codepoint, FT_LOAD_RENDER) != 0) {
continue;
}
width += face->glyph->advance.x >> 6;
const int advance = static_cast<int>(face->glyph->advance.x >> 6);
width += advance;
}
if (width <= 0 || height <= 0) {
@@ -851,8 +857,9 @@ const BgfxGuiService::TextTexture* BgfxGuiService::GetTextTexture(const std::str
std::vector<uint8_t> pixels(static_cast<size_t>(width * height * 4), 0);
int penX = 0;
for (unsigned char ch : text) {
if (FT_Load_Char(face, ch, FT_LOAD_RENDER) != 0) {
for (char ch : text) {
const FT_ULong codepoint = static_cast<FT_ULong>(static_cast<unsigned char>(ch));
if (FT_Load_Char(face, codepoint, FT_LOAD_RENDER) != 0) {
continue;
}
@@ -885,7 +892,7 @@ const BgfxGuiService::TextTexture* BgfxGuiService::GetTextTexture(const std::str
}
}
penX += glyph->advance.x >> 6;
penX += static_cast<int>(glyph->advance.x >> 6);
}
TextTexture entry{};

View File

@@ -380,6 +380,7 @@ bgfx::ShaderHandle BgfxShaderCompiler::CompileShader(
bool isVertex,
const std::vector<BgfxShaderUniform>& uniforms,
const std::vector<bgfx::Attrib::Enum>& attributes) const {
(void)attributes;
const bgfx::RendererType::Enum rendererType = bgfx::getRendererType();
@@ -502,7 +503,13 @@ bgfx::ShaderHandle BgfxShaderCompiler::CompileShader(
}
std::streamsize size = ifs.tellg();
ifs.seekg(0, std::ios::beg);
buffer.resize(size);
if (size <= 0) {
if (logger_) {
logger_->Error("BgfxShaderCompiler: Compiled shader size invalid for " + label);
}
return BGFX_INVALID_HANDLE;
}
buffer.resize(static_cast<size_t>(size));
if (!ifs.read(buffer.data(), size)) {
if (logger_) logger_->Error("BgfxShaderCompiler: Failed to read compiled shader data");
return BGFX_INVALID_HANDLE;

View File

@@ -288,6 +288,7 @@ bool ApplyMigrations(rapidjson::Document& document,
const std::filesystem::path& configPath,
const std::shared_ptr<ILogger>& logger,
const std::shared_ptr<IProbeService>& probeService) {
(void)document;
if (fromVersion == toVersion) {
return true;
}

View File

@@ -248,9 +248,9 @@ std::vector<SceneObject> SceneScriptService::LoadSceneObjects() {
object.shaderKeys.clear();
lua_getfield(L, -1, "shader_keys");
if (lua_istable(L, -1)) {
const size_t count = lua_rawlen(L, -1);
object.shaderKeys.reserve(count);
for (size_t keyIndex = 1; keyIndex <= count; ++keyIndex) {
const size_t shaderKeyCount = lua_rawlen(L, -1);
object.shaderKeys.reserve(shaderKeyCount);
for (size_t keyIndex = 1; keyIndex <= shaderKeyCount; ++keyIndex) {
lua_rawgeti(L, -1, static_cast<int>(keyIndex));
if (lua_isstring(L, -1)) {
object.shaderKeys.emplace_back(lua_tostring(L, -1));