Professional Documents
Culture Documents
a!efest "##$
raphics Track
%ntroduction to the Direct&D 11 raphics 'ipeline Direct&D 11 Tessellation (igh )e*el Shader )anguage +()S), Update-%ntroducing .ersion /0# Multithreaded 1endering for a!es Direct&D 11 Co!pute Shader-More enerality for 2d*anced Techni3ues
'artners Track
2d*anced Topics in 'U Tessellation +2MD, Water4Tight5 Te6tured5 Displaced Subdi*ision Surface Tessellation Using Direct&D 11 +7.%D%2,
DirectX 11 8*er*iew
Direct&D 11 is based on Direct&D 1#01
Si!ilar 2'% design 9 rendering pipeline
Enables new DirectX 11 hardware features Supports e6isting DirectX 1# and 1#01 hardware
Enables so!e new features as well
Supports a subset of DirectX : SM "0#; hardware Supported on Windows <5 Windows .ista5 Windows Ser*er "##$5 and Windows Ser*er "##$ 1"
DirectCo!pute
CS /0# on DirectX 11 (W CS >06 on so!e DX1#06 h?w
(ardware Tessellation
DirectX 11 (W only
Each feature le*el is a superset of the pre*ious one Concept was introduced with Direct&D 1#01
ID3D10Device1::GetFeatureLevel() D3D10_FEATURE_LEVEL_10_1 D3D10_FEATURE_LEVEL_10_0
D3D_FEATURE_LEVEL_10_1 +e0g0 2T% 1adeon (D "###?&###?>### SeriesE 7.%D%2 eBorce "1#? T""#, D3D_FEATURE_LEVEL_11_0 +e0g0 2T% 1adeon (D /### Series,
Direct&D 1#01 hardwareF Shader Model >015 cube!ap arrays5 e6tended MS225 optional DirectCo!pute +CS >01,5 all 1#G# features0
Direct&D 11 hardwareF Shader Model /0#5 hull 9 do!ain shaders5 !andatory DirectCo!pute +CS /0#,5 @CA(?@C<5 all 1#G1 features0
Direct&D : hardwareF !ust support Shader Model "0# +*sG"G#?psG"G#,5 occlusion 3ueries5 float for!ats +no blending,5 e6tended caps5 all :G1 features0 Direct&D : hardwareF !ust support Shader Model "0# +*sG"G#?psG"Gb, with instancing5 >H te6tures5 !ultiple render targets +> M1Ts,5 floating4 point blending5 all :G" features0
@ 12 +&'G'R'(', for!ats
optional for 1#G# ? 1#G1
DirectCo!pute
D3D_FEATURE_LEVEL_10_0+? 10_1+support for CS >06 is optional CS /0# is re3uired for D3D_FEATURE_LEVEL_11_0
1elated Technologies
DirectX raphics %nfrastructure +DX %, 101
.ersion 10# introduced in Windows .ista Enu!erates adapters5 display !odes5 and outputs +e0g0 !onitors, 7ew DXGI_FORMATs and i!pro*ed support for re!ote desktops
Demo
Updated D6Caps.iewer Utility
%D&D1# eo!etryShader
%D&D1#1asteri=erState
%D&D1#Counter
%D&D1#Te6ture&D
%D&D1#DepthStencil.iew
%D&D1#Sa!plerState
%D&D1# eo!etryShader
%D&D1#1asteri=erState
%D&D1#Counter
%D&D1#Te6ture&D
%D&D1#DepthStencil.iew
%D&D1#Sa!plerState
%D&D11 eo!etryShader
%D&D111asteri=erState
%D&D11Counter
%D&D11Te6ture&D
%D&D11DepthStencil.iew
%D&D11Sa!plerState
%D&D11De*iceChild %D&D11De*ice
%D&D112synchronous
%D&D111esource
%D&D11.iew
%D&D11.erte6Shader %D&D11 eo!etryShader %D&D11'i6elShader %D&D11Co!puteShader %D&D11Do!ainShader %D&D11(ullShader %D&D11%nput)ayout %D&D11'redicate %D&D11DepthStencilState %D&D11@lendState %D&D11Te6ture"D %D&D11DepthStencil.iew %D&D11Te6ture1D %D&D111enderTarget.iew %D&D11Luery %D&D11@uffer %D&D11Shader1esource.iew
%D&D11De*iceConte6t
Multi4threading 1ules
ID3D11Device is thread4safe
Without dri*er support for Concurrent Creates5 runti!e will enforce thread4safety with a coarse lock Without dri*er support for Concurrent Creates5 creating obIects and rendering with the i!!ediate conte6t will not be concurrent +using the sa!e coarse lock, Methods on !ost other obIects +ID3D11DeviceC il04 deri*ed, are also thread4safe Can opt4out by using D3D11_CREATE_DEVICE_$I*GLET1READED
Multi4threading 1ules
ID3D11DeviceC",te-t+is not thread4safe
Typical usage is one de*ice conte6t per thread5 one of the! using i!!ediate and the rest using deferred conte6ts 7ote that DX % !ethods should not be used concurrently while rendering with the i!!ediate de*ice conte6t
Bor e6a!ple5 2re3e,t()+uses the i!!ediate de*ice conte6t
Multi4threading 1ules
ID3D11DeviceC",te-t+deferred !ode li!itations
Ma%() !ust be used with D3D11_MA2_7RITE_DI$CARD and?or D3D11_MA2_7RITE_*O_OVER7RITE GetData()+for 3ueries is not allowed Lueries can be used in conIunction with predication %f e6ecuting a deferred co!!and list with a 3uery acti*e and the co!!and list itself uses the sa!e 3uery5 then the co!!and list sub!ission is ignored as in*alid
Multi4threading 1eco!!endations
Concurrent creation is a no brainer
Many engines already ha*e resource loading threads 1unti!e e!ulation is Cgood enoughD for a win
)ess o*erhead than the default Direct&D 1# M?T beha*ior
ConcurrentCreates dri*er support !akes it better When creating obIects with M?T dri*er support5 pro*iding initial data for static obIects should be !ore efficient
i0e Use the %I,itialData para!eter on the Create rather than staging resources5 U%0ate$u8Re3"urce()5 or Ma%()+when possible
Multi4threading 1eco!!endations
Concurrent sub!ission depends on the scenario
Useful for Triple4core5 Luad4core5 or !ore
Bor Dual4core5 it is less likely to be worthwhile
Si!ilar but not identical to Xbo6 &A# Co!!and @uffers Dri*er Co!!and)ists support is currently rare
%f starting with Direct&D 1#0#5 will need to fi6 up a few !inor structure differences
+11 !atches the 1#01 *ersion,
D3D10_&LE*D_DE$C1 D3D10_$1ADER_RE$OURCE_VIE7_DE$C1
Change resource Ma%() and 3uery &e.i,()5 E,0()5 9 GetData()+to use i!!ediate conte6t Create($ a0er takes an additional class linkage para!eter +can use *ULL, ($et$ a0er+and (Get$ a0er+take an additional class instance para!eter +can use *ULL,
Start with the e6isting guidance for !o*ing fro! Direct&D : to Direct&D 1#
12'( "##< Course O/
Introduction to Direct3D 10
httpF??!sdn0!icrosoft0co!?direct6?presentations
httpF??www0!icrosoftga!efest0co!?presentations?"##<0ht!
()S) Co!piler
DirectX 11 re3uires >0# or later profile shaders D&DCo!pile D)) contains latest ()S) co!piler
Used by D&DX:5 D&DX1#5 D&DX115 and FXC:EXE Can use directly +i0e0 without using D&DX,
7ote it is in its own DirectSetup C2@ file in the 1ED%ST folder
()S) 1eco!!endations
Use the latest co!piler
Esp0 a*oid the Kin bo6J D&D1#Co!pile 2'%s
enerally use the lowest profile possible for .S?'S when supporting 1#le*el: Bor DirectCo!pute
prefer CS /0# o*er CS >06 'refer CS >01 o*er CS >0#
D&DX11
%ncludes te6ture loaders +@M'5 R' 5 '7 5 DDS5 T%BB5 %B,
and asynchronous loaders introduced with D&DX1#
D&DCSX
8ptional e6tended D&DX D)) for Co!pute Shader
1esides in its own DirectSetup ? 1ED%ST C2@
ID3DX11FFT
1D5 "D5 &D support 1eal or Co!ple6 Borward or %n*erse Transfor! with optional scale
X72Math
aka 6bo6!ath "0# %nline C;; SSE?SSE" opti!i=ed !ath library
.MX1"$ opti!i=ed on Xbo6
S&/# functions
Bocused on single4precision floating4point operations )i!ited integer operations Con*ersion to?fro! packed graphics for!ats %!ple!ented using .isual Studio intrinsics Supports 6$A and 6A> nati*e
DirectX 11 Deploy!ent
DirectX 11 1unti!e is included with Windows < and Windows Ser*er "##$ 1" DirectX 11 1unti!e can be deployed down4le*el to Windows .ista ? Ser*er "##$ D&DX115 D&DCSX5 D&DCo!pile5 etc0 installed by DirectSetup ? DX SDH 1ED%ST
Rust like D&DX:5 D&DX1#5 X2UD%8"5 etc0
DirectX 11 1unti!e
Direct&D 11 DX % 101 W21'1# 1#le*el: Direct&D 1#01 Direct"D DirectWrite
7ew 2'% supporting 1#5 1#015 115 1#le*el:5 and W21'1# D&D glue library updated for new for!ats and WDDM 101 dri*er features 1#01 le*el software renderer Direct&D : Shader Model "0# h?w support +:G15 :G"5 :G& feature le*els, Updated e6isting 2'% to support W21'1#5 1#le*el: D%4like "D drawing 2'% for working on Direct&D surfaces
H@ :<1A>>
httpF??go0!icrosoft0co!?fwlink?T)ink%dP1A#1$:
Deployed through Windows Update 1e3uires Windows .ista ? Ser*er "##$ S'" to be installed See the D3D11I,3tall1el%er sa!ple in the DirectX SDH for detection5 applying the H@5 and !essaging for 1TM ? S'1 Detailed in Direct3D 11 De!loyment for Game De(elo!ers technical article
H@ :<1/1"
Bor corporate network en*iron!ents using Windows Ser*er Update Ser*ers +WSUS,5 H@ :<1A>> is not a*ailable Use this update instead
httpF??support0!icrosoft0co!?kb?:<1/1"?
)ocal %T ad!in will need to appro*e the update through the !anaged WSUS ser*ers 1e3uires Windows .ista ? Ser*er "##$ S'" to be installed
1eco!!endations
Update your e6isting Direct&D 1#06 code path to use Direct&D 11
This re3uires so!e installer?deploy!ent work Qour DX11 code path will re3uire Windows .ista S'"; or Windows <
Bor Windows .ista ? Windows < titles 1#le*el: feature le*els can pro*ide !ore hardware support5 so you donJt need a Direct&D: code path Bor titles that need Windows X' support5 you will need a legacy Direct&D: code path
1eco!!endations
%f you still only ha*e a legacy Direct&D : code path
7owJs the ti!e to in*est in DirectX 11 Take ad*antage of the e6isting resources )essons learned !o*ing fro! D&D: 4N D&D1# all apply to !o*ing fro! D&D: 4N D&D11
Direct&D 11 pro*ides
the latest hardware features new features for e6isting 1#06 hardware and supports the !aIority of *ideo cards with WDDM dri*ers
1esources
httpF??!sdn0!icrosoft0co!?direct6 httpF??www0!icrosoftga!efest0co!?presentations?"##$0ht!
a!efest "##$ raphics and 'artners Tracks a!efest "#1# raphics Track
CThink DirectX11 TessellationU V what are your optionsTD CDirectX 11 DirectCo!pute V 2 Teraflop for E*eryoneD C@lock Co!pression S!orgasbordD and additional talks fro! 2MD 9 7.%D%2
2''E7D%X
?i,clu0e+@03010: A IDXGI$Ba%C ai,+(._%$Ba%C ai,+C+*ULLD ID3D10Device+(._%Device+C+*ULLD E DXGI_$7A2_C1AI*_DE$C+30D FF+$et+t"+0e3ire0+value3 E 1RE$ULT+re3+C+D3D10CreateDeviceA,0$Ba%C ai,(+*ULL/+D3D10_DRIVER_TG2E_1ARD7ARE/ *ULL/+0/+D3D10_$DH_VER$IO*/+I30/ I._%$Ba%C ai,/+I._%Device+)D i4+(+FAILED(re3)+)+FF+Err"r+1a,0li,. FF+&i,0+re,0er+tar.et+4r"#+3Ba%+c ai, FF+$et+u%+vieB%"rt E
?i,clu0e+@03010_1: A IDXGI$Ba%C ai,+(._%$Ba%C ai,+C+*ULLD ID3D10Device1+(._%Device+C+*ULLD E DXGI_$7A2_C1AI*_DE$C+30D FF+$et+t"+0e3ire0+value3 E 1RE$ULT+re3+C+D3D10CreateDeviceA,0$Ba%C ai,1(+*ULL/+D3D10_DRIVER_TG2E_1ARD7ARE/ *ULL/+0/+D3D10_FEATURE_LEVEL_10_1/+D3D10_1_$DH_VER$IO*/+I30/ I._%$Ba%C ai,/+I._%Device+)D i4+(+FAILED(re3)+) J re3+C+D3D10CreateDeviceA,0$Ba%C ai,1(+*ULL/+D3D10_DRIVER_TG2E_1ARD7ARE/ *ULL/+0/+D3D10_FEATURE_LEVEL_10_0/+D3D10_1_$DH_VER$IO*/+I30/ I._%$Ba%C ai,/+I._%Device+)D K i4+(+FAILED(re3)+)+FF+Err"r+1a,0li,. FF+&i,0+re,0er+tar.et+4r"#+3Ba%+c ai, FF+$et+u%+vieB%"rt E FF+u3e+._%DeviceLMGetFeatureLevel()+t"+c ec!+4"r+10_1D+ca,+"t erBi3e+a33u#e+10_0
?i,clu0e+@03011: A IDXGI$Ba%C ai,+(._%$Ba%C ai,+C+*ULLD ID3D11Device+(._%Device+C+*ULLD ID3D11DeviceC",te-t(+._%C",te-t+C+*ULLD E DXGI_$7A2_C1AI*_DE$C+30D FF+$et+t"+0e3ire0+value3 E D3D_FEATURE_LEVEL+4lvlNO+C+J D3D_FEATURE_LEVEL_11_0/+D3D_FEATURE_LEVEL_10_1/+D3D_FEATURE_LEVEL+10_0+KD D3D_FEATURE_LEVEL+4lD 1RE$ULT+re3+C+D3D11CreateDeviceA,0$Ba%C ai,(+*ULL/+D3D_DRIVER_TG2E_1ARD7ARE/ *ULL/+0/+4lvl/+3i9e"4(4lvl)F3i9e"4(D3D_FEATURE_LEVEL)/ +++++++D3D11_$DH_VER$IO*/+I30/ I._%$Ba%C ai,/+I._%Device/+I4l/+I._%C",te-t+)D i4+(+FAILED(re3)+)+FF+Err"r+1a,0li,. FF+&i,0+re,0er+tar.et+4r"#+3Ba%+c ai, FF+$et+u%+vieB%"rt E FF+u3e+._%DeviceLMGetFeatureLevel()+("r+re#e#8er+4l+a8"ve)+t"+c ec!+4"r FF+11_0+"r+10_1/+a33u#e+10_0+"t erBi3e
?i,clu0e+@03011: A IDXGI$Ba%C ai,+(._%$Ba%C ai,+C+*ULLD ID3D11Device+(._%Device+C+*ULLD ID3D11DeviceC",te-t(+._%C",te-t+C+*ULLD E DXGI_$7A2_C1AI*_DE$C+30D FF+$et+t"+0e3ire0+value3 E D3D_FEATURE_LEVEL+4lvlNO+C+J D3D_FEATURE_LEVEL_11_0/+D3D_FEATURE_LEVEL_10_1/+D3D_FEATURE_LEVEL+10_0/ +++++++D3D_FEATURE_LEVEL_<_3/+D3D_FEATURE_LEVEL_<_)/+D3D_FEATURE_LEVEL_<_1+KD D3D_FEATURE_LEVEL+4lD 1RE$ULT+re3+C+D3D11CreateDeviceA,0$Ba%C ai,(+*ULL/+D3D_DRIVER_TG2E_1ARD7ARE/ *ULL/+0/+4lvl/+3i9e"4(4lvl)F3i9e"4(D3D_FEATURE_LEVEL)/ +++++++D3D11_$DH_VER$IO*/+I30/ I._%$Ba%C ai,/+I._%Device/+I4l/+I._%C",te-t+)D i4+(+FAILED(re3)+)+FF+Err"r+1a,0li,. FF+&i,0+re,0er+tar.et+4r"#+3Ba%+c ai, FF+$et+u%+vieB%"rt E FF+u3e+._%DeviceLMGetFeatureLevel()+("r+re#e#8er+4l+a8"ve)+t"+c ec!+4eature+level
?i,clu0e+@03011: A IDXGI$Ba%C ai,+(._%$Ba%C ai,+C+*ULLD ID3D11Device+(._%Device+C+*ULLD ID3D11DeviceC",te-t(+._%C",te-t+C+*ULLD E DXGI_$7A2_C1AI*_DE$C+30D FF+$et+t"+0e3ire0+value3 E 1RE$ULT+re3+C+D3D11CreateDeviceA,0$Ba%C ai,(+*ULL/+D3D_DRIVER_TG2E_1ARD7ARE/ *ULL/+0/+*ULL/+0/ +++++++D3D11_$DH_VER$IO*/+I30/ I._%$Ba%C ai,/+I._%Device/+*ULL/+I._%C",te-t+)D i4+(+FAILED(re3)+)+FF+Err"r+1a,0li,. FF+&i,0+re,0er+tar.et+4r"#+3Ba%+c ai, FF+$et+u%+vieB%"rt E FF+u3e+._%DeviceLMGetFeatureLevel()+t"+c ec!+4eature+level
DirectX 11 Debugging
DirectX SDH pro*ides debugging layer Enabled through code +D3D11_CREATE_DEVICE_DE&UG, or the DirectX Control 'anel utility
Control panel controls the 1# and 11 debugging layer through the sa!e settings Unlike Direct&D :5 it is per application not a global setting
DirectX 11 Debugging
Make sure your application runs Kdebug layerJ clean
E1181 and C811U'T%87 reports are critical to fi6 Tools like %I* for Windows assu!e this le*el of correctness
www0!icrosoftga!efest0co!