Commit 33e4363
committed
@
fix(rendering): use lightIdx instead of loop index l in GPU instancing forward-add light path
In _addRenderQueue, the BatchingSchemes.INSTANCING branch was using
the local loop index l for getInstancedBuffer() and _instancedQueues[]
instead of lightIdx (the global light index from validPunctualLights).
This caused mismatched indexing between the instancing path (which
used local per-model light indices) and recordCommandBuffer /
gatherLightPasses (which use global light indices), resulting in
wrong UBO/descriptor bindings for additional lights when different
models have different light culling results under GPU instancing.
Also added:
- Null check in recordCommandBuffer for sparse _instancedQueues entries
- lightIdx multiplier on dynamicOffsets for consistency with
non-instancing default branch and _instancedLightPassPool convention
Fixes: #19170
@1 parent 411f98d commit 33e4363
1 file changed
Lines changed: 5 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
| 246 | + | |
246 | 247 | | |
247 | 248 | | |
248 | 249 | | |
| |||
318 | 319 | | |
319 | 320 | | |
320 | 321 | | |
321 | | - | |
| 322 | + | |
322 | 323 | | |
323 | | - | |
324 | | - | |
325 | | - | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
326 | 327 | | |
327 | 328 | | |
328 | 329 | | |
| |||
0 commit comments