1 / 19

Introduction to Direct3D 10 Course

Introduction to Direct3D 10 Course. Porting Game Engines to Direct3D 10: Crysis / CryEngine2 Carsten Wenzel. Overview. Introduction D3D10 & CryEngine2 Porting, integration issues and optimizations Random bits Conclusion. Introduction. Early adaptation

aadi
Download Presentation

Introduction to Direct3D 10 Course

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Direct3D 10 Course Porting Game Engines to Direct3D 10: Crysis / CryEngine2Carsten Wenzel

  2. Overview • Introduction • D3D10 & CryEngine2 • Porting, integration issues and optimizations • Random bits • Conclusion

  3. Introduction • Early adaptation • Spec reviews / discussions started in 2005 • Actual work began middle 2006 • Support from MS and IHVs was crucial

  4. D3D10 in context of a multi-platform engine (1/3) • API redesign offers a more concise view on how modern graphics hardware works • For the sake of performance it “offloads” a lot of responsibility to the API user

  5. D3D10 in context of a multi-platform engine (2/3) • CryEngine2 is designed to be multi-platform • Render implementations share one interface and a lot of common code • State & resource management • Draw list processing • Shader subsystem, etc.

  6. D3D10 in context of a multi-platform engine (3/3) • Certain API changes required special consideration • State objects • Shader model 4.0 • Constant buffers • Strict API validation (shader linkage, etc) • Buffer updates • Support for new features • E.g. Geometry Shader, Stream Out, Texture Arrays

  7. Porting and making it work (1/2) • Render code separates platform / API dependent parts from independent parts • D3D10 renderer specializes base renderer • Inherits interface and all common code

  8. Porting and making it work (2/2) • Platform / API dependent parts wrapped and called from common code • Provided stubs implemented one at a time • #ifdef where API characteristics were awkward to map to common code flow

  9. Special considerations (1/5): State objects • Need fine grained control over render states! • Wrap state manipulation • Internally caches state objects • Currently build state objects on demand • Pre-warming cache might be worthwhile

  10. Special considerations (2/5):Shader model 4.0 • Use custom shader / effect system • Updated to support new API features and enhanced HLSL syntax • Query resource bindings via Shader Reflection • Compile existing shaders as is (/Gec) • Refactored to utilize load balancing • Still use shader cache

  11. Special considerations (3/5):Constant buffers • Group constants by frequency of update • Each group maps to a unique CB index • Constants bound via semantic which encodes group id • Allows preprocessor to move constants into their appropriate CB scope • Existing shaders automatically benefit from efficient binding • Source shader scripts devoid of API specific annotations • Shader authors don’t have to worry about API

  12. Special considerations (4/5):Strict API validation • API rigorously checks how user drives it • Simplifies lower API / driver levels • Example: Shader linkage • Vertex layout / output signature has to match input signatures of following shader • Dimension of each passed element has to match dimension expected in following shader • Took some time to clean up / unify signatures • Nice side effect: Signature-fixed shaders run faster on DX9

  13. Special considerations (5/5):Buffer updates • Update methods for truly static / dynamic buffers remain as in D3D9 • Occasional updates of static buffers can cause severe pipeline stalls(e.g. updating terrain) • Staging resources as intermediate storage • This way mesh update can be pipelined

  14. Random DX10 bits used in CryEngine2 • GS used for particles and shadows • Viewports for texture atlas • Filtered texture lookups in vertex shader (FFT water) • Multi-sampled texture lookup(HDR post-processing) • Sample depth from z buffer • Render to volume texture

  15. Conclusion • New D3D10 features are great • Perf improvements are definitely there • Expect several code revisions to drive the API in the most efficient way

  16. More details • [1] “Finding Next-Gen”, Martin Mittring, SIGGRAPH 2007 • Part of course 28, “Advanced Real-time Rendering in 3D Graphics in Games” • Wed Aug 8th, Room 7AB, 8:30 am - 5:30 pm • [2] “Real-time Atmospheric Effects in Games Revisited”, Carsten Wenzel, GDC 2007 • Slides and course notes available online

  17. Acknowledgements • Crytek R&D Graphics Group • Many thanks to MS, NVIDIA and ATI for the support

  18. Questions? *

More Related