Subtitle - PowerPoint PPT Presentation

1 / 19
About This Presentation
Title:

Subtitle

Description:

Platform / API dependent parts wrapped and called from common code ... #ifdef where API characteristics were awkward to map to common code flow ... – PowerPoint PPT presentation

Number of Views:47
Avg rating:3.0/5.0
Slides: 20
Provided by: aut125
Category:
Tags: code | subtitle

less

Transcript and Presenter's Notes

Title: Subtitle


1
(No Transcript)
2
Introduction to Direct3D 10 Course
  • Porting Game Engines to Direct3D 10 Crysis /
    CryEngine2Carsten Wenzel

3
Overview
  • Introduction
  • D3D10 CryEngine2
  • Porting, integration issues and optimizations
  • Random bits
  • Conclusion

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

5
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

6
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.

7
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

8
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

9
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

10
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

11
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

12
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 dont have to worry about API

13
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

14
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

15
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

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

17
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, 830 am - 530 pm
  • 2 Real-time Atmospheric Effects in Games
    Revisited, Carsten Wenzel, GDC 2007
  • Slides and course notes available online

18
Acknowledgements
  • Crytek RD Graphics Group
  • Many thanks to MS, NVIDIA and ATI for the support

19
Questions?
Write a Comment
User Comments (0)
About PowerShow.com