Graphics with the Direct3D11.1 API made e asy
description
Transcript of Graphics with the Direct3D11.1 API made e asy
![Page 1: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/1.jpg)
Graphics with the Direct3D11.1 API made easyPhillip NapieralskiProgram ManagerGIA23-113
![Page 2: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/2.jpg)
Transitioning to WinRT and DirectX11.1Developing with Direct3D11.1Debugging and testingCase study: AccuWeather
Agenda
![Page 3: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/3.jpg)
Transitioning to WinRT and DirectX11.1
![Page 4: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/4.jpg)
DirectX versionsWindows XP DirectX 9 hardware DirectX 9 APIWindows Vista DirectX 10 hardware DirectX 10 APIWindows 7 DirectX 11 hardware DirectX 11 APIHow do you design your software for all this hardware
![Page 5: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/5.jpg)
DirectX 11.1DirectX11.1 is the API that ships with Windows 8Better graphics stack integrationDirectX11+ utilizes tessellation and stereoscopic 3DNot all hardware supports DirectX 11 featuresCurrent ARM devices for instance
![Page 6: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/6.jpg)
Windows SDKThe DirectX SDK is now part of the Windows SDKUse the Windows SDK to pass certificationThis offers new opportunities for Windows Store AppsBuild-time shader compilation with Visual Studio’s HLSL compiler, FXC.exeTry the Visual Shader Designer in Visual Studio 2012Check out MSDN for more information
![Page 7: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/7.jpg)
Feature levelsDirectX11 API provides a uniform interface to access hardware capabilitiesFeature levels map to hardware capabilitiesFeature level 9 DirectX 9 hardware (ARM/power efficient machines)Feature level 10 DirectX 10 hardware (many laptops)Feature level 11 DirectX 11 hardware (high end gaming machines)
![Page 8: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/8.jpg)
Feature level 9Available on all hardwareVertex shadersPixel shaders8 textures4 render targetsCube mapsVolume texturesAnisotropic filteringAntialiasingHDR renderingMore information about the features available in each level on MSDN
![Page 9: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/9.jpg)
Feature level 10Available on DX10 and above hardwareVertex shadersPixel shaders8 textures4 render targetsCube mapsVolume texturesAnisotropic filteringAntialiasingHDR rendering
More information about the features available in each level on MSDN
Geometry shadersStream out128 textures per shader8 render targetsInteges in shadersVertex texturesShader samplingConstant buffersAlpha-to-coverageBasic DirectComputeAsync resource creation
![Page 10: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/10.jpg)
Feature level 11Available on DX11 and above hardwareVertex shadersPixel shaders8 textures4 render targetsCube mapsVolume texturesAnisotropic filteringAntialiasingHDR rendering
More information about the features available in each level on MSDN
Geometry shadersStream out128 textures per shader8 render targetsIntegers in shadersVertex texturesShader samplingConstant buffersAlpha-to-coverageBasic DirectComputeAsync resource creation
Full DirectComputeRandom access writesTessellation shadersNew compression formatMultithreading
![Page 11: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/11.jpg)
Feature level considerationsMax texture dimensionFeature level 9_1 supports up to 2048 x 2048Max primitive countFeature level 9_1 supports up to 65535InstancingSupported by feature levels 9_3 and upLaunch ARM devices support feature levels 9_1 or 9_3More information about the features available in each level on MSDN
![Page 12: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/12.jpg)
Demo
Sprite sample (feature levels)
![Page 13: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/13.jpg)
Developing with Direct3D11.1
![Page 14: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/14.jpg)
Development recommendationsTarget feature level 9_1 and scale up featuresAdjust to maintain performanceIf you require a higher feature levelTell the user the app requires a certain feature level or higher
![Page 15: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/15.jpg)
Store policyARM or Neutral packages must support feature level 9_1You may specify a higher feature level when submitting appCheck the feature level at the launch of your appNotify the user if their machine is not the appropriate feature levelSpecify feature level in app descriptionMore information about feature level store policy on MSDN
![Page 16: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/16.jpg)
Feature levels to supportvoid Direct3DBase::CreateDeviceResources(){ D3D_FEATURE_LEVEL featureLevels[] = { D3D_FEATURE_LEVEL_11_1, D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_10_0, D3D_FEATURE_LEVEL_9_3, D3D_FEATURE_LEVEL_9_2, D3D_FEATURE_LEVEL_9_1 }; // ...
![Page 17: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/17.jpg)
Get the machine feature levelD3D11CreateDevice( nullptr, // use the default adapter D3D_DRIVER_TYPE_HARDWARE, 0, creationFlags, // defined above featureLevels, // what app will support ARRAYSIZE(featureLevels), D3D11_SDK_VERSION, // should always be D3D11_SDK_VERSION &device, // created device &m_featureLevel, // feature level of the device &context // corresponding immediate context );
![Page 18: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/18.jpg)
Checking the feature level// Determine the technique that will be used to render the sprites.auto featureLevel = d3dDevice->GetFeatureLevel();
if (featureLevel >= D3D_FEATURE_LEVEL_10_0){
// Generate sprites on GPU using Geometry Shaderm_technique = RenderTechnique::GeometryShader;
}
Code from BasicSprites.cpp in the Sprite Sample on MSDN
![Page 19: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/19.jpg)
Authoring a shaderSyntax highlighting for HLSLHLSL is compiled at build time with fxc.exeHigh level shader languageHLSL source files are automatically compiled to .csoDriver translates (JITs) to it’s own instruction set whend3dDevice->CreatePixelShader(..) is called Shader model and type set in properties pane
![Page 20: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/20.jpg)
Debugging and testing
![Page 21: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/21.jpg)
Testing recommendationsTest individual feature levels using dxcpl.exeReview shader codeEnsure shader model matches the feature level you are targetingTest on a variety of hardwareARM, Intel, AMD, nVidia, old and newConfirm hardware specific issues using WARP
![Page 22: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/22.jpg)
Debugging graphicsVisual studio graphics debugging for x86/x64 systems
Check out Build talk 2-032, DirectX Graphics Development with Visual Studio 2012
![Page 23: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/23.jpg)
Remote debuggingTest your app on Windows RTDownload and run remote tools for your testing deviceIn your VS project properties, find the remote machineHit the green arrow to start debugging and enjoyRemote Tools available at microsoft.comSetup instructions on MSDN
![Page 24: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/24.jpg)
Stephen KeeferProgrammer
Case study: AccuWeather
![Page 25: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/25.jpg)
ChallengesSupporting all feature sets (9.1 thru 11.1)Supporting multiple platforms (x86, x64, and ARM)Transferring weather data from C# (client app) to C++ (DX Renderer)Creating fully dynamic scenes, no two scenes are the sameSmall developer community
![Page 26: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/26.jpg)
Overcoming challengesABI Proxy allows C# and C++ code communicationCreateSwapChainForComposition instead of CreateSwapChainForCoreWindowBlend states for transitioning
![Page 27: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/27.jpg)
Instancing in DirectX 10 and 11
![Page 28: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/28.jpg)
Developer takeawaysWindows 8=smooth integration of DirectX power with XAML layoutDirectX=brings your application into the future
![Page 29: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/29.jpg)
Wrap upThanks to AccuWeatherWhen designing your app, consider feature levelsUtilize samples to guide this processSprite sample at dev.windows.com (click samples and search there)
![Page 30: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/30.jpg)
Online Resources• Where is the DirectX SDK• Direct3D feature levels• Feature level store policy• Sprite sample• Remote debugging tools• Remote debugging setup
Other resources at //BuildOther graphics talks 2-032, 3-109, 3-112 and 4-102
Resources
Please submit session evals on the Build Windows 8 App or at http://aka.ms/BuildSessions
![Page 31: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/31.jpg)
• Develop: http://msdn.microsoft.com/en-US/windows/apps/br229512
• Design: http://design.windows.com/
• Samples: http://code.msdn.microsoft.com/windowsapps/Windows-8-Modern-Style-App-Samples
• Videos: http://channel9.msdn.com/Windows
Resources
Please submit session evals by using the Build Windows 8 appor at http://aka.ms/BuildSessions
![Page 32: Graphics with the Direct3D11.1 API made e asy](https://reader035.fdocuments.in/reader035/viewer/2022062222/56816768550346895ddc4e56/html5/thumbnails/32.jpg)
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.