Skip to content

feat: Descriptor / 有限 bindless 后端升级 - #2

Merged
haolange merged 1 commit into
mainfrom
cursor/descriptor-bindless-upgrade-03e0
Sep 15, 2026
Merged

haolange merged 1 commit into
mainfrom
cursor/descriptor-bindless-upgrade-03e0

Conversation

@haolange

Copy link
Copy Markdown
Owner

RHI 公共面保持 BindingTable + Count + SetBindElement(..., arrayIndex),不新增 Heap/Pool/View 容器。

DX12

  • View / TLAS / Null cache / Sampler 创建只占 CPU staging,不再做 identity pair + 即时 CopyToShaderVisible。
  • CreateSampler 每次仍返回新包装对象,相同 descriptor 共享 CPU 槽并引用计数。
  • 每个 BindingTable group(含 Count=1)自有连续 CPU 镜像 + GPU 段;SetBindElement 只写镜像并合并 dirty;SetBindingTable / Bind* 在 SetRootDescriptorTable 前一次 CopyDescriptors。
  • GPU heap 改为 size-class 空闲表(1 / 2–16 / 17–64 / 65–256 / 257+),不新开第二本 shader-visible heap。
  • Raster 私有 attachment、WorkGraph/DirectML、sampler-feedback Clear 仍走 GPU 槽。

Vulkan

  • SetsPerPage 按 descriptor 总数分档 128 / 32 / 4 / 1。
  • 共页先精确 Equals,否则允许逐项超集且总量浪费 ≤ 2×;空页回收规则保持。

Metal

  • ViewPool 按 262144 → 65536 → 16384 → 4096 阶梯创建,第一次成功即锁定,allocator 使用同一容量。
  • dispose 先 SetTextureView(nil) 清 native 槽再还软件 index。
  • 删除未使用的 HasDescriptorArray。

验证

  • 产品工程 Source Release 编译通过。
  • 进程内单测 23/23:size-class、dirty 合并、sampler intern key/refcount、VK 页策略、Metal 容量阶梯与既有 plan 测试。
  • 本环境无 DX/Metal 实机;Metal 清槽实机路径标 TODO(UNVERIFIED)。
  • GPU 合格项(alias/owned copy readback、view 创建后 GPU AvailableDescriptorCount 不再下降)需在 Windows/macOS matching host 复验。

未提交 stack.local.props,隔离构建输出已删除。

Open in Web Open in Cursor 

Keep the public BindingTable + Count + arrayIndex contract. DX12 views and interned samplers occupy CPU staging only; every table group owns a CPU mirror and GPU segment flushed on SetBindingTable. Vulkan pages pools by descriptor count and allows a 2x-waste superset share. Metal locks ViewPool capacity on first success and clears native slots on dispose.

Co-authored-by: CGBull <1824339952@qq.com>
@haolange
haolange merged commit 9a3fe07 into main Sep 15, 2026
2 of 6 checks passed
@haolange
haolange deleted the cursor/descriptor-bindless-upgrade-03e0 branch September 22, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants