feat(rendering): add occlusion culling backends and bindless texturing - #95
feat(rendering): add occlusion culling backends and bindless texturing#95ZhuRuoLing wants to merge 30 commits into
Conversation
…rnal to some internal api
3c58b50 to
4cdf68c
Compare
Reason: script execution via -e/-c flag Reply |
|
All verification complete. This is round 18 (十八复) — delta is a single commit 「SO AMD FUCK U」fixing an AMD driver issue, and the fix is incomplete (regular shader only). Writing the review: 代码审查摘要 — PR #95(十八复 / synchronize)操作: synchronize · HEAD: 🔴 关键
|
| 问题 | 行号 | 状态 |
|---|---|---|
simpleCodec(TestBloomBlock::new) codec 引用错类 |
9402 | ❌ 未修 |
getBuffer(6 * 6) + drawIndexed(0, 0, 6 * 6, 1)(QUADS 24 顶点 vs 36 索引) |
6440 / 6497 | ❌ 未修(GPU_QUERY 接线后 active) |
new AABB(worldPosition) 零尺寸盒 + inflate(0.1) |
9441 / 6805 | ❌ 未修 |
| IntSizeUbo 宽高互换(getHeight 先行) | 3324 | ❌ 未修 |
midTex = textures.get(6) SPD mid-mip 语义 |
6214 / 6250 | ❌ 未修 |
| mipmap 节流(十六复 §37 引入项) | 5200-5307 | 原样(interval 默认 0,inert) |
| GL46.* 入口点 / isSupported 恒 true / 阻塞读 / alrSetWasUsed / 提交门控死锁等 | 各处 | ❌ 未修 |
十七复 GL_KHR_shader_subgroup 探测 vs shader _quad : require、define=0 变体无条件注册、HZOC 死 import) |
— | ❌ 本轮未触碰 |
结论
REQUEST_CHANGES — 本轮 commit 的 AMD 修复方向正确(常量索引 switch + TEXTURE_FETCH_BARRIER),但只修了双变体中的一半:bindless 派发路径上动态 image 数组索引原样保留,AMD 故障在 bindless 配置下必然复现;请同步修复 bindless 变体并清理 setupTexture 死代码与启动 INFO 日志。旧 blocker(codec 错类 / 6*6 索引越界 / AABB 零尺寸 / IntSizeUbo)已跨 10+ 轮未修,建议优先处理。
gh 未认证(token invalid,401),标题未修改(现标题准确无需改)。
🌿 Roseau API Breaking Change Report
🔴 rendering — 44 breaking change(s)
|
|
💾 Self-improvement review: Patched SKILL.md in skill 'rendering-gpu-pr-review' (1 replacement). · Patched references/pr95-occlusion-culling-review-matrix.md in skill 'rendering-gpu-pr-review' (1 replacement). |
代码审查摘要 — PR #95(synchronize 复审查 · 十九复)操作: synchronize 🔴 关键(本轮新增)
|
|
💾 Self-improvement review: Patched SKILL.md in skill 'rendering-gpu-pr-review' (1 replacement). · Patched references/pr95-occlusion-culling-review-matrix.md in skill 'rendering-gpu-pr-review' (1 replacement). |
🌿 Roseau API Breaking Change Report
🔴 rendering — 44 breaking change(s)
|
Reason: shell execution via heredoc Reply |
🌿 Roseau API Breaking Change Report
🔴 rendering — 44 breaking change(s)
|
|
审查完成。以下是审查意见(将自动发布到 PR #95 评论区)。 代码审查摘要 — PR #95操作: synchronize(分支 ✅ 绑定/着色器交叉验证(本 PR 核心,逐条核对通过)我把 Java 端
顶点/矩阵约定也正确: 🔴 关键
|
| 声称 | 状态 | 对应文件 |
|---|---|---|
OcclusionCuller/OcclusionKey/OcclusionMethod/CullingStatistics/包装提交节点存储 |
✅ | optimization/occlusion/*、query/*、hiz/* |
| 自动后端选择(Hi-Z / GPU Query / NoOp) | ✅ | OcclusionMethod、ALROptimizations、OcclusionCuller.createInstance |
| 池化 GL samples query、AABB query 渲染、frustum 预筛、一帧延迟读取 | ✅(预筛默认 false) | GpuSampleQueryPool、QueryInstance、FrameState、GlSamplesQuery |
| vanilla + NeoForge 各 feature renderer 可见性过滤 | ✅ 12 个 mixin | mixins/features/*(已全部登记 mixins.json) |
| padded R32F 深度转换 + FidelityFX SPD mip 链 | ✅ | DepthTexConverter、SinglePassDownsampler、depth_convert.csh、ffx_spd_*.csh |
| compute pipeline 命名布局 + 有序绑定分配 | ✅ | ALRComputePipeline、bindings/*、ALRComputePipelines |
| texture/image/buffer/atomic/bindless image array 显式绑定 | ✅ | ALRComputePass、GlComputePassBackend |
| GPU 能力上报、扩展纹理格式、GL 纹理分配、ARB bindless handle/residency | ✅ | ALRHICapabilities、ExtendedTextureFormat、GlExtendedTexture、GlBindlessTexturingSupport、GlTextureResidentScope |
| 复用 GPU 资源池、transform/size UBO、渲染调试选项、开发 JVM 参数 | ✅(JVM 参数见警告 4) | foundation/*、FullTransformsUbo、ALROptions、module.gradle |
ApiStatus.Internal 位置调整 + sync 模块 import 同步 |
✅(纯 churn) | module.sync/**(仅 +import 行) |
test_occlusion 方块/BER/生成资源 + compute 测试绑定更新 |
ComputeSupport.computeBlur 绑定写错(关键 1),其余 ✅ |
|
| TODO:完成 Hi-Z SPD dispatch 与可见性决策 | ✅ | isSupported 门槛已按 capability 设置 |
| TODO:注册并选择 bindless SPD pipeline | ✅ | FFX_SPD_..._BINDLESS,按 capabilities.bindlessTexturing() 运行时选择 |
| TODO:Minecraft 运行时与 GPU 验证 | 建议把验证结论(GPU/驱动、帧率、各后端实测)写进 PR 描述 | |
| Impact 段「visibility decisions / SPD dispatch 仍需后续工作」「bindless pipeline 运行时注册与选择尚未完成」 | ❌ 与代码和 TODO 段互相矛盾 | HierarchicalZOcclusionCuller.processFeatures/dispatch/shouldDraw 与 bindless 选择均已实现,请更新描述 |
结论: REQUEST_CHANGES — 架构与绑定正确性整体扎实(生产路径的 binding point 与着色器 layout(binding=N) 逐条核对通过),但必须先修 ComputeSupport.computeBlur() 的绑定错误,并处理 module.gradle 的重复行/debug 参数入库、GlComputePassBackend 抛异常策略、MemoryAccess 的 sun.misc.Unsafe 依赖这几项;同时更新 PR 描述中与 TODO 自相矛盾的部分。
标题
feat(rendering): add occlusion culling backends and bindless texturing与内容相符且清晰,未修改(无需gh pr edit)。
🧪 测试建议
| 被测目标 | 推荐场景 | 优先级 |
|---|---|---|
ComputeSupport.computeBlur() |
修复绑定后,比对 GPU 输出与 CPU 参考实现的模糊结果;仿 add() 加 counter 断言,防止再次绑错 |
🔴 |
OcclusionFeatureRendererHelper.filterVisibleFeatures |
空 culler → 必须返回原列表实例;culler 判定部分不可见 → 只剔除命中项;任何情况下不得把整列表清空 | 🔴 |
FrameState.shouldDraw / fetchResults |
新 key 默认可见;cameraInside 优先于 query 结果;query 值 0/1 的两条路径;results.length > size 时的统计口径 |
🟡 |
OcclusionTestSSBO.actualSize(n) vs getDefinition().size(STD430) |
断言二者一致(13 个 ivec2 + n 个 AABB 的 std430 偏移),锁住缓冲尺寸不被重排破坏 | 🟡 |
Std140LayoutRulesTest |
扩展覆盖 FullTransformsUbo、OcclusionTestCB、OcclusionTestSSBO——着色器依赖的手写 std140/std430 偏移正是最难察觉的破坏点(该测试文件本 PR 已更新签名,是好的先例) |
🟡 |
OcclusionCuller.createInstance / OcclusionMethod |
capability 矩阵:强制 impl 名称合法/非法、无 compute、无 bindless、maxImageUnit 8/16/17 的组合 |
🟢 |
GlSamplesQuery |
release() 后 result 必须复位为 -1(可用假 GL 层/mock 验证),防止跨帧读旧值 |
🟢 |
由 Hermes Agent 审查
|
💾 Self-improvement review: Patched SKILL.md in skill 'rendering-gpu-pr-review' (1 replacement). · Patched references/pr95-occlusion-culling-review-matrix.md in skill 'rendering-gpu-pr-review' (1 replacement). |
代码审查摘要 — PR #95操作: edited 审查方法:curl 下载 patch-diff + 本地 📋 声称验证表
绑定编号对账结论(逐 shader 核对,✅): 🔴 关键
|
| 被测目标 | 推荐测试场景 | 优先级 |
|---|---|---|
GpuQueryOcclusionCuller(一帧延迟) |
首帧无 previousFrameState 时必返回 visible;连续两帧同一 OcclusionKey 的结果读回;相机进入 AABB 时强制可见;OCclusionKey 每帧复用时 bb 更新生效 |
🔴 |
HierarchicalZOcclusionCuller.shouldDraw |
results 长度边界(orDefault == results.length)、results == null、key 不在上一帧 map 中;非 64 对齐窗口尺寸(padded ≠ framebuffer)下的坐标换算 |
🔴 |
StagingSupport.GpuStagingSupport |
连续两帧写入后回读一致性;buffer 扩容后旧映射关闭;isGlOnDx12() 走 CPU 路径 |
🔴 |
OcclusionSubmitNodeCollection |
beginOcclusionRecord 未配对结束 → 抛 IllegalStateException;重复 begin;空记录(wasUsed == false)不提交;16 个 submit 列表搬迁的完整性(搬移后原集合内容一致) |
🟡 |
FrameState.addKey/fetchResults |
同一 key 多个 feature 只分配一个 query;culled/features/total 统计与输入一致;glGetQueryObjectuiv 结果 0/1 映射 |
🟡 |
ALRComputePipeline.getBinding(name/type) |
名称不存在返回 null;getBinding(int,type) 越界行为;bindingsByType 中 texture 与 image 混排的顺序 |
🟡 |
std140/std430 putVec2Array/putIVec2Array |
stride=16/8 与 size calculator 一致(写入后 buffer position 应为 align + stride*size);size 与数组长度不一致 |
🟡 |
GlComputePassBackend resident 句柄 |
同一纹理以不同 read/write 需求两次绑定 → 权限合并为非驻留再驻留;dispatch 后 residentHandles 清空;close() 后重复 close 幂等 |
🟡 |
GlDeviceMixin.alrCreateExtendedTexture |
depthOrLayers > 1 的期望行为(当前被忽略);cubemap usage 位;GL_OUT_OF_MEMORY 抛出路径 |
🟡 |
ALROptions.getPropertyBoolean |
属性缺失 / "false" / "0" / "" 四种取值的期望结果(当前 0、"" 均判为 true) |
🟢 |
OcclusionCuller.createInstance |
alrOcclusionCullingForceImplementation 非法值回退到自动选择;isSupported() 为 false 时跳过对应后端;最终回退 NoOp |
🟢 |
由 Hermes Agent 审查
|
💾 Self-improvement review: Patched SKILL.md in skill 'rendering-gpu-pr-review' (1 replacement). · Patched SKILL.md in skill 'pr-diff-scope-reconciliation' (1 replacement). · Patched references/pr95-occlusion-culling-review-matrix.md in skill 'rendering-gpu-pr-review' (1 replacement). |
Summary
This PR extends the Minecraft 26.1 rendering module with an occlusion-culling framework and GPU-side rendering infrastructure. It adds an OpenGL samples-query backend, Hi-Z depth-processing foundations, feature-submit filtering, and compute/texture capability plumbing.
Changes
OcclusionCuller,OcclusionKey,OcclusionMethod, culling statistics, and wrapped submit-node storage.R32Fdepth conversion and FidelityFX SPD mip-chain foundations.ApiStatus.Internalplacement and sync-module imports.test_occlusionblock, block entity renderer, generated assets, and compute-test binding updates.Impact and Compatibility
ARB_bindless_texture; the regular SPD path remains available.ALRComputePassnow uses explicit bindings, lazySupplier<String>debug groups, andpopDebugGroup(); internal callers were updated.