2012年3月6日 星期二

Managing Buffers Efficiently


D3D11 Device will grab a mutex for you,

CPU-GPU sync caused by CPU needs the GPU to complete.
Explicit
:
-spin-lock waiting for query
-Readback of frame buffer you just rendered to

Implicit:
- GPU memort all after deallo
-buffer renae
immediate update of a buffer still in use

The more sync points you have, the harder they are to find
- Middleware is generally written in vacuum,


Buffer usage pattern
-Forever buffer
-Long live buffer
-Transient buffer
-constants buffer




Transient buffer
- treate as a memory heap
- on CPU, freed memory available now
- on GPU, freed memory is available when GPU is finished used it.

CTrabsientBuffer: spin-lock waiting for RetiredFrame Queue
Transient buffer pattern work in Dx9

Discard-free temporary buffers


Constant buffers
-Group by frequency of update
-The cheapest, you never updates
-Splitting constants this way eliminates constants updates for static objects

Trick fot constant buffer
-use shard structs to update
-Assign them to slots by convention:
  - b0:per frame, p1: per-camera

Performance investigation

沒有留言:

張貼留言