slide1 l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Direct 3D Part 1: Utilizing The Maximum Power Of The GPU In Your Graphic-Intensive Windows Vista ("Longhorn") PowerPoint Presentation
Download Presentation
Direct 3D Part 1: Utilizing The Maximum Power Of The GPU In Your Graphic-Intensive Windows Vista ("Longhorn")

Loading in 2 Seconds...

  share
play fullscreen
1 / 40
gavril

Direct 3D Part 1: Utilizing The Maximum Power Of The GPU In Your Graphic-Intensive Windows Vista ("Longhorn") - PowerPoint PPT Presentation

249 Views
Download Presentation
Direct 3D Part 1: Utilizing The Maximum Power Of The GPU In Your Graphic-Intensive Windows Vista ("Longhorn")
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. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Direct 3D Part 1: Utilizing The Maximum Power Of The GPU In Your Graphic-Intensive Windows Vista ("Longhorn") Application Rudolph Balaz PRS311 Program Manager Microsoft Corporation

  2. Session Focus • PRS 311 (This talk) • Overview of Windows Vista Graphics Stack • Focus on Direct3D technologies • Discover Graphics Stack changes • Learn how to unleash the GPU • Understand what it means to your application • PRS 416 • Building applications using HLSL • Cool things you can do with Direct3D • Next generation uses of the GPU

  3. Topics Covered • Windows Vista Direct3D Goals • More Scalable / More Reliable • New uses of the GPU • Better visuals and effects • Windows Vista Direct 3D Technologies • New Display Driver Model • Direct 3D 9.0 • Direct 3D 10

  4. Direct 3D • Direct access to 3D hardware • Real time frame rates • Graphics Intensive Applications • Games, Productivity, Workstation Applications • Native & Managed APIs

  5. Windows Vista Graphics Stack Applications Windows Presentation Foundation Desktop Windows Manager Managed Direct3D9 Managed Direct3D10 Effects D3DX10 D3DX9 Direct3D9 Runtime Direct3D10 Runtime Windows Vista Display Driver Model

  6. Subtle Windows Vista Changes • GDI –software only • Desktop Composition • Your timing may vary • Actions may disable Desktop Composition • GetDC(NULL), Locking GDI primary surface • Shader Model 2.0 baseline

  7. Things To Do • Don’t lock the front buffer • Throttle rendering in Windowed mode • Test Fully • Windows XP driver model • Windows Vista driver model • With/Without Desktop Window Manager • Windowed/Fullscreen

  8. Scalability / Reliability

  9. GPU Is A Shared Resource • Presentation • Desktop Manager • Applications • Games • Multimedia • Workstation Graphics • Multi-monitor • Mobile • Remote (terminal server)

  10. Scalability / Reliability Windows Vista Display Driver Model

  11. Display Driver Model Highlights • Virtualized graphics memory • GPU Command Scheduling & Multitasking • Command translation moved to user mode • Managed Primaries • Fault tolerance • Plug and Play • Rebootless driver upgrade • Shared Surfaces • Secure Surfaces

  12. Driver Model Details • Basic Model • Available in Windows Vista • Virtualization is resource granularity • Command Scheduling is in Software • Advanced Model • Available Shortly after Windows Vista • Page-level faulting • Hardware context switching

  13. Subtle Windows Vista Changes • Can’t interleave GDI and D3D content • Don’t draw lines, Bit Blts, etc. on Window DC • Use Direct3D GetDC on Backbuffer • GDI is software • Not as performant as before • Managed Primaries • GDI popup flicker is gone for D3D9Ex • GDI Desktop ≠ Buffer in swap chain

  14. Things to do • Recreate Swap chain • If Window size ≠ Backbuffer Size • Desktop is rotated • Don’t mix GDI & D3D content

  15. Scalability / Reliability Direct3D 9.0 on Vista

  16. Direct3D9 for Vista • All Direct3D applications benefit from new Driver Model • Improved Stability • Multiple Applications • Direct3D 9.0c applications just work • Expose new driver model benefits to Applications • Direct3D9Ex • Vista Desktop built on top of D3D9

  17. Creating a Direct3D Device pD3D = Direct3DCreate9( D3D_SDK_VERSION ); pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_DIREC3D9EX | D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pd3dDevice ) ; pd3dDevice->QueryInterface( pd3dDevice, D3DCREATEDEVICEEX, pd3dDeviceEx ); • Above is changing for Windows Vista Beta 2 • Direct3D10 not in Windows Vista Beta 1 but coming Beta 2

  18. CreateTexture CreateVolumeTexture CreateCubeTexture CreateRenderTarget CreateVertexBuffer CreateIndexBuffer CreateDepthStencilSurface CreateOffscreenPlainSurface Shared Surfaces Parameter HANDLE* pSharedHandle • Resource can be re-opened using this shared handle. • Restrictions: • Resource attributes must match • Only creating Process can Lock surface • No automatic synchronization provided. • Must be D3DPOOL_DEFAULT

  19. Initialize Textures at Creation • Parameter HANDLE* pSharedHandle • Pointer to texture • Restrictions: • Must be D3DPOOL_SYSTEMMEM • Format must match texture being created

  20. GPU Resource Management • GPU Thread Priority HRESULT GetGPUThreadPriority(UINT *pPriority); HRESULT SetGPUThreadPriority(UINT Priority);   • Resource Priority • Soft-pinning • Per resource priority • Residency Check HRESULT IDirect3DDevice9Ex::CheckResourceResidency( [in, size_is ( NumResources )] IDirect3DResource9 * pResourceArray, [in] UINT32 NumResources);

  21. Presentation Control • Present same frame multiple times • VBlank HRESULT WaitForVBlank(void); • Frame Statistics HRESULT GetLastPresentIndex(UINT* pLastPresentCount); HRESULT GetFrameStatistics(D3DPRESENTSTATS* pPresentationStatistics); typedef struct _D3DPRESENTSTATS {    UINT PresentCount;    UINT PresentRefreshCount;    UINT SyncRefreshCount;    LARGE_INTEGER SyncQPCTime;    LARGE_INTEGER SyncGPUTime;} D3DPRESENTSTATS;

  22. Subtle Windows Vista Changes • D3DPOOL_DEFAULT • Resources never lost • not limited by Video memory • D3DERR_DEVICELOST - very rare • Example GPU hung and has been reset • D3DERR_DEVICEREMOVED • New error code • Driver uninstalled • Hardware removed

  23. Unsubtle Changes • TestCooperativeLevel deprecated • Always returns S_OK • Replaced by HRESULT CheckDeviceState(HWND hWindow); • New Device States D3DERR_DEVICELOST D3DERR_DEVICEHUNG D3DERR_DEVICEREMOVED S_PRESENT_OCCLUDED S_PRESENT_MODE_CHANGED

  24. When to use Direct3D9Ex • Eliminate Video Memory Limit • CAD / Design applications • Resource Sharing • Application uses multiple: Windows, Monitors, etc. • Resource Scheduling • Best Windows Vista Experience • Willing to have multiple code paths • Or only targeting newer hardware

  25. Things to do • Use D3D9Ex on Windows Vista • Use Shared surfaces to limit memory usage • Always use D3DPOOL_DEFAULT • Recreate everything on D3DDEVICE_REMOVED • Don’t use explicit resource management • Priority API’s • Use limit GPU usage when Windowed

  26. Better Visuals and Effects D3D10

  27. Direct3D10A Tremendous Step Forward • Fundamental architecture change • A new foundation for future releases • Rebuilt from the ground-up • Based on your feedback • In collaboration with the IHV’s • New hardware pipeline and software stack

  28. DXGIDirectX Graphics Infrastructure • Common operations refactored into a single DLL, isolated from rapid innovation on the 3D engine • Enables resource sharing between Direct3D®10 and future API’s

  29. Guaranteed Feature Set Strictly-defined, consistent behavior across hardware New Pipeline Stages and Primitive types Input Assembler Geometry Shader Common Shader Cores Stream Output New resource types and formats Ubiquity of resource access … Overview: The New Hardware Pipeline

  30. Resource Types And “Views”Ubiquity of Resource Usage • Create multiple “views” of a base resource for usage at different points in the pipeline • Pipeline Output • Render Target • and… • Shader Resource Input • Texture • and…

  31. Geometry ShaderPer-Primitive Operations • Operates on entire primitives[with adjacency] • Material selection/setup to reduce # of draw() calls • Set up barycentrics to exceed # of interpolators • Compute edge lengths • Compute plane equations • Compute silhouette edges GS Inputs:

  32. Single-Pass Render-to-Cubemap Geometry Shader ID3D10ShaderResourceView::GenMips(…)

  33. Single Pass Render-To-Cubemap

  34. Stream Output • Writes GS Output to one or more buffers • DrawAuto() to draw streamed-out data of variable size without CPU intervention • Uses: • Intra-frame re-use • Skin/morph once, render many • Inter-frame re-use • Iterative/procedural geometry processing • All-GPU particle systems • …

  35. Predicated Rendering • Predicate draw’s and blit’s with results of asynchronous queries • No CPU involvement required • Occlusion culling – render bounding box, predicate subsequent (complex) rendering on occlusion query result

  36. Summary • Windows Vista Direct3D Goals • Windows Vista Direct 3D Technologies

  37. Community Resources • “Windows Development” MSDN Forums • http://forums.microsoft.com/msdn/default.aspx • General, Graphics, Tools, Performance, and Audio • Notification Alerts, Messages and RSS Feeds • Integrated with Visual Studio 2005 • Advanced Search • FAQs, Answered/Unanswered Questions • directx@microsoft.com

  38. © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.