+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
[GEG1] 10.camera-centric engine design for multithreaded rendering
1. Game Engine Gems 1
Chap 10.
Camera-Centric Engine Design
for Multithreaded Rendering
ohyecloudy http://ohyecloudy.com
shader café http://cafe.naver.com/shader
2011.04.11
2. Uses of Multi-Core in Video Games
Multithreaded Command Buffers
Device-Independent Command Buffers
A Camera-Centric Design
Future Work
3. frame
Main Sim Shadow Reflect Main Post-
thread Update Maps Maps View Process
Anim
Particle
Physics
Update
Thread Update
Pool
4. frame
Main Sim Shadow Reflect Main Post-
thread Update Maps Maps View Process
Anim
Particle
Rendering API를
Physics
Update
Update 호출할 필요가 없는 작업만
Thread
Pool multithread
5. frame
Main Sim Shadow Reflect Main Post-
thread Update Maps Maps View Process
Stage 별로 그룹화
Anim
각Physics Particle 직접 device call
스테이지에서
Update
Thread Update
Pool
그래서 device를 소유하는
thread에서 대부분 일을 처리
6. Uses of Multi-Core in Video Games
Multithreaded Command Buffers
Device-Independent Command Buffers
A Camera-Centric Design
Future Work
7. • 그리기 명령을 수행하는데 필요한 정보
– device level
• rendering API 내부에 존재
– API를 호출하면 버퍼를 채움
– CPU 사용
8. • command buffer를 추상화
– multithread로 command buffer를 채울 수 있게
– device 독립
• DX9
– multithread command buffer 불가능
– device를 소유한 thread에서만 API call
– multithread를 지원 옵션이 있긴 있다
• 모든 call에 베타제어
• 성능 저하가 심함
• 제외
9. Uses of Multi-Core in Video Games
Multithreaded Command Buffers
Device-Independent Command Buffers
A Camera-Centric Design
Future Work
15. Uses of Multi-Core in Video Games
Multithreaded Command Buffers
Device-Independent Command Buffers
A Camera-Centric Design
Future Work
16. • load balancing 필요
– command buffer 채우는 작업을 할당
– thread 별로 어떻게 할당?
• 최종 장면이 나오기 전까지 여러 장면을 렌더링
– shadow map, reflection, post processing, …
– 카메라
• 장면마다 공유
17. • camera 단위
– command buffer 생성을 쪼갠다.
• draw call 묶기
– API 호출에 따른 오버헤드 최소화
– render state 변경 최소화
– batch
18. frame
Submit
Main Sim
to
thread Update Device
Anim Render
Particle
Physics View
Update
Thread Update Filling
Pool
20. void renderControl::CreateRenderViews()
{
List<RenderView *> currentViews;
for (int i = 0; i < mCameras.size(); ++i) {
currentViews.add(
new RenderView(mCameras[i], kVT_MainCamera));
}
for (int i = 0; i < mLights.size(); ++i) {
if (mLights[i].IsShadowCasting()) {
currentViews.add(
new RenderView(
mLights[i].getShadowCamera(),
kVT_ShadowMap));
}
}
for (int i = 0; i < currentViews.size(); ++i) {
ThreadPool.QueueWork(
procThreadedFillRenderView, currentViews[i]);
}
ThreadPool.waitForWorkToFinish();
}