统一 2D 渲染链路以消除格式分叉和热路径中转

将图片主路径收口为 RGBA5551 输入、RGB565 backbuffer 输出,并删除 USE_RGB565_BACKBUFFER 双路径。sprite/tilemap 主绘制改为直接 RGBA5551 -> RGB565,透明语义固定为 1-bit alpha test。同步收口 SDL/FB present 路径、sprite 资源加载/导出规范,以及相关测试与文档。

Constraint: 运行时图片主路径需统一到 RGBA5551,不能继续保留主要 RGBA8888 分支
Constraint: 透明仅支持 1-bit 语义,不引入 alpha blending
Rejected: 保留 USE_RGB565_BACKBUFFER 宏双路径 | 持续增加维护成本并掩盖真实主链路
Rejected: 主绘制继续走 RGBA5551 -> RGBA8888 -> RGB565 | 热路径存在不必要中转
Confidence: high
Scope-risk: moderate
Directive: 后续图片资源默认按 RGBA5551 接入;不要重新引入通用 RGBA8888 主运行时路径
Directive: 字体 atlas 目前仍属兼容输入;若继续收口,优先改成 1-bit mask 而不是新的图片分支
Tested: render_pipeline_tests;SDL Demo Release 构建;搜索确认无 USE_RGB565_BACKBUFFER 残留
Not-tested: Linux framebuffer 目标实机构建与显示验证
This commit is contained in:
2026-06-08 18:32:04 +08:00
parent 8785368913
commit 5ac61dca0e
19 changed files with 167075 additions and 166993 deletions
+36 -5
View File
@@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.16)
project(IMX6U-Game)
include(CTest)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -9,7 +10,6 @@ if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
endif()
option(USE_FRAMEBUFFER "Use Linux framebuffer instead of SDL2" OFF)
option(USE_RGB565_BACKBUFFER "Use RGB565 internal backbuffer to eliminate present conversion on RGB565 fb0" OFF)
set(CORE_SOURCES
src/Core/Asset/ObjLoader.cpp
@@ -63,10 +63,6 @@ if(USE_FRAMEBUFFER)
target_compile_definitions(imx6u_core PUBLIC USE_FRAMEBUFFER)
endif()
if(USE_RGB565_BACKBUFFER)
target_compile_definitions(imx6u_core PUBLIC USE_RGB565_BACKBUFFER)
endif()
if(USE_FRAMEBUFFER)
else()
if(WIN32)
@@ -139,3 +135,38 @@ endfunction()
add_subdirectory(src/Apps/Game)
add_subdirectory(src/Apps/Demo)
if(BUILD_TESTING AND NOT USE_FRAMEBUFFER)
add_executable(render_pipeline_tests
tests/render_pipeline_tests.cpp
)
target_link_libraries(render_pipeline_tests PRIVATE imx6u_core)
target_include_directories(render_pipeline_tests PRIVATE ${CORE_INCLUDE_DIRS})
if(CMAKE_CONFIGURATION_TYPES)
foreach(config ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER "${config}" config_upper)
set_target_properties(render_pipeline_tests PROPERTIES
RUNTIME_OUTPUT_DIRECTORY_${config_upper} "${CMAKE_BINARY_DIR}/${config}"
)
endforeach()
else()
set_target_properties(render_pipeline_tests PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
)
endif()
if(WIN32)
add_custom_command(TARGET render_pipeline_tests POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${SDL2_DLL}"
"$<TARGET_FILE_DIR:render_pipeline_tests>"
)
endif()
if(MSVC)
target_compile_options(render_pipeline_tests PRIVATE /utf-8 /W3)
endif()
add_test(NAME render_pipeline_tests COMMAND render_pipeline_tests)
endif()