图形渲染时的数据传输流程


sequenceDiagram

participant CPU
participant Storage as Storage<br/>硬盘
participant RAM as RAM<br/>内存

box 显卡
participant VRAM as VRAM<br/>显存
participant GPU
end

CPU->>Storage: 请把数据传给 RAM!
activate Storage
Storage->>Storage: 传输数据到 RAM
deactivate Storage
destroy Storage
Storage-->>RAM: 网格与纹理数据

activate CPU
CPU->>CPU: 处理 RAM 中的数据
deactivate CPU

CPU->>GPU: 请准备好处理一些数据!

CPU->>VRAM: 请接收来自 RAM 的数据!
activate VRAM
activate CPU
CPU->>CPU: 转移 RAM 的数据到 VRAM
RAM-->>VRAM: 网格与纹理数据
deactivate VRAM

CPU->>CPU: 删除 RAM 中不再使用的数据。
deactivate CPU
note over CPU,RAM: 有些数据还会被用作碰撞体轮廓

activate GPU
GPU->>GPU: 进行渲染
deactivate GPU

CPU->>GPU:请释放 VRAM 中不再使用的数据!
note over CPU,GPU: 爆显存就是因为这一步的机制没做好
activate GPU
GPU->>GPU:释放VRAM中无用的数据
deactivate GPU