32
Graphics with the Direct3D11.1 API made easy Phillip Napieralski Program Manager GIA2 3-113

Graphics with the Direct3D11.1 API made e asy

  • Upload
    gittel

  • View
    55

  • Download
    0

Embed Size (px)

DESCRIPTION

Graphics with the Direct3D11.1 API made e asy. Phillip Napieralski Program Manager GIA2 3-113. Agenda. Transitioning to WinRT and DirectX11.1 Developing with Direct3D11.1 Debugging and testing Case study: AccuWeather. Transitioning to WinRT and DirectX11.1. DirectX versions. - PowerPoint PPT Presentation

Citation preview

Page 1: Graphics with the Direct3D11.1 API made  e asy

Graphics with the Direct3D11.1 API made easyPhillip NapieralskiProgram ManagerGIA23-113

Page 2: Graphics with the Direct3D11.1 API made  e asy

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

Transitioning to WinRT and DirectX11.1

Page 4: Graphics with the Direct3D11.1 API made  e asy

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

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

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

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

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

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

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

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

Demo

Sprite sample (feature levels)

Page 13: Graphics with the Direct3D11.1 API made  e asy

Developing with Direct3D11.1

Page 14: Graphics with the Direct3D11.1 API made  e asy

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

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

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

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

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

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

Debugging and testing

Page 21: Graphics with the Direct3D11.1 API made  e asy

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

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

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

Stephen KeeferProgrammer

Case study: AccuWeather

Page 25: Graphics with the Direct3D11.1 API made  e asy

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

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

Instancing in DirectX 10 and 11

Page 28: Graphics with the Direct3D11.1 API made  e asy

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

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 32: Graphics with the Direct3D11.1 API made  e asy

© 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.