pc games for windows 10 chuck walbourn senior software engineer advanced technology group (atg)

Download PC Games for Windows 10 Chuck Walbourn Senior Software Engineer Advanced Technology Group (ATG)

If you can't read please download the document

Upload: amos-copeland

Post on 22-Dec-2015

256 views

Category:

Documents


8 download

TRANSCRIPT

  • Slide 1
  • Slide 2
  • PC Games for Windows 10 Chuck Walbourn Senior Software Engineer Advanced Technology Group (ATG)
  • Slide 3
  • Windows 10 Next version of Windows, available as a Technical Preview now Windows 7 & Windows 8 users with individual licenses get a free upgrade In the first year after release Windows as a service Kept current for the lifetime of the device at no cost http://blogs.windows.com/
  • Slide 4
  • Windows 10 DirectX 12 runtime The Start menu lives! Better multiple desktop support Improved command prompt (no, seriously!) Windows universal platform to target all Windows 10 devices PCs, tablets, phones, and Xbox One Still runs your Windows desktop applications, too!
  • Slide 5
  • Agenda Windows 10 AppCompat Win32 game development WinRT in Windows desktop applications Developer tools
  • Slide 6
  • Windows 10 system requirements Same system requirements as Windows 8.1 1 GHz+ CPU 1 GB RAM (32-bit) / 2 GB RAM (64-bit) DirectX 9 graphics device with WDDM driver 32-bit requires PAE, NX, and SSE/SSE2 64-bit requires CMPXCHG16b, PrefetchW, and LAHF/SAHF
  • Slide 7
  • DirectX on Windows 10 Same compatibility as Windows 7 / Windows 8.x DirectX 9.0c Direct3D 10.x Direct3D 11.x DirectPlay is an optional feature Assuming you arent using undocumented/internal behavior or APIs
  • Slide 8
  • Version checking Ideally, check for the feature directly Dont tie it implicitly to a version Normally should be limited to: you must be this high to ride this ride VerifyVersionInfo to do a >= version check Use VersionHelpers.h in the Windows SDK http://aka.ms/kkc5m0
  • Slide 9
  • bool IsWindowsVistaSP2OrGreater() { OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0, {0}, 0, 0 }; DWORDLONG const dwlConditionMask = VerSetConditionMask( VerSetConditionMask( 0, VER_MAJORVERSION, VER_GREATER_EQUAL), VER_MINORVERSION, VER_GREATER_EQUAL), VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL); osvi.dwMajorVersion = HIBYTE(_WIN32_WINNT_VISTA); osvi.dwMinorVersion = LOBYTE(_WIN32_WINNT_VISTA); osvi.wServicePackMajor = 2; return VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE; } You must be this high to ride this ride
  • Slide 10
  • GetVersion(Ex) Deprecated API! warning C4996: 'GetVersionExW': was declared deprecated Always a problematic API for future compatibility Lots of bad version checks out there As of Windows 8.1 and Windows 10 The version number returned is not necessarily the true OS version Effectively an OSVersionLie shim is always in place Unless you add a section in an embedded EXE manifest
  • Slide 11
  • High-DPI 125%, 150%, 200%, 250% scaling DirectX games should signal they are Per Monitor High DPI Aware Full-screen games have been handling resolution scaling of UI for a long time Otherwise, might be subjected to various compatibility behaviors Important to test this scenario for any installers/launchers/utilities, too! Clipped UI Unreadable text Blurry images Bad text layout Misaligned input fields http://go.microsoft.com/fwlink/?LinkID=129586
  • Slide 12
  • Embedded Manifests! Visual Studio settings handle User Account Control Linker -> Manifest File Enable User Account Control (UAC) set to Yes (/MANIFESTUAC:) UAC Execution Level set to asInvoker (/level='asInvoker') Or rarely requireAdministrator (/level='requireAdministrator') High-DPI aware Manifest Tool -> Input and Output DPI Awareness set to Per Monitor High DPI Aware OS Compatibility Add a.manifest file to your project http://aka.ms/i6kdnw
  • Slide 13
  • myfile.manifest
  • Slide 14
  • Windows Family Safety Windows 10 supports the following game rating systems CERO, COB-AU, CSRR, DJCTQ, ESRB, FPB, GRB, PCBP, PEGI, USK Windows desktop applications use GDFs and tools to provide ratings metadata http://aka.ms/kp7864
  • Slide 15
  • Microsoft basic render driver You always have a Direct3D device on a Windows system It could be a software fallback Replaces the old VGA driver You might want to detect this case and warn the user about potential performance issues http://aka.ms/k5c74x
  • Slide 16
  • Win32 game development
  • Slide 17
  • Windows 10 DirectX runtime built into OS Direct3D 12.0 Direct3D 11.0 - 11.3 XAudio XInput D3DCompiler (HLSL compiler) Win32 APIs for use by all C++ applications
  • Slide 18
  • Direct3D 12 Console-like API on the PC Minimize CPU overhead Direct3D 12 supported across all Windows 10 devices Better Power, Better Performance: Your Game on DirectX12 Advanced DirectX12 Graphics and Performance
  • Slide 19
  • Direct3D 11 Core graphics technology for Windows 7, Windows 8, and Xbox One Supported on Windows 10 Broad hardware support through feature levels Feature Level Shader Model Notes 11.05.0ATI Radeon HD 5000-7000 NVIDIA GeForce GTX 400-700 Intel Ivy Bridge Surface Pro 10.14.1ATI Radeon HD 3000/4000 NVIDIA GeForce GTX 300 Intel Sandy Bridge 10.04.0ATI Radeon HD 2000 NVIDIA GeForce 8/9 Intel 965M Feature LevelShader Model Notes 9.32.XWindows phone 8 Windows phone 8.1 9.22.0 9.12.0Surface RT Surface 2
  • Slide 20
  • Direct3D 11.1 / DXGI 1.2 Device interop for 10.x 11.x Direct2D/DirectWrite supports 11.x devices Direct3D hardware support in session 0 Support for hardware feature level 11.1 Feature LevelShader ModelNotes 11.15.0ATI Radeon HD 8000 NVIDIA GeForce GTX 900 Intel Haswell, Broadwell Surface Pro 2 Surface Pro 3 Xbox One
  • Slide 21
  • Direct3D 11.1 / DXGI 1.2 Optional hardware features Logical ops for output merger Constant Buffer partial updates Constant Buffer offsetting Clear View UAVs at every stage UAV only rendering Extended double-precision shaders Minimum precision HLSL shaders Applications Faster shader constant updates Enhanced HLSL debugging Improved perf on low-spec GPUs
  • Slide 22
  • Direct3D 11.1 / DXGI 1.2 ID3D11Device1 ID3D11DeviceContext1 CopySubresourceRegion1 UpdateSubresource1 ??Get/SetConstantBuffers1 SwapDeviceContextState ClearView DiscardView1 ID3D11BlendState1 Logical ops ID3D11RasterizerState1 Forced sample count ID3DUserDefinedAnnotation
  • Slide 23
  • Direct3D 11.2 / DXGI 1.3 Optional hardware features Tiled Resources (Tier 1 / Tier 2) Map DEFAULT buffers Clear View for depth buffers Min/Max Filtering D3D11_FILTER_MINIMUM_* D3D11_FILTER_MAXIMUM_* Applications Virtual texturing Improved DirectCompute read- back
  • Slide 24
  • Direct3D 11.2 / DXGI 1.3 ID3D11Device2 ID3D11DeviceContext2 UpdateTileMappings CopyTileMappings CopyTiles UpdateTiles ResizeTilePool SetMarkerInt BeginEventInt EndEvent IDXGISwapChain2::GetFrameLatencyWaitableObject
  • Slide 25
  • Direct3D 11.3 / DXGI 1.4 Optional hardware features Tiled Resources (Tier 3) Map DEFAULT textures ASTC texture compression JPEG H/W codec Conservative rasterization Rasterizer ordered views Pixel Shader specified stencil ref Applications Faster texture loading Very-low-bit-rate compression GPGPU applications Order-Independent Transparency
  • Slide 26
  • Direct3D 11.3 / DXGI 1.4 ID3D11Device3 ID3D11DeviceContext3 ID3D11RasterizerState2 Conservative rasterization ID3D11Texture2D1 / ID3D11Texture3D1 Texture layout ID3D11ShaderResourceView1 / ID3D11RenderTargetView1 / ID3D11UnorderedAccessView1 Planar resource support ID3D11Query1 Query context setting
  • Slide 27
  • Direct3D debug device support Traditionally installed by Windows SDK / legacy DirectX SDK For Windows 10, its an optional feature Start -> Settings -> System -> Optional features -> Add a feature Select Graphics Tools
  • Slide 28
  • XAudio Game audio API for real-time mixing, audio effects, and so on. XAudio 2.8 included in the OS http://aka.ms/f2xp1a
  • Slide 29
  • XInput Xbox 360 Common Controller gamepad API Driver support for Xbox 360 Common Controller Xbox 360 Wireless Receiver for Windows Xbox One Controller XInput 1.4 included in the OS http://aka.ms/mu9kn7
  • Slide 30
  • Direct3D compiler D3DCompiler_47.dll included with the OS D3DCompileFromFile D3DReflect Supports HLSL Function Linking (lib_* profiles) D3DCreateFunctionLinkingGraph ID3D11FunctionLinkingGraph http://aka.ms/tuoxjd
  • Slide 31
  • DirectXMath C++ math library for vectors, matrices, quaternions, bounding volumes SSE2 / ARM-NEON optimized Replaces D3DXMath and XNAMath C++ Library See the SimpleMath wrapper in the DirectX Tool Kit http://aka.ms/kjp2dz
  • Slide 32
  • CodePlex projects Shared source helper/utility code for DirectX Windows, Windows Phone, and Xbox One DirectX Tool Kit - SpriteBatch, Model, SimpleMath, Texture Loaders, DirectX Tool Kit for Audio, and so on. https://directxtk.codeplex.com/ DirectXTex Texture content processing (mipmaps, block-compression codecs, format conversion) https://directxtex.codeplex.com/ DirectXMesh Mesh content processing (generating tangent frames, vertex cache) optimization) https://directxmesh.codeplex.com/
  • Slide 33
  • Share code with Windows apps All these Win32 APIs and libraries also work with apps for the Windows universal platform XInput will be replaced with GamePad WinRT API Dual-use Coding Techniques for Games http://aka.ms/fo3su4
  • Slide 34
  • WinRT in Windows desktop applications
  • Slide 35
  • WinRT vs. Win32 APIs WinRT is just a style of API design vs Win32 APIs (Flat C functions or COM-based) Underlying technology is an extension of COM COM ( IUnknown ) + Metadata ( IInspectable ) IUnknown provides reference-counting IInspectable extends IUnknown with metadata and namespaces Metadata is stored in.winmd files Primary used for language projection (JavaScript, C#).winmd files use the.NET metadata format (ECMA-335 Partition II - CLI) Many WinRT APIs are callable from Windows desktop applications
  • Slide 36
  • C++/CX C++/CX are language extensions to simplify WinRT programming Syntax and keywords is similar to Managed C++ (/CLR) ref class, ref struct value class, value struct interface class, interface struct property delegate event
  • Slide 37
  • C++/CX ( /ZW ) is not managed C++( /CLR ) There is no CLR framework or garbage collector running Not compatible with managed assemblies This is just the compiler creating plumbing code for WinRT types Requires C++ Exception Handling ( /EHsc ) be enabled vs. Managed C++ ( /CLR ) requiring asynchronous exceptions (/EHa ) C++ Exception handling is efficiently implemented for x64 native and ARM A bit quirky for x86, but much more efficient than /EHa Does not require Run-Time Type Information RTTI ( /GR )
  • Slide 38
  • Windows Runtime C++ Template Library (WRL) Alternative to using C++/CX (/ZW ) language extensions Similar design to the Active Template Library (ATL) Low-level way to author and consume WinRT components Authoring requires use of IDL which is tricky and requires manual syncing Consuming WinRT components is straight-forward
  • Slide 39
  • Microsoft::WRL::ComPtr Standard COM smart-pointer Similar to ATLs CComPtr but without the ATL dependency ATL isnt in Visual Studio Express editions Works for Windows desktop applications, too! The rest of Windows Runtime Library (WRL) is for working with WinRT
  • Slide 40
  • #include -or- #include class A { private: Microsoft::WRL::ComPtr m_device; Microsoft::WRL::ComPtr m_context; } myfile.h
  • Slide 41
  • #include "myfile.h" using Microsoft::WRL::ComPtr; HRESULT hr = D3D11CreateDevice( , &m_device, , &m_context ); // -or- HRESULT hr = D3D11CreateDevice( , m_device.ReleaseAndGetAddressOf(), , m_context.ReleaseAndGetAddressOf() ); myfile.cpp
  • Slide 42
  • ComPtr d3dDebug; hr = m_device.As( &d3dDebug ); if (SUCCEEDED(hr)) { } ID3D11Device* ptr = m_device.Get(); m_device.Reset(); m_context.Reset(); myfile.cpp
  • Slide 43
  • Challenges with using WinRT from Win32 Many only work for Windows Store apps Windows Store apps only vs. Windows Store apps, desktop apps on MSDN More will be supported for Windows 10 No significant samples or documentation currently Particularly using WRL Many require the Single-Threaded COM (STA) memory model DirectX applications use the Multi-Threaded COM (MTA) memory model Can work around this by creating a helper thread with STA set
  • Slide 44
  • #include #include "Windows.ApplicationModel.DataTransfer.h" #pragma comment(lib,"runtimeobject.lib") using namespace ABI::Windows::ApplicationModel::DataTransfer; using namespace ABI::Windows::Foundation; using namespace Microsoft::WRL; using namespace Microsoft::WRL::Wrappers; RoInitializeWrapper initialize(RO_INIT_MULTITHREADED); if (FAILED(initialize)) Setup
  • Slide 45
  • auto rtc = HStringReference( RuntimeClass_Windows_ApplicationModel_DataTransfer_DataTransferManager ); ComPtr statics; HRESULT hr = GetActivationFactory(rtc.Get(), statics.GetAddressOf()); if (FAILED(hr)) Microsoft::WRL::ComPtr interop; hr = statics.As(&interop); if (FAILED(hr)) ComPtr manager; hr = interop->GetForWindow( hWnd, IID_PPV_ARGS( manager.GetAddressOf() ) ); if (FAILED(hr)) Getting the base object
  • Slide 46
  • typedef ITypedEventHandler handler_t; auto callback = Callback ( [](IDataTransferManager *, IDataRequestedEventArgs* args) -> HRESULT { // next slide }); hr = manager->add_DataRequested( callback.Get(), &mRequestToken); if (FAILED(hr)) interop->ShowShareUIForWindow( hWnd ); Registering the callback/Triggering the UI
  • Slide 47 put_Description(); } return hr; Callback implementation">
  • ComPtr request; HRESULT hr = args->get_Request( request.GetAddressOf() ); if (SUCCEEDED(hr)) { ComPtr package; hr = request->get_Data( package.GetAddressOf() ); if (SUCCEEDED(hr)) { ComPtr props; hr = package->get_Properties( props.GetAddressOf() ); if (SUCCEEDED(hr)) { props->put_Title( HStringReference( L"Share example" ).Get() ); props->put_Description(); } return hr; Callback implementation
  • Slide 48
  • Developer tools
  • Slide 49
  • Where is the DirectX SDK? The legacy DirectX SDK is no more Integrated into the Windows SDK as of Windows 8 All versions of D3DX (D3DX9, D3DX10, D3DX11) and XACT are deprecated The shared-source projects on CodePlex borrow heavily from D3DX functionality See Living without D3DX, DirectX SDK Tools Catalog, DirectX SDKs of a certain age, DirectX SDK Samples Catalog @ http://aka.ms/dxsdkhttp://aka.ms/dxsdk
  • Slide 50
  • Visual C++ / Windows SDK DirectX headers/libs XAudio headers/libs XInput headers/libs D3DCompiler header/lib/DLL That is, the HLSL compiler DirectXMath FXC.EXE, GDFMaker.exe, DxCapsViewer.exe Also supports writing Windows desktop applications for all DirectX 11 capable versions of Windows
  • Slide 51
  • Visual Studio Community Visual Studio 2013 Update 4 introduced a new Community edition Professional feature set for indies, students, hobbyists, and individuals http://www.visualstudio.com/en-us/news/vs2013-community-vs.aspx
  • Slide 52
  • Graphics debugger Visual Studio 2013 Community, Visual Studio 2013 Pro+, Visual Studio 2015 Capture engine best on Windows 8.1 or Windows 10 Solve the Tough Graphics Problems with Your Game Using DirectX Tools
  • Slide 53
  • Visual Studio 2015 Tools for Windows Store, Windows Phone, and Windows desktop Platform Toolset v140 Improved C++11 / C++14 / C99 conformance Better build and link performance Improved auto-vectorizer / auto-parallelizer, performance and correctness improvements high_resolution_clock / steady_clock works!
  • Slide 54
  • Visual Studio 2015 notable changes New warnings on by default C4317: not enough arguments passed for format string C4422: too many arguments passed for format string C4426: %* is not allowed in format string of function printf_s C2082: redefinition of formal parameter X C4456: declaration of X hides previous local declaration C4457: declaration of X hides function parameter C4458: declaration of X hides class member C4459: declaration of 'X' hides global declaration C4838: conversion from X to Y requires a narrowing conversion
  • Slide 55 "foo" _bar L"Hello"L"World" -> L"Hello" L"World"">
  • Visual Studio 2015 notable changes Legacy vs. C99 Conformance mode for printf / wprintf %s vs %S Consider using %ls and %hs instead Cant have your own typedef for char16_t or char32_t anymore C2632: X followed by char16_t is illegal C2632: X followed by char32_t is illegal Support for user-defined literals can break existing strings "foo"_bar -> "foo" _bar L"Hello"L"World" -> L"Hello" L"World"
  • Slide 56
  • Call to action Install the Windows 10 Technical Preview Install the Visual Studio 2015 Technical Preview If you are using Visual Studio 2013 Express for Windows desktop, take a look at using Visual Studio 2013 Community instead Stop using the legacy DirectX SDK (as much as possible) See Where is the DirectX SDK? - http://aka.ms/dxsdkhttp://aka.ms/dxsdk Stop using DXSETUP (aka DirectX End User Runtime) See Not So DirectSetup - http://aka.ms/dxsetuphttp://aka.ms/dxsetup
  • Slide 57
  • Questions?
  • Slide 58
  • 2015 Microsoft Corporation. All rights reserved. Microsoft, Xbox, Windows, 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. 2015 Microsoft Corporation. All rights reserved. Microsoft, Xbox, Windows, 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.