Просмотр исходного кода

Added universal windows build project

Ivan Safrin 10 лет назад
Родитель
Сommit
0b18a0ab90
31 измененных файлов с 4539 добавлено и 2 удалено
  1. 0 2
      .gitignore
  2. 54 0
      build/windows/universal/Polycode.sln
  3. 363 0
      build/windows/universal/PolycodeCore/PolycodeCore.vcxproj
  4. 463 0
      build/windows/universal/PolycodeCore/PolycodeCore.vcxproj.filters
  5. 8 0
      build/windows/universal/PolycodeCore/targetver.h
  6. 217 0
      build/windows/universal/TemplateApp/App.cpp
  7. 53 0
      build/windows/universal/TemplateApp/App.h
  8. BIN
      build/windows/universal/TemplateApp/Assets/LockScreenLogo.scale-200.png
  9. BIN
      build/windows/universal/TemplateApp/Assets/SplashScreen.scale-200.png
  10. BIN
      build/windows/universal/TemplateApp/Assets/Square150x150Logo.scale-200.png
  11. BIN
      build/windows/universal/TemplateApp/Assets/Square44x44Logo.scale-200.png
  12. BIN
      build/windows/universal/TemplateApp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
  13. BIN
      build/windows/universal/TemplateApp/Assets/StoreLogo.png
  14. BIN
      build/windows/universal/TemplateApp/Assets/Wide310x150Logo.scale-200.png
  15. 476 0
      build/windows/universal/TemplateApp/Common/DeviceResources.cpp
  16. 80 0
      build/windows/universal/TemplateApp/Common/DeviceResources.h
  17. 42 0
      build/windows/universal/TemplateApp/Common/DirectXHelper.h
  18. 183 0
      build/windows/universal/TemplateApp/Common/StepTimer.h
  19. 1478 0
      build/windows/universal/TemplateApp/Common/d3dx12.h
  20. 489 0
      build/windows/universal/TemplateApp/Content/Sample3DSceneRenderer.cpp
  21. 61 0
      build/windows/universal/TemplateApp/Content/Sample3DSceneRenderer.h
  22. 12 0
      build/windows/universal/TemplateApp/Content/SamplePixelShader.hlsl
  23. 39 0
      build/windows/universal/TemplateApp/Content/SampleVertexShader.hlsl
  24. 19 0
      build/windows/universal/TemplateApp/Content/ShaderStructures.h
  25. 49 0
      build/windows/universal/TemplateApp/Package.appxmanifest
  26. 249 0
      build/windows/universal/TemplateApp/TemplateApp.vcxproj
  27. 66 0
      build/windows/universal/TemplateApp/TemplateApp.vcxproj.filters
  28. 92 0
      build/windows/universal/TemplateApp/TemplateAppMain.cpp
  29. 30 0
      build/windows/universal/TemplateApp/TemplateAppMain.h
  30. 1 0
      build/windows/universal/TemplateApp/pch.cpp
  31. 15 0
      build/windows/universal/TemplateApp/pch.h

+ 0 - 2
.gitignore

@@ -77,7 +77,6 @@ Temporary Items
 [Dd]ebugPublic/
 [Rr]elease/
 [Rr]eleases/
-build/
 bld/
 [Oo]bj/
 
@@ -256,7 +255,6 @@ FakesAssemblies/
 
 
 ### Xcode ###
-build/
 *.pbxuser
 !default.pbxuser
 *.mode1v3

+ 54 - 0
build/windows/universal/Polycode.sln

@@ -0,0 +1,54 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.23107.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PolycodeCore", "PolycodeCore\PolycodeCore.vcxproj", "{EE7AE05C-9AE5-47FA-8A08-28E8D8D89B94}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TemplateApp", "TemplateApp\TemplateApp.vcxproj", "{53C60437-81FF-472C-9D97-83445BFF7109}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|ARM = Debug|ARM
+		Debug|x64 = Debug|x64
+		Debug|x86 = Debug|x86
+		Release|ARM = Release|ARM
+		Release|x64 = Release|x64
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{EE7AE05C-9AE5-47FA-8A08-28E8D8D89B94}.Debug|ARM.ActiveCfg = Debug|ARM
+		{EE7AE05C-9AE5-47FA-8A08-28E8D8D89B94}.Debug|ARM.Build.0 = Debug|ARM
+		{EE7AE05C-9AE5-47FA-8A08-28E8D8D89B94}.Debug|x64.ActiveCfg = Debug|x64
+		{EE7AE05C-9AE5-47FA-8A08-28E8D8D89B94}.Debug|x64.Build.0 = Debug|x64
+		{EE7AE05C-9AE5-47FA-8A08-28E8D8D89B94}.Debug|x86.ActiveCfg = Debug|Win32
+		{EE7AE05C-9AE5-47FA-8A08-28E8D8D89B94}.Debug|x86.Build.0 = Debug|Win32
+		{EE7AE05C-9AE5-47FA-8A08-28E8D8D89B94}.Release|ARM.ActiveCfg = Release|ARM
+		{EE7AE05C-9AE5-47FA-8A08-28E8D8D89B94}.Release|ARM.Build.0 = Release|ARM
+		{EE7AE05C-9AE5-47FA-8A08-28E8D8D89B94}.Release|x64.ActiveCfg = Release|x64
+		{EE7AE05C-9AE5-47FA-8A08-28E8D8D89B94}.Release|x64.Build.0 = Release|x64
+		{EE7AE05C-9AE5-47FA-8A08-28E8D8D89B94}.Release|x86.ActiveCfg = Release|Win32
+		{EE7AE05C-9AE5-47FA-8A08-28E8D8D89B94}.Release|x86.Build.0 = Release|Win32
+		{53C60437-81FF-472C-9D97-83445BFF7109}.Debug|ARM.ActiveCfg = Debug|ARM
+		{53C60437-81FF-472C-9D97-83445BFF7109}.Debug|ARM.Build.0 = Debug|ARM
+		{53C60437-81FF-472C-9D97-83445BFF7109}.Debug|ARM.Deploy.0 = Debug|ARM
+		{53C60437-81FF-472C-9D97-83445BFF7109}.Debug|x64.ActiveCfg = Debug|x64
+		{53C60437-81FF-472C-9D97-83445BFF7109}.Debug|x64.Build.0 = Debug|x64
+		{53C60437-81FF-472C-9D97-83445BFF7109}.Debug|x64.Deploy.0 = Debug|x64
+		{53C60437-81FF-472C-9D97-83445BFF7109}.Debug|x86.ActiveCfg = Debug|Win32
+		{53C60437-81FF-472C-9D97-83445BFF7109}.Debug|x86.Build.0 = Debug|Win32
+		{53C60437-81FF-472C-9D97-83445BFF7109}.Debug|x86.Deploy.0 = Debug|Win32
+		{53C60437-81FF-472C-9D97-83445BFF7109}.Release|ARM.ActiveCfg = Release|ARM
+		{53C60437-81FF-472C-9D97-83445BFF7109}.Release|ARM.Build.0 = Release|ARM
+		{53C60437-81FF-472C-9D97-83445BFF7109}.Release|ARM.Deploy.0 = Release|ARM
+		{53C60437-81FF-472C-9D97-83445BFF7109}.Release|x64.ActiveCfg = Release|x64
+		{53C60437-81FF-472C-9D97-83445BFF7109}.Release|x64.Build.0 = Release|x64
+		{53C60437-81FF-472C-9D97-83445BFF7109}.Release|x64.Deploy.0 = Release|x64
+		{53C60437-81FF-472C-9D97-83445BFF7109}.Release|x86.ActiveCfg = Release|Win32
+		{53C60437-81FF-472C-9D97-83445BFF7109}.Release|x86.Build.0 = Release|Win32
+		{53C60437-81FF-472C-9D97-83445BFF7109}.Release|x86.Deploy.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

+ 363 - 0
build/windows/universal/PolycodeCore/PolycodeCore.vcxproj

@@ -0,0 +1,363 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|ARM">
+      <Configuration>Debug</Configuration>
+      <Platform>ARM</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|ARM">
+      <Configuration>Release</Configuration>
+      <Platform>ARM</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\..\..\..\src\core\PolyBezierCurve.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyBone.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyCamera.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyClient.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyColor.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyConfig.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyCore.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyCoreInput.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyCoreServices.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyCubemap.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyData.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyEntity.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyEvent.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyEventDispatcher.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyEventHandler.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyFont.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyFontGlyphSheet.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyFontManager.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyGPUDrawBuffer.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyImage.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyInputEvent.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyLabel.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyLogger.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyMaterial.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyMaterialManager.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyMatrix4.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyMesh.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyObject.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyParticleEmitter.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyPeer.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyPerlin.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyQuaternion.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyQuaternionCurve.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyRay.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyRectangle.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyRenderDataArray.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyRenderer.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyResource.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyResourceManager.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyScene.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolySceneEntityInstance.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolySceneImage.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolySceneLabel.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolySceneLight.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolySceneLine.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolySceneManager.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolySceneMesh.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyScenePrimitive.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolySceneRenderTexture.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolySceneSound.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolySceneSprite.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyServer.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyShader.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolySkeleton.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolySocket.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolySound.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolySoundManager.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyString.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyTexture.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyThreaded.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyTimer.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyTimerManager.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyTween.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyTweenManager.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyVector2.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyVector3.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyVector4.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\rgbe.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\tinystr.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\tinyxml.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\tinyxmlerror.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\tinyxmlparser.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\..\..\..\include\Polycode.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyBezierCurve.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyBone.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyCamera.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyClient.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyCocoaCore.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyColor.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyConfig.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyCore.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyCoreInput.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyCoreServices.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyCubemap.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyData.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyEntity.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyEvent.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyEventDispatcher.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyEventHandler.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyFont.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyFontGlyphSheet.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyFontManager.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyGlobals.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyGPUDrawBuffer.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyImage.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyInputEvent.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyInputKeys.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyLabel.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyLogger.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyMaterial.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyMaterialManager.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyMatrix4.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyMesh.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyObject.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyParticleEmitter.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyPeer.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyPerlin.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyQuaternion.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyQuaternionCurve.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyRay.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyRectangle.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyRenderDataArray.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyRenderer.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyResource.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyResourceManager.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyScene.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySceneEntityInstance.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySceneImage.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySceneLabel.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySceneLight.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySceneLine.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySceneManager.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySceneMesh.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyScenePrimitive.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySceneRenderTexture.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySceneSound.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySceneSprite.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyServer.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyServerWorld.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyShader.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySkeleton.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySocket.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySound.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySoundManager.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyString.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyTexture.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyThreaded.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyTimer.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyTimerManager.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyTween.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyTweenManager.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyVector2.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyVector3.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyVector4.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\rgbe.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\stb_image.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\tinystr.h" />
+    <ClInclude Include="..\..\..\..\include\polycode\core\tinyxml.h" />
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{ee7ae05c-9ae5-47fa-8a08-28e8d8d89b94}</ProjectGuid>
+    <Keyword>StaticLibrary</Keyword>
+    <ProjectName>PolycodeCore</ProjectName>
+    <RootNamespace>PolycodeCore</RootNamespace>
+    <DefaultLanguage>en-US</DefaultLanguage>
+    <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
+    <AppContainerApplication>true</AppContainerApplication>
+    <ApplicationType>Windows Store</ApplicationType>
+    <WindowsTargetPlatformVersion>10.0.10240.0</WindowsTargetPlatformVersion>
+    <WindowsTargetPlatformMinVersion>10.0.10240.0</WindowsTargetPlatformMinVersion>
+    <ApplicationTypeRevision>10.0</ApplicationTypeRevision>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <GenerateManifest>false</GenerateManifest>
+    <IncludePath>../../../../include;$(IncludePath)</IncludePath>
+    <OutDir>..\..\..\..\lib\windows\x86</OutDir>
+    <TargetName>Polycored</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <GenerateManifest>false</GenerateManifest>
+    <IncludePath>../../../../include;$(IncludePath)</IncludePath>
+    <OutDir>..\..\..\..\lib\windows\x86</OutDir>
+    <TargetName>Polycore</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
+    <GenerateManifest>false</GenerateManifest>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
+    <GenerateManifest>false</GenerateManifest>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <GenerateManifest>false</GenerateManifest>
+    <OutDir>..\..\..\..\lib\windows\x64</OutDir>
+    <IncludePath>../../../../include;$(IncludePath)</IncludePath>
+    <TargetName>Polycored</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <GenerateManifest>false</GenerateManifest>
+    <OutDir>..\..\..\..\lib\windows\x64</OutDir>
+    <IncludePath>../../../../include;$(IncludePath)</IncludePath>
+    <TargetName>Polycore</TargetName>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <CompileAsWinRT>false</CompileAsWinRT>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_WINDOWS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
+      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <CompileAsWinRT>false</CompileAsWinRT>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_WINDOWS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Optimization>Full</Optimization>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
+      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|arm'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <CompileAsWinRT>false</CompileAsWinRT>
+      <SDLCheck>true</SDLCheck>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
+      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|arm'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <CompileAsWinRT>false</CompileAsWinRT>
+      <SDLCheck>true</SDLCheck>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
+      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <CompileAsWinRT>false</CompileAsWinRT>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_WINDOWS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
+      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <CompileAsWinRT>false</CompileAsWinRT>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_WINDOWS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
+      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
+    </Link>
+  </ItemDefinitionGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 463 - 0
build/windows/universal/PolycodeCore/PolycodeCore.vcxproj.filters

@@ -0,0 +1,463 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Resource Files">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+    <Filter Include="Source">
+      <UniqueIdentifier>{3a81c187-e488-4f3d-a455-45ae0819f819}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Include">
+      <UniqueIdentifier>{aa5fee39-5043-40d0-a4a8-432e830cfc13}</UniqueIdentifier>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\..\..\..\src\core\PolyBezierCurve.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyBone.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyCamera.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyClient.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyColor.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyConfig.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyCore.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyCoreInput.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyCoreServices.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyCubemap.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyData.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyEntity.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyEvent.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyEventDispatcher.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyEventHandler.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyFont.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyFontGlyphSheet.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyFontManager.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyGPUDrawBuffer.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyImage.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyInputEvent.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyLabel.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyLogger.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyMaterial.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyMaterialManager.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyMatrix4.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyMesh.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyObject.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyParticleEmitter.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyPeer.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyPerlin.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyQuaternion.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyQuaternionCurve.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyRay.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyRectangle.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyRenderDataArray.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyRenderer.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyResource.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyResourceManager.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyScene.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolySceneEntityInstance.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolySceneImage.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolySceneLabel.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolySceneLight.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolySceneLine.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolySceneManager.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolySceneMesh.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyScenePrimitive.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolySceneRenderTexture.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolySceneSound.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolySceneSprite.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyServer.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyShader.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolySkeleton.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolySocket.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolySound.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolySoundManager.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyString.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyTexture.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyThreaded.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyTimer.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyTimerManager.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyTween.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyTweenManager.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyVector2.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyVector3.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyVector4.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\rgbe.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\tinystr.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\tinyxml.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\tinyxmlerror.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\tinyxmlparser.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\..\..\..\include\Polycode.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyBezierCurve.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyBone.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyCamera.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyClient.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyCocoaCore.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyColor.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyConfig.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyCore.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyCoreInput.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyCoreServices.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyCubemap.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyData.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyEntity.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyEvent.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyEventDispatcher.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyEventHandler.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyFont.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyFontGlyphSheet.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyFontManager.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyGlobals.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyGPUDrawBuffer.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyImage.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyInputEvent.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyInputKeys.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyLabel.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyLogger.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyMaterial.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyMaterialManager.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyMatrix4.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyMesh.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyObject.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyParticleEmitter.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyPeer.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyPerlin.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyQuaternion.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyQuaternionCurve.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyRay.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyRectangle.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyRenderDataArray.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyRenderer.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyResource.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyResourceManager.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyScene.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySceneEntityInstance.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySceneImage.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySceneLabel.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySceneLight.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySceneLine.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySceneManager.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySceneMesh.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyScenePrimitive.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySceneRenderTexture.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySceneSound.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySceneSprite.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyServer.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyServerWorld.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyShader.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySkeleton.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySocket.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySound.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolySoundManager.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyString.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyTexture.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyThreaded.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyTimer.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyTimerManager.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyTween.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyTweenManager.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyVector2.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyVector3.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyVector4.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\rgbe.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\stb_image.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\tinystr.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\tinyxml.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+  </ItemGroup>
+</Project>

+ 8 - 0
build/windows/universal/PolycodeCore/targetver.h

@@ -0,0 +1,8 @@
+#pragma once
+
+// Including SDKDDKVer.h defines the highest available Windows platform.
+
+// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
+// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
+
+#include <SDKDDKVer.h>

+ 217 - 0
build/windows/universal/TemplateApp/App.cpp

@@ -0,0 +1,217 @@
+#include "pch.h"
+#include "App.h"
+
+#include <ppltasks.h>
+
+using namespace TemplateApp;
+
+using namespace concurrency;
+using namespace Windows::ApplicationModel;
+using namespace Windows::ApplicationModel::Core;
+using namespace Windows::ApplicationModel::Activation;
+using namespace Windows::UI::Core;
+using namespace Windows::UI::Input;
+using namespace Windows::System;
+using namespace Windows::Foundation;
+using namespace Windows::Graphics::Display;
+
+// The DirectX 12 Application template is documented at http://go.microsoft.com/fwlink/?LinkID=613670&clcid=0x409
+
+// The main function is only used to initialize our IFrameworkView class.
+[Platform::MTAThread]
+int main(Platform::Array<Platform::String^>^)
+{
+	auto direct3DApplicationSource = ref new Direct3DApplicationSource();
+	CoreApplication::Run(direct3DApplicationSource);
+	return 0;
+}
+
+IFrameworkView^ Direct3DApplicationSource::CreateView()
+{
+	return ref new App();
+}
+
+App::App() :
+	m_windowClosed(false),
+	m_windowVisible(true)
+{
+}
+
+// The first method called when the IFrameworkView is being created.
+void App::Initialize(CoreApplicationView^ applicationView)
+{
+	// Register event handlers for app lifecycle. This example includes Activated, so that we
+	// can make the CoreWindow active and start rendering on the window.
+	applicationView->Activated +=
+		ref new TypedEventHandler<CoreApplicationView^, IActivatedEventArgs^>(this, &App::OnActivated);
+
+	CoreApplication::Suspending +=
+		ref new EventHandler<SuspendingEventArgs^>(this, &App::OnSuspending);
+
+	CoreApplication::Resuming +=
+		ref new EventHandler<Platform::Object^>(this, &App::OnResuming);
+}
+
+// Called when the CoreWindow object is created (or re-created).
+void App::SetWindow(CoreWindow^ window)
+{
+	window->SizeChanged += 
+		ref new TypedEventHandler<CoreWindow^, WindowSizeChangedEventArgs^>(this, &App::OnWindowSizeChanged);
+
+	window->VisibilityChanged +=
+		ref new TypedEventHandler<CoreWindow^, VisibilityChangedEventArgs^>(this, &App::OnVisibilityChanged);
+
+	window->Closed += 
+		ref new TypedEventHandler<CoreWindow^, CoreWindowEventArgs^>(this, &App::OnWindowClosed);
+
+	DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView();
+
+	currentDisplayInformation->DpiChanged +=
+		ref new TypedEventHandler<DisplayInformation^, Object^>(this, &App::OnDpiChanged);
+
+	currentDisplayInformation->OrientationChanged +=
+		ref new TypedEventHandler<DisplayInformation^, Object^>(this, &App::OnOrientationChanged);
+
+	DisplayInformation::DisplayContentsInvalidated +=
+		ref new TypedEventHandler<DisplayInformation^, Object^>(this, &App::OnDisplayContentsInvalidated);
+}
+
+// Initializes scene resources, or loads a previously saved app state.
+void App::Load(Platform::String^ entryPoint)
+{
+	if (m_main == nullptr)
+	{
+		m_main = std::unique_ptr<TemplateAppMain>(new TemplateAppMain());
+	}
+}
+
+// This method is called after the window becomes active.
+void App::Run()
+{
+	while (!m_windowClosed)
+	{
+		if (m_windowVisible)
+		{
+			CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent);
+
+			auto commandQueue = GetDeviceResources()->GetCommandQueue();
+			PIXBeginEvent(commandQueue, 0, L"Update");
+			{
+				m_main->Update();
+			}
+			PIXEndEvent(commandQueue);
+
+			PIXBeginEvent(commandQueue, 0, L"Render");
+			{
+				if (m_main->Render())
+				{
+					GetDeviceResources()->Present();
+				}
+			}
+			PIXEndEvent(commandQueue);
+		}
+		else
+		{
+			CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessOneAndAllPending);
+		}
+	}
+}
+
+// Required for IFrameworkView.
+// Terminate events do not cause Uninitialize to be called. It will be called if your IFrameworkView
+// class is torn down while the app is in the foreground.
+void App::Uninitialize()
+{
+}
+
+// Application lifecycle event handlers.
+
+void App::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args)
+{
+	// Run() won't start until the CoreWindow is activated.
+	CoreWindow::GetForCurrentThread()->Activate();
+}
+
+void App::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args)
+{
+	// Save app state asynchronously after requesting a deferral. Holding a deferral
+	// indicates that the application is busy performing suspending operations. Be
+	// aware that a deferral may not be held indefinitely. After about five seconds,
+	// the app will be forced to exit.
+	SuspendingDeferral^ deferral = args->SuspendingOperation->GetDeferral();
+
+	create_task([this, deferral]()
+	{
+		// TODO: Insert your code here.
+		m_main->OnSuspending();
+
+		deferral->Complete();
+	});
+}
+
+void App::OnResuming(Platform::Object^ sender, Platform::Object^ args)
+{
+	// Restore any data or state that was unloaded on suspend. By default, data
+	// and state are persisted when resuming from suspend. Note that this event
+	// does not occur if the app was previously terminated.
+
+	// TODO: Insert your code here.
+	m_main->OnResuming();
+}
+
+// Window event handlers.
+
+void App::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args)
+{
+	GetDeviceResources()->SetLogicalSize(Size(sender->Bounds.Width, sender->Bounds.Height));
+	m_main->OnWindowSizeChanged();
+}
+
+void App::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args)
+{
+	m_windowVisible = args->Visible;
+}
+
+void App::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args)
+{
+	m_windowClosed = true;
+}
+
+// DisplayInformation event handlers.
+
+void App::OnDpiChanged(DisplayInformation^ sender, Object^ args)
+{
+	GetDeviceResources()->SetDpi(sender->LogicalDpi);
+	m_main->OnWindowSizeChanged();
+}
+
+void App::OnOrientationChanged(DisplayInformation^ sender, Object^ args)
+{
+	GetDeviceResources()->SetCurrentOrientation(sender->CurrentOrientation);
+	m_main->OnWindowSizeChanged();
+}
+
+void App::OnDisplayContentsInvalidated(DisplayInformation^ sender, Object^ args)
+{
+	GetDeviceResources()->ValidateDevice();
+}
+
+std::shared_ptr<DX::DeviceResources> App::GetDeviceResources()
+{
+	if (m_deviceResources != nullptr && m_deviceResources->IsDeviceRemoved())
+	{
+		// All references to the existing D3D device must be released before a new device
+		// can be created.
+
+		m_deviceResources = nullptr;
+		m_main->OnDeviceRemoved();
+	}
+
+	if (m_deviceResources == nullptr)
+	{
+		m_deviceResources = std::make_shared<DX::DeviceResources>();
+		m_deviceResources->SetWindow(CoreWindow::GetForCurrentThread());
+		m_main->CreateRenderers(m_deviceResources);
+	}
+	return m_deviceResources;
+}

+ 53 - 0
build/windows/universal/TemplateApp/App.h

@@ -0,0 +1,53 @@
+#pragma once
+
+#include "pch.h"
+#include "Common\DeviceResources.h"
+#include "TemplateAppMain.h"
+
+namespace TemplateApp
+{
+	// Main entry point for our app. Connects the app with the Windows shell and handles application lifecycle events.
+	ref class App sealed : public Windows::ApplicationModel::Core::IFrameworkView
+	{
+	public:
+		App();
+
+		// IFrameworkView methods.
+		virtual void Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView);
+		virtual void SetWindow(Windows::UI::Core::CoreWindow^ window);
+		virtual void Load(Platform::String^ entryPoint);
+		virtual void Run();
+		virtual void Uninitialize();
+
+	protected:
+		// Application lifecycle event handlers.
+		void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args);
+		void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ args);
+		void OnResuming(Platform::Object^ sender, Platform::Object^ args);
+
+		// Window event handlers.
+		void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args);
+		void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args);
+		void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args);
+
+		// DisplayInformation event handlers.
+		void OnDpiChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args);
+		void OnOrientationChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args);
+		void OnDisplayContentsInvalidated(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args);
+
+	private:
+		// Private accessor for m_deviceResources, protects against device removed errors.
+		std::shared_ptr<DX::DeviceResources> GetDeviceResources();
+
+		std::shared_ptr<DX::DeviceResources> m_deviceResources;
+		std::unique_ptr<TemplateAppMain> m_main;
+		bool m_windowClosed;
+		bool m_windowVisible;
+	};
+}
+
+ref class Direct3DApplicationSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource
+{
+public:
+	virtual Windows::ApplicationModel::Core::IFrameworkView^ CreateView();
+};

BIN
build/windows/universal/TemplateApp/Assets/LockScreenLogo.scale-200.png


BIN
build/windows/universal/TemplateApp/Assets/SplashScreen.scale-200.png


BIN
build/windows/universal/TemplateApp/Assets/Square150x150Logo.scale-200.png


BIN
build/windows/universal/TemplateApp/Assets/Square44x44Logo.scale-200.png


BIN
build/windows/universal/TemplateApp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png


BIN
build/windows/universal/TemplateApp/Assets/StoreLogo.png


BIN
build/windows/universal/TemplateApp/Assets/Wide310x150Logo.scale-200.png


+ 476 - 0
build/windows/universal/TemplateApp/Common/DeviceResources.cpp

@@ -0,0 +1,476 @@
+#include "pch.h"
+#include "DeviceResources.h"
+#include "DirectXHelper.h"
+
+using namespace DirectX;
+using namespace Microsoft::WRL;
+using namespace Windows::Foundation;
+using namespace Windows::Graphics::Display;
+using namespace Windows::UI::Core;
+using namespace Windows::UI::Xaml::Controls;
+using namespace Platform;
+
+// Constants used to calculate screen rotations.
+namespace ScreenRotation
+{
+	// 0-degree Z-rotation
+	static const XMFLOAT4X4 Rotation0(
+		1.0f, 0.0f, 0.0f, 0.0f,
+		0.0f, 1.0f, 0.0f, 0.0f,
+		0.0f, 0.0f, 1.0f, 0.0f,
+		0.0f, 0.0f, 0.0f, 1.0f
+		);
+
+	// 90-degree Z-rotation
+	static const XMFLOAT4X4 Rotation90(
+		0.0f, 1.0f, 0.0f, 0.0f,
+		-1.0f, 0.0f, 0.0f, 0.0f,
+		0.0f, 0.0f, 1.0f, 0.0f,
+		0.0f, 0.0f, 0.0f, 1.0f
+		);
+
+	// 180-degree Z-rotation
+	static const XMFLOAT4X4 Rotation180(
+		-1.0f, 0.0f, 0.0f, 0.0f,
+		0.0f, -1.0f, 0.0f, 0.0f,
+		0.0f, 0.0f, 1.0f, 0.0f,
+		0.0f, 0.0f, 0.0f, 1.0f
+		);
+
+	// 270-degree Z-rotation
+	static const XMFLOAT4X4 Rotation270(
+		0.0f, -1.0f, 0.0f, 0.0f,
+		1.0f, 0.0f, 0.0f, 0.0f,
+		0.0f, 0.0f, 1.0f, 0.0f,
+		0.0f, 0.0f, 0.0f, 1.0f
+		);
+};
+
+// Constructor for DeviceResources.
+DX::DeviceResources::DeviceResources() :
+	m_currentFrame(0),
+	m_screenViewport(),
+	m_rtvDescriptorSize(0),
+	m_fenceEvent(0),
+	m_d3dRenderTargetSize(),
+	m_outputSize(),
+	m_logicalSize(),
+	m_nativeOrientation(DisplayOrientations::None),
+	m_currentOrientation(DisplayOrientations::None),
+	m_dpi(-1.0f),
+	m_deviceRemoved(false)
+{
+	ZeroMemory(m_fenceValues, sizeof(m_fenceValues));
+	CreateDeviceIndependentResources();
+	CreateDeviceResources();
+}
+
+// Configures resources that don't depend on the Direct3D device.
+void DX::DeviceResources::CreateDeviceIndependentResources()
+{
+}
+
+// Configures the Direct3D device, and stores handles to it and the device context.
+void DX::DeviceResources::CreateDeviceResources()
+{
+#if defined(_DEBUG)
+	// If the project is in a debug build, enable debugging via SDK Layers.
+	{
+		ComPtr<ID3D12Debug> debugController;
+		if (SUCCEEDED(D3D12GetDebugInterface(IID_PPV_ARGS(&debugController))))
+		{
+			debugController->EnableDebugLayer();
+		}
+	}
+#endif
+
+	DX::ThrowIfFailed(CreateDXGIFactory1(IID_PPV_ARGS(&m_dxgiFactory)));
+
+	// Create the Direct3D 12 API device object
+	HRESULT hr = D3D12CreateDevice(
+		nullptr,						// Specify nullptr to use the default adapter.
+		D3D_FEATURE_LEVEL_11_0,			// Minimum feature level this app can support.
+		IID_PPV_ARGS(&m_d3dDevice)		// Returns the Direct3D device created.
+		);
+
+	if (FAILED(hr))
+	{
+		// If the initialization fails, fall back to the WARP device.
+		// For more information on WARP, see: 
+		// http://go.microsoft.com/fwlink/?LinkId=286690
+
+		ComPtr<IDXGIAdapter> warpAdapter;
+		m_dxgiFactory->EnumWarpAdapter(IID_PPV_ARGS(&warpAdapter)); 
+
+		DX::ThrowIfFailed(
+			D3D12CreateDevice(
+				warpAdapter.Get(),
+				D3D_FEATURE_LEVEL_11_0,
+				IID_PPV_ARGS(&m_d3dDevice)
+				)
+			);
+	}
+
+	// Create the command queue.
+	D3D12_COMMAND_QUEUE_DESC queueDesc = {};
+	queueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
+	queueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;
+
+	DX::ThrowIfFailed(m_d3dDevice->CreateCommandQueue(&queueDesc, IID_PPV_ARGS(&m_commandQueue)));
+
+	for (UINT n = 0; n < c_frameCount; n++)
+	{
+		DX::ThrowIfFailed(
+			m_d3dDevice->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&m_commandAllocators[n]))
+			);
+	}
+
+	// Create synchronization objects.
+	DX::ThrowIfFailed(m_d3dDevice->CreateFence(m_fenceValues[m_currentFrame], D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&m_fence)));
+	m_fenceValues[m_currentFrame]++;
+
+	m_fenceEvent = CreateEventEx(nullptr, FALSE, FALSE, EVENT_ALL_ACCESS);
+}
+
+// These resources need to be recreated every time the window size is changed.
+void DX::DeviceResources::CreateWindowSizeDependentResources()
+{
+	// Wait until all previous GPU work is complete.
+	WaitForGpu();
+
+	// Clear the previous window size specific content.
+	for (UINT n = 0; n < c_frameCount; n++)
+	{
+		m_renderTargets[n] = nullptr;
+	}
+	m_rtvHeap = nullptr;
+
+	// Calculate the necessary render target size in pixels.
+	m_outputSize.Width = DX::ConvertDipsToPixels(m_logicalSize.Width, m_dpi);
+	m_outputSize.Height = DX::ConvertDipsToPixels(m_logicalSize.Height, m_dpi);
+
+	// Prevent zero size DirectX content from being created.
+	m_outputSize.Width = max(m_outputSize.Width, 1);
+	m_outputSize.Height = max(m_outputSize.Height, 1);
+
+	// The width and height of the swap chain must be based on the window's
+	// natively-oriented width and height. If the window is not in the native
+	// orientation, the dimensions must be reversed.
+	DXGI_MODE_ROTATION displayRotation = ComputeDisplayRotation();
+
+	bool swapDimensions = displayRotation == DXGI_MODE_ROTATION_ROTATE90 || displayRotation == DXGI_MODE_ROTATION_ROTATE270;
+	m_d3dRenderTargetSize.Width = swapDimensions ? m_outputSize.Height : m_outputSize.Width;
+	m_d3dRenderTargetSize.Height = swapDimensions ? m_outputSize.Width : m_outputSize.Height;
+
+	if (m_swapChain != nullptr)
+	{
+		// If the swap chain already exists, resize it.
+		HRESULT hr = m_swapChain->ResizeBuffers(
+			c_frameCount,
+			lround(m_d3dRenderTargetSize.Width),
+			lround(m_d3dRenderTargetSize.Height),
+			DXGI_FORMAT_B8G8R8A8_UNORM,
+			0
+			);
+
+		if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET)
+		{
+			// If the device was removed for any reason, a new device and swap chain will need to be created.
+			m_deviceRemoved = true;
+
+			// Do not continue execution of this method. DeviceResources will be destroyed and re-created.
+			return;
+		}
+		else
+		{
+			DX::ThrowIfFailed(hr);
+		}
+	}
+	else
+	{
+		// Otherwise, create a new one using the same adapter as the existing Direct3D device.
+		DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {};
+
+		swapChainDesc.Width = lround(m_d3dRenderTargetSize.Width);	// Match the size of the window.
+		swapChainDesc.Height = lround(m_d3dRenderTargetSize.Height);
+		swapChainDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;			// This is the most common swap chain format.
+		swapChainDesc.Stereo = false;
+		swapChainDesc.SampleDesc.Count = 1;							// Don't use multi-sampling.
+		swapChainDesc.SampleDesc.Quality = 0;
+		swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
+		swapChainDesc.BufferCount = c_frameCount;					// Use triple-buffering to minimize latency.
+		swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;	// All Windows Universal apps must use _FLIP_ SwapEffects
+		swapChainDesc.Flags = 0;
+		swapChainDesc.Scaling = DXGI_SCALING_NONE;
+		swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_IGNORE;
+
+		ComPtr<IDXGISwapChain1> swapChain;
+		DX::ThrowIfFailed(
+			m_dxgiFactory->CreateSwapChainForCoreWindow(
+				m_commandQueue.Get(),
+				reinterpret_cast<IUnknown*>(m_window.Get()),
+				&swapChainDesc,
+				nullptr,
+				&swapChain
+				)
+			);
+
+		DX::ThrowIfFailed(swapChain.As(&m_swapChain));
+	}
+
+	// Set the proper orientation for the swap chain, and generate
+	// 3D matrix transformations for rendering to the rotated swap chain.
+	// The 3D matrix is specified explicitly to avoid rounding errors.
+
+	switch (displayRotation)
+	{
+	case DXGI_MODE_ROTATION_IDENTITY:
+		m_orientationTransform3D = ScreenRotation::Rotation0;
+		break;
+
+	case DXGI_MODE_ROTATION_ROTATE90:
+		m_orientationTransform3D = ScreenRotation::Rotation270;
+		break;
+
+	case DXGI_MODE_ROTATION_ROTATE180:
+		m_orientationTransform3D = ScreenRotation::Rotation180;
+		break;
+
+	case DXGI_MODE_ROTATION_ROTATE270:
+		m_orientationTransform3D = ScreenRotation::Rotation90;
+		break;
+
+	default:
+		throw ref new FailureException();
+	}
+
+	DX::ThrowIfFailed(
+		m_swapChain->SetRotation(displayRotation)
+		);
+
+	// Create a render target view of the swap chain back buffer.
+	{
+		D3D12_DESCRIPTOR_HEAP_DESC desc = {};
+		desc.NumDescriptors = c_frameCount;
+		desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV;
+		desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;
+		DX::ThrowIfFailed(m_d3dDevice->CreateDescriptorHeap(&desc, IID_PPV_ARGS(&m_rtvHeap)));
+		m_rtvHeap->SetName(L"Render Target View Descriptor Heap");
+
+		// All pending GPU work was already finished. Update the tracked fence values
+		// to the last value signaled.
+		for (UINT n = 0; n < c_frameCount; n++)
+		{
+			m_fenceValues[n] = m_fenceValues[m_currentFrame];
+		}
+
+		m_currentFrame = 0;
+		CD3DX12_CPU_DESCRIPTOR_HANDLE rtvDescriptor(m_rtvHeap->GetCPUDescriptorHandleForHeapStart());
+		m_rtvDescriptorSize = m_d3dDevice->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
+		for (UINT n = 0; n < c_frameCount; n++)
+		{
+			DX::ThrowIfFailed(m_swapChain->GetBuffer(n, IID_PPV_ARGS(&m_renderTargets[n])));
+			m_d3dDevice->CreateRenderTargetView(m_renderTargets[n].Get(), nullptr, rtvDescriptor);
+			rtvDescriptor.Offset(m_rtvDescriptorSize);
+
+			WCHAR name[25];
+			swprintf_s(name, L"Render Target %d", n);
+			m_renderTargets[n]->SetName(name);
+		}
+	}
+
+	// Set the 3D rendering viewport to target the entire window.
+	m_screenViewport = { 0.0f, 0.0f, m_d3dRenderTargetSize.Width, m_d3dRenderTargetSize.Height, 0.0f, 1.0f };
+}
+
+// This method is called when the CoreWindow is created (or re-created).
+void DX::DeviceResources::SetWindow(CoreWindow^ window)
+{
+	DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView();
+
+	m_window = window;
+	m_logicalSize = Windows::Foundation::Size(window->Bounds.Width, window->Bounds.Height);
+	m_nativeOrientation = currentDisplayInformation->NativeOrientation;
+	m_currentOrientation = currentDisplayInformation->CurrentOrientation;
+	m_dpi = currentDisplayInformation->LogicalDpi;
+
+	CreateWindowSizeDependentResources();
+}
+
+// This method is called in the event handler for the SizeChanged event.
+void DX::DeviceResources::SetLogicalSize(Windows::Foundation::Size logicalSize)
+{
+	if (m_logicalSize != logicalSize)
+	{
+		m_logicalSize = logicalSize;
+		CreateWindowSizeDependentResources();
+	}
+}
+
+// This method is called in the event handler for the DpiChanged event.
+void DX::DeviceResources::SetDpi(float dpi)
+{
+	if (dpi != m_dpi)
+	{
+		m_dpi = dpi;
+
+		// When the display DPI changes, the logical size of the window (measured in Dips) also changes and needs to be updated.
+		m_logicalSize = Windows::Foundation::Size(m_window->Bounds.Width, m_window->Bounds.Height);
+
+		CreateWindowSizeDependentResources();
+	}
+}
+
+// This method is called in the event handler for the OrientationChanged event.
+void DX::DeviceResources::SetCurrentOrientation(DisplayOrientations currentOrientation)
+{
+	if (m_currentOrientation != currentOrientation)
+	{
+		m_currentOrientation = currentOrientation;
+		CreateWindowSizeDependentResources();
+	}
+}
+
+// This method is called in the event handler for the DisplayContentsInvalidated event.
+void DX::DeviceResources::ValidateDevice()
+{
+	// The D3D Device is no longer valid if the default adapter changed since the device
+	// was created or if the device has been removed.
+
+	// First, get the LUID for the adapter from when the device was created.
+
+	LUID previousAdapterLuid = m_d3dDevice->GetAdapterLuid();
+
+	// Next, get the information for the current default adapter.
+
+	ComPtr<IDXGIFactory2> currentFactory;
+	DX::ThrowIfFailed(CreateDXGIFactory1(IID_PPV_ARGS(&currentFactory)));
+
+	ComPtr<IDXGIAdapter1> currentDefaultAdapter;
+	DX::ThrowIfFailed(currentFactory->EnumAdapters1(0, &currentDefaultAdapter));
+
+	DXGI_ADAPTER_DESC currentDesc;
+	DX::ThrowIfFailed(currentDefaultAdapter->GetDesc(&currentDesc));
+
+	// If the adapter LUIDs don't match, or if the device reports that it has been removed,
+	// a new D3D device must be created.
+
+	if (previousAdapterLuid.LowPart != currentDesc.AdapterLuid.LowPart ||
+		previousAdapterLuid.HighPart != currentDesc.AdapterLuid.HighPart ||
+		FAILED(m_d3dDevice->GetDeviceRemovedReason()))
+	{
+		m_deviceRemoved = true;
+	}
+}
+
+// Present the contents of the swap chain to the screen.
+void DX::DeviceResources::Present()
+{
+	// The first argument instructs DXGI to block until VSync, putting the application
+	// to sleep until the next VSync. This ensures we don't waste any cycles rendering
+	// frames that will never be displayed to the screen.
+	HRESULT hr = m_swapChain->Present(1, 0);
+
+	// If the device was removed either by a disconnection or a driver upgrade, we 
+	// must recreate all device resources.
+	if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET)
+	{
+		m_deviceRemoved = true;
+	}
+	else
+	{
+		DX::ThrowIfFailed(hr);
+
+		MoveToNextFrame();
+	}
+}
+
+// Wait for pending GPU work to complete.
+void DX::DeviceResources::WaitForGpu()
+{
+	// Schedule a Signal command in the queue.
+	DX::ThrowIfFailed(m_commandQueue->Signal(m_fence.Get(), m_fenceValues[m_currentFrame]));
+
+	// Wait until the fence has been crossed.
+	DX::ThrowIfFailed(m_fence->SetEventOnCompletion(m_fenceValues[m_currentFrame], m_fenceEvent));
+	WaitForSingleObjectEx(m_fenceEvent, INFINITE, FALSE);
+
+	// Increment the fence value for the current frame.
+	m_fenceValues[m_currentFrame]++;
+}
+
+// Prepare to render the next frame.
+void DX::DeviceResources::MoveToNextFrame()
+{
+	// Schedule a Signal command in the queue.
+	const UINT64 currentFenceValue = m_fenceValues[m_currentFrame];
+	DX::ThrowIfFailed(m_commandQueue->Signal(m_fence.Get(), currentFenceValue));
+
+	// Advance the frame index.
+	m_currentFrame = (m_currentFrame + 1) % c_frameCount;
+
+	// Check to see if the next frame is ready to start.
+	if (m_fence->GetCompletedValue() < m_fenceValues[m_currentFrame])
+	{
+		DX::ThrowIfFailed(m_fence->SetEventOnCompletion(m_fenceValues[m_currentFrame], m_fenceEvent));
+		WaitForSingleObjectEx(m_fenceEvent, INFINITE, FALSE);
+	}
+
+	// Set the fence value for the next frame.
+	m_fenceValues[m_currentFrame] = currentFenceValue + 1;
+}
+
+// This method determines the rotation between the display device's native Orientation and the
+// current display orientation.
+DXGI_MODE_ROTATION DX::DeviceResources::ComputeDisplayRotation()
+{
+	DXGI_MODE_ROTATION rotation = DXGI_MODE_ROTATION_UNSPECIFIED;
+
+	// Note: NativeOrientation can only be Landscape or Portrait even though
+	// the DisplayOrientations enum has other values.
+	switch (m_nativeOrientation)
+	{
+	case DisplayOrientations::Landscape:
+		switch (m_currentOrientation)
+		{
+		case DisplayOrientations::Landscape:
+			rotation = DXGI_MODE_ROTATION_IDENTITY;
+			break;
+
+		case DisplayOrientations::Portrait:
+			rotation = DXGI_MODE_ROTATION_ROTATE270;
+			break;
+
+		case DisplayOrientations::LandscapeFlipped:
+			rotation = DXGI_MODE_ROTATION_ROTATE180;
+			break;
+
+		case DisplayOrientations::PortraitFlipped:
+			rotation = DXGI_MODE_ROTATION_ROTATE90;
+			break;
+		}
+		break;
+
+	case DisplayOrientations::Portrait:
+		switch (m_currentOrientation)
+		{
+		case DisplayOrientations::Landscape:
+			rotation = DXGI_MODE_ROTATION_ROTATE90;
+			break;
+
+		case DisplayOrientations::Portrait:
+			rotation = DXGI_MODE_ROTATION_IDENTITY;
+			break;
+
+		case DisplayOrientations::LandscapeFlipped:
+			rotation = DXGI_MODE_ROTATION_ROTATE270;
+			break;
+
+		case DisplayOrientations::PortraitFlipped:
+			rotation = DXGI_MODE_ROTATION_ROTATE180;
+			break;
+		}
+		break;
+	}
+	return rotation;
+}

+ 80 - 0
build/windows/universal/TemplateApp/Common/DeviceResources.h

@@ -0,0 +1,80 @@
+#pragma once
+
+namespace DX
+{
+	static const UINT c_frameCount = 3;		// Use triple buffering.
+
+	// Controls all the DirectX device resources.
+	class DeviceResources
+	{
+	public:
+		DeviceResources();
+		void SetWindow(Windows::UI::Core::CoreWindow^ window);
+		void SetLogicalSize(Windows::Foundation::Size logicalSize);
+		void SetCurrentOrientation(Windows::Graphics::Display::DisplayOrientations currentOrientation);
+		void SetDpi(float dpi);
+		void ValidateDevice();
+		void Present();
+		void WaitForGpu();
+
+		// Device Accessors.
+		Windows::Foundation::Size	GetOutputSize() const				{ return m_outputSize; }
+		Windows::Foundation::Size	GetLogicalSize() const				{ return m_logicalSize; }
+		bool						IsDeviceRemoved() const				{ return m_deviceRemoved; }
+
+		// D3D Accessors.
+		ID3D12Device*				GetD3DDevice() const				{ return m_d3dDevice.Get(); }
+		IDXGISwapChain3*			GetSwapChain() const				{ return m_swapChain.Get(); }
+		ID3D12Resource*				GetRenderTarget() const				{ return m_renderTargets[m_currentFrame].Get(); }
+		ID3D12CommandQueue*			GetCommandQueue() const				{ return m_commandQueue.Get(); }
+		ID3D12CommandAllocator*		GetCommandAllocator() const			{ return m_commandAllocators[m_currentFrame].Get(); }
+		D3D12_VIEWPORT				GetScreenViewport() const			{ return m_screenViewport; }
+		DirectX::XMFLOAT4X4			GetOrientationTransform3D() const	{ return m_orientationTransform3D; }
+		UINT						GetCurrentFrameIndex() const		{ return m_currentFrame; }
+
+		CD3DX12_CPU_DESCRIPTOR_HANDLE GetRenderTargetView() const
+		{
+			return CD3DX12_CPU_DESCRIPTOR_HANDLE(m_rtvHeap->GetCPUDescriptorHandleForHeapStart(), m_currentFrame, m_rtvDescriptorSize);
+		}
+
+	private:
+		void CreateDeviceIndependentResources();
+		void CreateDeviceResources();
+		void CreateWindowSizeDependentResources();
+		void MoveToNextFrame();
+		DXGI_MODE_ROTATION ComputeDisplayRotation();
+
+		UINT											m_currentFrame;
+
+		// Direct3D objects.
+		Microsoft::WRL::ComPtr<ID3D12Device>			m_d3dDevice;
+		Microsoft::WRL::ComPtr<IDXGIFactory4>			m_dxgiFactory;
+		Microsoft::WRL::ComPtr<IDXGISwapChain3>			m_swapChain;
+		Microsoft::WRL::ComPtr<ID3D12Resource>			m_renderTargets[c_frameCount];
+		Microsoft::WRL::ComPtr<ID3D12DescriptorHeap>	m_rtvHeap;
+		UINT											m_rtvDescriptorSize;
+		Microsoft::WRL::ComPtr<ID3D12CommandQueue>		m_commandQueue;
+		Microsoft::WRL::ComPtr<ID3D12CommandAllocator>	m_commandAllocators[c_frameCount];
+		D3D12_VIEWPORT									m_screenViewport;
+		bool											m_deviceRemoved;
+
+		// CPU/GPU Synchronization.
+		Microsoft::WRL::ComPtr<ID3D12Fence>				m_fence;
+		UINT64											m_fenceValues[c_frameCount];
+		HANDLE											m_fenceEvent;
+
+		// Cached reference to the Window.
+		Platform::Agile<Windows::UI::Core::CoreWindow>	m_window;
+
+		// Cached device properties.
+		Windows::Foundation::Size						m_d3dRenderTargetSize;
+		Windows::Foundation::Size						m_outputSize;
+		Windows::Foundation::Size						m_logicalSize;
+		Windows::Graphics::Display::DisplayOrientations	m_nativeOrientation;
+		Windows::Graphics::Display::DisplayOrientations	m_currentOrientation;
+		float											m_dpi;
+
+		// Transforms used for display orientation.
+		DirectX::XMFLOAT4X4 m_orientationTransform3D;
+	};
+}

+ 42 - 0
build/windows/universal/TemplateApp/Common/DirectXHelper.h

@@ -0,0 +1,42 @@
+#pragma once
+
+#include <ppltasks.h>	// For create_task
+
+namespace DX
+{
+	inline void ThrowIfFailed(HRESULT hr)
+	{
+		if (FAILED(hr))
+		{
+			// Set a breakpoint on this line to catch Win32 API errors.
+			throw Platform::Exception::CreateException(hr);
+		}
+	}
+
+	// Function that reads from a binary file asynchronously.
+	inline Concurrency::task<std::vector<byte>> ReadDataAsync(const std::wstring& filename)
+	{
+		using namespace Windows::Storage;
+		using namespace Concurrency;
+
+		auto folder = Windows::ApplicationModel::Package::Current->InstalledLocation;
+
+		return create_task(folder->GetFileAsync(Platform::StringReference(filename.c_str()))).then([](StorageFile^ file)
+		{
+			return FileIO::ReadBufferAsync(file);
+		}).then([](Streams::IBuffer^ fileBuffer) -> std::vector<byte>
+		{
+			std::vector<byte> returnBuffer;
+			returnBuffer.resize(fileBuffer->Length);
+			Streams::DataReader::FromBuffer(fileBuffer)->ReadBytes(Platform::ArrayReference<byte>(returnBuffer.data(), fileBuffer->Length));
+			return returnBuffer;
+		});
+	}
+
+	// Converts a length in device-independent pixels (DIPs) to a length in physical pixels.
+	inline float ConvertDipsToPixels(float dips, float dpi)
+	{
+		static const float dipsPerInch = 96.0f;
+		return floorf(dips * dpi / dipsPerInch + 0.5f); // Round to nearest integer.
+	}
+}

+ 183 - 0
build/windows/universal/TemplateApp/Common/StepTimer.h

@@ -0,0 +1,183 @@
+#pragma once
+
+#include <wrl.h>
+
+namespace DX
+{
+	// Helper class for animation and simulation timing.
+	class StepTimer
+	{
+	public:
+		StepTimer() : 
+			m_elapsedTicks(0),
+			m_totalTicks(0),
+			m_leftOverTicks(0),
+			m_frameCount(0),
+			m_framesPerSecond(0),
+			m_framesThisSecond(0),
+			m_qpcSecondCounter(0),
+			m_isFixedTimeStep(false),
+			m_targetElapsedTicks(TicksPerSecond / 60)
+		{
+			if (!QueryPerformanceFrequency(&m_qpcFrequency))
+			{
+				throw ref new Platform::FailureException();
+			}
+
+			if (!QueryPerformanceCounter(&m_qpcLastTime))
+			{
+				throw ref new Platform::FailureException();
+			}
+
+			// Initialize max delta to 1/10 of a second.
+			m_qpcMaxDelta = m_qpcFrequency.QuadPart / 10;
+		}
+
+		// Get elapsed time since the previous Update call.
+		uint64 GetElapsedTicks() const						{ return m_elapsedTicks; }
+		double GetElapsedSeconds() const					{ return TicksToSeconds(m_elapsedTicks); }
+
+		// Get total time since the start of the program.
+		uint64 GetTotalTicks() const						{ return m_totalTicks; }
+		double GetTotalSeconds() const						{ return TicksToSeconds(m_totalTicks); }
+
+		// Get total number of updates since start of the program.
+		uint32 GetFrameCount() const						{ return m_frameCount; }
+
+		// Get the current framerate.
+		uint32 GetFramesPerSecond() const					{ return m_framesPerSecond; }
+
+		// Set whether to use fixed or variable timestep mode.
+		void SetFixedTimeStep(bool isFixedTimestep)			{ m_isFixedTimeStep = isFixedTimestep; }
+
+		// Set how often to call Update when in fixed timestep mode.
+		void SetTargetElapsedTicks(uint64 targetElapsed)	{ m_targetElapsedTicks = targetElapsed; }
+		void SetTargetElapsedSeconds(double targetElapsed)	{ m_targetElapsedTicks = SecondsToTicks(targetElapsed); }
+
+		// Integer format represents time using 10,000,000 ticks per second.
+		static const uint64 TicksPerSecond = 10000000;
+
+		static double TicksToSeconds(uint64 ticks)			{ return static_cast<double>(ticks) / TicksPerSecond; }
+		static uint64 SecondsToTicks(double seconds)		{ return static_cast<uint64>(seconds * TicksPerSecond); }
+
+		// After an intentional timing discontinuity (for instance a blocking IO operation)
+		// call this to avoid having the fixed timestep logic attempt a set of catch-up 
+		// Update calls.
+
+		void ResetElapsedTime()
+		{
+			if (!QueryPerformanceCounter(&m_qpcLastTime))
+			{
+				throw ref new Platform::FailureException();
+			}
+
+			m_leftOverTicks = 0;
+			m_framesPerSecond = 0;
+			m_framesThisSecond = 0;
+			m_qpcSecondCounter = 0;
+		}
+
+		// Update timer state, calling the specified Update function the appropriate number of times.
+		template<typename TUpdate>
+		void Tick(const TUpdate& update)
+		{
+			// Query the current time.
+			LARGE_INTEGER currentTime;
+
+			if (!QueryPerformanceCounter(&currentTime))
+			{
+				throw ref new Platform::FailureException();
+			}
+
+			uint64 timeDelta = currentTime.QuadPart - m_qpcLastTime.QuadPart;
+
+			m_qpcLastTime = currentTime;
+			m_qpcSecondCounter += timeDelta;
+
+			// Clamp excessively large time deltas (e.g. after paused in the debugger).
+			if (timeDelta > m_qpcMaxDelta)
+			{
+				timeDelta = m_qpcMaxDelta;
+			}
+
+			// Convert QPC units into a canonical tick format. This cannot overflow due to the previous clamp.
+			timeDelta *= TicksPerSecond;
+			timeDelta /= m_qpcFrequency.QuadPart;
+
+			uint32 lastFrameCount = m_frameCount;
+
+			if (m_isFixedTimeStep)
+			{
+				// Fixed timestep update logic
+
+				// If the app is running very close to the target elapsed time (within 1/4 of a millisecond) just clamp
+				// the clock to exactly match the target value. This prevents tiny and irrelevant errors
+				// from accumulating over time. Without this clamping, a game that requested a 60 fps
+				// fixed update, running with vsync enabled on a 59.94 NTSC display, would eventually
+				// accumulate enough tiny errors that it would drop a frame. It is better to just round 
+				// small deviations down to zero to leave things running smoothly.
+
+				if (abs(static_cast<int64>(timeDelta - m_targetElapsedTicks)) < TicksPerSecond / 4000)
+				{
+					timeDelta = m_targetElapsedTicks;
+				}
+
+				m_leftOverTicks += timeDelta;
+
+				while (m_leftOverTicks >= m_targetElapsedTicks)
+				{
+					m_elapsedTicks = m_targetElapsedTicks;
+					m_totalTicks += m_targetElapsedTicks;
+					m_leftOverTicks -= m_targetElapsedTicks;
+					m_frameCount++;
+
+					update();
+				}
+			}
+			else
+			{
+				// Variable timestep update logic.
+				m_elapsedTicks = timeDelta;
+				m_totalTicks += timeDelta;
+				m_leftOverTicks = 0;
+				m_frameCount++;
+
+				update();
+			}
+
+			// Track the current framerate.
+			if (m_frameCount != lastFrameCount)
+			{
+				m_framesThisSecond++;
+			}
+
+			if (m_qpcSecondCounter >= static_cast<uint64>(m_qpcFrequency.QuadPart))
+			{
+				m_framesPerSecond = m_framesThisSecond;
+				m_framesThisSecond = 0;
+				m_qpcSecondCounter %= m_qpcFrequency.QuadPart;
+			}
+		}
+
+	private:
+		// Source timing data uses QPC units.
+		LARGE_INTEGER m_qpcFrequency;
+		LARGE_INTEGER m_qpcLastTime;
+		uint64 m_qpcMaxDelta;
+
+		// Derived timing data uses a canonical tick format.
+		uint64 m_elapsedTicks;
+		uint64 m_totalTicks;
+		uint64 m_leftOverTicks;
+
+		// Members for tracking the framerate.
+		uint32 m_frameCount;
+		uint32 m_framesPerSecond;
+		uint32 m_framesThisSecond;
+		uint64 m_qpcSecondCounter;
+
+		// Members for configuring fixed timestep mode.
+		bool m_isFixedTimeStep;
+		uint64 m_targetElapsedTicks;
+	};
+}

+ 1478 - 0
build/windows/universal/TemplateApp/Common/d3dx12.h

@@ -0,0 +1,1478 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+//  Copyright (C) Microsoft Corporation.  All Rights Reserved.
+//
+//  File:       d3dx12.h
+//  Content:    D3DX12 utility library
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef __D3DX12_H__
+#define __D3DX12_H__
+
+#include "d3d12.h"
+
+#if defined( __cplusplus )
+
+struct CD3DX12_DEFAULT {};
+extern const DECLSPEC_SELECTANY CD3DX12_DEFAULT D3D12_DEFAULT;
+
+//------------------------------------------------------------------------------------------------
+inline bool operator==( const D3D12_VIEWPORT& l, const D3D12_VIEWPORT& r )
+{
+    return l.TopLeftX == r.TopLeftX && l.TopLeftY == r.TopLeftY && l.Width == r.Width &&
+        l.Height == r.Height && l.MinDepth == r.MinDepth && l.MaxDepth == r.MaxDepth;
+}
+
+//------------------------------------------------------------------------------------------------
+inline bool operator!=( const D3D12_VIEWPORT& l, const D3D12_VIEWPORT& r )
+{ return !( l == r ); }
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_RECT : public D3D12_RECT
+{
+    CD3DX12_RECT()
+    {}
+    explicit CD3DX12_RECT( const D3D12_RECT& o ) :
+        D3D12_RECT( o )
+    {}
+    explicit CD3DX12_RECT(
+        LONG Left,
+        LONG Top,
+        LONG Right,
+        LONG Bottom )
+    {
+        left = Left;
+        top = Top;
+        right = Right;
+        bottom = Bottom;
+    }
+    ~CD3DX12_RECT() {}
+    operator const D3D12_RECT&() const { return *this; }
+};
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_BOX : public D3D12_BOX
+{
+    CD3DX12_BOX()
+    {}
+    explicit CD3DX12_BOX( const D3D12_BOX& o ) :
+        D3D12_BOX( o )
+    {}
+    explicit CD3DX12_BOX(
+        LONG Left,
+        LONG Right )
+    {
+        left = Left;
+        top = 0;
+        front = 0;
+        right = Right;
+        bottom = 1;
+        back = 1;
+    }
+    explicit CD3DX12_BOX(
+        LONG Left,
+        LONG Top,
+        LONG Right,
+        LONG Bottom )
+    {
+        left = Left;
+        top = Top;
+        front = 0;
+        right = Right;
+        bottom = Bottom;
+        back = 1;
+    }
+    explicit CD3DX12_BOX(
+        LONG Left,
+        LONG Top,
+        LONG Front,
+        LONG Right,
+        LONG Bottom,
+        LONG Back )
+    {
+        left = Left;
+        top = Top;
+        front = Front;
+        right = Right;
+        bottom = Bottom;
+        back = Back;
+    }
+    ~CD3DX12_BOX() {}
+    operator const D3D12_BOX&() const { return *this; }
+};
+inline bool operator==( const D3D12_BOX& l, const D3D12_BOX& r )
+{
+    return l.left == r.left && l.top == r.top && l.front == r.front &&
+        l.right == r.right && l.bottom == r.bottom && l.back == r.back;
+}
+inline bool operator!=( const D3D12_BOX& l, const D3D12_BOX& r )
+{ return !( l == r ); }
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_DEPTH_STENCIL_DESC : public D3D12_DEPTH_STENCIL_DESC
+{
+    CD3DX12_DEPTH_STENCIL_DESC()
+    {}
+    explicit CD3DX12_DEPTH_STENCIL_DESC( const D3D12_DEPTH_STENCIL_DESC& o ) :
+        D3D12_DEPTH_STENCIL_DESC( o )
+    {}
+    explicit CD3DX12_DEPTH_STENCIL_DESC( CD3DX12_DEFAULT )
+    {
+        DepthEnable = TRUE;
+        DepthWriteMask = D3D12_DEPTH_WRITE_MASK_ALL;
+        DepthFunc = D3D12_COMPARISON_FUNC_LESS;
+        StencilEnable = FALSE;
+        StencilReadMask = D3D12_DEFAULT_STENCIL_READ_MASK;
+        StencilWriteMask = D3D12_DEFAULT_STENCIL_WRITE_MASK;
+        const D3D12_DEPTH_STENCILOP_DESC defaultStencilOp =
+        { D3D12_STENCIL_OP_KEEP, D3D12_STENCIL_OP_KEEP, D3D12_STENCIL_OP_KEEP, D3D12_COMPARISON_FUNC_ALWAYS };
+        FrontFace = defaultStencilOp;
+        BackFace = defaultStencilOp;
+    }
+    explicit CD3DX12_DEPTH_STENCIL_DESC(
+        BOOL depthEnable,
+        D3D12_DEPTH_WRITE_MASK depthWriteMask,
+        D3D12_COMPARISON_FUNC depthFunc,
+        BOOL stencilEnable,
+        UINT8 stencilReadMask,
+        UINT8 stencilWriteMask,
+        D3D12_STENCIL_OP frontStencilFailOp,
+        D3D12_STENCIL_OP frontStencilDepthFailOp,
+        D3D12_STENCIL_OP frontStencilPassOp,
+        D3D12_COMPARISON_FUNC frontStencilFunc,
+        D3D12_STENCIL_OP backStencilFailOp,
+        D3D12_STENCIL_OP backStencilDepthFailOp,
+        D3D12_STENCIL_OP backStencilPassOp,
+        D3D12_COMPARISON_FUNC backStencilFunc )
+    {
+        DepthEnable = depthEnable;
+        DepthWriteMask = depthWriteMask;
+        DepthFunc = depthFunc;
+        StencilEnable = stencilEnable;
+        StencilReadMask = stencilReadMask;
+        StencilWriteMask = stencilWriteMask;
+        FrontFace.StencilFailOp = frontStencilFailOp;
+        FrontFace.StencilDepthFailOp = frontStencilDepthFailOp;
+        FrontFace.StencilPassOp = frontStencilPassOp;
+        FrontFace.StencilFunc = frontStencilFunc;
+        BackFace.StencilFailOp = backStencilFailOp;
+        BackFace.StencilDepthFailOp = backStencilDepthFailOp;
+        BackFace.StencilPassOp = backStencilPassOp;
+        BackFace.StencilFunc = backStencilFunc;
+    }
+    ~CD3DX12_DEPTH_STENCIL_DESC() {}
+    operator const D3D12_DEPTH_STENCIL_DESC&() const { return *this; }
+};
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_BLEND_DESC : public D3D12_BLEND_DESC
+{
+    CD3DX12_BLEND_DESC()
+    {}
+    explicit CD3DX12_BLEND_DESC( const D3D12_BLEND_DESC& o ) :
+        D3D12_BLEND_DESC( o )
+    {}
+    explicit CD3DX12_BLEND_DESC( CD3DX12_DEFAULT )
+    {
+        AlphaToCoverageEnable = FALSE;
+        IndependentBlendEnable = FALSE;
+        const D3D12_RENDER_TARGET_BLEND_DESC defaultRenderTargetBlendDesc =
+        {
+            FALSE,FALSE,
+            D3D12_BLEND_ONE, D3D12_BLEND_ZERO, D3D12_BLEND_OP_ADD,
+            D3D12_BLEND_ONE, D3D12_BLEND_ZERO, D3D12_BLEND_OP_ADD,
+            D3D12_LOGIC_OP_NOOP,
+            D3D12_COLOR_WRITE_ENABLE_ALL,
+        };
+        for (UINT i = 0; i < D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i)
+            RenderTarget[ i ] = defaultRenderTargetBlendDesc;
+    }
+    ~CD3DX12_BLEND_DESC() {}
+    operator const D3D12_BLEND_DESC&() const { return *this; }
+};
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_RASTERIZER_DESC : public D3D12_RASTERIZER_DESC
+{
+    CD3DX12_RASTERIZER_DESC()
+    {}
+    explicit CD3DX12_RASTERIZER_DESC( const D3D12_RASTERIZER_DESC& o ) :
+        D3D12_RASTERIZER_DESC( o )
+    {}
+    explicit CD3DX12_RASTERIZER_DESC( CD3DX12_DEFAULT )
+    {
+        FillMode = D3D12_FILL_MODE_SOLID;
+        CullMode = D3D12_CULL_MODE_BACK;
+        FrontCounterClockwise = FALSE;
+        DepthBias = D3D12_DEFAULT_DEPTH_BIAS;
+        DepthBiasClamp = D3D12_DEFAULT_DEPTH_BIAS_CLAMP;
+        SlopeScaledDepthBias = D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS;
+        DepthClipEnable = TRUE;
+        MultisampleEnable = FALSE;
+        AntialiasedLineEnable = FALSE;
+        ForcedSampleCount = 0;
+        ConservativeRaster = D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF;
+    }
+    explicit CD3DX12_RASTERIZER_DESC(
+        D3D12_FILL_MODE fillMode,
+        D3D12_CULL_MODE cullMode,
+        BOOL frontCounterClockwise,
+        INT depthBias,
+        FLOAT depthBiasClamp,
+        FLOAT slopeScaledDepthBias,
+        BOOL depthClipEnable,
+        BOOL multisampleEnable,
+        BOOL antialiasedLineEnable, 
+        UINT forcedSampleCount, 
+        D3D12_CONSERVATIVE_RASTERIZATION_MODE conservativeRaster)
+    {
+        FillMode = fillMode;
+        CullMode = cullMode;
+        FrontCounterClockwise = frontCounterClockwise;
+        DepthBias = depthBias;
+        DepthBiasClamp = depthBiasClamp;
+        SlopeScaledDepthBias = slopeScaledDepthBias;
+        DepthClipEnable = depthClipEnable;
+        MultisampleEnable = multisampleEnable;
+        AntialiasedLineEnable = antialiasedLineEnable;
+        ForcedSampleCount = forcedSampleCount;
+        ConservativeRaster = conservativeRaster;
+    }
+    ~CD3DX12_RASTERIZER_DESC() {}
+    operator const D3D12_RASTERIZER_DESC&() const { return *this; }
+};
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_RESOURCE_ALLOCATION_INFO : public D3D12_RESOURCE_ALLOCATION_INFO
+{
+    CD3DX12_RESOURCE_ALLOCATION_INFO()
+    {}
+    explicit CD3DX12_RESOURCE_ALLOCATION_INFO( const D3D12_RESOURCE_ALLOCATION_INFO& o ) :
+        D3D12_RESOURCE_ALLOCATION_INFO( o )
+    {}
+    CD3DX12_RESOURCE_ALLOCATION_INFO(
+        UINT64 size,
+        UINT64 alignment )
+    {
+        SizeInBytes = size;
+        Alignment = alignment;
+    }
+    operator const D3D12_RESOURCE_ALLOCATION_INFO&() const { return *this; }
+};
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_HEAP_PROPERTIES : public D3D12_HEAP_PROPERTIES
+{
+    CD3DX12_HEAP_PROPERTIES()
+    {}
+    explicit CD3DX12_HEAP_PROPERTIES(const D3D12_HEAP_PROPERTIES &o) :
+        D3D12_HEAP_PROPERTIES(o)
+    {}
+    CD3DX12_HEAP_PROPERTIES( 
+        D3D12_CPU_PAGE_PROPERTY cpuPageProperty, 
+        D3D12_MEMORY_POOL memoryPoolPreference,
+        UINT creationNodeMask = 1, 
+        UINT nodeMask = 1 )
+    {
+        Type = D3D12_HEAP_TYPE_CUSTOM;
+        CPUPageProperty = cpuPageProperty;
+        MemoryPoolPreference = memoryPoolPreference;
+        CreationNodeMask = creationNodeMask;
+        VisibleNodeMask = nodeMask;
+    }
+    explicit CD3DX12_HEAP_PROPERTIES( 
+        D3D12_HEAP_TYPE type, 
+        UINT creationNodeMask = 1, 
+        UINT nodeMask = 1 )
+    {
+        Type = type;
+        CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN;
+        MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN;
+        CreationNodeMask = creationNodeMask;
+        VisibleNodeMask = nodeMask;
+    }
+    operator const D3D12_HEAP_PROPERTIES&() const { return *this; }
+    bool IsCPUAccessible() const
+    {
+        return Type == D3D12_HEAP_TYPE_UPLOAD || Type == D3D12_HEAP_TYPE_READBACK || (Type == D3D12_HEAP_TYPE_CUSTOM &&
+            (CPUPageProperty == D3D12_CPU_PAGE_PROPERTY_WRITE_COMBINE || CPUPageProperty == D3D12_CPU_PAGE_PROPERTY_WRITE_BACK));
+    }
+};
+inline bool operator==( const D3D12_HEAP_PROPERTIES& l, const D3D12_HEAP_PROPERTIES& r )
+{
+    return l.Type == r.Type && l.CPUPageProperty == r.CPUPageProperty && 
+        l.MemoryPoolPreference == r.MemoryPoolPreference &&
+        l.CreationNodeMask == r.CreationNodeMask &&
+        l.VisibleNodeMask == r.VisibleNodeMask;
+}
+inline bool operator!=( const D3D12_HEAP_PROPERTIES& l, const D3D12_HEAP_PROPERTIES& r )
+{ return !( l == r ); }
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_HEAP_DESC : public D3D12_HEAP_DESC
+{
+    CD3DX12_HEAP_DESC()
+    {}
+    explicit CD3DX12_HEAP_DESC(const D3D12_HEAP_DESC &o) :
+        D3D12_HEAP_DESC(o)
+    {}
+    CD3DX12_HEAP_DESC( 
+        UINT64 size, 
+        D3D12_HEAP_PROPERTIES properties, 
+        UINT64 alignment = 0, 
+        D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE )
+    {
+        SizeInBytes = size;
+        Properties = properties;
+        Alignment = alignment;
+        Flags = flags;
+    }
+    CD3DX12_HEAP_DESC( 
+        UINT64 size, 
+        D3D12_HEAP_TYPE type, 
+        UINT64 alignment = 0, 
+        D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE )
+    {
+        SizeInBytes = size;
+        Properties = CD3DX12_HEAP_PROPERTIES( type );
+        Alignment = alignment;
+        Flags = flags;
+    }
+    CD3DX12_HEAP_DESC( 
+        UINT64 size, 
+        D3D12_CPU_PAGE_PROPERTY cpuPageProperty, 
+        D3D12_MEMORY_POOL memoryPoolPreference, 
+        UINT64 alignment = 0, 
+        D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE )
+    {
+        SizeInBytes = size;
+        Properties = CD3DX12_HEAP_PROPERTIES( cpuPageProperty, memoryPoolPreference );
+        Alignment = alignment;
+        Flags = flags;
+    }
+    CD3DX12_HEAP_DESC( 
+        const D3D12_RESOURCE_ALLOCATION_INFO& resAllocInfo,
+        D3D12_HEAP_PROPERTIES properties, 
+        D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE )
+    {
+        SizeInBytes = resAllocInfo.SizeInBytes;
+        Properties = properties;
+        Alignment = resAllocInfo.Alignment;
+        Flags = flags;
+    }
+    CD3DX12_HEAP_DESC( 
+        const D3D12_RESOURCE_ALLOCATION_INFO& resAllocInfo,
+        D3D12_HEAP_TYPE type, 
+        D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE )
+    {
+        SizeInBytes = resAllocInfo.SizeInBytes;
+        Properties = CD3DX12_HEAP_PROPERTIES( type );
+        Alignment = resAllocInfo.Alignment;
+        Flags = flags;
+    }
+    CD3DX12_HEAP_DESC( 
+        const D3D12_RESOURCE_ALLOCATION_INFO& resAllocInfo,
+        D3D12_CPU_PAGE_PROPERTY cpuPageProperty, 
+        D3D12_MEMORY_POOL memoryPoolPreference, 
+        D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE )
+    {
+        SizeInBytes = resAllocInfo.SizeInBytes;
+        Properties = CD3DX12_HEAP_PROPERTIES( cpuPageProperty, memoryPoolPreference );
+        Alignment = resAllocInfo.Alignment;
+        Flags = flags;
+    }
+    operator const D3D12_HEAP_DESC&() const { return *this; }
+    bool IsCPUAccessible() const
+    { return static_cast< const CD3DX12_HEAP_PROPERTIES* >( &Properties )->IsCPUAccessible(); }
+};
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_CLEAR_VALUE : public D3D12_CLEAR_VALUE
+{
+    CD3DX12_CLEAR_VALUE()
+    {}
+    explicit CD3DX12_CLEAR_VALUE(const D3D12_CLEAR_VALUE &o) :
+        D3D12_CLEAR_VALUE(o)
+    {}
+    CD3DX12_CLEAR_VALUE( 
+        DXGI_FORMAT format, 
+        const FLOAT color[4] )
+    {
+        Format = format;
+        memcpy( Color, color, sizeof( Color ) );
+    }
+    CD3DX12_CLEAR_VALUE( 
+        DXGI_FORMAT format, 
+        FLOAT depth,
+        UINT8 stencil )
+    {
+        Format = format;
+        /* Use memcpy to preserve NAN values */
+        memcpy( &DepthStencil.Depth, &depth, sizeof( depth ) );
+        DepthStencil.Stencil = stencil;
+    }
+    operator const D3D12_CLEAR_VALUE&() const { return *this; }
+};
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_RANGE : public D3D12_RANGE
+{
+    CD3DX12_RANGE()
+    {}
+    explicit CD3DX12_RANGE(const D3D12_RANGE &o) :
+        D3D12_RANGE(o)
+    {}
+    CD3DX12_RANGE( 
+        SIZE_T begin, 
+        SIZE_T end )
+    {
+        Begin = begin;
+        End = end;
+    }
+    operator const D3D12_RANGE&() const { return *this; }
+};
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_TILED_RESOURCE_COORDINATE : public D3D12_TILED_RESOURCE_COORDINATE
+{
+    CD3DX12_TILED_RESOURCE_COORDINATE()
+    {}
+    explicit CD3DX12_TILED_RESOURCE_COORDINATE(const D3D12_TILED_RESOURCE_COORDINATE &o) :
+        D3D12_TILED_RESOURCE_COORDINATE(o)
+    {}
+    CD3DX12_TILED_RESOURCE_COORDINATE( 
+        UINT x, 
+        UINT y, 
+        UINT z, 
+        UINT subresource ) 
+    {
+        X = x;
+        Y = y;
+        Z = z;
+        Subresource = subresource;
+    }
+    operator const D3D12_TILED_RESOURCE_COORDINATE&() const { return *this; }
+};
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_TILE_REGION_SIZE : public D3D12_TILE_REGION_SIZE
+{
+    CD3DX12_TILE_REGION_SIZE()
+    {}
+    explicit CD3DX12_TILE_REGION_SIZE(const D3D12_TILE_REGION_SIZE &o) :
+        D3D12_TILE_REGION_SIZE(o)
+    {}
+    CD3DX12_TILE_REGION_SIZE( 
+        UINT numTiles, 
+        BOOL useBox, 
+        UINT width, 
+        UINT16 height, 
+        UINT16 depth ) 
+    {
+        NumTiles = numTiles;
+        UseBox = useBox;
+        Width = width;
+        Height = height;
+        Depth = depth;
+    }
+    operator const D3D12_TILE_REGION_SIZE&() const { return *this; }
+};
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_SUBRESOURCE_TILING : public D3D12_SUBRESOURCE_TILING
+{
+    CD3DX12_SUBRESOURCE_TILING()
+    {}
+    explicit CD3DX12_SUBRESOURCE_TILING(const D3D12_SUBRESOURCE_TILING &o) :
+        D3D12_SUBRESOURCE_TILING(o)
+    {}
+    CD3DX12_SUBRESOURCE_TILING( 
+        UINT widthInTiles, 
+        UINT16 heightInTiles, 
+        UINT16 depthInTiles, 
+        UINT startTileIndexInOverallResource ) 
+    {
+        WidthInTiles = widthInTiles;
+        HeightInTiles = heightInTiles;
+        DepthInTiles = depthInTiles;
+        StartTileIndexInOverallResource = startTileIndexInOverallResource;
+    }
+    operator const D3D12_SUBRESOURCE_TILING&() const { return *this; }
+};
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_TILE_SHAPE : public D3D12_TILE_SHAPE
+{
+    CD3DX12_TILE_SHAPE()
+    {}
+    explicit CD3DX12_TILE_SHAPE(const D3D12_TILE_SHAPE &o) :
+        D3D12_TILE_SHAPE(o)
+    {}
+    CD3DX12_TILE_SHAPE( 
+        UINT widthInTexels, 
+        UINT heightInTexels, 
+        UINT depthInTexels ) 
+    {
+        WidthInTexels = widthInTexels;
+        HeightInTexels = heightInTexels;
+        DepthInTexels = depthInTexels;
+    }
+    operator const D3D12_TILE_SHAPE&() const { return *this; }
+};
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_RESOURCE_BARRIER : public D3D12_RESOURCE_BARRIER
+{
+    CD3DX12_RESOURCE_BARRIER()
+    {}
+    explicit CD3DX12_RESOURCE_BARRIER(const D3D12_RESOURCE_BARRIER &o) :
+        D3D12_RESOURCE_BARRIER(o)
+    {}
+    static inline CD3DX12_RESOURCE_BARRIER Transition(
+        _In_ ID3D12Resource* pResource,
+        D3D12_RESOURCE_STATES stateBefore,
+        D3D12_RESOURCE_STATES stateAfter,
+        UINT subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES,
+        D3D12_RESOURCE_BARRIER_FLAGS flags = D3D12_RESOURCE_BARRIER_FLAG_NONE)
+    {
+        CD3DX12_RESOURCE_BARRIER result = {};
+        D3D12_RESOURCE_BARRIER &barrier = result;
+        result.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
+        result.Flags = flags;
+        barrier.Transition.pResource = pResource;
+        barrier.Transition.StateBefore = stateBefore;
+        barrier.Transition.StateAfter = stateAfter;
+        barrier.Transition.Subresource = subresource;
+        return result;
+    }
+    static inline CD3DX12_RESOURCE_BARRIER Aliasing(
+        _In_ ID3D12Resource* pResourceBefore,
+        _In_ ID3D12Resource* pResourceAfter)
+    {
+        CD3DX12_RESOURCE_BARRIER result = {};
+        D3D12_RESOURCE_BARRIER &barrier = result;
+        result.Type = D3D12_RESOURCE_BARRIER_TYPE_ALIASING;
+        barrier.Aliasing.pResourceBefore = pResourceBefore;
+        barrier.Aliasing.pResourceAfter = pResourceAfter;
+        return result;
+    }
+    static inline CD3DX12_RESOURCE_BARRIER UAV(
+        _In_ ID3D12Resource* pResource)
+    {
+        CD3DX12_RESOURCE_BARRIER result = {};
+        D3D12_RESOURCE_BARRIER &barrier = result;
+        result.Type = D3D12_RESOURCE_BARRIER_TYPE_UAV;
+        barrier.UAV.pResource = pResource;
+        return result;
+    }
+    operator const D3D12_RESOURCE_BARRIER&() const { return *this; }
+};
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_PACKED_MIP_INFO : public D3D12_PACKED_MIP_INFO
+{
+    CD3DX12_PACKED_MIP_INFO()
+    {}
+    explicit CD3DX12_PACKED_MIP_INFO(const D3D12_PACKED_MIP_INFO &o) :
+        D3D12_PACKED_MIP_INFO(o)
+    {}
+    CD3DX12_PACKED_MIP_INFO( 
+        UINT8 numStandardMips, 
+        UINT8 numPackedMips, 
+        UINT numTilesForPackedMips, 
+        UINT startTileIndexInOverallResource ) 
+    {
+        NumStandardMips = numStandardMips;
+        NumPackedMips = numPackedMips;
+        NumTilesForPackedMips = numTilesForPackedMips;
+        StartTileIndexInOverallResource = startTileIndexInOverallResource;
+    }
+    operator const D3D12_PACKED_MIP_INFO&() const { return *this; }
+};
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_SUBRESOURCE_FOOTPRINT : public D3D12_SUBRESOURCE_FOOTPRINT
+{
+    CD3DX12_SUBRESOURCE_FOOTPRINT()
+    {}
+    explicit CD3DX12_SUBRESOURCE_FOOTPRINT(const D3D12_SUBRESOURCE_FOOTPRINT &o) :
+        D3D12_SUBRESOURCE_FOOTPRINT(o)
+    {}
+    CD3DX12_SUBRESOURCE_FOOTPRINT( 
+        DXGI_FORMAT format, 
+        UINT width, 
+        UINT height, 
+        UINT depth, 
+        UINT rowPitch ) 
+    {
+        Format = format;
+        Width = width;
+        Height = height;
+        Depth = depth;
+        RowPitch = rowPitch;
+    }
+    explicit CD3DX12_SUBRESOURCE_FOOTPRINT( 
+        const D3D12_RESOURCE_DESC& resDesc, 
+        UINT rowPitch ) 
+    {
+        Format = resDesc.Format;
+        Width = UINT( resDesc.Width );
+        Height = resDesc.Height;
+        Depth = (resDesc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D ? resDesc.DepthOrArraySize : 1);
+        RowPitch = rowPitch;
+    }
+    operator const D3D12_SUBRESOURCE_FOOTPRINT&() const { return *this; }
+};
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_TEXTURE_COPY_LOCATION : public D3D12_TEXTURE_COPY_LOCATION
+{ 
+    CD3DX12_TEXTURE_COPY_LOCATION()
+    {}
+    explicit CD3DX12_TEXTURE_COPY_LOCATION(const D3D12_TEXTURE_COPY_LOCATION &o) :
+        D3D12_TEXTURE_COPY_LOCATION(o)
+    {}
+    CD3DX12_TEXTURE_COPY_LOCATION(ID3D12Resource* pRes) { pResource = pRes; }
+    CD3DX12_TEXTURE_COPY_LOCATION(ID3D12Resource* pRes, D3D12_PLACED_SUBRESOURCE_FOOTPRINT const& Footprint)
+    {
+        pResource = pRes;
+        Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT;
+        PlacedFootprint = Footprint;
+    }
+    CD3DX12_TEXTURE_COPY_LOCATION(ID3D12Resource* pRes, UINT Sub)
+    {
+        pResource = pRes;
+        Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
+        SubresourceIndex = Sub;
+    }
+}; 
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_DESCRIPTOR_RANGE : public D3D12_DESCRIPTOR_RANGE
+{
+    CD3DX12_DESCRIPTOR_RANGE() { }
+    explicit CD3DX12_DESCRIPTOR_RANGE(const D3D12_DESCRIPTOR_RANGE &o) :
+        D3D12_DESCRIPTOR_RANGE(o)
+    {}
+    CD3DX12_DESCRIPTOR_RANGE(
+        D3D12_DESCRIPTOR_RANGE_TYPE rangeType,
+        UINT numDescriptors,
+        UINT baseShaderRegister,
+        UINT registerSpace = 0,
+        UINT offsetInDescriptorsFromTableStart =
+        D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND)
+    {
+        Init(rangeType, numDescriptors, baseShaderRegister, registerSpace, offsetInDescriptorsFromTableStart);
+    }
+    
+    inline void Init(
+        D3D12_DESCRIPTOR_RANGE_TYPE rangeType,
+        UINT numDescriptors,
+        UINT baseShaderRegister,
+        UINT registerSpace = 0,
+        UINT offsetInDescriptorsFromTableStart =
+        D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND)
+    {
+        Init(*this, rangeType, numDescriptors, baseShaderRegister, registerSpace, offsetInDescriptorsFromTableStart);
+    }
+    
+    static inline void Init(
+        _Out_ D3D12_DESCRIPTOR_RANGE &range,
+        D3D12_DESCRIPTOR_RANGE_TYPE rangeType,
+        UINT numDescriptors,
+        UINT baseShaderRegister,
+        UINT registerSpace = 0,
+        UINT offsetInDescriptorsFromTableStart =
+        D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND)
+    {
+        range.RangeType = rangeType;
+        range.NumDescriptors = numDescriptors;
+        range.BaseShaderRegister = baseShaderRegister;
+        range.RegisterSpace = registerSpace;
+        range.OffsetInDescriptorsFromTableStart = offsetInDescriptorsFromTableStart;
+    }
+};
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_ROOT_DESCRIPTOR_TABLE : public D3D12_ROOT_DESCRIPTOR_TABLE
+{
+    CD3DX12_ROOT_DESCRIPTOR_TABLE() {}
+    explicit CD3DX12_ROOT_DESCRIPTOR_TABLE(const D3D12_ROOT_DESCRIPTOR_TABLE &o) :
+        D3D12_ROOT_DESCRIPTOR_TABLE(o)
+    {}
+    CD3DX12_ROOT_DESCRIPTOR_TABLE(
+        UINT numDescriptorRanges,
+        _In_reads_opt_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* _pDescriptorRanges)
+    {
+        Init(numDescriptorRanges, _pDescriptorRanges);
+    }
+    
+    inline void Init(
+        UINT numDescriptorRanges,
+        _In_reads_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* _pDescriptorRanges)
+    {
+        Init(*this, numDescriptorRanges, _pDescriptorRanges);
+    }
+    
+    static inline void Init(
+        _Out_ D3D12_ROOT_DESCRIPTOR_TABLE &rootDescriptorTable,
+        UINT numDescriptorRanges,
+        _In_reads_opt_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* _pDescriptorRanges)
+    {
+        rootDescriptorTable.NumDescriptorRanges = numDescriptorRanges;
+        rootDescriptorTable.pDescriptorRanges = _pDescriptorRanges;
+    }
+};
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_ROOT_CONSTANTS : public D3D12_ROOT_CONSTANTS
+{
+    CD3DX12_ROOT_CONSTANTS() {}
+    explicit CD3DX12_ROOT_CONSTANTS(const D3D12_ROOT_CONSTANTS &o) :
+        D3D12_ROOT_CONSTANTS(o)
+    {}
+    CD3DX12_ROOT_CONSTANTS(
+        UINT num32BitValues,
+        UINT shaderRegister,
+        UINT registerSpace = 0)
+    {
+        Init(num32BitValues, shaderRegister, registerSpace);
+    }
+    
+    inline void Init(
+        UINT num32BitValues,
+        UINT shaderRegister,
+        UINT registerSpace = 0)
+    {
+        Init(*this, num32BitValues, shaderRegister, registerSpace);
+    }
+    
+    static inline void Init(
+        _Out_ D3D12_ROOT_CONSTANTS &rootConstants,
+        UINT num32BitValues,
+        UINT shaderRegister,
+        UINT registerSpace = 0)
+    {
+        rootConstants.Num32BitValues = num32BitValues;
+        rootConstants.ShaderRegister = shaderRegister;
+        rootConstants.RegisterSpace = registerSpace;
+    }
+};
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_ROOT_DESCRIPTOR : public D3D12_ROOT_DESCRIPTOR
+{
+    CD3DX12_ROOT_DESCRIPTOR() {}
+    explicit CD3DX12_ROOT_DESCRIPTOR(const D3D12_ROOT_DESCRIPTOR &o) :
+        D3D12_ROOT_DESCRIPTOR(o)
+    {}
+    CD3DX12_ROOT_DESCRIPTOR(
+        UINT shaderRegister,
+        UINT registerSpace = 0)
+    {
+        Init(shaderRegister, registerSpace);
+    }
+    
+    inline void Init(
+        UINT shaderRegister,
+        UINT registerSpace = 0)
+    {
+        Init(*this, shaderRegister, registerSpace);
+    }
+    
+    static inline void Init(_Out_ D3D12_ROOT_DESCRIPTOR &table, UINT shaderRegister, UINT registerSpace = 0)
+    {
+        table.ShaderRegister = shaderRegister;
+        table.RegisterSpace = registerSpace;
+    }
+};
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_ROOT_PARAMETER : public D3D12_ROOT_PARAMETER
+{
+    CD3DX12_ROOT_PARAMETER() {}
+    explicit CD3DX12_ROOT_PARAMETER(const D3D12_ROOT_PARAMETER &o) :
+        D3D12_ROOT_PARAMETER(o)
+    {}
+    
+    static inline void InitAsDescriptorTable(
+        _Out_ D3D12_ROOT_PARAMETER &rootParam,
+        UINT numDescriptorRanges,
+        _In_reads_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* pDescriptorRanges,
+        D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL)
+    {
+        rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
+        rootParam.ShaderVisibility = visibility;
+        CD3DX12_ROOT_DESCRIPTOR_TABLE::Init(rootParam.DescriptorTable, numDescriptorRanges, pDescriptorRanges);
+    }
+
+    static inline void InitAsConstants(
+        _Out_ D3D12_ROOT_PARAMETER &rootParam,
+        UINT num32BitValues,
+        UINT shaderRegister,
+        UINT registerSpace = 0,
+        D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL)
+    {
+        rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS;
+        rootParam.ShaderVisibility = visibility;
+        CD3DX12_ROOT_CONSTANTS::Init(rootParam.Constants, num32BitValues, shaderRegister, registerSpace);
+    }
+
+    static inline void InitAsConstantBufferView(
+        _Out_ D3D12_ROOT_PARAMETER &rootParam,
+        UINT shaderRegister,
+        UINT registerSpace = 0,
+        D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL)
+    {
+        rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV;
+        rootParam.ShaderVisibility = visibility;
+        CD3DX12_ROOT_DESCRIPTOR::Init(rootParam.Descriptor, shaderRegister, registerSpace);
+    }
+
+    static inline void InitAsShaderResourceView(
+        _Out_ D3D12_ROOT_PARAMETER &rootParam,
+        UINT shaderRegister,
+        UINT registerSpace = 0,
+        D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL)
+    {
+        rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_SRV;
+        rootParam.ShaderVisibility = visibility;
+        CD3DX12_ROOT_DESCRIPTOR::Init(rootParam.Descriptor, shaderRegister, registerSpace);
+    }
+
+    static inline void InitAsUnorderedAccessView(
+        _Out_ D3D12_ROOT_PARAMETER &rootParam,
+        UINT shaderRegister,
+        UINT registerSpace = 0,
+        D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL)
+    {
+        rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_UAV;
+        rootParam.ShaderVisibility = visibility;
+        CD3DX12_ROOT_DESCRIPTOR::Init(rootParam.Descriptor, shaderRegister, registerSpace);
+    }
+    
+    inline void InitAsDescriptorTable(
+        UINT numDescriptorRanges,
+        _In_reads_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* pDescriptorRanges,
+        D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL)
+    {
+        InitAsDescriptorTable(*this, numDescriptorRanges, pDescriptorRanges, visibility);
+    }
+    
+    inline void InitAsConstants(
+        UINT num32BitValues,
+        UINT shaderRegister,
+        UINT registerSpace = 0,
+        D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL)
+    {
+        InitAsConstants(*this, num32BitValues, shaderRegister, registerSpace, visibility);
+    }
+
+    inline void InitAsConstantBufferView(
+        UINT shaderRegister,
+        UINT registerSpace = 0,
+        D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL)
+    {
+        InitAsConstantBufferView(*this, shaderRegister, registerSpace, visibility);
+    }
+
+    inline void InitAsShaderResourceView(
+        UINT shaderRegister,
+        UINT registerSpace = 0,
+        D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL)
+    {
+        InitAsShaderResourceView(*this, shaderRegister, registerSpace, visibility);
+    }
+
+    inline void InitAsUnorderedAccessView(
+        UINT shaderRegister,
+        UINT registerSpace = 0,
+        D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL)
+    {
+        InitAsUnorderedAccessView(*this, shaderRegister, registerSpace, visibility);
+    }
+};
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_STATIC_SAMPLER_DESC : public D3D12_STATIC_SAMPLER_DESC
+{
+    CD3DX12_STATIC_SAMPLER_DESC() {}
+    explicit CD3DX12_STATIC_SAMPLER_DESC(const D3D12_STATIC_SAMPLER_DESC &o) :
+        D3D12_STATIC_SAMPLER_DESC(o)
+    {}
+    CD3DX12_STATIC_SAMPLER_DESC(
+         UINT shaderRegister,
+         D3D12_FILTER filter = D3D12_FILTER_ANISOTROPIC,
+         D3D12_TEXTURE_ADDRESS_MODE addressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP,
+         D3D12_TEXTURE_ADDRESS_MODE addressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP,
+         D3D12_TEXTURE_ADDRESS_MODE addressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP,
+         FLOAT mipLODBias = 0,
+         UINT maxAnisotropy = 16,
+         D3D12_COMPARISON_FUNC comparisonFunc = D3D12_COMPARISON_FUNC_LESS_EQUAL,
+         D3D12_STATIC_BORDER_COLOR borderColor = D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE,
+         FLOAT minLOD = 0.f,
+         FLOAT maxLOD = D3D12_FLOAT32_MAX,
+         D3D12_SHADER_VISIBILITY shaderVisibility = D3D12_SHADER_VISIBILITY_ALL, 
+         UINT registerSpace = 0)
+    {
+        Init(
+            shaderRegister,
+            filter,
+            addressU,
+            addressV,
+            addressW,
+            mipLODBias,
+            maxAnisotropy,
+            comparisonFunc,
+            borderColor,
+            minLOD,
+            maxLOD,
+            shaderVisibility,
+            registerSpace);
+    }
+    
+    static inline void Init(
+        _Out_ D3D12_STATIC_SAMPLER_DESC &samplerDesc,
+         UINT shaderRegister,
+         D3D12_FILTER filter = D3D12_FILTER_ANISOTROPIC,
+         D3D12_TEXTURE_ADDRESS_MODE addressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP,
+         D3D12_TEXTURE_ADDRESS_MODE addressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP,
+         D3D12_TEXTURE_ADDRESS_MODE addressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP,
+         FLOAT mipLODBias = 0,
+         UINT maxAnisotropy = 16,
+         D3D12_COMPARISON_FUNC comparisonFunc = D3D12_COMPARISON_FUNC_LESS_EQUAL,
+         D3D12_STATIC_BORDER_COLOR borderColor = D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE,
+         FLOAT minLOD = 0.f,
+         FLOAT maxLOD = D3D12_FLOAT32_MAX,
+         D3D12_SHADER_VISIBILITY shaderVisibility = D3D12_SHADER_VISIBILITY_ALL, 
+         UINT registerSpace = 0)
+    {
+        samplerDesc.ShaderRegister = shaderRegister;
+        samplerDesc.Filter = filter;
+        samplerDesc.AddressU = addressU;
+        samplerDesc.AddressV = addressV;
+        samplerDesc.AddressW = addressW;
+        samplerDesc.MipLODBias = mipLODBias;
+        samplerDesc.MaxAnisotropy = maxAnisotropy;
+        samplerDesc.ComparisonFunc = comparisonFunc;
+        samplerDesc.BorderColor = borderColor;
+        samplerDesc.MinLOD = minLOD;
+        samplerDesc.MaxLOD = maxLOD;
+        samplerDesc.ShaderVisibility = shaderVisibility;
+        samplerDesc.RegisterSpace = registerSpace;
+    }
+    inline void Init(
+         UINT shaderRegister,
+         D3D12_FILTER filter = D3D12_FILTER_ANISOTROPIC,
+         D3D12_TEXTURE_ADDRESS_MODE addressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP,
+         D3D12_TEXTURE_ADDRESS_MODE addressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP,
+         D3D12_TEXTURE_ADDRESS_MODE addressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP,
+         FLOAT mipLODBias = 0,
+         UINT maxAnisotropy = 16,
+         D3D12_COMPARISON_FUNC comparisonFunc = D3D12_COMPARISON_FUNC_LESS_EQUAL,
+         D3D12_STATIC_BORDER_COLOR borderColor = D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE,
+         FLOAT minLOD = 0.f,
+         FLOAT maxLOD = D3D12_FLOAT32_MAX,
+         D3D12_SHADER_VISIBILITY shaderVisibility = D3D12_SHADER_VISIBILITY_ALL, 
+         UINT registerSpace = 0)
+    {
+        Init(
+            *this,
+            shaderRegister,
+            filter,
+            addressU,
+            addressV,
+            addressW,
+            mipLODBias,
+            maxAnisotropy,
+            comparisonFunc,
+            borderColor,
+            minLOD,
+            maxLOD,
+            shaderVisibility,
+            registerSpace);
+    }
+    
+};
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_ROOT_SIGNATURE_DESC : public D3D12_ROOT_SIGNATURE_DESC
+{
+    CD3DX12_ROOT_SIGNATURE_DESC() {}
+    explicit CD3DX12_ROOT_SIGNATURE_DESC(const D3D12_ROOT_SIGNATURE_DESC &o) :
+        D3D12_ROOT_SIGNATURE_DESC(o)
+    {}
+    CD3DX12_ROOT_SIGNATURE_DESC(
+        UINT numParameters,
+        _In_reads_opt_(numParameters) const D3D12_ROOT_PARAMETER* _pParameters,
+        UINT numStaticSamplers = 0,
+        _In_reads_opt_(numStaticSamplers) const D3D12_STATIC_SAMPLER_DESC* _pStaticSamplers = NULL,
+        D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE)
+    {
+        Init(numParameters, _pParameters, numStaticSamplers, _pStaticSamplers, flags);
+    }
+    
+    inline void Init(
+        UINT numParameters,
+        _In_reads_opt_(numParameters) const D3D12_ROOT_PARAMETER* _pParameters,
+        UINT numStaticSamplers = 0,
+        _In_reads_opt_(numStaticSamplers) const D3D12_STATIC_SAMPLER_DESC* _pStaticSamplers = NULL,
+        D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE)
+    {
+        Init(*this, numParameters, _pParameters, numStaticSamplers, _pStaticSamplers, flags);
+    }
+
+    static inline void Init(
+        _Out_ D3D12_ROOT_SIGNATURE_DESC &desc,
+        UINT numParameters,
+        _In_reads_opt_(numParameters) const D3D12_ROOT_PARAMETER* _pParameters,
+        UINT numStaticSamplers = 0,
+        _In_reads_opt_(numStaticSamplers) const D3D12_STATIC_SAMPLER_DESC* _pStaticSamplers = NULL,
+        D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE)
+    {
+        desc.NumParameters = numParameters;
+        desc.pParameters = _pParameters;
+        desc.NumStaticSamplers = numStaticSamplers;
+        desc.pStaticSamplers = _pStaticSamplers;
+        desc.Flags = flags;
+    }
+    
+    CD3DX12_ROOT_SIGNATURE_DESC(CD3DX12_DEFAULT) : CD3DX12_ROOT_SIGNATURE_DESC(0,NULL,0,NULL,D3D12_ROOT_SIGNATURE_FLAG_NONE) {}
+};
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_CPU_DESCRIPTOR_HANDLE : public D3D12_CPU_DESCRIPTOR_HANDLE
+{
+    CD3DX12_CPU_DESCRIPTOR_HANDLE() {}
+    explicit CD3DX12_CPU_DESCRIPTOR_HANDLE(const D3D12_CPU_DESCRIPTOR_HANDLE &o) :
+        D3D12_CPU_DESCRIPTOR_HANDLE(o)
+    {}
+    CD3DX12_CPU_DESCRIPTOR_HANDLE(CD3DX12_DEFAULT) { ptr = 0; }
+    CD3DX12_CPU_DESCRIPTOR_HANDLE(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE &other, INT offsetScaledByIncrementSize)
+    {
+        InitOffsetted(other, offsetScaledByIncrementSize);
+    }
+    CD3DX12_CPU_DESCRIPTOR_HANDLE(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE &other, INT offsetInDescriptors, UINT descriptorIncrementSize)
+    {
+        InitOffsetted(other, offsetInDescriptors, descriptorIncrementSize);
+    }
+    CD3DX12_CPU_DESCRIPTOR_HANDLE& Offset(INT offsetInDescriptors, UINT descriptorIncrementSize)
+    { 
+        ptr += offsetInDescriptors * descriptorIncrementSize;
+        return *this;
+    }
+    CD3DX12_CPU_DESCRIPTOR_HANDLE& Offset(INT offsetScaledByIncrementSize) 
+    { 
+        ptr += offsetScaledByIncrementSize;
+        return *this;
+    }
+    bool operator==(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE& other)
+    {
+        return (ptr == other.ptr);
+    }
+    bool operator!=(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE& other)
+    {
+        return (ptr != other.ptr);
+    }
+    CD3DX12_CPU_DESCRIPTOR_HANDLE &operator=(const D3D12_CPU_DESCRIPTOR_HANDLE &other)
+    {
+        ptr = other.ptr;
+        return *this;
+    }
+    
+    inline void InitOffsetted(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize)
+    {
+        InitOffsetted(*this, base, offsetScaledByIncrementSize);
+    }
+    
+    inline void InitOffsetted(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize)
+    {
+        InitOffsetted(*this, base, offsetInDescriptors, descriptorIncrementSize);
+    }
+    
+    static inline void InitOffsetted(_Out_ D3D12_CPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize)
+    {
+        handle.ptr = base.ptr + offsetScaledByIncrementSize;
+    }
+    
+    static inline void InitOffsetted(_Out_ D3D12_CPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize)
+    {
+        handle.ptr = base.ptr + offsetInDescriptors * descriptorIncrementSize;
+    }
+};
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_GPU_DESCRIPTOR_HANDLE : public D3D12_GPU_DESCRIPTOR_HANDLE
+{
+    CD3DX12_GPU_DESCRIPTOR_HANDLE() {}
+    explicit CD3DX12_GPU_DESCRIPTOR_HANDLE(const D3D12_GPU_DESCRIPTOR_HANDLE &o) :
+        D3D12_GPU_DESCRIPTOR_HANDLE(o)
+    {}
+    CD3DX12_GPU_DESCRIPTOR_HANDLE(CD3DX12_DEFAULT) { ptr = 0; }
+    CD3DX12_GPU_DESCRIPTOR_HANDLE(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE &other, INT offsetScaledByIncrementSize)
+    {
+        InitOffsetted(other, offsetScaledByIncrementSize);
+    }
+    CD3DX12_GPU_DESCRIPTOR_HANDLE(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE &other, INT offsetInDescriptors, UINT descriptorIncrementSize)
+    {
+        InitOffsetted(other, offsetInDescriptors, descriptorIncrementSize);
+    }
+    CD3DX12_GPU_DESCRIPTOR_HANDLE& Offset(INT offsetInDescriptors, UINT descriptorIncrementSize)
+    { 
+        ptr += offsetInDescriptors * descriptorIncrementSize;
+        return *this;
+    }
+    CD3DX12_GPU_DESCRIPTOR_HANDLE& Offset(INT offsetScaledByIncrementSize) 
+    { 
+        ptr += offsetScaledByIncrementSize;
+        return *this;
+    }
+    inline bool operator==(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE& other)
+    {
+        return (ptr == other.ptr);
+    }
+    inline bool operator!=(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE& other)
+    {
+        return (ptr != other.ptr);
+    }
+    CD3DX12_GPU_DESCRIPTOR_HANDLE &operator=(const D3D12_GPU_DESCRIPTOR_HANDLE &other)
+    {
+        ptr = other.ptr;
+        return *this;
+    }
+    
+    inline void InitOffsetted(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize)
+    {
+        InitOffsetted(*this, base, offsetScaledByIncrementSize);
+    }
+    
+    inline void InitOffsetted(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize)
+    {
+        InitOffsetted(*this, base, offsetInDescriptors, descriptorIncrementSize);
+    }
+    
+    static inline void InitOffsetted(_Out_ D3D12_GPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize)
+    {
+        handle.ptr = base.ptr + offsetScaledByIncrementSize;
+    }
+    
+    static inline void InitOffsetted(_Out_ D3D12_GPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize)
+    {
+        handle.ptr = base.ptr + offsetInDescriptors * descriptorIncrementSize;
+    }
+};
+
+//------------------------------------------------------------------------------------------------
+inline UINT D3D12CalcSubresource( UINT MipSlice, UINT ArraySlice, UINT PlaneSlice, UINT MipLevels, UINT ArraySize )
+{ 
+    return MipSlice + ArraySlice * MipLevels + PlaneSlice * MipLevels * ArraySize; 
+}
+
+//------------------------------------------------------------------------------------------------
+template <typename T, typename U, typename V>
+inline void D3D12DecomposeSubresource( UINT Subresource, UINT MipLevels, UINT ArraySize, _Out_ T& MipSlice, _Out_ U& ArraySlice, _Out_ V& PlaneSlice )
+{
+    MipSlice = static_cast<T>(Subresource % MipLevels);
+    ArraySlice = static_cast<U>((Subresource / MipLevels) % ArraySize);
+    PlaneSlice = static_cast<V>(Subresource / (MipLevels * ArraySize));
+}
+
+//------------------------------------------------------------------------------------------------
+inline UINT8 D3D12GetFormatPlaneCount(
+    _In_ ID3D12Device* pDevice,
+    DXGI_FORMAT Format
+    )
+{
+    D3D12_FEATURE_DATA_FORMAT_INFO formatInfo = {Format};
+    if (FAILED(pDevice->CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO, &formatInfo, sizeof(formatInfo))))
+    {
+        return 0;
+    }
+    return formatInfo.PlaneCount;
+}
+
+//------------------------------------------------------------------------------------------------
+struct CD3DX12_RESOURCE_DESC : public D3D12_RESOURCE_DESC
+{
+    CD3DX12_RESOURCE_DESC()
+    {}
+    explicit CD3DX12_RESOURCE_DESC( const D3D12_RESOURCE_DESC& o ) :
+        D3D12_RESOURCE_DESC( o )
+    {}
+    CD3DX12_RESOURCE_DESC( 
+        D3D12_RESOURCE_DIMENSION dimension,
+        UINT64 alignment,
+        UINT64 width,
+        UINT height,
+        UINT16 depthOrArraySize,
+        UINT16 mipLevels,
+        DXGI_FORMAT format,
+        UINT sampleCount,
+        UINT sampleQuality,
+        D3D12_TEXTURE_LAYOUT layout,
+        D3D12_RESOURCE_FLAGS flags )
+    {
+        Dimension = dimension;
+        Alignment = alignment;
+        Width = width;
+        Height = height;
+        DepthOrArraySize = depthOrArraySize;
+        MipLevels = mipLevels;
+        Format = format;
+        SampleDesc.Count = sampleCount;
+        SampleDesc.Quality = sampleQuality;
+        Layout = layout;
+        Flags = flags;
+    }
+    static inline CD3DX12_RESOURCE_DESC Buffer( 
+        const D3D12_RESOURCE_ALLOCATION_INFO& resAllocInfo,
+        D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE )
+    {
+        return CD3DX12_RESOURCE_DESC( D3D12_RESOURCE_DIMENSION_BUFFER, resAllocInfo.Alignment, resAllocInfo.SizeInBytes, 
+            1, 1, 1, DXGI_FORMAT_UNKNOWN, 1, 0, D3D12_TEXTURE_LAYOUT_ROW_MAJOR, flags );
+    }
+    static inline CD3DX12_RESOURCE_DESC Buffer( 
+        UINT64 width,
+        D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE,
+        UINT64 alignment = 0 )
+    {
+        return CD3DX12_RESOURCE_DESC( D3D12_RESOURCE_DIMENSION_BUFFER, alignment, width, 1, 1, 1, 
+            DXGI_FORMAT_UNKNOWN, 1, 0, D3D12_TEXTURE_LAYOUT_ROW_MAJOR, flags );
+    }
+    static inline CD3DX12_RESOURCE_DESC Tex1D( 
+        DXGI_FORMAT format,
+        UINT64 width,
+        UINT16 arraySize = 1,
+        UINT16 mipLevels = 0,
+        D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE,
+        D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT_UNKNOWN,
+        UINT64 alignment = 0 )
+    {
+        return CD3DX12_RESOURCE_DESC( D3D12_RESOURCE_DIMENSION_TEXTURE1D, alignment, width, 1, arraySize, 
+            mipLevels, format, 1, 0, layout, flags );
+    }
+    static inline CD3DX12_RESOURCE_DESC Tex2D( 
+        DXGI_FORMAT format,
+        UINT64 width,
+        UINT height,
+        UINT16 arraySize = 1,
+        UINT16 mipLevels = 0,
+        UINT sampleCount = 1,
+        UINT sampleQuality = 0,
+        D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE,
+        D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT_UNKNOWN,
+        UINT64 alignment = 0 )
+    {
+        return CD3DX12_RESOURCE_DESC( D3D12_RESOURCE_DIMENSION_TEXTURE2D, alignment, width, height, arraySize, 
+            mipLevels, format, sampleCount, sampleQuality, layout, flags );
+    }
+    static inline CD3DX12_RESOURCE_DESC Tex3D( 
+        DXGI_FORMAT format,
+        UINT64 width,
+        UINT height,
+        UINT16 depth,
+        UINT16 mipLevels = 0,
+        D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE,
+        D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT_UNKNOWN,
+        UINT64 alignment = 0 )
+    {
+        return CD3DX12_RESOURCE_DESC( D3D12_RESOURCE_DIMENSION_TEXTURE3D, alignment, width, height, depth, 
+            mipLevels, format, 1, 0, layout, flags );
+    }
+    inline UINT16 Depth() const
+    { return (Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D ? DepthOrArraySize : 1); }
+    inline UINT16 ArraySize() const
+    { return (Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE3D ? DepthOrArraySize : 1); }
+    inline UINT8 PlaneCount(_In_ ID3D12Device* pDevice) const
+    { return D3D12GetFormatPlaneCount(pDevice, Format); }
+    inline UINT Subresources(_In_ ID3D12Device* pDevice) const
+    { return MipLevels * ArraySize() * PlaneCount(pDevice); }
+    inline UINT CalcSubresource(UINT MipSlice, UINT ArraySlice, UINT PlaneSlice)
+    { return D3D12CalcSubresource(MipSlice, ArraySlice, PlaneSlice, MipLevels, ArraySize()); }
+    operator const D3D12_RESOURCE_DESC&() const { return *this; }
+};
+
+//------------------------------------------------------------------------------------------------
+// Row-by-row memcpy
+inline void MemcpySubresource(
+    _In_ const D3D12_MEMCPY_DEST* pDest,
+    _In_ const D3D12_SUBRESOURCE_DATA* pSrc,
+    SIZE_T RowSizeInBytes,
+    UINT NumRows,
+    UINT NumSlices)
+{
+    for (UINT z = 0; z < NumSlices; ++z)
+    {
+        BYTE* pDestSlice = reinterpret_cast<BYTE*>(pDest->pData) + pDest->SlicePitch * z;
+        const BYTE* pSrcSlice = reinterpret_cast<const BYTE*>(pSrc->pData) + pSrc->SlicePitch * z;
+        for (UINT y = 0; y < NumRows; ++y)
+        {
+            memcpy(pDestSlice + pDest->RowPitch * y,
+                   pSrcSlice + pSrc->RowPitch * y,
+                   RowSizeInBytes);
+        }
+    }
+}
+
+//------------------------------------------------------------------------------------------------
+// Returns required size of a buffer to be used for data upload
+inline UINT64 GetRequiredIntermediateSize(
+    _In_ ID3D12Resource* pDestinationResource,
+    _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource,
+    _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources)
+{
+    D3D12_RESOURCE_DESC Desc = pDestinationResource->GetDesc();
+    UINT64 RequiredSize = 0;
+    
+    ID3D12Device* pDevice;
+    pDestinationResource->GetDevice(__uuidof(*pDevice), reinterpret_cast<void**>(&pDevice));
+    pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, 0, nullptr, nullptr, nullptr, &RequiredSize);
+    pDevice->Release();
+    
+    return RequiredSize;
+}
+
+//------------------------------------------------------------------------------------------------
+// All arrays must be populated (e.g. by calling GetCopyableFootprints)
+inline UINT64 UpdateSubresources(
+    _In_ ID3D12GraphicsCommandList* pCmdList,
+    _In_ ID3D12Resource* pDestinationResource,
+    _In_ ID3D12Resource* pIntermediate,
+    _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource,
+    _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources,
+    UINT64 RequiredSize,
+    _In_reads_(NumSubresources) const D3D12_PLACED_SUBRESOURCE_FOOTPRINT* pLayouts,
+    _In_reads_(NumSubresources) const UINT* pNumRows,
+    _In_reads_(NumSubresources) const UINT64* pRowSizesInBytes,
+    _In_reads_(NumSubresources) const D3D12_SUBRESOURCE_DATA* pSrcData)
+{
+    // Minor validation
+    D3D12_RESOURCE_DESC IntermediateDesc = pIntermediate->GetDesc();
+    D3D12_RESOURCE_DESC DestinationDesc = pDestinationResource->GetDesc();
+    if (IntermediateDesc.Dimension != D3D12_RESOURCE_DIMENSION_BUFFER || 
+        IntermediateDesc.Width < RequiredSize + pLayouts[0].Offset || 
+        RequiredSize > (SIZE_T)-1 || 
+        (DestinationDesc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER && 
+            (FirstSubresource != 0 || NumSubresources != 1)))
+    {
+        return 0;
+    }
+    
+    BYTE* pData;
+    HRESULT hr = pIntermediate->Map(0, NULL, reinterpret_cast<void**>(&pData));
+    if (FAILED(hr))
+    {
+        return 0;
+    }
+    
+    for (UINT i = 0; i < NumSubresources; ++i)
+    {
+        if (pRowSizesInBytes[i] > (SIZE_T)-1) return 0;
+        D3D12_MEMCPY_DEST DestData = { pData + pLayouts[i].Offset, pLayouts[i].Footprint.RowPitch, pLayouts[i].Footprint.RowPitch * pNumRows[i] };
+        MemcpySubresource(&DestData, &pSrcData[i], (SIZE_T)pRowSizesInBytes[i], pNumRows[i], pLayouts[i].Footprint.Depth);
+    }
+    pIntermediate->Unmap(0, NULL);
+    
+    if (DestinationDesc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER)
+    {
+        CD3DX12_BOX SrcBox( UINT( pLayouts[0].Offset ), UINT( pLayouts[0].Offset + pLayouts[0].Footprint.Width ) );
+        pCmdList->CopyBufferRegion(
+            pDestinationResource, 0, pIntermediate, pLayouts[0].Offset, pLayouts[0].Footprint.Width);
+    }
+    else
+    {
+        for (UINT i = 0; i < NumSubresources; ++i)
+        {
+            CD3DX12_TEXTURE_COPY_LOCATION Dst(pDestinationResource, i + FirstSubresource);
+            CD3DX12_TEXTURE_COPY_LOCATION Src(pIntermediate, pLayouts[i]);
+            pCmdList->CopyTextureRegion(&Dst, 0, 0, 0, &Src, nullptr);
+        }
+    }
+    return RequiredSize;
+}
+
+//------------------------------------------------------------------------------------------------
+// Heap-allocating UpdateSubresources implementation
+inline UINT64 UpdateSubresources( 
+    _In_ ID3D12GraphicsCommandList* pCmdList,
+    _In_ ID3D12Resource* pDestinationResource,
+    _In_ ID3D12Resource* pIntermediate,
+    UINT64 IntermediateOffset,
+    _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource,
+    _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources,
+    _In_reads_(NumSubresources) D3D12_SUBRESOURCE_DATA* pSrcData)
+{
+    UINT64 RequiredSize = 0;
+    UINT64 MemToAlloc = static_cast<UINT64>(sizeof(D3D12_PLACED_SUBRESOURCE_FOOTPRINT) + sizeof(UINT) + sizeof(UINT64)) * NumSubresources;
+    if (MemToAlloc > SIZE_MAX)
+    {
+       return 0;
+    }
+    void* pMem = HeapAlloc(GetProcessHeap(), 0, static_cast<SIZE_T>(MemToAlloc));
+    if (pMem == NULL)
+    {
+       return 0;
+    }
+    D3D12_PLACED_SUBRESOURCE_FOOTPRINT* pLayouts = reinterpret_cast<D3D12_PLACED_SUBRESOURCE_FOOTPRINT*>(pMem);
+    UINT64* pRowSizesInBytes = reinterpret_cast<UINT64*>(pLayouts + NumSubresources);
+    UINT* pNumRows = reinterpret_cast<UINT*>(pRowSizesInBytes + NumSubresources);
+    
+    D3D12_RESOURCE_DESC Desc = pDestinationResource->GetDesc();
+    ID3D12Device* pDevice;
+    pDestinationResource->GetDevice(__uuidof(*pDevice), reinterpret_cast<void**>(&pDevice));
+    pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, IntermediateOffset, pLayouts, pNumRows, pRowSizesInBytes, &RequiredSize);
+    pDevice->Release();
+    
+    UINT64 Result = UpdateSubresources(pCmdList, pDestinationResource, pIntermediate, FirstSubresource, NumSubresources, RequiredSize, pLayouts, pNumRows, pRowSizesInBytes, pSrcData);
+    HeapFree(GetProcessHeap(), 0, pMem);
+    return Result;
+}
+
+//------------------------------------------------------------------------------------------------
+// Stack-allocating UpdateSubresources implementation
+template <UINT MaxSubresources>
+inline UINT64 UpdateSubresources( 
+    _In_ ID3D12GraphicsCommandList* pCmdList,
+    _In_ ID3D12Resource* pDestinationResource,
+    _In_ ID3D12Resource* pIntermediate,
+    UINT64 IntermediateOffset,
+    _In_range_(0, MaxSubresources) UINT FirstSubresource,
+    _In_range_(1, MaxSubresources - FirstSubresource) UINT NumSubresources,
+    _In_reads_(NumSubresources) D3D12_SUBRESOURCE_DATA* pSrcData)
+{
+    UINT64 RequiredSize = 0;
+    D3D12_PLACED_SUBRESOURCE_FOOTPRINT Layouts[MaxSubresources];
+    UINT NumRows[MaxSubresources];
+    UINT64 RowSizesInBytes[MaxSubresources];
+    
+    D3D12_RESOURCE_DESC Desc = pDestinationResource->GetDesc();
+    ID3D12Device* pDevice;
+    pDestinationResource->GetDevice(__uuidof(*pDevice), reinterpret_cast<void**>(&pDevice));
+    pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, IntermediateOffset, Layouts, NumRows, RowSizesInBytes, &RequiredSize);
+    pDevice->Release();
+    
+    return UpdateSubresources(pCmdList, pDestinationResource, pIntermediate, FirstSubresource, NumSubresources, RequiredSize, Layouts, NumRows, RowSizesInBytes, pSrcData);
+}
+
+//------------------------------------------------------------------------------------------------
+inline bool D3D12IsLayoutOpaque( D3D12_TEXTURE_LAYOUT Layout )
+{ return Layout == D3D12_TEXTURE_LAYOUT_UNKNOWN || Layout == D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE; }
+
+//------------------------------------------------------------------------------------------------
+inline ID3D12CommandList * const * CommandListCast(ID3D12GraphicsCommandList * const * pp)
+{
+    // This cast is useful for passing strongly typed command list pointers into
+    // ExecuteCommandLists.
+    // This cast is valid as long as the const-ness is respected. D3D12 APIs do
+    // respect the const-ness of their arguments.
+    return reinterpret_cast<ID3D12CommandList * const *>(pp);
+}
+
+
+#endif // defined( __cplusplus )
+
+#endif //__D3DX12_H__
+
+
+

+ 489 - 0
build/windows/universal/TemplateApp/Content/Sample3DSceneRenderer.cpp

@@ -0,0 +1,489 @@
+#include "pch.h"
+#include "Sample3DSceneRenderer.h"
+
+#include "..\Common\DirectXHelper.h"
+#include <ppltasks.h>
+#include <synchapi.h>
+
+using namespace TemplateApp;
+
+using namespace Concurrency;
+using namespace DirectX;
+using namespace Microsoft::WRL;
+using namespace Windows::Foundation;
+using namespace Windows::Storage;
+
+// Indices into the application state map.
+Platform::String^ AngleKey = "Angle";
+Platform::String^ TrackingKey = "Tracking";
+
+// Loads vertex and pixel shaders from files and instantiates the cube geometry.
+Sample3DSceneRenderer::Sample3DSceneRenderer(const std::shared_ptr<DX::DeviceResources>& deviceResources) :
+	m_loadingComplete(false),
+	m_radiansPerSecond(XM_PIDIV4),	// rotate 45 degrees per second
+	m_angle(0),
+	m_tracking(false),
+	m_mappedConstantBuffer(nullptr),
+	m_deviceResources(deviceResources)
+{
+	LoadState();
+	ZeroMemory(&m_constantBufferData, sizeof(m_constantBufferData));
+
+	CreateDeviceDependentResources();
+	CreateWindowSizeDependentResources();
+}
+
+Sample3DSceneRenderer::~Sample3DSceneRenderer()
+{
+	m_constantBuffer->Unmap(0, nullptr);
+	m_mappedConstantBuffer = nullptr;
+}
+
+void Sample3DSceneRenderer::CreateDeviceDependentResources()
+{
+	auto d3dDevice = m_deviceResources->GetD3DDevice();
+
+	// Create a root signature with a single constant buffer slot.
+	{
+		CD3DX12_DESCRIPTOR_RANGE range;
+		CD3DX12_ROOT_PARAMETER parameter;
+
+		range.Init(D3D12_DESCRIPTOR_RANGE_TYPE_CBV, 1, 0);
+		parameter.InitAsDescriptorTable(1, &range, D3D12_SHADER_VISIBILITY_VERTEX);
+
+		D3D12_ROOT_SIGNATURE_FLAGS rootSignatureFlags =
+			D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT | // Only the input assembler stage needs access to the constant buffer.
+			D3D12_ROOT_SIGNATURE_FLAG_DENY_DOMAIN_SHADER_ROOT_ACCESS |
+			D3D12_ROOT_SIGNATURE_FLAG_DENY_GEOMETRY_SHADER_ROOT_ACCESS |
+			D3D12_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS |
+			D3D12_ROOT_SIGNATURE_FLAG_DENY_PIXEL_SHADER_ROOT_ACCESS;
+
+		CD3DX12_ROOT_SIGNATURE_DESC descRootSignature;
+		descRootSignature.Init(1, &parameter, 0, nullptr, rootSignatureFlags);
+
+		ComPtr<ID3DBlob> pSignature;
+		ComPtr<ID3DBlob> pError;
+		DX::ThrowIfFailed(D3D12SerializeRootSignature(&descRootSignature, D3D_ROOT_SIGNATURE_VERSION_1, pSignature.GetAddressOf(), pError.GetAddressOf()));
+		DX::ThrowIfFailed(d3dDevice->CreateRootSignature(0, pSignature->GetBufferPointer(), pSignature->GetBufferSize(), IID_PPV_ARGS(&m_rootSignature)));
+	}
+
+	// Load shaders asynchronously.
+	auto createVSTask = DX::ReadDataAsync(L"SampleVertexShader.cso").then([this](std::vector<byte>& fileData) {
+		m_vertexShader = fileData;
+	});
+
+	auto createPSTask = DX::ReadDataAsync(L"SamplePixelShader.cso").then([this](std::vector<byte>& fileData) {
+		m_pixelShader = fileData;
+	});
+
+	// Create the pipeline state once the shaders are loaded.
+	auto createPipelineStateTask = (createPSTask && createVSTask).then([this]() {
+
+		static const D3D12_INPUT_ELEMENT_DESC inputLayout[] =
+		{
+			{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
+			{ "COLOR", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
+		};
+
+		D3D12_GRAPHICS_PIPELINE_STATE_DESC state = {};
+		state.InputLayout = { inputLayout, _countof(inputLayout) };
+		state.pRootSignature = m_rootSignature.Get();
+		state.VS = { &m_vertexShader[0], m_vertexShader.size() };
+		state.PS = { &m_pixelShader[0], m_pixelShader.size() };
+		state.RasterizerState = CD3DX12_RASTERIZER_DESC(D3D12_DEFAULT);
+		state.BlendState = CD3DX12_BLEND_DESC(D3D12_DEFAULT);
+		state.DepthStencilState.DepthEnable = FALSE;
+		state.DepthStencilState.StencilEnable = FALSE;
+		state.SampleMask = UINT_MAX;
+		state.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
+		state.NumRenderTargets = 1;
+		state.RTVFormats[0] = DXGI_FORMAT_B8G8R8A8_UNORM;
+		state.SampleDesc.Count = 1;
+
+		DX::ThrowIfFailed(m_deviceResources->GetD3DDevice()->CreateGraphicsPipelineState(&state, IID_PPV_ARGS(&m_pipelineState)));
+
+		// Shader data can be deleted once the pipeline state is created.
+		m_vertexShader.clear();
+		m_pixelShader.clear();
+	});
+
+	// Create and upload cube geometry resources to the GPU.
+	auto createAssetsTask = createPipelineStateTask.then([this]() {
+		auto d3dDevice = m_deviceResources->GetD3DDevice();
+
+		// Create a command list.
+		DX::ThrowIfFailed(d3dDevice->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, m_deviceResources->GetCommandAllocator(), m_pipelineState.Get(), IID_PPV_ARGS(&m_commandList)));
+
+		// Cube vertices. Each vertex has a position and a color.
+		VertexPositionColor cubeVertices[] =
+		{
+			{ XMFLOAT3(-0.5f, -0.5f, -0.5f), XMFLOAT3(0.0f, 0.0f, 0.0f) },
+			{ XMFLOAT3(-0.5f, -0.5f,  0.5f), XMFLOAT3(0.0f, 0.0f, 1.0f) },
+			{ XMFLOAT3(-0.5f,  0.5f, -0.5f), XMFLOAT3(0.0f, 1.0f, 0.0f) },
+			{ XMFLOAT3(-0.5f,  0.5f,  0.5f), XMFLOAT3(0.0f, 1.0f, 1.0f) },
+			{ XMFLOAT3(0.5f, -0.5f, -0.5f), XMFLOAT3(1.0f, 0.0f, 0.0f) },
+			{ XMFLOAT3(0.5f, -0.5f,  0.5f), XMFLOAT3(1.0f, 0.0f, 1.0f) },
+			{ XMFLOAT3(0.5f,  0.5f, -0.5f), XMFLOAT3(1.0f, 1.0f, 0.0f) },
+			{ XMFLOAT3(0.5f,  0.5f,  0.5f), XMFLOAT3(1.0f, 1.0f, 1.0f) },
+		};
+
+		const UINT vertexBufferSize = sizeof(cubeVertices);
+
+		// Create the vertex buffer resource in the GPU's default heap and copy vertex data into it using the upload heap.
+		// The upload resource must not be released until after the GPU has finished using it.
+		Microsoft::WRL::ComPtr<ID3D12Resource> vertexBufferUpload;
+
+		CD3DX12_HEAP_PROPERTIES defaultHeapProperties(D3D12_HEAP_TYPE_DEFAULT);
+		CD3DX12_RESOURCE_DESC vertexBufferDesc = CD3DX12_RESOURCE_DESC::Buffer(vertexBufferSize);
+		DX::ThrowIfFailed(d3dDevice->CreateCommittedResource(
+			&defaultHeapProperties,
+			D3D12_HEAP_FLAG_NONE,
+			&vertexBufferDesc,
+			D3D12_RESOURCE_STATE_COPY_DEST,
+			nullptr,
+			IID_PPV_ARGS(&m_vertexBuffer)));
+
+		CD3DX12_HEAP_PROPERTIES uploadHeapProperties(D3D12_HEAP_TYPE_UPLOAD);
+		DX::ThrowIfFailed(d3dDevice->CreateCommittedResource(
+			&uploadHeapProperties,
+			D3D12_HEAP_FLAG_NONE,
+			&vertexBufferDesc,
+			D3D12_RESOURCE_STATE_GENERIC_READ,
+			nullptr,
+			IID_PPV_ARGS(&vertexBufferUpload)));
+
+		m_vertexBuffer->SetName(L"Vertex Buffer Resource");
+		vertexBufferUpload->SetName(L"Vertex Buffer Upload Resource");
+
+		// Upload the vertex buffer to the GPU.
+		{
+			D3D12_SUBRESOURCE_DATA vertexData = {};
+			vertexData.pData = reinterpret_cast<BYTE*>(cubeVertices);
+			vertexData.RowPitch = vertexBufferSize;
+			vertexData.SlicePitch = vertexData.RowPitch;
+
+			UpdateSubresources(m_commandList.Get(), m_vertexBuffer.Get(), vertexBufferUpload.Get(), 0, 0, 1, &vertexData);
+
+			CD3DX12_RESOURCE_BARRIER vertexBufferResourceBarrier =
+				CD3DX12_RESOURCE_BARRIER::Transition(m_vertexBuffer.Get(), D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER);
+			m_commandList->ResourceBarrier(1, &vertexBufferResourceBarrier);
+		}
+
+		// Load mesh indices. Each trio of indices represents a triangle to be rendered on the screen.
+		// For example: 0,2,1 means that the vertices with indexes 0, 2 and 1 from the vertex buffer compose the
+		// first triangle of this mesh.
+		unsigned short cubeIndices[] =
+		{
+			0, 2, 1, // -x
+			1, 2, 3,
+
+			4, 5, 6, // +x
+			5, 7, 6,
+
+			0, 1, 5, // -y
+			0, 5, 4,
+
+			2, 6, 7, // +y
+			2, 7, 3,
+
+			0, 4, 6, // -z
+			0, 6, 2,
+
+			1, 3, 7, // +z
+			1, 7, 5,
+		};
+
+		const UINT indexBufferSize = sizeof(cubeIndices);
+
+		// Create the index buffer resource in the GPU's default heap and copy index data into it using the upload heap.
+		// The upload resource must not be released until after the GPU has finished using it.
+		Microsoft::WRL::ComPtr<ID3D12Resource> indexBufferUpload;
+
+		CD3DX12_RESOURCE_DESC indexBufferDesc = CD3DX12_RESOURCE_DESC::Buffer(indexBufferSize);
+		DX::ThrowIfFailed(d3dDevice->CreateCommittedResource(
+			&defaultHeapProperties,
+			D3D12_HEAP_FLAG_NONE,
+			&indexBufferDesc,
+			D3D12_RESOURCE_STATE_COPY_DEST,
+			nullptr,
+			IID_PPV_ARGS(&m_indexBuffer)));
+
+		DX::ThrowIfFailed(d3dDevice->CreateCommittedResource(
+			&uploadHeapProperties,
+			D3D12_HEAP_FLAG_NONE,
+			&indexBufferDesc,
+			D3D12_RESOURCE_STATE_GENERIC_READ,
+			nullptr,
+			IID_PPV_ARGS(&indexBufferUpload)));
+
+		m_indexBuffer->SetName(L"Index Buffer Resource");
+		indexBufferUpload->SetName(L"Index Buffer Upload Resource");
+
+		// Upload the index buffer to the GPU.
+		{
+			D3D12_SUBRESOURCE_DATA indexData = {};
+			indexData.pData = reinterpret_cast<BYTE*>(cubeIndices);
+			indexData.RowPitch = indexBufferSize;
+			indexData.SlicePitch = indexData.RowPitch;
+
+			UpdateSubresources(m_commandList.Get(), m_indexBuffer.Get(), indexBufferUpload.Get(), 0, 0, 1, &indexData);
+
+			CD3DX12_RESOURCE_BARRIER indexBufferResourceBarrier =
+				CD3DX12_RESOURCE_BARRIER::Transition(m_indexBuffer.Get(), D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
+			m_commandList->ResourceBarrier(1, &indexBufferResourceBarrier);
+		}
+
+		// Create a descriptor heap for the constant buffers.
+		{
+			D3D12_DESCRIPTOR_HEAP_DESC heapDesc = {};
+			heapDesc.NumDescriptors = DX::c_frameCount;
+			heapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV;
+			// This flag indicates that this descriptor heap can be bound to the pipeline and that descriptors contained in it can be referenced by a root table.
+			heapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE;
+			DX::ThrowIfFailed(d3dDevice->CreateDescriptorHeap(&heapDesc, IID_PPV_ARGS(&m_cbvHeap)));
+
+			m_cbvHeap->SetName(L"Constant Buffer View Descriptor Heap");
+		}
+
+		CD3DX12_RESOURCE_DESC constantBufferDesc = CD3DX12_RESOURCE_DESC::Buffer(DX::c_frameCount * c_alignedConstantBufferSize);
+		DX::ThrowIfFailed(d3dDevice->CreateCommittedResource(
+			&uploadHeapProperties,
+			D3D12_HEAP_FLAG_NONE,
+			&constantBufferDesc,
+			D3D12_RESOURCE_STATE_GENERIC_READ,
+			nullptr,
+			IID_PPV_ARGS(&m_constantBuffer)));
+
+		m_constantBuffer->SetName(L"Constant Buffer");
+
+		// Create constant buffer views to access the upload buffer.
+		D3D12_GPU_VIRTUAL_ADDRESS cbvGpuAddress = m_constantBuffer->GetGPUVirtualAddress();
+		CD3DX12_CPU_DESCRIPTOR_HANDLE cbvCpuHandle(m_cbvHeap->GetCPUDescriptorHandleForHeapStart());
+		m_cbvDescriptorSize = d3dDevice->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
+
+		for (int n = 0; n < DX::c_frameCount; n++)
+		{
+			D3D12_CONSTANT_BUFFER_VIEW_DESC desc;
+			desc.BufferLocation = cbvGpuAddress;
+			desc.SizeInBytes = c_alignedConstantBufferSize;
+			d3dDevice->CreateConstantBufferView(&desc, cbvCpuHandle);
+
+			cbvGpuAddress += desc.SizeInBytes;
+			cbvCpuHandle.Offset(m_cbvDescriptorSize);
+		}
+
+		// Map the constant buffers.
+		DX::ThrowIfFailed(m_constantBuffer->Map(0, nullptr, reinterpret_cast<void**>(&m_mappedConstantBuffer)));
+		ZeroMemory(m_mappedConstantBuffer, DX::c_frameCount * c_alignedConstantBufferSize);
+		// We don't unmap this until the app closes. Keeping things mapped for the lifetime of the resource is okay.
+
+		// Close the command list and execute it to begin the vertex/index buffer copy into the GPU's default heap.
+		DX::ThrowIfFailed(m_commandList->Close());
+		ID3D12CommandList* ppCommandLists[] = { m_commandList.Get() };
+		m_deviceResources->GetCommandQueue()->ExecuteCommandLists(_countof(ppCommandLists), ppCommandLists);
+
+		// Create vertex/index buffer views.
+		m_vertexBufferView.BufferLocation = m_vertexBuffer->GetGPUVirtualAddress();
+		m_vertexBufferView.StrideInBytes = sizeof(VertexPositionColor);
+		m_vertexBufferView.SizeInBytes = sizeof(cubeVertices);
+
+		m_indexBufferView.BufferLocation = m_indexBuffer->GetGPUVirtualAddress();
+		m_indexBufferView.SizeInBytes = sizeof(cubeIndices);
+		m_indexBufferView.Format = DXGI_FORMAT_R16_UINT;
+
+		// Wait for the command list to finish executing; the vertex/index buffers need to be uploaded to the GPU before the upload resources go out of scope.
+		m_deviceResources->WaitForGpu();
+	});
+
+	createAssetsTask.then([this]() {
+		m_loadingComplete = true;
+	});
+}
+
+// Initializes view parameters when the window size changes.
+void Sample3DSceneRenderer::CreateWindowSizeDependentResources()
+{
+	Size outputSize = m_deviceResources->GetOutputSize();
+	float aspectRatio = outputSize.Width / outputSize.Height;
+	float fovAngleY = 70.0f * XM_PI / 180.0f;
+
+	D3D12_VIEWPORT viewport = m_deviceResources->GetScreenViewport();
+	m_scissorRect = { 0, 0, static_cast<LONG>(viewport.Width), static_cast<LONG>(viewport.Height)};
+
+	// This is a simple example of change that can be made when the app is in
+	// portrait or snapped view.
+	if (aspectRatio < 1.0f)
+	{
+		fovAngleY *= 2.0f;
+	}
+
+	// Note that the OrientationTransform3D matrix is post-multiplied here
+	// in order to correctly orient the scene to match the display orientation.
+	// This post-multiplication step is required for any draw calls that are
+	// made to the swap chain render target. For draw calls to other targets,
+	// this transform should not be applied.
+
+	// This sample makes use of a right-handed coordinate system using row-major matrices.
+	XMMATRIX perspectiveMatrix = XMMatrixPerspectiveFovRH(
+		fovAngleY,
+		aspectRatio,
+		0.01f,
+		100.0f
+		);
+
+	XMFLOAT4X4 orientation = m_deviceResources->GetOrientationTransform3D();
+	XMMATRIX orientationMatrix = XMLoadFloat4x4(&orientation);
+
+	XMStoreFloat4x4(
+		&m_constantBufferData.projection,
+		XMMatrixTranspose(perspectiveMatrix * orientationMatrix)
+		);
+
+	// Eye is at (0,0.7,1.5), looking at point (0,-0.1,0) with the up-vector along the y-axis.
+	static const XMVECTORF32 eye = { 0.0f, 0.7f, 1.5f, 0.0f };
+	static const XMVECTORF32 at = { 0.0f, -0.1f, 0.0f, 0.0f };
+	static const XMVECTORF32 up = { 0.0f, 1.0f, 0.0f, 0.0f };
+
+	XMStoreFloat4x4(&m_constantBufferData.view, XMMatrixTranspose(XMMatrixLookAtRH(eye, at, up)));
+}
+
+// Called once per frame, rotates the cube and calculates the model and view matrices.
+void Sample3DSceneRenderer::Update(DX::StepTimer const& timer)
+{
+	if (m_loadingComplete)
+	{
+		if (!m_tracking)
+		{
+			// Rotate the cube a small amount.
+			m_angle += static_cast<float>(timer.GetElapsedSeconds()) * m_radiansPerSecond;
+
+			Rotate(m_angle);
+		}
+
+		// Update the constant buffer resource.
+		UINT8* destination = m_mappedConstantBuffer + (m_deviceResources->GetCurrentFrameIndex() * c_alignedConstantBufferSize);
+		memcpy(destination, &m_constantBufferData, sizeof(m_constantBufferData));
+	}
+}
+
+// Saves the current state of the renderer.
+void Sample3DSceneRenderer::SaveState()
+{
+	auto state = ApplicationData::Current->LocalSettings->Values;
+
+	if (state->HasKey(AngleKey))
+	{
+		state->Remove(AngleKey);
+	}
+	if (state->HasKey(TrackingKey))
+	{
+		state->Remove(TrackingKey);
+	}
+
+	state->Insert(AngleKey, PropertyValue::CreateSingle(m_angle));
+	state->Insert(TrackingKey, PropertyValue::CreateBoolean(m_tracking));
+}
+
+// Restores the previous state of the renderer.
+void Sample3DSceneRenderer::LoadState()
+{
+	auto state = ApplicationData::Current->LocalSettings->Values;
+	if (state->HasKey(AngleKey))
+	{
+		m_angle = safe_cast<IPropertyValue^>(state->Lookup(AngleKey))->GetSingle();
+		state->Remove(AngleKey);
+	}
+	if (state->HasKey(TrackingKey))
+	{
+		m_tracking = safe_cast<IPropertyValue^>(state->Lookup(TrackingKey))->GetBoolean();
+		state->Remove(TrackingKey);
+	}
+}
+
+// Rotate the 3D cube model a set amount of radians.
+void Sample3DSceneRenderer::Rotate(float radians)
+{
+	// Prepare to pass the updated model matrix to the shader.
+	XMStoreFloat4x4(&m_constantBufferData.model, XMMatrixTranspose(XMMatrixRotationY(radians)));
+}
+
+void Sample3DSceneRenderer::StartTracking()
+{
+	m_tracking = true;
+}
+
+// When tracking, the 3D cube can be rotated around its Y axis by tracking pointer position relative to the output screen width.
+void Sample3DSceneRenderer::TrackingUpdate(float positionX)
+{
+	if (m_tracking)
+	{
+		float radians = XM_2PI * 2.0f * positionX / m_deviceResources->GetOutputSize().Width;
+		Rotate(radians);
+	}
+}
+
+void Sample3DSceneRenderer::StopTracking()
+{
+	m_tracking = false;
+}
+
+// Renders one frame using the vertex and pixel shaders.
+bool Sample3DSceneRenderer::Render()
+{
+	// Loading is asynchronous. Only draw geometry after it's loaded.
+	if (!m_loadingComplete)
+	{
+		return false;
+	}
+
+	DX::ThrowIfFailed(m_deviceResources->GetCommandAllocator()->Reset());
+
+	// The command list can be reset anytime after ExecuteCommandList() is called.
+	DX::ThrowIfFailed(m_commandList->Reset(m_deviceResources->GetCommandAllocator(), m_pipelineState.Get()));
+
+	PIXBeginEvent(m_commandList.Get(), 0, L"Draw the cube");
+	{
+		// Set the graphics root signature and descriptor heaps to be used by this frame.
+		m_commandList->SetGraphicsRootSignature(m_rootSignature.Get());
+		ID3D12DescriptorHeap* ppHeaps[] = { m_cbvHeap.Get() };
+		m_commandList->SetDescriptorHeaps(_countof(ppHeaps), ppHeaps);
+
+		// Bind the current frame's constant buffer to the pipeline.
+		CD3DX12_GPU_DESCRIPTOR_HANDLE gpuHandle(m_cbvHeap->GetGPUDescriptorHandleForHeapStart(), m_deviceResources->GetCurrentFrameIndex(), m_cbvDescriptorSize);
+		m_commandList->SetGraphicsRootDescriptorTable(0, gpuHandle);
+
+		// Set the viewport and scissor rectangle.
+		D3D12_VIEWPORT viewport = m_deviceResources->GetScreenViewport();
+		m_commandList->RSSetViewports(1, &viewport);
+		m_commandList->RSSetScissorRects(1, &m_scissorRect);
+
+		// Indicate this resource will be in use as a render target.
+		CD3DX12_RESOURCE_BARRIER renderTargetResourceBarrier =
+			CD3DX12_RESOURCE_BARRIER::Transition(m_deviceResources->GetRenderTarget(), D3D12_RESOURCE_STATE_PRESENT, D3D12_RESOURCE_STATE_RENDER_TARGET);
+		m_commandList->ResourceBarrier(1, &renderTargetResourceBarrier);
+
+		// Record drawing commands.
+		m_commandList->ClearRenderTargetView(m_deviceResources->GetRenderTargetView(), DirectX::Colors::CornflowerBlue, 0, nullptr);
+		D3D12_CPU_DESCRIPTOR_HANDLE renderTargetView = m_deviceResources->GetRenderTargetView();
+		m_commandList->OMSetRenderTargets(1, &renderTargetView, false, nullptr);
+
+		m_commandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
+		m_commandList->IASetVertexBuffers(0, 1, &m_vertexBufferView);
+		m_commandList->IASetIndexBuffer(&m_indexBufferView);
+		m_commandList->DrawIndexedInstanced(36, 1, 0, 0, 0);
+
+		// Indicate that the render target will now be used to present when the command list is done executing.
+		CD3DX12_RESOURCE_BARRIER presentResourceBarrier =
+			CD3DX12_RESOURCE_BARRIER::Transition(m_deviceResources->GetRenderTarget(), D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PRESENT);
+		m_commandList->ResourceBarrier(1, &presentResourceBarrier);
+	}
+	PIXEndEvent(m_commandList.Get());
+
+	DX::ThrowIfFailed(m_commandList->Close());
+
+	// Execute the command list.
+	ID3D12CommandList* ppCommandLists[] = { m_commandList.Get() };
+	m_deviceResources->GetCommandQueue()->ExecuteCommandLists(_countof(ppCommandLists), ppCommandLists);
+
+	return true;
+}

+ 61 - 0
build/windows/universal/TemplateApp/Content/Sample3DSceneRenderer.h

@@ -0,0 +1,61 @@
+#pragma once
+
+#include "..\Common\DeviceResources.h"
+#include "ShaderStructures.h"
+#include "..\Common\StepTimer.h"
+
+namespace TemplateApp
+{
+	// This sample renderer instantiates a basic rendering pipeline.
+	class Sample3DSceneRenderer
+	{
+	public:
+		Sample3DSceneRenderer(const std::shared_ptr<DX::DeviceResources>& deviceResources);
+		~Sample3DSceneRenderer();
+		void CreateDeviceDependentResources();
+		void CreateWindowSizeDependentResources();
+		void Update(DX::StepTimer const& timer);
+		bool Render();
+		void SaveState();
+
+		void StartTracking();
+		void TrackingUpdate(float positionX);
+		void StopTracking();
+		bool IsTracking() { return m_tracking; }
+
+	private:
+		void LoadState();
+		void Rotate(float radians);
+
+	private:
+		// Constant buffers must be 256-byte aligned.
+		static const UINT c_alignedConstantBufferSize = (sizeof(ModelViewProjectionConstantBuffer) + 255) & ~255;
+
+		// Cached pointer to device resources.
+		std::shared_ptr<DX::DeviceResources> m_deviceResources;
+
+		// Direct3D resources for cube geometry.
+		Microsoft::WRL::ComPtr<ID3D12GraphicsCommandList>	m_commandList;
+		Microsoft::WRL::ComPtr<ID3D12RootSignature>			m_rootSignature;
+		Microsoft::WRL::ComPtr<ID3D12PipelineState>			m_pipelineState;
+		Microsoft::WRL::ComPtr<ID3D12DescriptorHeap>		m_cbvHeap;
+		Microsoft::WRL::ComPtr<ID3D12Resource>				m_vertexBuffer;
+		Microsoft::WRL::ComPtr<ID3D12Resource>				m_indexBuffer;
+		Microsoft::WRL::ComPtr<ID3D12Resource>				m_constantBuffer;
+		ModelViewProjectionConstantBuffer					m_constantBufferData;
+		UINT8*												m_mappedConstantBuffer;
+		UINT												m_cbvDescriptorSize;
+		D3D12_RECT											m_scissorRect;
+		std::vector<byte>									m_vertexShader;
+		std::vector<byte>									m_pixelShader;
+		D3D12_VERTEX_BUFFER_VIEW							m_vertexBufferView;
+		D3D12_INDEX_BUFFER_VIEW								m_indexBufferView;
+
+		// Variables used with the rendering loop.
+		bool	m_loadingComplete;
+		float	m_radiansPerSecond;
+		float	m_angle;
+		bool	m_tracking;
+	};
+}
+

+ 12 - 0
build/windows/universal/TemplateApp/Content/SamplePixelShader.hlsl

@@ -0,0 +1,12 @@
+// Per-pixel color data passed through the pixel shader.
+struct PixelShaderInput
+{
+	float4 pos : SV_POSITION;
+	float3 color : COLOR0;
+};
+
+// A pass-through function for the (interpolated) color data.
+float4 main(PixelShaderInput input) : SV_TARGET
+{
+	return float4(input.color, 1.0f);
+}

+ 39 - 0
build/windows/universal/TemplateApp/Content/SampleVertexShader.hlsl

@@ -0,0 +1,39 @@
+// A constant buffer that stores the three basic column-major matrices for composing geometry.
+cbuffer ModelViewProjectionConstantBuffer : register(b0)
+{
+	matrix model;
+	matrix view;
+	matrix projection;
+};
+
+// Per-vertex data used as input to the vertex shader.
+struct VertexShaderInput
+{
+	float3 pos : POSITION;
+	float3 color : COLOR0;
+};
+
+// Per-pixel color data passed through the pixel shader.
+struct PixelShaderInput
+{
+	float4 pos : SV_POSITION;
+	float3 color : COLOR0;
+};
+
+// Simple shader to do vertex processing on the GPU.
+PixelShaderInput main(VertexShaderInput input)
+{
+	PixelShaderInput output;
+	float4 pos = float4(input.pos, 1.0f);
+
+	// Transform the vertex position into projected space.
+	pos = mul(pos, model);
+	pos = mul(pos, view);
+	pos = mul(pos, projection);
+	output.pos = pos;
+
+	// Pass the color through without modification.
+	output.color = input.color;
+
+	return output;
+}

+ 19 - 0
build/windows/universal/TemplateApp/Content/ShaderStructures.h

@@ -0,0 +1,19 @@
+#pragma once
+
+namespace TemplateApp
+{
+	// Constant buffer used to send MVP matrices to the vertex shader.
+	struct ModelViewProjectionConstantBuffer
+	{
+		DirectX::XMFLOAT4X4 model;
+		DirectX::XMFLOAT4X4 view;
+		DirectX::XMFLOAT4X4 projection;
+	};
+
+	// Used to send per-vertex data to the vertex shader.
+	struct VertexPositionColor
+	{
+		DirectX::XMFLOAT3 pos;
+		DirectX::XMFLOAT3 color;
+	};
+}

+ 49 - 0
build/windows/universal/TemplateApp/Package.appxmanifest

@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<Package
+  xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
+  xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
+  xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
+  IgnorableNamespaces="uap mp">
+
+  <Identity
+    Name="ebf9cff2-5673-4638-b92f-9dfde76805e3"
+    Publisher="CN=ivan"
+    Version="1.0.0.0" />
+
+  <mp:PhoneIdentity PhoneProductId="ebf9cff2-5673-4638-b92f-9dfde76805e3" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
+
+  <Properties>
+    <DisplayName>TemplateApp</DisplayName>
+    <PublisherDisplayName>ivan</PublisherDisplayName>
+    <Logo>Assets\StoreLogo.png</Logo>
+  </Properties>
+
+  <Dependencies>
+    <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
+  </Dependencies>
+
+  <Resources>
+    <Resource Language="x-generate"/>
+  </Resources>
+
+  <Applications>
+    <Application Id="App"
+      Executable="$targetnametoken$.exe"
+      EntryPoint="TemplateApp.App">
+      <uap:VisualElements
+        DisplayName="TemplateApp"
+        Square150x150Logo="Assets\Square150x150Logo.png"
+        Square44x44Logo="Assets\Square44x44Logo.png"
+        Description="TemplateApp"
+        BackgroundColor="transparent">
+        <uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
+        <uap:SplashScreen Image="Assets\SplashScreen.png" />
+      </uap:VisualElements>
+    </Application>
+  </Applications>
+
+  <Capabilities>
+    <Capability Name="internetClient" />
+  </Capabilities>
+</Package>

+ 249 - 0
build/windows/universal/TemplateApp/TemplateApp.vcxproj

@@ -0,0 +1,249 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|ARM">
+      <Configuration>Debug</Configuration>
+      <Platform>ARM</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|ARM">
+      <Configuration>Release</Configuration>
+      <Platform>ARM</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{53c60437-81ff-472c-9d97-83445bff7109}</ProjectGuid>
+    <Keyword>DirectXApp</Keyword>
+    <RootNamespace>TemplateApp</RootNamespace>
+    <DefaultLanguage>en-US</DefaultLanguage>
+    <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
+    <AppContainerApplication>true</AppContainerApplication>
+    <ApplicationType>Windows Store</ApplicationType>
+    <WindowsTargetPlatformVersion>10.0.10240.0</WindowsTargetPlatformVersion>
+    <WindowsTargetPlatformMinVersion>10.0.10240.0</WindowsTargetPlatformMinVersion>
+    <ApplicationTypeRevision>10.0</ApplicationTypeRevision>
+    <EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <PlatformToolset>v140</PlatformToolset>
+    <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <PlatformToolset>v140</PlatformToolset>
+    <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <PlatformToolset>v140</PlatformToolset>
+    <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+    <Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ImageContentTask.props" />
+    <Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\MeshContentTask.props" />
+    <Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ShaderGraphContentTask.props" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    
+    <PackageCertificateKeyFile>TemplateApp_TemporaryKey.pfx</PackageCertificateKeyFile>
+    
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
+    <Link>
+      <AdditionalDependencies>mincore.lib;d3d12.lib;dxgi.lib;windowscodecs.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm</AdditionalLibraryDirectories>
+    </Link>
+    <ClCompile>
+      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+      <PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
+    <Link>
+      <AdditionalDependencies>mincore.lib;d3d12.lib;dxgi.lib;windowscodecs.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm</AdditionalLibraryDirectories>
+    </Link>
+    <ClCompile>
+      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+      <PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Link>
+      <AdditionalDependencies>mincore.lib;d3d12.lib;dxgi.lib;windowscodecs.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib</AdditionalLibraryDirectories>
+    </Link>
+    <ClCompile>
+      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+      <PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Link>
+      <AdditionalDependencies>mincore.lib;d3d12.lib;dxgi.lib;windowscodecs.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib</AdditionalLibraryDirectories>
+    </Link>
+    <ClCompile>
+      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+      <PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Link>
+      <AdditionalDependencies>d3d12.lib;dxgi.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64</AdditionalLibraryDirectories>
+    </Link>
+    <ClCompile>
+      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+      <PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Link>
+      <AdditionalDependencies>mincore.lib;d3d12.lib;dxgi.lib;windowscodecs.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64</AdditionalLibraryDirectories>
+    </Link>
+    <ClCompile>
+      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+      <PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <Image Include="Assets\LockScreenLogo.scale-200.png" />
+    <Image Include="Assets\SplashScreen.scale-200.png" />
+    <Image Include="Assets\Square150x150Logo.scale-200.png" />
+    <Image Include="Assets\Square44x44Logo.scale-200.png" />
+    <Image Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
+    <Image Include="Assets\StoreLogo.png" />
+    <Image Include="Assets\Wide310x150Logo.scale-200.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="App.h" />
+    <ClInclude Include="Common\d3dx12.h" />
+    <ClInclude Include="Common\DeviceResources.h" />
+    <ClInclude Include="TemplateAppMain.h" />
+    <ClInclude Include="Common\DirectXHelper.h" />
+    <ClInclude Include="Common\StepTimer.h" />
+    <ClInclude Include="Content\Sample3DSceneRenderer.h" />
+    <ClInclude Include="Content\ShaderStructures.h" />
+    <ClInclude Include="pch.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="App.cpp" />
+    <ClCompile Include="Common\DeviceResources.cpp" />
+    <ClCompile Include="TemplateAppMain.cpp" />
+    <ClCompile Include="Content\Sample3DSceneRenderer.cpp" />
+    <ClCompile Include="pch.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <AppxManifest Include="Package.appxmanifest">
+      <SubType>Designer</SubType>
+    </AppxManifest>
+    
+    <None Include="TemplateApp_TemporaryKey.pfx" />
+    
+  </ItemGroup>
+  <ItemGroup>
+    <FxCompile Include="Content\SamplePixelShader.hlsl">
+      <ShaderType>Pixel</ShaderType>
+    </FxCompile>
+    <FxCompile Include="Content\SampleVertexShader.hlsl">
+      <ShaderType>Vertex</ShaderType>
+    </FxCompile>
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+    <Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ImageContentTask.targets" />
+    <Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\MeshContentTask.targets" />
+    <Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ShaderGraphContentTask.targets" />
+  </ImportGroup>
+</Project>

+ 66 - 0
build/windows/universal/TemplateApp/TemplateApp.vcxproj.filters

@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Common">
+      <UniqueIdentifier>53c60437-81ff-472c-9d97-83445bff7109</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Assets">
+      <UniqueIdentifier>a4d7a1bf-7e7e-4369-9f98-0399a4b47842</UniqueIdentifier>
+      <Extensions>bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png</Extensions>
+    </Filter>
+    <Filter Include="Content">
+      <UniqueIdentifier>a6e56e60-e209-4f42-8c1c-a4a01738d7bc</UniqueIdentifier>
+    </Filter>
+    <ClInclude Include="Common\d3dx12.h">
+      <Filter>Common</Filter>
+    </ClInclude>
+    <ClInclude Include="Common\DirectXHelper.h">
+      <Filter>Common</Filter>
+    </ClInclude>
+    <ClInclude Include="Common\StepTimer.h">
+      <Filter>Common</Filter>
+    </ClInclude>
+    <ClInclude Include="Common\DeviceResources.h">
+      <Filter>Common</Filter>
+    </ClInclude>
+    <ClCompile Include="Common\DeviceResources.cpp">
+      <Filter>Common</Filter>
+    </ClCompile>
+    <ClInclude Include="Content\Sample3DSceneRenderer.h">
+      <Filter>Content</Filter>
+    </ClInclude>
+    <ClInclude Include="Content\ShaderStructures.h">
+      <Filter>Content</Filter>
+    </ClInclude>
+    <ClCompile Include="Content\Sample3DSceneRenderer.cpp">
+      <Filter>Content</Filter>
+    </ClCompile>
+    <FxCompile Include="Content\SamplePixelShader.hlsl">
+      <Filter>Content</Filter>
+    </FxCompile>
+    <FxCompile Include="Content\SampleVertexShader.hlsl">
+      <Filter>Content</Filter>
+    </FxCompile>
+    <Image Include="Assets\LockScreenLogo.scale-200.png">
+      <Filter>Assets</Filter>
+    </Image>
+    <Image Include="Assets\SplashScreen.scale-200.png">
+      <Filter>Assets</Filter>
+    </Image>
+    <Image Include="Assets\Square150x150Logo.scale-200.png">
+      <Filter>Assets</Filter>
+    </Image>
+    <Image Include="Assets\Square44x44Logo.scale-200.png">
+      <Filter>Assets</Filter>
+    </Image>
+    <Image Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png">
+      <Filter>Assets</Filter>
+    </Image>
+    <Image Include="Assets\StoreLogo.png">
+      <Filter>Assets</Filter>
+    </Image>
+    <Image Include="Assets\Wide310x150Logo.scale-200.png">
+      <Filter>Assets</Filter>
+    </Image>
+  </ItemGroup>
+</Project>

+ 92 - 0
build/windows/universal/TemplateApp/TemplateAppMain.cpp

@@ -0,0 +1,92 @@
+#include "pch.h"
+#include "TemplateAppMain.h"
+#include "Common\DirectXHelper.h"
+
+using namespace TemplateApp;
+using namespace Windows::Foundation;
+using namespace Windows::System::Threading;
+using namespace Concurrency;
+
+// The DirectX 12 Application template is documented at http://go.microsoft.com/fwlink/?LinkID=613670&clcid=0x409
+
+// Loads and initializes application assets when the application is loaded.
+TemplateAppMain::TemplateAppMain()
+{
+	// TODO: Change the timer settings if you want something other than the default variable timestep mode.
+	// e.g. for 60 FPS fixed timestep update logic, call:
+	/*
+	m_timer.SetFixedTimeStep(true);
+	m_timer.SetTargetElapsedSeconds(1.0 / 60);
+	*/
+}
+
+// Creates and initializes the renderers.
+void TemplateAppMain::CreateRenderers(const std::shared_ptr<DX::DeviceResources>& deviceResources)
+{
+	// TODO: Replace this with your app's content initialization.
+	m_sceneRenderer = std::unique_ptr<Sample3DSceneRenderer>(new Sample3DSceneRenderer(deviceResources));
+
+	OnWindowSizeChanged();
+}
+
+// Updates the application state once per frame.
+void TemplateAppMain::Update()
+{
+	// Update scene objects.
+	m_timer.Tick([&]()
+	{
+		// TODO: Replace this with your app's content update functions.
+		m_sceneRenderer->Update(m_timer);
+	});
+}
+
+// Renders the current frame according to the current application state.
+// Returns true if the frame was rendered and is ready to be displayed.
+bool TemplateAppMain::Render()
+{
+	// Don't try to render anything before the first Update.
+	if (m_timer.GetFrameCount() == 0)
+	{
+		return false;
+	}
+
+	// Render the scene objects.
+	// TODO: Replace this with your app's content rendering functions.
+	return m_sceneRenderer->Render();
+}
+
+// Updates application state when the window's size changes (e.g. device orientation change)
+void TemplateAppMain::OnWindowSizeChanged()
+{
+	// TODO: Replace this with the size-dependent initialization of your app's content.
+	m_sceneRenderer->CreateWindowSizeDependentResources();
+}
+
+// Notifies the app that it is being suspended.
+void TemplateAppMain::OnSuspending()
+{
+	// TODO: Replace this with your app's suspending logic.
+
+	// Process lifetime management may terminate suspended apps at any time, so it is
+	// good practice to save any state that will allow the app to restart where it left off.
+
+	m_sceneRenderer->SaveState();
+
+	// If your application uses video memory allocations that are easy to re-create,
+	// consider releasing that memory to make it available to other applications.
+}
+
+// Notifes the app that it is no longer suspended.
+void TemplateAppMain::OnResuming()
+{
+	// TODO: Replace this with your app's resuming logic.
+}
+
+// Notifies renderers that device resources need to be released.
+void TemplateAppMain::OnDeviceRemoved()
+{
+	// TODO: Save any necessary application or renderer state and release the renderer
+	// and its resources which are no longer valid.
+	m_sceneRenderer->SaveState();
+	m_sceneRenderer = nullptr;
+}

+ 30 - 0
build/windows/universal/TemplateApp/TemplateAppMain.h

@@ -0,0 +1,30 @@
+#pragma once
+
+#include "Common\StepTimer.h"
+#include "Common\DeviceResources.h"
+#include "Content\Sample3DSceneRenderer.h"
+
+// Renders Direct3D content on the screen.
+namespace TemplateApp
+{
+	class TemplateAppMain
+	{
+	public:
+		TemplateAppMain();
+		void CreateRenderers(const std::shared_ptr<DX::DeviceResources>& deviceResources);
+		void Update();
+		bool Render();
+
+		void OnWindowSizeChanged();
+		void OnSuspending();
+		void OnResuming();
+		void OnDeviceRemoved();
+
+	private:
+		// TODO: Replace with your own content renderers.
+		std::unique_ptr<Sample3DSceneRenderer> m_sceneRenderer;
+
+		// Rendering loop timer.
+		DX::StepTimer m_timer;
+	};
+}

+ 1 - 0
build/windows/universal/TemplateApp/pch.cpp

@@ -0,0 +1 @@
+#include "pch.h"

+ 15 - 0
build/windows/universal/TemplateApp/pch.h

@@ -0,0 +1,15 @@
+#pragma once
+
+#include <wrl.h>
+#include <wrl/client.h>
+#include <d3d12.h>
+#include "Common\d3dx12.h"
+#include <dxgi1_4.h>
+#include <d3d11_3.h>
+#include <pix.h>
+#include <DirectXColors.h>
+#include <DirectXMath.h>
+#include <memory>
+#include <vector>
+#include <agile.h>
+#include <concrt.h>