Files
workinf_Blender_Wasm/docs/tasks/WBV2-P1424-001-compute-ssbo/CS04.md
mes123456 f3e21c6b98
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
chore: checkpoint web Blender migration source, tools and docs
Accumulated uncommitted work: GHOST Web backend, WebGL/GPU web layer,
web workflow engine and protocol, tooling, docs and task records.
Large generated evidence, user-testing archives, build snapshots and
imported test assets remain untracked.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-10 11:18:01 +08:00

55 lines
3.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# CS04:原生间接 dispatch 与命令缓冲区
- queueTask: WBV2-P1424-001
- parentTask: WBV2-P1424-000
- packageStatus: planned
- dependsOn: CS01, CS03
- validation: NOT_RUN;acceptance: NOT_CLAIMED
## 业务与交付
原生 Pass 的 GPU_compute_dispatch_indirect → 原生 SSBO 参数 → WebGPU dispatchWorkgroupsIndirect
GPU_compute_dispatch_indirect 真实原生生产实现及源头到消费者的参数所有权映射。
## 最小输入与源码依据
- `blender-5.2.0/source/blender/gpu/GPU_compute.hh`
- `blender-5.2.0/source/blender/gpu/intern/gpu_compute.cc`
- `blender-5.2.0/source/blender/draw/intern/draw_command.cc`
- `blender-5.2.0/source/blender/gpu/webgl/webgl_backend.cc`
- `blender-5.2.0/source/blender/gpu/webgl/webgl_shader.cc`
- `web/protocol/gpu-compute.ts`
- `web/app/src/workers/gpu-compute.worker.ts`
- webgl_backend.cc:1489 的原生间接 dispatch 仍拒绝。
- gpu-compute.worker.ts 已有 step.indirect 路径;Python broker 的支持尚未闭合原生调用。
## 实现步骤
1. 将原生 indirect StorageBuf 所有权、尺寸和原 API 指定的参数起点传入同一 broker,不另建执行器。
2. 让 GPU 生成的 x/y/z 参数经过真实生产者顺序和 COMMAND 屏障进入消费 pass;检查三项 uint32、对齐、边界与资源使用约束。
3. 避免把 indirect 参数强制变成用户 shader 必须声明的 SSBO;按 pipeline 原有资源布局添加独立 indirect 使用。
4. 处理零 dispatch、参数过限、生产失败、取消和多 dispatch 序列;普通 dispatch 与 indirect 共享诊断和提交规则。
## 失败边界
不能仅在 Python 示例中调用 indirect 就关闭原生缺口;不能从未经同步的 CPU 镜像读旧参数。
发生阻塞时记录具体业务、原生函数/create-info、producer/consumer 和下一修复动作;保留既有产物,继续无此依赖的实现卡,不用缺失证据作为实现阻塞。
## 延后的用户场景(当前不执行)
- 前一步 GPU 写 indirect 参数,后一步消费
- 0/越界/过限参数
- indirect buffer 未声明为 shader binding
- 参数 buffer 释放与旧请求到达
没有在本次拆解中创建或运行测试 fixture。原生 shader、现有模板和真实业务数据是实现输入;需要新增用户使用 fixture 时在全项目实现完成后安排。
## 交接
每次报告填写:实际 workflow/route、源码函数与修改、仍未实现接口、产物元数据(仅生成时)、失败/no-mutation 策略、implementation 状态、validation=NOT_RUN、acceptance=NOT_CLAIMED、下一实现动作。记录 unitCount/verifiedUnits/unverifiedUnits/sourceTreeSha256 的来源;未绑定/未验证不增记覆盖。
执行约束:本卡属于 WBV2-P1424-001 / parent WBV2-P1424-000,nextTask=null 保持不变。全部功能实现前不执行测试、回归、冒烟、浏览器验收、类型/语法/上下文检查或证据审计。仅为产物生成进行必要增量编译。源码检索使用 tools/web/search-wbv2-batch-source.mjs 的精确 --source/--unit;GLSL fixture 只读取本卡列出的原文件。不加载完整专项规划、历史日志或源码 inventory。JS 仅承担浏览器 API/传输;几何算法仍使用 OCCT 出口,Three.js 仅显示。