1 / 51

Modern Graphics Using Windows 7 and Direct3D 11 Hardware

CL15. Modern Graphics Using Windows 7 and Direct3D 11 Hardware. Michael Oneppo. Agenda. Windows 7 Direct3D Review Direct3D 10 Review Expanding Reach: D3D10Level9 and WARP HLSL & Shaders Direct3D 11 Multi-Threading Tessellation. DirectCompute. Direct3D 11 also offers DirectCompute

percy
Download Presentation

Modern Graphics Using Windows 7 and Direct3D 11 Hardware

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. CL15 Modern Graphics Using Windows 7 and Direct3D 11 Hardware Michael Oneppo

  2. Agenda • Windows 7 Direct3D Review • Direct3D 10 Review • Expanding Reach: D3D10Level9 and WARP • HLSL & Shaders • Direct3D 11 • Multi-Threading • Tessellation

  3. DirectCompute • Direct3D 11 also offers DirectCompute • Meant for general purpose programming on the GPU (GPGPU) • P09-16 “DirectX11 DirectCompute” Chas Boyd Thursday, 11:30 AM, 408A • DirectCompute Hands-on Lab • Running every day!

  4. When To Use Direct3D • Direct3D is a low-level, programmable rasterizer • Bare-bones, meant for getting the best performance possible • Use for • High-performance, high-quality 3D • Utmost control over the GPU

  5. Agenda • Windows 7 Direct3D Review • Direct3D 10 Review • Expanding Reach: D3D10Level9 and WARP • HLSL & Shaders • Direct3D 11 • Multi-Threading • Tessellation

  6. Review: The D3D10 Pipeline • Input Assembler • Fixed-function • Takes in vertices • Does tasks like indexing, instancing • Vertex Shader • Programmable • Performs an operation on each vertex produced by the input assembler • Geometry Shader • Programmable • Performs an operation on primitive (triangle, line segment, or point) • Output Merger • Fixed-function • Combines the output of pixels into a rendered image • Blending • Depth Testing • Stenciling • Rasterizer • Fixed-function • Converts primitives to pixels • Pixel Shader • Programmable • Computes the color value of each pixel

  7. Expanding Reach: Direct3D10 Level 9

  8. Review: D3D10Level9 & Feature Levels • Direct3D 9 hardware had hundreds of individual capabilities or “CAPS” • Ultra fine-grained feature control • D3D10 Level 9 offers just 3 levels • FeatureLevel9_1 • FeatureLevel9_2 • FeatureLevel9_3

  9. Feature Level 9_3: Shader model 3.0 NV 6800 + ATI 1x00 series + Super set Feature Level 9_2: Shader model 2.0 Some additional features (next slide) ATI 9800 ATI X200 Super set Feature Level 9_1: Shader model 2.0 Intel 965, Geforce FX Older S3 Parts SIS Mirage

  10. D3D10Level9 Feature Level Codes • static const D3D10_FEATURE_LEVEL1 levelAttempts[] = • { • D3D10_FEATURE_LEVEL_10_1, • D3D10_FEATURE_LEVEL_10_0, • D3D10_FEATURE_LEVEL_9_3, • D3D10_FEATURE_LEVEL_9_2, • D3D10_FEATURE_LEVEL_9_1, • };

  11. D3D10Level9 Device Creation • for (UINT level = 0; level < ARRAY_SIZE(levelAttempts); level++) • { • hr = D3D10CreateDevice1( • pAdapter, • DriverType, • Software, • Flags, • levelAttempts[level], • D3D10_1_SDK_VERSION, • &spDevice • ); • if (SUCCEEDED(hr)) • break; • }

  12. Direct3D 10 Level 9 and DirectX • Also accessible through Direct3D 11 • Direct2D automatically uses Direct3D 10 Level 9

  13. WARP 10

  14. Our Criteria for WARP Development • 100% conformant with Direct3D10 Spec • Performance • Fast enough for most mainstream scenarios • Scales very well with the number of cores on your system • Tested against many sophisticated applications • Games • CAD software

  15. How WARP fits in • if !(SUCCEEDED(hr)) • { • hr = D3D10CreateDevice1( • NULL, • D3D10_DRIVER_TYPE_WARP, • NULL, • 0, • D3D10_FEATURE_LEVEL_10_1, • D3D10_1_SDK_VERSION, • &pDevice • ); • }

  16. Shaders The heart and soul of modern graphics programming

  17. What is a Shader? • A script that tells a programmable stage of the graphics hardware what calculations to do to achieve a material, transformation, or effect • Written in HLSL • C++-like language that is designed for this task • Has a huge number of convenience features that exploit core features of the graphics card • No pointers  • Builtin variables (float4, matrix, etc) • Intrinsic functions (mul, normalize, etc)

  18. Example Shader float4 PSFloorEffect( PSSceneIn input ) : SV_TARGET { float2 tex = float2( input.Tex.x, input.Tex.y + g_fElapsedTime*.097 ); tex.x += sin( input.Tex.y*40 )*0.001; tex.y += sin( input.Tex.y*60 )*0.001; float4 color = BoxFilter( g_samLinearClampU, tex, 7 ); return float4( color.xyz * 0.999f, 1 ); }

  19. Agenda • Windows 7 Direct3D Review • Direct3D 10 Review • Expanding Reach: D3D10Level9 and WARP • HLSL & Shaders • Direct3D 11 • Multi-Threading • Tessellation

  20. Multi-Threading

  21. Asynchronous resource loading Upload resources, create shaders, create state objects in parallel Concurrent with rendering Multithreaded draw & state submission Spread out render work across many threads D3D11 Design Goals

  22. D3D device functionality now split into three separate interfaces Device, Immediate Context, Deferred Context Device has free threaded resource creation Immediate Context is your single primary device for state, draws, and queries Deferred Contexts are your per-thread devices for state & draws Devices and Contexts

  23. D3D11 Interfaces Render Thread Load Thread 1 Load Thread 2 CreateTexture CreateShader Immediate Context Device DrawPrim CreateVB CreateTexture DrawPrim CreateShader CreateShader DrawPrim CreateIB CreateVB DrawPrim DrawPrim

  24. Can create many deferred contexts Each one is single threaded (thread unsafe) Deferred context generates a Command List Command list is consumed by Immediate or Deferred contexts No read-backs or downloads from the GPU Queries Resource locking Lock with DISCARD is supported on deferred contexts Deferred Contexts

  25. D3D11 Interfaces Immediate Context Deferred Context Deferred Context Command List Command List DrawPrim DrawPrim DrawPrim DrawPrim DrawPrim DrawPrim DrawPrim DrawPrim DrawPrim Execute Execute

  26. Command lists are optimized for single use Less optimized for precompiled usage scenarios No state is inherited from immediate context Deferred contexts start out with default state Dynamic state can be injected via resources Constant buffers, textures, queries, VBs, etc. State Inheritance

  27. State recorded in a command list does not affect immediate context at all Can optionally persist immediate context state Fastest performance: reset immediate context state after command list execution, when executing command lists back-to-back State Inheritance

  28. D3D11 API is available on D3D10 hardware & drivers D3D10 drivers can be updated to better support some D3D11 features Works on Windows Vista too! D3D11 on D3D10

  29. Tessellation Why Tessellate?

  30. Asset Size: Comparison Pre-Tesselated Mesh: ~5500 kB Sub-D Mesh: ~130 kB

  31. More Reasons • Continuous level of detail • Skin at the control mesh level • Faster dynamic computations at the control mesh level • Cloth • Collisions

  32. Direct3D 11 Tessellation Design

  33. New Primitives

  34. Hull Shader • Operates per input primitive • E.g. patch • Computes control point transforms • E.g. Basis Change • Computes tessellation factors per edge of generated patches

  35. Tessellator • Inputs • Takes in “Tessellation Factors” provided by the Hull shader • Tess factors per-side in the range of [2.0..64.0] • Outputs • UV or UVW domain points • Connectivity of those points (tris, lines) • No adjacency information • Many possible partitioning schemes

  36. Domain Shader • Operates on each point generated by the tessellator • Gets ALL control points as input • Control points and patch constant data are passed directly to the domain shader • Evaluate primitive surface to compute position of points • Convert from U,V space into positions, tangents

  37. Basic Tessellation demo Hull Shaders & Domain Shaders

  38. This is a lot… • There’s a lot of complexity here, but it’s worth it • D3D11 can target almost any surface algorithm you want • Bezier • NURBs • Dynamic and static tessellation • Displacement • Subdivision and more…

  39. No Compromise: Details & Performance! • Low poly count for high performance • High poly count for refined detail • Iteratively refine to produce a smooth limit surface • Modern implementations allow for creases and other hard edges • Detail can be layered on with displacement & normal maps

  40. FBX Format: Industry Momentum • Data transport for geometry, textures & lighting and animation • Integration with most common digital content creation (DCC) applications • Support for Direct3D 11 Tessellation for “round trip” iterations • Create in your application of choice • Export via FBX • Review in DX rendering engine

  41. SubD11 (a.k.a. “Sebastian”) demo

  42. The Platform Update for Windows Vista • Down-level availability of key Windows 7 features on Windows Vista • Available on Windows Update • More information: • http://support.microsoft.com/kb/971644

  43. Additional Resources • DirectX on MSDN: • http://msdn.microsoft.com/directx • Windows 7 SDK: • http://msdn.microsoft.com/windows • August 2009 DirectX SDK: • http://msdn.microsoft.com/directx/sdk

  44. YOUR FEEDBACK IS IMPORTANT TO US! Please fill out session evaluation forms online at MicrosoftPDC.com

  45. Learn More On Channel 9 • Expand your PDC experience through Channel 9 • Explore videos, hands-on labs, sample code and demos through the new Channel 9 training courses channel9.msdn.com/learn Built by Developers for Developers….

  46. Hull Shader Syntax [patchsize(12)] [patchconstantfunc(MyPatchConstantFunc)] MyOutPoint main(uint Id : SV_ControlPointID, InputPatch<MyInPoint, 12> InPts) { MyOutPoint result; … result = TransformControlPoint( InPts[Id] ); return result; }

  47. Domain Shader Syntax void main( out MyDSOutput result, float2 myInputUV : SV_DomainPoint,MyDSInputDSInputs, OutputPatch<MyOutPoint, 12> ControlPts, MyTessFactorstessFactors ){ … result.Position = EvaluateSurfaceUVtoXYZ( ControlPoints, myInputUV );}

More Related