Modern graphics using windows 7 and direct3d 11 hardware
Download
1 / 51

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


  • 191 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
Modern graphics using windows 7 and direct3d 11 hardware l.jpg

CL15

Modern Graphics Using Windows 7 and Direct3D 11 Hardware

Michael Oneppo


Agenda l.jpg
Agenda

  • Windows 7 Direct3D Review

    • Direct3D 10 Review

    • Expanding Reach: D3D10Level9 and WARP

    • HLSL & Shaders

  • Direct3D 11

    • Multi-Threading

    • Tessellation


Directcompute l.jpg
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 l.jpg
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 l.jpg
Agenda

  • Windows 7 Direct3D Review

    • Direct3D 10 Review

    • Expanding Reach: D3D10Level9 and WARP

    • HLSL & Shaders

  • Direct3D 11

    • Multi-Threading

    • Tessellation


Review the d3d10 pipeline l.jpg
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 l.jpg
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 l.jpg

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 l.jpg
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 l.jpg
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 l.jpg
Direct3D 10 Level 9 and DirectX

  • Also accessible through Direct3D 11

  • Direct2D automatically uses Direct3D 10 Level 9



Our criteria for warp development l.jpg
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 l.jpg
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 l.jpg
Shaders

The heart and soul of modern graphics programming


What is a shader l.jpg
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 l.jpg
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 l.jpg
Agenda

  • Windows 7 Direct3D Review

    • Direct3D 10 Review

    • Expanding Reach: D3D10Level9 and WARP

    • HLSL & Shaders

  • Direct3D 11

    • Multi-Threading

    • Tessellation



D3d11 design goals l.jpg

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 l.jpg

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 l.jpg
D3D11 Interfaces 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 l.jpg

Can create many deferred contexts interfaces

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 l.jpg
D3D11 Interfaces interfaces

Immediate

Context

Deferred

Context

Deferred

Context

Command List

Command List

DrawPrim

DrawPrim

DrawPrim

DrawPrim

DrawPrim

DrawPrim

DrawPrim

DrawPrim

DrawPrim

Execute

Execute


State inheritance l.jpg

Command lists are optimized for single use interfaces

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 l.jpg

State recorded in a command list does interfacesnot 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 l.jpg

D3D11 API is available on D3D10 hardware & drivers interfaces

D3D10 drivers can be updated to better support some D3D11 features

Works on Windows Vista too!

D3D11 on D3D10


Tessellation l.jpg

Tessellation interfaces

Why Tessellate?


Asset size comparison l.jpg
Asset Size: Comparison interfaces

Pre-Tesselated Mesh: ~5500 kB

Sub-D Mesh: ~130 kB


More reasons l.jpg
More Reasons interfaces

  • Continuous level of detail

  • Skin at the control mesh level

  • Faster dynamic computations at the control mesh level

    • Cloth

    • Collisions


Direct3d 11 tessellation design l.jpg

Direct3D 11 interfacesTessellation Design


New primitives l.jpg
New Primitives interfaces


Hull shader l.jpg
Hull Shader interfaces

  • Operates per input primitive

    • E.g. patch

  • Computes control point transforms

    • E.g. Basis Change

  • Computes tessellation factors per edge of generated patches


Tessellator l.jpg
Tessellator interfaces

  • 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 l.jpg
Domain Shader interfaces

  • 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 l.jpg

Basic Tessellation interfaces

demo

Hull Shaders & Domain Shaders


This is a lot l.jpg
This is a lot… interfaces

  • 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 l.jpg
No Compromise: Details & Performance! interfaces

  • 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 l.jpg
FBX Format: Industry Momentum interfaces

  • 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 l.jpg
The Platform Update for Windows Vista interfaces

  • 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 l.jpg
Additional Resources interfaces

  • 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 l.jpg

YOUR FEEDBACK IS IMPORTANT TO US! interfaces

Please fill out session evaluation forms online at

MicrosoftPDC.com


Learn more on channel 9 l.jpg
Learn More On Channel 9 interfaces

  • 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 l.jpg
Hull Shader interfaces 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 l.jpg
Domain Shader interfaces Syntax

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

OutputPatch<MyOutPoint, 12> ControlPts, MyTessFactorstessFactors ){

result.Position =

EvaluateSurfaceUVtoXYZ( ControlPoints, myInputUV );}