Presentation is loading. Please wait.

Presentation is loading. Please wait.

PC Games for Windows 10 Chuck Walbourn Senior Software Engineer

Similar presentations


Presentation on theme: "PC Games for Windows 10 Chuck Walbourn Senior Software Engineer"— Presentation transcript:

1

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

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

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!

5 Agenda Windows 10 AppCompat Win32 game development
WinRT in Windows desktop applications Developer tools

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 PAE – IsProcessorFeaturePresent(PF_PAE_ENABLED) NX – Extended feature CPUInfo[3] bit 20, IsProcessorFeaturePresent(PF_NX_ENABLED) SSE – CPUInfo[3] bit 25, IsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE) SSE2 – CPUInfo[3] bit 26, IsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE) CMPXCHG16b – CPUInfo[2] bit 13, IsProcessorFeaturePresent(PF_COMPARE_EXCHANGE128) LAHF/SAHF -- Extended feature CPUInfo[2] bit 0 PREFETCHW – Extended feature CPUInfo[2] bit 8 –or- accepts instructions as a no-op (rather than an illegal instruction)

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 aren’t using undocumented/internal behavior or APIs… Remember DirectPlay Voice and Direct3D Retained Mode were removed as of Windows Vista.

8 Version checking Ideally, check for the feature directly
Don’t 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

9 You must be this high to ride this ride…
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; }

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 <compatibility> section in an embedded EXE manifest

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

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 VS 2010 and VS 2012 need to use manual manifests to get the desired <dpiAware>True/PM</dpiAware> setting, VS handles it correctly.

13 myfile.manifest <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> <application> <!-- Windows Vista --> <supportedOS Id="{e c5-a5fe-008deee3d3f0}"/> <!-- Windows 7 --> <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a f93a}"/> <!--Windows 8 --> <supportedOS Id="{4a2f28e3-53b ba9c-d69d4a4a6e38}"/> <!-- Windows > <supportedOS Id="{1f676c76-80e bb-83d0f6d0da78}"/> <!-- Windows 10 --> <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> </application> </compatibility> </assembly>

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

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 Introduced with Windows 8.0

16 Win32 game development

17 Windows 10 “DirectX runtime” built into OS
Direct3D 12.0 Direct3D XAudio XInput D3DCompiler (HLSL compiler) Win32 APIs for use by all C++ applications

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

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.0 5.0 ATI Radeon HD NVIDIA GeForce GTX Intel “Ivy Bridge” Surface Pro 10.1 4.1 ATI Radeon HD 3000/4000 NVIDIA GeForce GTX 300 Intel “Sandy Bridge” 10.0 4.0 ATI Radeon HD 2000 NVIDIA GeForce 8/9 Intel 965M Feature Level Shader Model Notes 9.3 2.X Windows phone 8 Windows phone 8.1 9.2 2.0 9.1 Surface RT Surface 2 Also supported on Windows Vista Service Pack 2 with KB <

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 Level Shader Model Notes 11.1 5.0 ATI Radeon HD 8000 NVIDIA GeForce GTX 900 Intel “Haswell”, “Broadwell” Surface Pro 2 Surface Pro 3 Xbox One Partial support on Windows 7 SP1 via KB

21 Direct3D 11.1 / DXGI 1.2 Optional hardware features Applications
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 Faster shader constant updates Enhanced HLSL debugging Improved perf on low-spec GPUs Full support on Windows 8.0 or later

22 Direct3D 11.1 / DXGI 1.2 ID3D11Device1 ID3D11DeviceContext1
CopySubresourceRegion1 UpdateSubresource1 ??Get/SetConstantBuffers1 SwapDeviceContextState ClearView DiscardView1 ID3D11BlendState1 Logical ops ID3D11RasterizerState1 Forced sample count ID3DUserDefinedAnnotation

23 Direct3D 11.2 / DXGI 1.3 Tiled Resources (Tier 1 / Tier 2)
Optional hardware features Applications Tiled Resources (Tier 1 / Tier 2) Map DEFAULT buffers Clear View for depth buffers Min/Max Filtering D3D11_FILTER_MINIMUM_* D3D11_FILTER_MAXIMUM_* Virtual texturing Improved DirectCompute read-back Supported on Windows 8.1 or later

24 Direct3D 11.2 / DXGI 1.3 ID3D11Device2 ID3D11DeviceContext2
UpdateTileMappings CopyTileMappings CopyTiles UpdateTiles ResizeTilePool SetMarkerInt BeginEventInt EndEvent IDXGISwapChain2::GetFrameLatencyWaitableObject

25 Direct3D 11.3 / DXGI 1.4 Tiled Resources (Tier 3) Map DEFAULT textures
Optional hardware features Applications Tiled Resources (Tier 3) Map DEFAULT textures ASTC texture compression JPEG H/W codec Conservative rasterization Rasterizer ordered views Pixel Shader specified stencil ref Faster texture loading Very-low-bit-rate compression GPGPU applications Order-Independent Transparency Supported on Windows 10 or later

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

27 Direct3D debug device support
Traditionally installed by Windows SDK / legacy DirectX SDK For Windows 10, it’s an optional feature Start -> Settings -> System -> Optional features -> Add a feature Select Graphics Tools

28 XAudio Game audio API for real-time mixing, audio effects, and so on.
XAudio 2.8 included in the OS XAudio 2.8 included with Windows 8.0 or later. XAudio 2.7 supports Windows Vista/Windows 7 but requires the legacy DirectX SDK / DXSETUP

29 XInput Xbox 360 Common Controller gamepad API Driver support for
Xbox 360 Wireless Receiver for Windows Xbox One Controller XInput 1.4 included in the OS XInput 1.4 is part of Windows 8.0 and later. XInput comes with Windows Vista or later. XInput 1.3 supports Windows Vista/Windows 7 but requires the legacy DirectX SDK / DXSETUP

30 Direct3D compiler D3DCompiler_47.dll included with the OS
D3DCompileFromFile D3DReflect Supports HLSL Function Linking (“lib_*” profiles) D3DCreateFunctionLinkingGraph ID3D11FunctionLinkingGraph You can deploy D3DCompiler_47.dll with your Win32 desktop application for Windows Vista, Windows 7, and Windows 8.0

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 DirectXMath is all inline C++ code, so there’s no OS component dependency

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. DirectXTex – Texture content processing (mipmaps, block-compression codecs, format conversion) DirectXMesh – Mesh content processing (generating tangent frames, vertex cache) optimization) DirectX 12 support for these libraries is in progress

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

34 WinRT in Windows desktop applications

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

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

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)

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

39 Microsoft::WRL::ComPtr
Standard COM smart-pointer Similar to ATL’s CComPtr but without the ATL dependency ATL isn’t in Visual Studio Express editions Works for Windows desktop applications, too! The rest of Windows Runtime Library (WRL) is for working with WinRT

40 myfile.h #include <wrl.h> -or- #include <wrl/client.h> class A { … private: Microsoft::WRL::ComPtr<ID3D11Device> m_device; Microsoft::WRL::ComPtr<ID3D11DeviceContext> m_context; }

41 myfile.cpp #include "myfile.h" using Microsoft::WRL::ComPtr; … HRESULT hr = D3D11CreateDevice( …, &m_device, …, &m_context ); // -or- HRESULT hr = D3D11CreateDevice( …, m_device.ReleaseAndGetAddressOf(), …, m_context.ReleaseAndGetAddressOf() );

42 myfile.cpp ComPtr<ID3D11Debug> d3dDebug; hr = m_device.As( &d3dDebug ); if (SUCCEEDED(hr)) { … } ID3D11Device* ptr = m_device.Get(); m_device.Reset(); m_context.Reset();

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

44 Setup #include <wrl.h> #include <ShObjIdl.h> #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)) …

45 Getting the base object
auto rtc = HStringReference( RuntimeClass_Windows_ApplicationModel_DataTransfer_DataTransferManager ); ComPtr<IDataTransferManagerStatics> statics; HRESULT hr = GetActivationFactory(rtc.Get(), statics.GetAddressOf()); if (FAILED(hr)) … Microsoft::WRL::ComPtr<IDataTransferManagerInterop> interop; hr = statics.As(&interop); ComPtr<IDataTransferManager> manager; hr = interop->GetForWindow( hWnd, IID_PPV_ARGS( manager.GetAddressOf() ) );

46 Registering the callback/Triggering the UI
typedef ITypedEventHandler<DataTransferManager*, DataRequestedEventArgs*> handler_t; auto callback = Callback<handler_t>( [](IDataTransferManager *, IDataRequestedEventArgs* args) -> HRESULT { … // next slide }); hr = manager->add_DataRequested( callback.Get(), &mRequestToken); if (FAILED(hr)) … interop->ShowShareUIForWindow( hWnd );

47 Callback implementation
ComPtr<IDataRequest> request; HRESULT hr = args->get_Request( request.GetAddressOf() ); if (SUCCEEDED(hr)) { ComPtr<IDataPackage> package; hr = request->get_Data( package.GetAddressOf() ); ComPtr<IDataPackagePropertySet> props; hr = package->get_Properties( props.GetAddressOf() ); props->put_Title( HStringReference( L"Share example" ).Get() ); props->put_Description(…); … } return hr;

48 Developer tools

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

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

51 Visual Studio Community
Visual Studio 2013 Update 4 introduced a new Community edition Professional feature set for indies, students, hobbyists, and individuals Generally a better option than VS Express for Windows Desktop

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

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 <atomics>, <mutex> performance and correctness improvements <chrono> high_resolution_clock / steady_clock works!

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

55 Visual Studio 2015 notable changes
Legacy vs. C99 Conformance mode for printf / wprintf “%s” vs “%S” Consider using “%ls” and “%hs” instead Can’t 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"

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? - Stop using DXSETUP (aka DirectX End User Runtime) See Not So DirectSetup -

57

58


Download ppt "PC Games for Windows 10 Chuck Walbourn Senior Software Engineer"

Similar presentations


Ads by Google