Files
workinf_Blender_Wasm/docs/tasks/WBV2-P1424-001-compute-ssbo/CS03.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

58 lines
3.7 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.
# CS03:SSBO/VBO/UBO 所有权和事务回写
- queueTask: WBV2-P1424-001
- parentTask: WBV2-P1424-000
- packageStatus: planned
- dependsOn: CS02
- validation: NOT_RUN;acceptance: NOT_CLAIMED
## 业务与交付
原生 buffer 创建/更新/绑定 → compute 读写 → owning buffer 回写 → 下一次原生消费
原生资源生命周期和多输出提交契约;已有持久缓存整合为一个资源所有权实现。
## 最小输入与源码依据
- `blender-5.2.0/source/blender/gpu/GPU_storage_buffer.hh`
- `blender-5.2.0/source/blender/gpu/intern/gpu_storage_buffer.cc`
- `blender-5.2.0/source/blender/gpu/webgl/webgl_backend.cc`
- `blender-5.2.0/source/blender/gpu/webgl/webgl_shader.cc`
- `blender-5.2.0/source/blender/gpu/webgl/webgl_draw.cc`
- `web/protocol/gpu-compute.ts`
- `web/app/src/workers/gpu-compute.worker.ts`
- `web/app/src/engine-client/gpu-compute-host.ts`
- WebGLComputeStorageBuf、compute_owner_token、ownedBuffers 和 webgl_vertbuf_compute_commit 已存在。
- webgl_shader.cc:1518 按资源顺序回写;共享内存结果发布成功不自动保证多个 native owner 的 commit 原子性。
- 当前 writable alias 显式拒绝;只读 alias、缓存释放、容量与使用长度需保持同一原生语义。
## 实现步骤
1. 保留 owner token,完善 session/context/generation、分配容量、使用长度、dirty/version;unbind 与 destroy 严格区分。
2. 补齐 create/update/clear/read/sync/copy_sub/resize 的真实范围与内容语义,处理 GPU_USAGE_DEVICE_ONLY 的首次生产及重分配。
3. 在修改任一 owner 前预检所有回写目标、尺寸、代数和上传资源;采用可回滚 staging 或无失败 commit 阶段,避免后一个 owner 失败留下前一个已修改。
4. 以原生 allocation 识别别名;给同一资源合法的只读绑定复用身份,写别名按 WebGPU 允许的真实布局落地。无法等价表达时精确拒绝并保留业务缺口。
5. 失败/取消时同时丢弃 GPU 暂存写入和本轮 native dirty 变更;正确恢复 used size 和下一次 snapshot。
## 失败边界
不能把 WASM 地址当跨生命周期 handle;不能把 Buffer 的持久分配等同于内容同步。
发生阻塞时记录具体业务、原生函数/create-info、producer/consumer 和下一修复动作;保留既有产物,继续无此依赖的实现卡,不用缺失证据作为实现阻塞。
## 延后的用户场景(当前不执行)
- 双输出其中一目标失效时 no-mutation
- resize/free 后地址重用
- CPU update→GPU write→CPU read
- 只读/读写别名、部分 copy、device-only VBO
没有在本次拆解中创建或运行测试 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 仅显示。