8. Command Objects
• client side
– 실제 동작은 없음. request 역할.
• server side
1. server-API 를 사용하는 오브젝트로 빌드.
2. command가 예약된 만큼 실행
• 재생성 필요 없음
9. Command Buffer
• client와 server를 연결
– client, server는 각 쓰레드가 돌고 있음.
• multi-threading issue가 발생하는 곳
10. State Machine
• state cache
– rendering pipeline 추상화
• binding
– render target state
– camera state
– light state
– material state
– transform state
– ...
11. Macro State Objects
• one-to-many 관계
– client state와 server state
• client state
– RenderTarget
• server state
– clear information and operation (color, flags, ...)
– render buffer characteristics (size, ...)
– post-effects parameters and execution (blur,...)
12. Driver Execution Process
Game Client State Command Server Platform
Engine Cache Buffer Graphics API
DirectX
Bind Queue
State OpenGL
Swap
PS3
Build & XDK
Dispatch
Queue ...
Command
Queue
14. Driver Objects Pattern
<<interface>> <<interface>>
Client Command Server Command
<<interface>>
Command +Queue() +Build = 0()
+Dispatch = 0()
+Queue()
+Build = 0()
+Dispatch = 0()
Client Draw Command Server Draw Command
<<interface>>
Client Draw Command
+SetColor()
<<interface>>
Command Data
Server Draw Command
+Build()
+Dispatch()
Draw Command Data
+SetColor()
A B
15. Driver Objects Pattern
• one-to-one X
<<interface>> <<interface>>
• client code
Client Command Server Command
+Queue() +Build = 0()
+Dispatch = 0() • server code
Client Draw Command Server Draw Command
• lifetime이 client, server
<<interface>>
Command Data
분리
Draw Command Data
+SetColor()
16. Three Command Objects
• client command
– queuing
– lifetime management
• command data
– server code 실행에 인자로 사용
• server command
– platform graphics API-specific code
17. synchronization : command buffer
• double buffering
– client가 하나를 채우는 동안
– server는 하나를 실행하고 비움
• synchronization points
– client frame end
– server frame end
18. Thread Safety :
Command Data Sharing Policy
• command data에 접근
– client, server 둘 다
– 퍼포먼스가 중요
– thread safe를 보장하지 않음
• 수정이 필요하면 재생성
• refcount > 0
– 수정하려면 재생성.