image-regions-v2 branch: layer cache invalidation and sort key

未關閉
#128 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
42/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
cpp

研究方向

Start in engine/render/r_main.cpp, reading IsDirty, ProcessCommands, MakeShapeSortKey, EmitSprite and DispatchGroup around the cited lines on branch feat/image-regions-v2 at commit 1b51acd. Trace how texture completion, viewport and texture IDs, screen size, and sampler setup affect cached layer replay. Done when the four reported cache invalidation, sort key, resize, and texture setup issues are addressed and the affected rendering behavior is verified.

由索引模型根據 Issue 內容生成。

描述

This is about the WIP branch feat/image-regions-v2 on your fork (at 1b51acd), since issues are turned off there. I read through it and these are the places where I think changes are needed.

Pending textures keep a layer dirty forever. usedIncompleteTextures is only ever set to true (https://github.com/zao/PathOfBuilding-SimpleGraphic/blob/1b51acd62a6beac96bdf5c26c3e02e484b68d255/engine/render/r_main.cpp#L2373-L2375) and ProcessCommands doesn't reset it (https://github.com/zao/PathOfBuilding-SimpleGraphic/blob/1b51acd62a6beac96bdf5c26c3e02e484b68d255/engine/render/r_main.cpp#L748-L758). When an async texture finishes, the command bytes stay the same (same pointer), so the layer isn't reassembled either, and IsDirty() always returns false (https://github.com/zao/PathOfBuilding-SimpleGraphic/blob/1b51acd62a6beac96bdf5c26c3e02e484b68d255/engine/render/r_main.cpp#L193-L197). I think that means elision stays off once a layer has drawn a loading texture, and region UVs stay based on the placeholder size, since EmitSprite clamps the size to 1 (https://github.com/zao/PathOfBuilding-SimpleGraphic/blob/1b51acd62a6beac96bdf5c26c3e02e484b68d255/engine/render/r_main.cpp#L2466-L2468). A texture generation counter that IsDirty() checks would cover both.

Sort key arguments are swapped. MakeShapeSortKey takes (effectTag, effectUser, viewportId, texId) (https://github.com/zao/PathOfBuilding-SimpleGraphic/blob/1b51acd62a6beac96bdf5c26c3e02e484b68d255/engine/render/r_main.cpp#L2263), but both callers pass texMemo, vpMemo (https://github.com/zao/PathOfBuilding-SimpleGraphic/blob/1b51acd62a6beac96bdf5c26c3e02e484b68d255/engine/render/r_main.cpp#L2601 and https://github.com/zao/PathOfBuilding-SimpleGraphic/blob/1b51acd62a6beac96bdf5c26c3e02e484b68d255/engine/render/r_main.cpp#L2634). With the viewport bits masked out, shapes are sorted by viewport instead of texture.

Screen size isn't in the cache key. screenSize is latched in ProcessCommands (https://github.com/zao/PathOfBuilding-SimpleGraphic/blob/1b51acd62a6beac96bdf5c26c3e02e484b68d255/engine/render/r_main.cpp#L751) and used for glViewport, u_screenSize and the scissor flip (https://github.com/zao/PathOfBuilding-SimpleGraphic/blob/1b51acd62a6beac96bdf5c26c3e02e484b68d255/engine/render/r_main.cpp#L2677-L2680, https://github.com/zao/PathOfBuilding-SimpleGraphic/blob/1b51acd62a6beac96bdf5c26c3e02e484b68d255/engine/render/r_main.cpp#L2711-L2713). A layer whose commands stay the same across a resize would replay with the old size.

Cache hits still pay the full texture setup. DispatchGroup sets every sampler uniform and rebinds every unit for each batch (https://github.com/zao/PathOfBuilding-SimpleGraphic/blob/1b51acd62a6beac96bdf5c26c3e02e484b68d255/engine/render/r_main.cpp#L2718-L2730). Setting the uniforms once after linking and binding only the used units would make a replay much cheaper.

主要語言
C++
星號
23
分支
69
平均合併
2 小時 50 分鐘
30 天內合併 PR
1

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic 的其他 Issue

查看 PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。