modern graphics using windows 7 and direct3d 11 hardware
Download
Skip this Video
Download Presentation
Modern Graphics Using Windows 7 and Direct3D 11 Hardware

Loading in 2 Seconds...

play fullscreen
1 / 51

Modern Graphics Using Windows 7 and Direct3D 11 Hardware - PowerPoint PPT Presentation


  • 189 Views
  • Uploaded on

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

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Modern Graphics Using Windows 7 and Direct3D 11 Hardware' - percy


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
agenda
Agenda
  • Windows 7 Direct3D Review
    • Direct3D 10 Review
    • Expanding Reach: D3D10Level9 and WARP
    • HLSL & Shaders
  • Direct3D 11
    • Multi-Threading
    • Tessellation
directcompute
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!
when to use direct3d
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
agenda5
Agenda
  • Windows 7 Direct3D Review
    • Direct3D 10 Review
    • Expanding Reach: D3D10Level9 and WARP
    • HLSL & Shaders
  • Direct3D 11
    • Multi-Threading
    • Tessellation
review the d3d10 pipeline
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
review d3d10level9 feature levels
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
slide9

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

d3d10level9 feature level codes
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,
  • };
d3d10level9 device creation
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;
  • }
direct3d 10 level 9 and directx
Direct3D 10 Level 9 and DirectX
  • Also accessible through Direct3D 11
  • Direct2D automatically uses Direct3D 10 Level 9
our criteria for warp development
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
how warp fits in
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
  • );
  • }
shaders
Shaders

The heart and soul of modern graphics programming

what is a shader
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)
example shader
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 );

}

agenda19
Agenda
  • Windows 7 Direct3D Review
    • Direct3D 10 Review
    • Expanding Reach: D3D10Level9 and WARP
    • HLSL & Shaders
  • Direct3D 11
    • Multi-Threading
    • Tessellation
d3d11 design goals

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
devices and contexts

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
d3d11 interfaces
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

deferred contexts

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
d3d11 interfaces25
D3D11 Interfaces

Immediate

Context

Deferred

Context

Deferred

Context

Command List

Command List

DrawPrim

DrawPrim

DrawPrim

DrawPrim

DrawPrim

DrawPrim

DrawPrim

DrawPrim

DrawPrim

Execute

Execute

state inheritance

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
state inheritance27

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
d3d11 on d3d10

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
tessellation

Tessellation

Why Tessellate?

asset size comparison
Asset Size: Comparison

Pre-Tesselated Mesh: ~5500 kB

Sub-D Mesh: ~130 kB

more reasons
More Reasons
  • Continuous level of detail
  • Skin at the control mesh level
  • Faster dynamic computations at the control mesh level
    • Cloth
    • Collisions
hull shader
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
tessellator
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
domain shader
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
basic tessellation

Basic Tessellation

demo

Hull Shaders & Domain Shaders

this is a lot
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…

no compromise details performance
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
fbx format industry momentum
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
the platform update for windows vista
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
additional resources
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
slide46

YOUR FEEDBACK IS IMPORTANT TO US!

Please fill out session evaluation forms online at

MicrosoftPDC.com

learn more on channel 9
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….

hull shader syntax
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;

}

domain shader syntax
Domain Shader Syntax

void main( out MyDSOutput result, float2 myInputUV : SV_DomainPoint,MyDSInputDSInputs,

OutputPatch<MyOutPoint, 12> ControlPts, MyTessFactorstessFactors ){

result.Position =

EvaluateSurfaceUVtoXYZ( ControlPoints, myInputUV );}

ad