Blender Git Loki

Git Commits -> Revision 70892ec

August 17, 2019, 12:48 (GMT)
DRW: Refactor to support draw call batching

This refactor improve draw structures CPU/Memory efficiency and lower the
driver overhead of doing many drawcalls.

- Model Matrix is now part of big UBOs that contain 1024 matrices.
- Object Infos follow the same improvement.
- Matrices are indexed by gl_BaseInstanceARB or a fallback uniform.
- All these resources are using a single 32bit identifier (DRWResourceHandle).
- DRWUniform & DRWCall are alloced in chunks to improve cache coherence & memory usage.
- DRWUniform now support up to vec4_copy.
- Draw calls are batch together if their resource id are consecutive.

This has a great impact on CPU usage when using lots of instances. Even if the biggest
bottleneck in these situations is the depsgraph iteration, the driver overhead when doing
thousands of drawcalls is still high.

This only improve situations where the CPU is the bottleneck: small geometry, lots of
instances.

The next step is to sort the drawcall inside a DRWCallChunk to improve the batching process
when instancing order is pretty random.

Reviewers: brecht, antoniov

Differential Revision: https://developer.blender.org/D4997

Commit Details:

Full Hash: 70892ec1e19b033b431d0d5af19f97d187cdfd6a
Parent Commit: 11e6de7
Lines Changed: +77, -0

2 Modified Paths:

/source/blender/draw/intern/draw_manager.h (+3, -0) (Diff)
/source/blender/draw/intern/draw_manager_exec.c (+74, -0) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021