-
Notifications
You must be signed in to change notification settings - Fork 7
TBR Pipeline Implementation & Pipeline Optimization #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ective-correct interpolation Signed-off-by: ZhouFANG <indevn@outlook.com>
… multi-rendering-mode Signed-off-by: ZhouFANG <indevn@outlook.com>
…g code for TBR. Signed-off-by: ZhouFANG <indevn@outlook.com>
…ace culling for TBR. Signed-off-by: ZhouFANG <indevn@outlook.com>
1. Add backface culling to TRADITIONAL pipeline to match TILE_BASED behavior 2. Fix depth buffer initialization from infinity to 1.0f for standard range Signed-off-by: ZhouFANG <indevn@outlook.com>
Signed-off-by: ZhouFANG <indevn@outlook.com>
This reverts commit 70e1581. Signed-off-by: ZhouFANG <indevn@outlook.com>
… debugging. Signed-off-by: ZhouFANG <indevn@outlook.com>
…s counting in Binning to eliminate frequent dynamic memory reallocations. Signed-off-by: ZhouFANG <indevn@outlook.com>
…ocation Signed-off-by: ZhouFANG <indevn@outlook.com>
Signed-off-by: ZhouFANG <indevn@outlook.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
整体实现非常出色,代码结构清晰、逻辑完整,功能覆盖也非常全面。
在阅读过程中,我发现一些相对细小的改进点,比如:注释位置和风格的一致性、少量命名和魔法数需要调整,以及部分重复代码可以通过抽取工具函数来减少冗余。
这些修改都属于可读性和维护性方面的提升,并不影响整体功能。总体来说,代码质量已经不错,仅需在细节上稍作打磨即可。
Signed-off-by: ZhouFANG <indevn@outlook.com>
Signed-off-by: ZhouFANG <indevn@outlook.com>
Signed-off-by: ZhouFANG <indevn@outlook.com>
…ipeline to PerTriangle for consistency with TileBased. Switch core function comments to Doxygen style. Signed-off-by: ZhouFANG <indevn@outlook.com>
…ng to enable SIMD-friendly rasterization; use relative-coordinate cross products to ensure numerical stability. Signed-off-by: ZhouFANG <indevn@outlook.com>
ZzzhHe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议把DEBUG的打印信息从SPDLOG_INFO改为SPDLOG_DEBUG,然后在 #include <spdlog/spdlog.h> 之前添加宏定义 #define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_INFO,就可以区分info打印和debug打印
… and per-bucket parallel merge) Signed-off-by: ZhouFANG <indevn@outlook.com>
…dContext structure. Replacing hard-coded values with constants. Signed-off-by: ZhouFANG <indevn@outlook.com>
…, set the default log level to INFO Signed-off-by: ZhouFANG <indevn@outlook.com>
…SIMD-friendly rasterization, and add corresponding mask statistics output. Signed-off-by: ZhouFANG <indevn@outlook.com>
…paration and update functionality to reduce redundant computations. Signed-off-by: ZhouFANG <indevn@outlook.com>
Signed-off-by: ZhouFANG <indevn@outlook.com>
…imize computation and eliminate redundancy. Added copy/move constructors for thread safety Signed-off-by: ZhouFANG <indevn@outlook.com>
ZzzhHe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改动很清晰,更新很及时,整体实现也很完整!
Description
该PR主要专注于
在Rasterize中实现容器复用,通过为每个OpenMP线程分配固定大小的片段暂存容器,避免频繁的内存分配与释放。为防止线程间竞争,写入操作严格限制在瓦片边界内进行。
这部分优化可能会让代码可读性变差,故将复杂优化集中在TBR中进行,保留PerTriangle作为基础版本进行对照参考。
在VS和FS中,每个顶点/片元都会从UniformBuffer中取传入的矩阵和向量,背后是 std::unordered_map 查表 + std::variant 拷贝。顶点数量、片元数量越多,重复调用次数也就越多。这里尝试通过缓存复用,尽可能消除重复计算。对于VS和FS,在缓存无效时(未进行Prepare等情况),会回退原先的路径进行计算。
尽管TBR原本是为移动端硬件设计,但经过测试和优化在软件实现下,相比于Triangle为核心的划分,Tile划分同样适用于CPU的并行加速场景,体现出了更好的效果。目前TBR管线的单帧时间明显优于传统PerTriangle管线。
测试在Win11(wslg, WSL2 with Ubuntu24.04LTS)下完成,CPU平台为移动端i9-13900h,TBR单帧平均计算时间保持在100ms以下。
Test Platform
Ubuntu24.04 (in WSL2, Windows11)
TO-DO