Browse Source

More UWP stuff, removed debug dependencies

Ivan Safrin 10 years ago
parent
commit
21bff15725
78 changed files with 1883 additions and 3473 deletions
  1. 19 19
      build/windows/universal/Polycode.sln
  2. 3 1
      build/windows/universal/PolycodeCore/PolycodeCore.vcxproj
  3. 6 0
      build/windows/universal/PolycodeCore/PolycodeCore.vcxproj.filters
  4. 0 217
      build/windows/universal/TemplateApp/App.cpp
  5. 0 53
      build/windows/universal/TemplateApp/App.h
  6. 8 0
      build/windows/universal/TemplateApp/App.xaml
  7. 120 0
      build/windows/universal/TemplateApp/App.xaml.cpp
  8. 27 0
      build/windows/universal/TemplateApp/App.xaml.h
  9. 0 476
      build/windows/universal/TemplateApp/Common/DeviceResources.cpp
  10. 0 80
      build/windows/universal/TemplateApp/Common/DeviceResources.h
  11. 0 42
      build/windows/universal/TemplateApp/Common/DirectXHelper.h
  12. 0 183
      build/windows/universal/TemplateApp/Common/StepTimer.h
  13. 0 1478
      build/windows/universal/TemplateApp/Common/d3dx12.h
  14. 0 489
      build/windows/universal/TemplateApp/Content/Sample3DSceneRenderer.cpp
  15. 0 61
      build/windows/universal/TemplateApp/Content/Sample3DSceneRenderer.h
  16. 0 12
      build/windows/universal/TemplateApp/Content/SamplePixelShader.hlsl
  17. 0 39
      build/windows/universal/TemplateApp/Content/SampleVertexShader.hlsl
  18. 0 19
      build/windows/universal/TemplateApp/Content/ShaderStructures.h
  19. 27 0
      build/windows/universal/TemplateApp/Generated Files/App.g.h
  20. 96 0
      build/windows/universal/TemplateApp/Generated Files/App.g.hpp
  21. 9 0
      build/windows/universal/TemplateApp/Generated Files/App.xaml
  22. BIN
      build/windows/universal/TemplateApp/Generated Files/App.xbf
  23. 28 0
      build/windows/universal/TemplateApp/Generated Files/MainPage.g.h
  24. 40 0
      build/windows/universal/TemplateApp/Generated Files/MainPage.g.hpp
  25. 14 0
      build/windows/universal/TemplateApp/Generated Files/MainPage.xaml
  26. BIN
      build/windows/universal/TemplateApp/Generated Files/MainPage.xbf
  27. 57 0
      build/windows/universal/TemplateApp/Generated Files/XamlBindingInfo.g.h
  28. 13 0
      build/windows/universal/TemplateApp/Generated Files/XamlBindingInfo.g.hpp
  29. 2 0
      build/windows/universal/TemplateApp/Generated Files/XamlLibMetadataProvider.g.cpp
  30. 544 0
      build/windows/universal/TemplateApp/Generated Files/XamlTypeInfo.Impl.g.cpp
  31. 98 0
      build/windows/universal/TemplateApp/Generated Files/XamlTypeInfo.g.cpp
  32. 343 0
      build/windows/universal/TemplateApp/Generated Files/XamlTypeInfo.g.h
  33. 13 0
      build/windows/universal/TemplateApp/MainPage.xaml
  34. 27 0
      build/windows/universal/TemplateApp/MainPage.xaml.cpp
  35. 21 0
      build/windows/universal/TemplateApp/MainPage.xaml.h
  36. 2 2
      build/windows/universal/TemplateApp/Package.appxmanifest
  37. 31 0
      build/windows/universal/TemplateApp/PolycodeTemplateApp.cpp
  38. 18 0
      build/windows/universal/TemplateApp/PolycodeTemplateApp.h
  39. 99 114
      build/windows/universal/TemplateApp/TemplateApp.vcxproj
  40. 29 36
      build/windows/universal/TemplateApp/TemplateApp.vcxproj.filters
  41. 0 92
      build/windows/universal/TemplateApp/TemplateAppMain.cpp
  42. 0 30
      build/windows/universal/TemplateApp/TemplateAppMain.h
  43. 6 1
      build/windows/universal/TemplateApp/pch.cpp
  44. 10 14
      build/windows/universal/TemplateApp/pch.h
  45. 5 4
      include/Polycode.h
  46. 3 2
      include/polycode/core/PolyFont.h
  47. 3 1
      include/polycode/core/PolyFontGlyphSheet.h
  48. 2 0
      include/polycode/core/PolyFontManager.h
  49. 1 1
      include/polycode/core/PolyGlobals.h
  50. 44 0
      include/polycode/core/PolyUWPCore.h
  51. 2 1
      include/polycode/core/PolyVector3.h
  52. BIN
      lib/windows/x64/OpenAL32d.lib
  53. BIN
      lib/windows/x64/Polycored.lib
  54. BIN
      lib/windows/x64/freetype_d.lib
  55. BIN
      lib/windows/x64/liboggd.lib
  56. BIN
      lib/windows/x64/libpng15_staticd.lib
  57. BIN
      lib/windows/x64/libvorbisd.lib
  58. BIN
      lib/windows/x64/libvorbisfiled.lib
  59. BIN
      lib/windows/x64/lua5.1d.lib
  60. BIN
      lib/windows/x64/physfsd.lib
  61. BIN
      lib/windows/x64/zlibd.lib
  62. BIN
      lib/windows/x86/OpenAL32d.lib
  63. BIN
      lib/windows/x86/freetype_d.lib
  64. BIN
      lib/windows/x86/liboggd.lib
  65. BIN
      lib/windows/x86/libpng15_staticd.lib
  66. BIN
      lib/windows/x86/libvorbisd.lib
  67. BIN
      lib/windows/x86/libvorbisfiled.lib
  68. BIN
      lib/windows/x86/lua5.1d.lib
  69. BIN
      lib/windows/x86/physfsd.lib
  70. BIN
      lib/windows/x86/zlibd.lib
  71. 1 0
      src/core/PolyClient.cpp
  72. 3 2
      src/core/PolyCore.cpp
  73. 1 0
      src/core/PolyPeer.cpp
  74. 1 0
      src/core/PolyServer.cpp
  75. 1 1
      src/core/PolySocket.cpp
  76. 7 2
      src/core/PolySound.cpp
  77. 2 1
      src/core/PolyString.cpp
  78. 97 0
      src/core/PolyUWPCore.cpp

+ 19 - 19
build/windows/universal/Polycode.sln

@@ -5,7 +5,7 @@ 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}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TemplateApp", "TemplateApp\TemplateApp.vcxproj", "{06B5F55D-2971-4458-A612-348ECD8AD7DF}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -29,24 +29,24 @@ Global
 		{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
+		{06B5F55D-2971-4458-A612-348ECD8AD7DF}.Debug|ARM.ActiveCfg = Debug|ARM
+		{06B5F55D-2971-4458-A612-348ECD8AD7DF}.Debug|ARM.Build.0 = Debug|ARM
+		{06B5F55D-2971-4458-A612-348ECD8AD7DF}.Debug|ARM.Deploy.0 = Debug|ARM
+		{06B5F55D-2971-4458-A612-348ECD8AD7DF}.Debug|x64.ActiveCfg = Debug|x64
+		{06B5F55D-2971-4458-A612-348ECD8AD7DF}.Debug|x64.Build.0 = Debug|x64
+		{06B5F55D-2971-4458-A612-348ECD8AD7DF}.Debug|x64.Deploy.0 = Debug|x64
+		{06B5F55D-2971-4458-A612-348ECD8AD7DF}.Debug|x86.ActiveCfg = Debug|Win32
+		{06B5F55D-2971-4458-A612-348ECD8AD7DF}.Debug|x86.Build.0 = Debug|Win32
+		{06B5F55D-2971-4458-A612-348ECD8AD7DF}.Debug|x86.Deploy.0 = Debug|Win32
+		{06B5F55D-2971-4458-A612-348ECD8AD7DF}.Release|ARM.ActiveCfg = Release|ARM
+		{06B5F55D-2971-4458-A612-348ECD8AD7DF}.Release|ARM.Build.0 = Release|ARM
+		{06B5F55D-2971-4458-A612-348ECD8AD7DF}.Release|ARM.Deploy.0 = Release|ARM
+		{06B5F55D-2971-4458-A612-348ECD8AD7DF}.Release|x64.ActiveCfg = Release|x64
+		{06B5F55D-2971-4458-A612-348ECD8AD7DF}.Release|x64.Build.0 = Release|x64
+		{06B5F55D-2971-4458-A612-348ECD8AD7DF}.Release|x64.Deploy.0 = Release|x64
+		{06B5F55D-2971-4458-A612-348ECD8AD7DF}.Release|x86.ActiveCfg = Release|Win32
+		{06B5F55D-2971-4458-A612-348ECD8AD7DF}.Release|x86.Build.0 = Release|Win32
+		{06B5F55D-2971-4458-A612-348ECD8AD7DF}.Release|x86.Deploy.0 = Release|Win32
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 3 - 1
build/windows/universal/PolycodeCore/PolycodeCore.vcxproj

@@ -91,6 +91,7 @@
     <ClCompile Include="..\..\..\..\src\core\PolyTimerManager.cpp" />
     <ClCompile Include="..\..\..\..\src\core\PolyTween.cpp" />
     <ClCompile Include="..\..\..\..\src\core\PolyTweenManager.cpp" />
+    <ClCompile Include="..\..\..\..\src\core\PolyUWPCore.cpp" />
     <ClCompile Include="..\..\..\..\src\core\PolyVector2.cpp" />
     <ClCompile Include="..\..\..\..\src\core\PolyVector3.cpp" />
     <ClCompile Include="..\..\..\..\src\core\PolyVector4.cpp" />
@@ -170,6 +171,7 @@
     <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\PolyUWPCore.h" />
     <ClInclude Include="..\..\..\..\include\polycode\core\PolyVector2.h" />
     <ClInclude Include="..\..\..\..\include\polycode\core\PolyVector3.h" />
     <ClInclude Include="..\..\..\..\include\polycode\core\PolyVector4.h" />
@@ -336,7 +338,7 @@
       <PrecompiledHeader>NotUsing</PrecompiledHeader>
       <CompileAsWinRT>false</CompileAsWinRT>
       <SDLCheck>true</SDLCheck>
-      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_WINDOWS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <Link>
       <SubSystem>Console</SubSystem>

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

@@ -229,6 +229,9 @@
     <ClCompile Include="..\..\..\..\src\core\tinyxmlparser.cpp">
       <Filter>Source</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\..\..\src\core\PolyUWPCore.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\..\..\include\Polycode.h">
@@ -459,5 +462,8 @@
     <ClInclude Include="..\..\..\..\include\polycode\core\tinyxml.h">
       <Filter>Include</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\..\..\include\polycode\core\PolyUWPCore.h">
+      <Filter>Include</Filter>
+    </ClInclude>
   </ItemGroup>
 </Project>

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

@@ -1,217 +0,0 @@
-#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;
-}

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

@@ -1,53 +0,0 @@
-#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();
-};

+ 8 - 0
build/windows/universal/TemplateApp/App.xaml

@@ -0,0 +1,8 @@
+<Application
+    x:Class="TemplateApp.App"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:local="using:TemplateApp"
+    RequestedTheme="Light">
+
+</Application>

+ 120 - 0
build/windows/universal/TemplateApp/App.xaml.cpp

@@ -0,0 +1,120 @@
+//
+// App.xaml.cpp
+// Implementation of the App class.
+//
+
+#include "pch.h"
+#include "MainPage.xaml.h"
+
+using namespace TemplateApp;
+
+using namespace Platform;
+using namespace Windows::ApplicationModel;
+using namespace Windows::ApplicationModel::Activation;
+using namespace Windows::Foundation;
+using namespace Windows::Foundation::Collections;
+using namespace Windows::UI::Xaml;
+using namespace Windows::UI::Xaml::Controls;
+using namespace Windows::UI::Xaml::Controls::Primitives;
+using namespace Windows::UI::Xaml::Data;
+using namespace Windows::UI::Xaml::Input;
+using namespace Windows::UI::Xaml::Interop;
+using namespace Windows::UI::Xaml::Media;
+using namespace Windows::UI::Xaml::Navigation;
+
+/// <summary>
+/// Initializes the singleton application object.  This is the first line of authored code
+/// executed, and as such is the logical equivalent of main() or WinMain().
+/// </summary>
+App::App()
+{
+	InitializeComponent();
+	Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
+}
+
+/// <summary>
+/// Invoked when the application is launched normally by the end user.	Other entry points
+/// will be used such as when the application is launched to open a specific file.
+/// </summary>
+/// <param name="e">Details about the launch request and process.</param>
+void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e)
+{
+
+#if _DEBUG
+		// Show graphics profiling information while debugging.
+		if (IsDebuggerPresent())
+		{
+			// Display the current frame rate counters
+			 DebugSettings->EnableFrameRateCounter = true;
+		}
+#endif
+
+	auto rootFrame = dynamic_cast<Frame^>(Window::Current->Content);
+
+	// Do not repeat app initialization when the Window already has content,
+	// just ensure that the window is active
+	if (rootFrame == nullptr)
+	{
+		// Create a Frame to act as the navigation context and associate it with
+		// a SuspensionManager key
+		rootFrame = ref new Frame();
+
+		rootFrame->NavigationFailed += ref new Windows::UI::Xaml::Navigation::NavigationFailedEventHandler(this, &App::OnNavigationFailed);
+
+		if (e->PreviousExecutionState == ApplicationExecutionState::Terminated)
+		{
+			// TODO: Restore the saved session state only when appropriate, scheduling the
+			// final launch steps after the restore is complete
+
+		}
+
+		if (rootFrame->Content == nullptr)
+		{
+			// When the navigation stack isn't restored navigate to the first page,
+			// configuring the new page by passing required information as a navigation
+			// parameter
+			rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments);
+		}
+		// Place the frame in the current Window
+		Window::Current->Content = rootFrame;
+		// Ensure the current window is active
+		Window::Current->Activate();
+	}
+	else
+	{
+		if (rootFrame->Content == nullptr)
+		{
+			// When the navigation stack isn't restored navigate to the first page,
+			// configuring the new page by passing required information as a navigation
+			// parameter
+			rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments);
+		}
+		// Ensure the current window is active
+		Window::Current->Activate();
+	}
+}
+
+/// <summary>
+/// Invoked when application execution is being suspended.	Application state is saved
+/// without knowing whether the application will be terminated or resumed with the contents
+/// of memory still intact.
+/// </summary>
+/// <param name="sender">The source of the suspend request.</param>
+/// <param name="e">Details about the suspend request.</param>
+void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e)
+{
+	(void) sender;	// Unused parameter
+	(void) e;	// Unused parameter
+
+	//TODO: Save application state and stop any background activity
+}
+
+/// <summary>
+/// Invoked when Navigation to a certain page fails
+/// </summary>
+/// <param name="sender">The Frame which failed navigation</param>
+/// <param name="e">Details about the navigation failure</param>
+void App::OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e)
+{
+	throw ref new FailureException("Failed to load Page " + e->SourcePageType.Name);
+}

+ 27 - 0
build/windows/universal/TemplateApp/App.xaml.h

@@ -0,0 +1,27 @@
+//
+// App.xaml.h
+// Declaration of the App class.
+//
+
+#pragma once
+
+#include "App.g.h"
+
+namespace TemplateApp
+{
+	/// <summary>
+	/// Provides application-specific behavior to supplement the default Application class.
+	/// </summary>
+	ref class App sealed
+	{
+	protected:
+		virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) override;
+
+	internal:
+		App();
+
+	private:
+		void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e);
+		void OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e);
+	};
+}

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

@@ -1,476 +0,0 @@
-#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;
-}

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

@@ -1,80 +0,0 @@
-#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;
-	};
-}

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

@@ -1,42 +0,0 @@
-#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.
-	}
-}

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

@@ -1,183 +0,0 @@
-#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;
-	};
-}

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

@@ -1,1478 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-//
-//  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__
-
-
-

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

@@ -1,489 +0,0 @@
-#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;
-}

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

@@ -1,61 +0,0 @@
-#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;
-	};
-}
-

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

@@ -1,12 +0,0 @@
-// 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);
-}

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

@@ -1,39 +0,0 @@
-// 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;
-}

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

@@ -1,19 +0,0 @@
-#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;
-	};
-}

+ 27 - 0
build/windows/universal/TemplateApp/Generated Files/App.g.h

@@ -0,0 +1,27 @@
+#pragma once
+//------------------------------------------------------------------------------
+//     This code was generated by a tool.
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+//------------------------------------------------------------------------------
+
+#include "XamlTypeInfo.g.h"
+
+namespace TemplateApp
+{
+    partial ref class App :  public ::Windows::UI::Xaml::Application,
+        public ::Windows::UI::Xaml::Markup::IXamlMetadataProvider
+    {
+    public:
+        void InitializeComponent();
+        [Windows::Foundation::Metadata::DefaultOverload]
+        virtual ::Windows::UI::Xaml::Markup::IXamlType^ GetXamlType(::Windows::UI::Xaml::Interop::TypeName type);
+        virtual ::Windows::UI::Xaml::Markup::IXamlType^ GetXamlType(::Platform::String^ fullName);
+        virtual ::Platform::Array<::Windows::UI::Xaml::Markup::XmlnsDefinition>^ GetXmlnsDefinitions();
+    private:
+        ::XamlTypeInfo::InfoProvider::XamlTypeInfoProvider^ _provider;
+        bool _contentLoaded;
+    };
+}
+

+ 96 - 0
build/windows/universal/TemplateApp/Generated Files/App.g.hpp

@@ -0,0 +1,96 @@
+//------------------------------------------------------------------------------
+//     This code was generated by a tool.
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+//------------------------------------------------------------------------------
+
+#include "pch.h"
+#include "App.xaml.h"
+
+
+#if defined _DEBUG && !defined DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
+extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
+#endif
+
+#if (defined(_M_IX86) || defined(_M_AMD64)) && !defined(_VSDESIGNER_DONT_LOAD_AS_DLL)
+#if defined(_M_IX86)
+#pragma comment(linker, "/EXPORT:DllGetActivationFactory=_DllGetActivationFactory@8,PRIVATE")
+#pragma comment(linker, "/EXPORT:DllCanUnloadNow=_DllCanUnloadNow@0,PRIVATE")
+#pragma comment(linker, "/EXPORT:VSDesignerDllMain=_VSDesignerDllMain@12,PRIVATE")
+#pragma comment(linker, "/INCLUDE:___refMTAThread")
+#elif defined(_M_AMD64)
+#pragma comment(linker, "/EXPORT:DllGetActivationFactory=DllGetActivationFactory,PRIVATE")
+#pragma comment(linker, "/EXPORT:DllCanUnloadNow,PRIVATE")
+#pragma comment(linker, "/EXPORT:VSDesignerDllMain,PRIVATE")
+#pragma comment(linker, "/INCLUDE:__refMTAThread")
+#endif
+
+extern int __abi___threading_model;
+
+extern "C"
+{
+    int __stdcall _DllMainCRTStartup(void* hinstDLL, unsigned long fdwReason, void** lpvReserved);
+
+    int __stdcall VSDesignerDllMain(void* hinstDLL, unsigned long fdwReason, void** lpvReserved)
+    {
+        __abi___threading_model = _VCCORLIB_THREADING_MODEL_OVERRIDE;
+        return _DllMainCRTStartup(hinstDLL, fdwReason, lpvReserved);
+    }
+}
+
+#endif // (defined(_M_IX86) || defined(_M_AMD64)) && !defined(_VSDESIGNER_DONT_LOAD_AS_DLL)
+
+void ::TemplateApp::App::InitializeComponent()
+{
+#if defined _DEBUG && !defined DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
+    UnhandledException += ref new ::Windows::UI::Xaml::UnhandledExceptionEventHandler(
+        [](::Platform::Object^ sender, ::Windows::UI::Xaml::UnhandledExceptionEventArgs^ e)
+        {
+            (void)sender; // Unused parameter
+            if (IsDebuggerPresent())
+            {
+                ::Platform::String^ errorMessage = e->Message;
+                __debugbreak();
+            }
+        });
+#endif
+}
+
+
+::Windows::UI::Xaml::Markup::IXamlType^ ::TemplateApp::App::GetXamlType(::Windows::UI::Xaml::Interop::TypeName type)
+{
+    if(_provider == nullptr)
+    {
+        _provider = ref new XamlTypeInfo::InfoProvider::XamlTypeInfoProvider();
+    }
+    return _provider->GetXamlTypeByType(type);
+}
+
+::Windows::UI::Xaml::Markup::IXamlType^ ::TemplateApp::App::GetXamlType(::Platform::String^ fullName)
+{
+    if(_provider == nullptr)
+    {
+        _provider = ref new XamlTypeInfo::InfoProvider::XamlTypeInfoProvider();
+    }
+    return _provider->GetXamlTypeByName(fullName);
+}
+
+::Platform::Array<::Windows::UI::Xaml::Markup::XmlnsDefinition>^ ::TemplateApp::App::GetXmlnsDefinitions()
+{
+    return ref new ::Platform::Array<::Windows::UI::Xaml::Markup::XmlnsDefinition>(0);
+}
+
+#ifndef DISABLE_XAML_GENERATED_MAIN
+int __cdecl main(::Platform::Array<::Platform::String^>^ args)
+{
+    (void)args; // Unused parameter
+    ::Windows::UI::Xaml::Application::Start(ref new ::Windows::UI::Xaml::ApplicationInitializationCallback(
+        [](::Windows::UI::Xaml::ApplicationInitializationCallbackParams^ p) {
+            (void)p; // Unused parameter
+            auto app = ref new ::TemplateApp::App();
+        }));
+}
+#endif
+
+

+ 9 - 0
build/windows/universal/TemplateApp/Generated Files/App.xaml

@@ -0,0 +1,9 @@
+<Application
+    x:Class="TemplateApp.App"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:local="using:TemplateApp"
+    RequestedTheme="Light">
+
+</Application>
+

BIN
build/windows/universal/TemplateApp/Generated Files/App.xbf


+ 28 - 0
build/windows/universal/TemplateApp/Generated Files/MainPage.g.h

@@ -0,0 +1,28 @@
+#pragma once
+//------------------------------------------------------------------------------
+//     This code was generated by a tool.
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+//------------------------------------------------------------------------------
+
+
+
+namespace TemplateApp
+{
+    [::Windows::Foundation::Metadata::WebHostHidden]
+    partial ref class MainPage : public ::Windows::UI::Xaml::Controls::Page, 
+        public ::Windows::UI::Xaml::Markup::IComponentConnector,
+        public ::Windows::UI::Xaml::Markup::IComponentConnector2
+    {
+    public:
+        void InitializeComponent();
+        virtual void Connect(int connectionId, ::Platform::Object^ target);
+        virtual ::Windows::UI::Xaml::Markup::IComponentConnector^ GetBindingConnector(int connectionId, ::Platform::Object^ target);
+    
+    private:
+        bool _contentLoaded;
+    
+    };
+}
+

+ 40 - 0
build/windows/universal/TemplateApp/Generated Files/MainPage.g.hpp

@@ -0,0 +1,40 @@
+//------------------------------------------------------------------------------
+//     This code was generated by a tool.
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+//------------------------------------------------------------------------------
+#include "pch.h"
+
+#if defined _DEBUG && !defined DISABLE_XAML_GENERATED_BINDING_DEBUG_OUTPUT
+extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
+#endif
+
+#include "MainPage.xaml.h"
+
+void ::TemplateApp::MainPage::InitializeComponent()
+{
+    if (_contentLoaded)
+    {
+        return;
+    }
+    _contentLoaded = true;
+    ::Windows::Foundation::Uri^ resourceLocator = ref new ::Windows::Foundation::Uri(L"ms-appx:///MainPage.xaml");
+    ::Windows::UI::Xaml::Application::LoadComponent(this, resourceLocator, ::Windows::UI::Xaml::Controls::Primitives::ComponentResourceLocation::Application);
+}
+
+void ::TemplateApp::MainPage::Connect(int __connectionId, ::Platform::Object^ __target)
+{
+    __connectionId;         // unreferenced 
+    __target;               // unreferenced
+    _contentLoaded = true;
+}
+
+::Windows::UI::Xaml::Markup::IComponentConnector^ ::TemplateApp::MainPage::GetBindingConnector(int __connectionId, ::Platform::Object^ __target)
+{
+    __connectionId;         // unreferenced
+    __target;               // unreferenced
+    return nullptr;
+}
+
+

+ 14 - 0
build/windows/universal/TemplateApp/Generated Files/MainPage.xaml

@@ -0,0 +1,14 @@
+<Page
+    x:Class="TemplateApp.MainPage"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:local="using:TemplateApp"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    mc:Ignorable="d">
+
+    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
+
+    </Grid>
+</Page>
+

BIN
build/windows/universal/TemplateApp/Generated Files/MainPage.xbf


+ 57 - 0
build/windows/universal/TemplateApp/Generated Files/XamlBindingInfo.g.h

@@ -0,0 +1,57 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+#pragma once
+
+namespace XamlBindingInfo
+{
+    ref class XamlBindings;
+
+    class IXamlBindings
+    {
+    public:
+        virtual ~IXamlBindings() {};
+        virtual bool IsInitialized() = 0;
+        virtual void Update() = 0;
+        virtual bool SetDataRoot(::Platform::Object^ data) = 0;
+        virtual void StopTracking() = 0;
+        virtual void Connect(int connectionId, ::Platform::Object^ target) = 0;
+        virtual void ResetTemplate() = 0;
+        virtual int ProcessBindings(::Windows::UI::Xaml::Controls::ContainerContentChangingEventArgs^ args) = 0;
+        virtual void SubscribeForDataContextChanged(::Windows::UI::Xaml::FrameworkElement^ object, ::XamlBindingInfo::XamlBindings^ handler) = 0;
+    };
+
+    ref class XamlBindings sealed : 
+        ::Windows::UI::Xaml::IDataTemplateExtension, 
+        ::Windows::UI::Xaml::Markup::IComponentConnector
+    {
+    internal:
+        XamlBindings(::XamlBindingInfo::IXamlBindings* pBindings);
+        void Initialize();
+        void Update();
+        void StopTracking();
+        void Loading(::Windows::UI::Xaml::FrameworkElement^ src, ::Platform::Object^ data);
+        void DataContextChanged(::Windows::UI::Xaml::FrameworkElement^ sender, ::Windows::UI::Xaml::DataContextChangedEventArgs^ args);
+        void SubscribeForDataContextChanged(::Windows::UI::Xaml::FrameworkElement^ object);
+
+    public:
+        // IComponentConnector
+        virtual void Connect(int connectionId, ::Platform::Object^ target);
+
+        // IDataTemplateExtension
+        virtual bool ProcessBinding(unsigned int);
+        virtual int ProcessBindings(::Windows::UI::Xaml::Controls::ContainerContentChangingEventArgs^ args);
+        virtual void ResetTemplate();
+
+    private:
+        ~XamlBindings();
+
+        IXamlBindings* _pBindings = nullptr;
+    };
+}
+

+ 13 - 0
build/windows/universal/TemplateApp/Generated Files/XamlBindingInfo.g.hpp

@@ -0,0 +1,13 @@
+
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+#include "pch.h"
+
+
+

+ 2 - 0
build/windows/universal/TemplateApp/Generated Files/XamlLibMetadataProvider.g.cpp

@@ -0,0 +1,2 @@
+
+

+ 544 - 0
build/windows/universal/TemplateApp/Generated Files/XamlTypeInfo.Impl.g.cpp

@@ -0,0 +1,544 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+#include "pch.h"
+#include <regex>
+#include "XamlTypeInfo.g.h"
+
+
+
+// XamlTypeInfoProvider
+::Windows::UI::Xaml::Markup::IXamlType^ ::XamlTypeInfo::InfoProvider::XamlTypeInfoProvider::GetXamlTypeByType(::Windows::UI::Xaml::Interop::TypeName type)
+{
+    auto xamlType = GetXamlTypeByName(type.Name);
+    ::XamlTypeInfo::InfoProvider::XamlUserType^ userXamlType = dynamic_cast<::XamlTypeInfo::InfoProvider::XamlUserType^>(xamlType);
+    if (xamlType == nullptr || (userXamlType != nullptr && userXamlType->IsReturnTypeStub && !userXamlType->IsLocalType))
+    {
+        ::Windows::UI::Xaml::Markup::IXamlType^ libXamlType = CheckOtherMetadataProvidersForType(type);
+        if (libXamlType != nullptr)
+        {
+            if(libXamlType->IsConstructible || xamlType == nullptr)
+            {
+                xamlType = libXamlType;
+            }
+        }
+    }
+            return xamlType;
+}
+
+::Windows::UI::Xaml::Markup::IXamlType^ ::XamlTypeInfo::InfoProvider::XamlTypeInfoProvider::GetXamlTypeByName(::Platform::String^ typeName)
+{
+    if (typeName == nullptr || typeName->IsEmpty())
+    {
+        return nullptr;
+    }
+
+    auto val = _xamlTypes.find(typeName);
+    ::Windows::UI::Xaml::Markup::IXamlType^ xamlType = nullptr;
+    if (val != _xamlTypes.end())
+    {
+        xamlType = (val->second).Resolve<::Windows::UI::Xaml::Markup::IXamlType>();
+        if(xamlType != nullptr)
+        {
+            return xamlType;
+        }
+    }
+
+    xamlType = CreateXamlType(typeName);
+    ::XamlTypeInfo::InfoProvider::XamlUserType^ userXamlType = dynamic_cast<::XamlTypeInfo::InfoProvider::XamlUserType^>(xamlType);
+    if (xamlType == nullptr || (userXamlType != nullptr && userXamlType->IsReturnTypeStub && !userXamlType->IsLocalType))
+    {
+        ::Windows::UI::Xaml::Markup::IXamlType^ libXamlType  = CheckOtherMetadataProvidersForName(typeName);
+        if (libXamlType != nullptr)
+        {
+            if(libXamlType->IsConstructible || xamlType == nullptr)
+            {
+                xamlType = libXamlType;
+            }
+        }
+    }
+
+
+    if (xamlType != nullptr)
+    {
+        Platform::WeakReference wr(xamlType);
+        _xamlTypes[xamlType->FullName] =  wr;
+    }
+    return xamlType;
+}
+
+::Windows::UI::Xaml::Markup::IXamlMember^ ::XamlTypeInfo::InfoProvider::XamlTypeInfoProvider::GetMemberByLongName(::Platform::String^ longMemberName)
+{
+    if (longMemberName == nullptr || longMemberName->IsEmpty())
+    {
+        return nullptr;
+    }
+
+    auto val = _xamlMembers.find(longMemberName);
+    if (val != _xamlMembers.end())
+    {
+        return val->second;
+    }
+
+    auto xamlMember = CreateXamlMember(longMemberName);
+
+    if (xamlMember != nullptr)
+    {
+        _xamlMembers[longMemberName] = xamlMember;
+    }
+    return xamlMember;
+}
+
+
+
+// XamlSystemBaseType
+::XamlTypeInfo::InfoProvider::XamlSystemBaseType::XamlSystemBaseType(::Platform::String^ name) :
+    _fullName(name)
+{
+}
+
+::Windows::UI::Xaml::Markup::IXamlType^ ::XamlTypeInfo::InfoProvider::XamlSystemBaseType::BaseType::get()
+{
+    throw ref new ::Platform::NotImplementedException;
+}
+
+::Windows::UI::Xaml::Markup::IXamlMember^ ::XamlTypeInfo::InfoProvider::XamlSystemBaseType::ContentProperty::get()
+{
+    throw ref new ::Platform::NotImplementedException;
+}
+
+::Platform::String^ ::XamlTypeInfo::InfoProvider::XamlSystemBaseType::FullName::get()
+{
+    return _fullName;
+}
+
+::Platform::String^ ::XamlTypeInfo::InfoProvider::XamlSystemBaseType::Name::get()
+{
+    const wchar_t* seperator = wcsrchr(_fullName->Data(), '.');
+    if (seperator == nullptr)
+    {
+        return _fullName;
+    }
+    return ref new ::Platform::String(seperator);
+}
+
+bool ::XamlTypeInfo::InfoProvider::XamlSystemBaseType::IsArray::get()
+{
+    throw ref new ::Platform::NotImplementedException;
+}
+
+bool ::XamlTypeInfo::InfoProvider::XamlSystemBaseType::IsCollection::get()
+{
+    throw ref new ::Platform::NotImplementedException;
+}
+
+bool ::XamlTypeInfo::InfoProvider::XamlSystemBaseType::IsConstructible::get()
+{
+    throw ref new ::Platform::NotImplementedException;
+}
+
+bool ::XamlTypeInfo::InfoProvider::XamlSystemBaseType::IsDictionary::get()
+{
+    throw ref new ::Platform::NotImplementedException;
+}
+
+bool ::XamlTypeInfo::InfoProvider::XamlSystemBaseType::IsMarkupExtension::get()
+{
+    throw ref new ::Platform::NotImplementedException;
+}
+
+bool ::XamlTypeInfo::InfoProvider::XamlSystemBaseType::IsEnum::get()
+{
+    throw ref new ::Platform::NotImplementedException;
+}
+
+bool ::XamlTypeInfo::InfoProvider::XamlSystemBaseType::IsSystemType::get()
+{
+    throw ref new ::Platform::NotImplementedException;
+}
+
+bool ::XamlTypeInfo::InfoProvider::XamlSystemBaseType::IsBindable::get()
+{
+    throw ref new ::Platform::NotImplementedException;
+}
+
+::Windows::UI::Xaml::Markup::IXamlType^ ::XamlTypeInfo::InfoProvider::XamlSystemBaseType::ItemType::get()
+{
+    throw ref new ::Platform::NotImplementedException;
+}
+
+::Windows::UI::Xaml::Markup::IXamlType^ ::XamlTypeInfo::InfoProvider::XamlSystemBaseType::KeyType::get()
+{
+    throw ref new ::Platform::NotImplementedException;
+}
+
+::Windows::UI::Xaml::Interop::TypeName (::XamlTypeInfo::InfoProvider::XamlSystemBaseType::UnderlyingType::get)()
+{
+    ::Windows::UI::Xaml::Interop::TypeName typeName;
+
+    typeName.Name = _fullName;
+    typeName.Kind = ::Windows::UI::Xaml::Interop::TypeKind::Primitive;
+
+    return typeName;
+}
+
+::Platform::Object^ ::XamlTypeInfo::InfoProvider::XamlSystemBaseType::ActivateInstance()
+{
+    throw ref new ::Platform::NotImplementedException;
+}
+
+::Windows::UI::Xaml::Markup::IXamlMember^ ::XamlTypeInfo::InfoProvider::XamlSystemBaseType::GetMember(::Platform::String^)
+{
+    throw ref new ::Platform::NotImplementedException;
+}
+
+void ::XamlTypeInfo::InfoProvider::XamlSystemBaseType::AddToVector(::Platform::Object^, ::Platform::Object^)
+{
+    throw ref new ::Platform::NotImplementedException;
+}
+
+void ::XamlTypeInfo::InfoProvider::XamlSystemBaseType::AddToMap(::Platform::Object^, ::Platform::Object^, ::Platform::Object^)
+{
+    throw ref new ::Platform::NotImplementedException;
+}
+
+void ::XamlTypeInfo::InfoProvider::XamlSystemBaseType::RunInitializer()
+{
+    throw ref new ::Platform::NotImplementedException;
+}
+
+::Platform::Object^ ::XamlTypeInfo::InfoProvider::XamlSystemBaseType::CreateFromString(::Platform::String^)
+{
+    throw ref new ::Platform::NotImplementedException;
+}
+
+//XamlUserType
+::XamlTypeInfo::InfoProvider::XamlUserType::XamlUserType(::XamlTypeInfo::InfoProvider::XamlTypeInfoProvider^ provider, ::Platform::String^ fullName, ::Windows::UI::Xaml::Markup::IXamlType^ baseType) :
+    _isArray(false),
+    _isMarkupExtension(false),
+    _isEnum(false),
+    _isBindable(false),
+    _isReturnTypeStub(false),
+    _isLocalType(false),
+    _fullName(fullName),
+    _provider(provider),
+    _baseType(baseType)
+{
+}
+
+::Platform::String^ ::XamlTypeInfo::InfoProvider::XamlUserType::FullName::get()
+{
+    return _fullName;
+}
+
+::Platform::String^ ::XamlTypeInfo::InfoProvider::XamlUserType::Name::get()
+{
+    const wchar_t *seperator = wcsrchr(_fullName->Data(), '.');
+    if (seperator == nullptr)
+    {
+        return _fullName;
+    }
+    return ref new ::Platform::String(seperator);
+}
+
+::Windows::UI::Xaml::Interop::TypeName (::XamlTypeInfo::InfoProvider::XamlUserType::UnderlyingType::get)()
+{
+    ::Windows::UI::Xaml::Interop::TypeName typeName;
+
+    typeName.Name = _fullName;
+    typeName.Kind = KindOfType;
+
+    return typeName;
+}
+
+bool ::XamlTypeInfo::InfoProvider::XamlUserType::IsSystemType::get()
+{
+    return true;
+}
+
+::Windows::UI::Xaml::Markup::IXamlType^ ::XamlTypeInfo::InfoProvider::XamlUserType::BaseType::get()
+{
+    return _baseType;
+}
+
+bool ::XamlTypeInfo::InfoProvider::XamlUserType::IsArray::get()
+{
+    return _isArray;
+}
+
+bool ::XamlTypeInfo::InfoProvider::XamlUserType::IsCollection::get()
+{
+    return CollectionAdd != nullptr;
+}
+
+bool ::XamlTypeInfo::InfoProvider::XamlUserType::IsConstructible::get()
+{
+    return Activator != nullptr;
+}
+
+bool ::XamlTypeInfo::InfoProvider::XamlUserType::IsDictionary::get()
+{
+    return DictionaryAdd != nullptr;
+}
+
+bool ::XamlTypeInfo::InfoProvider::XamlUserType::IsMarkupExtension::get()
+{
+    return _isMarkupExtension;
+}
+
+bool ::XamlTypeInfo::InfoProvider::XamlUserType::IsEnum::get()
+{
+    return _isEnum;
+}
+
+bool ::XamlTypeInfo::InfoProvider::XamlUserType::IsBindable::get()
+{
+    return _isBindable;
+}
+
+bool ::XamlTypeInfo::InfoProvider::XamlUserType::IsReturnTypeStub::get()
+{
+    return _isReturnTypeStub;
+}
+
+bool ::XamlTypeInfo::InfoProvider::XamlUserType::IsLocalType::get()
+{
+    return _isLocalType;
+}
+
+::Windows::UI::Xaml::Markup::IXamlMember^ ::XamlTypeInfo::InfoProvider::XamlUserType::ContentProperty::get()
+{
+    return _provider->GetMemberByLongName(_contentPropertyName);
+}
+
+::Windows::UI::Xaml::Markup::IXamlType^ ::XamlTypeInfo::InfoProvider::XamlUserType::ItemType::get()
+{
+    return _provider->GetXamlTypeByName(_itemTypeName);
+}
+
+::Windows::UI::Xaml::Markup::IXamlType^ ::XamlTypeInfo::InfoProvider::XamlUserType::KeyType::get()
+{
+    return _provider->GetXamlTypeByName(_keyTypeName);
+}
+
+::Windows::UI::Xaml::Markup::IXamlMember^ ::XamlTypeInfo::InfoProvider::XamlUserType::GetMember(::Platform::String^ name)
+{
+    auto val = _memberNames.find(name);
+    if (val != _memberNames.end())
+    {
+        return _provider->GetMemberByLongName(val->second);
+    }
+    return nullptr;
+}
+
+::Platform::Object^ ::XamlTypeInfo::InfoProvider::XamlUserType::ActivateInstance()
+{
+    return Activator();
+}
+
+void ::XamlTypeInfo::InfoProvider::XamlUserType::AddToMap(::Platform::Object^ instance, ::Platform::Object^ key, ::Platform::Object^ item)
+{
+    DictionaryAdd(instance, key, item);
+}
+
+void ::XamlTypeInfo::InfoProvider::XamlUserType::AddToVector(::Platform::Object^ instance, ::Platform::Object^ item)
+{
+    CollectionAdd(instance, item);
+}
+
+void ::XamlTypeInfo::InfoProvider::XamlUserType::RunInitializer()
+{
+    // The C++ runtime will have already run all the Static Initializers at start up.
+}
+
+::Platform::Object^ ::XamlTypeInfo::InfoProvider::XamlUserType::CreateFromString(::Platform::String^ input)
+{
+    return FromStringConverter(this, input);
+}
+
+void ::XamlTypeInfo::InfoProvider::XamlUserType::SetContentPropertyName(::Platform::String^ contentPropertyName)
+{
+    _contentPropertyName = contentPropertyName;
+}
+
+void ::XamlTypeInfo::InfoProvider::XamlUserType::SetIsArray()
+{
+    _isArray = true;
+}
+
+void ::XamlTypeInfo::InfoProvider::XamlUserType::SetIsMarkupExtension()
+{
+    _isMarkupExtension = true;
+}
+
+void ::XamlTypeInfo::InfoProvider::XamlUserType::SetIsEnum()
+{
+    _isEnum = true;
+}
+
+void ::XamlTypeInfo::InfoProvider::XamlUserType::SetIsBindable()
+{
+    _isBindable = true;
+}
+
+void ::XamlTypeInfo::InfoProvider::XamlUserType::SetIsReturnTypeStub()
+{
+    _isReturnTypeStub = true;
+}
+
+void ::XamlTypeInfo::InfoProvider::XamlUserType::SetIsLocalType()
+{
+    _isLocalType = true;
+}
+
+void ::XamlTypeInfo::InfoProvider::XamlUserType::SetItemTypeName(::Platform::String^ itemTypeName)
+{
+    _itemTypeName = itemTypeName;
+}
+
+void ::XamlTypeInfo::InfoProvider::XamlUserType::SetKeyTypeName(::Platform::String^ keyTypeName)
+{
+    _keyTypeName = keyTypeName;
+}
+
+void ::XamlTypeInfo::InfoProvider::XamlUserType::AddMemberName(::Platform::String^ shortName)
+{
+    _memberNames[shortName] = FullName + "." + shortName;
+}
+
+void ::XamlTypeInfo::InfoProvider::XamlUserType::AddEnumValue(::Platform::String^ name, ::Platform::Object^ value)
+{
+    _enumValues[name->Data()] = value;
+}
+
+::default::uint32 (::XamlTypeInfo::InfoProvider::XamlUserType::CreateEnumUIntFromString)(::Platform::String^ input)
+{
+    bool found = false;
+
+    const std::wregex regularExpression(L"^\\s+|\\s*,\\s*|\\s+$");
+    uint32 val = 0;
+
+    for (std::wcregex_token_iterator it(input->Begin(), input->End(), regularExpression, -1), end; it != end; ++it)
+    {
+        const std::wcsub_match& subMatch = *it;
+
+        if (subMatch.length() == 0 )
+        {
+            continue;
+        }
+
+        std::wstring lookup(subMatch.first, (unsigned int)subMatch.length());
+
+        try
+        {
+            auto entry = _enumValues.find(lookup);
+            if (entry != _enumValues.end())
+            {
+                const auto f = entry->second;
+                val |= safe_cast<int>(f);
+            }
+            else
+            {
+                val |= std::stoi(subMatch);
+            }
+            found=true;
+        }
+        catch (const std::invalid_argument& )
+        {
+            found = false;
+            break;
+        }
+    }
+
+    if(found)
+    {
+        return val;
+    }
+    throw ref new ::Platform::InvalidArgumentException();
+}
+
+// XamlMember
+::XamlTypeInfo::InfoProvider::XamlMember::XamlMember(::XamlTypeInfo::InfoProvider::XamlTypeInfoProvider^ provider, ::Platform::String^ name, ::Platform::String^ typeName) :
+    _isAttachable(false),
+    _isDependencyProperty(false),
+    _isReadOnly(false),
+    _name(name),
+    _typeName(typeName),
+    _provider(provider)
+{
+}
+
+void ::XamlTypeInfo::InfoProvider::XamlMember::SetIsAttachable()
+{
+    _isAttachable = true;
+}
+
+bool ::XamlTypeInfo::InfoProvider::XamlMember::IsAttachable::get()
+{
+    return _isAttachable;
+}
+
+void ::XamlTypeInfo::InfoProvider::XamlMember::SetIsDependencyProperty()
+{
+    _isDependencyProperty = true;
+}
+
+bool ::XamlTypeInfo::InfoProvider::XamlMember::IsDependencyProperty::get()
+{
+    return _isDependencyProperty;
+}
+
+void ::XamlTypeInfo::InfoProvider::XamlMember::SetIsReadOnly()
+{
+    _isReadOnly = true;
+}
+
+bool ::XamlTypeInfo::InfoProvider::XamlMember::IsReadOnly::get()
+{
+    return _isReadOnly;
+}
+
+::Platform::String^ ::XamlTypeInfo::InfoProvider::XamlMember::Name::get()
+{
+    return _name;
+}
+
+::Windows::UI::Xaml::Markup::IXamlType^ ::XamlTypeInfo::InfoProvider::XamlMember::Type::get()
+{
+    return _provider->GetXamlTypeByName(_typeName);
+}
+
+void ::XamlTypeInfo::InfoProvider::XamlMember::SetTargetTypeName(::Platform::String^ targetTypeName)
+{
+    _targetTypeName = targetTypeName;
+}
+
+::Windows::UI::Xaml::Markup::IXamlType^ ::XamlTypeInfo::InfoProvider::XamlMember::TargetType::get()
+{
+    return _provider->GetXamlTypeByName(_targetTypeName);
+}
+
+::Platform::Object^ ::XamlTypeInfo::InfoProvider::XamlMember::GetValue(::Platform::Object^ instance)
+{
+    if (Getter != nullptr)
+    {
+        return Getter(instance);
+    }
+    throw ref new ::Platform::NullReferenceException();
+}
+
+void ::XamlTypeInfo::InfoProvider::XamlMember::SetValue(::Platform::Object^ instance, ::Platform::Object^ value)
+{
+    if (Setter != nullptr)
+    {
+        Setter(instance, value);
+        return;
+    }
+    throw ref new ::Platform::NullReferenceException();
+}
+

+ 98 - 0
build/windows/universal/TemplateApp/Generated Files/XamlTypeInfo.g.cpp

@@ -0,0 +1,98 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+#include "pch.h"
+#include "XamlTypeInfo.g.h"
+
+#include "App.xaml.h"
+#include "MainPage.xaml.h"
+#include "XamlBindingInfo.g.hpp"
+#include "App.g.hpp"
+#include "MainPage.g.hpp"
+
+
+::Platform::Collections::Vector<::Windows::UI::Xaml::Markup::IXamlMetadataProvider^>^ ::XamlTypeInfo::InfoProvider::XamlTypeInfoProvider::OtherProviders::get()
+{
+    if(_otherProviders == nullptr)
+    {
+        auto otherProviders = ref new ::Platform::Collections::Vector<::Windows::UI::Xaml::Markup::IXamlMetadataProvider^>();
+        _otherProviders = otherProviders;
+    }
+    return _otherProviders;
+}
+
+::Windows::UI::Xaml::Markup::IXamlType^ ::XamlTypeInfo::InfoProvider::XamlTypeInfoProvider::CheckOtherMetadataProvidersForName(::Platform::String^ typeName)
+{
+    ::Windows::UI::Xaml::Markup::IXamlType^ foundXamlType = nullptr;
+    for (unsigned int i = 0; i < OtherProviders->Size; i++)
+    {
+        auto xamlType = OtherProviders->GetAt(i)->GetXamlType(typeName);
+        if(xamlType != nullptr)
+        {
+            if(xamlType->IsConstructible)    // not Constructible means it might be a Return Type Stub
+            {
+                return xamlType;
+            }
+            foundXamlType = xamlType;
+        }
+    }
+    return foundXamlType;
+}
+
+::Windows::UI::Xaml::Markup::IXamlType^ ::XamlTypeInfo::InfoProvider::XamlTypeInfoProvider::CheckOtherMetadataProvidersForType(::Windows::UI::Xaml::Interop::TypeName t)
+{
+    ::Windows::UI::Xaml::Markup::IXamlType^ foundXamlType = nullptr;
+    for (unsigned int i = 0; i < OtherProviders->Size; i++)
+    {
+        auto xamlType = OtherProviders->GetAt(i)->GetXamlType(t);
+        if(xamlType != nullptr)
+        {
+            if(xamlType->IsConstructible)    // not Constructible means it might be a Return Type Stub
+            {
+                return xamlType;
+            }
+            foundXamlType = xamlType;
+        }
+    }
+    return foundXamlType;
+}
+
+::Windows::UI::Xaml::Markup::IXamlType^ ::XamlTypeInfo::InfoProvider::XamlTypeInfoProvider::CreateXamlType(::Platform::String^ typeName)
+{
+    if (typeName == L"Windows.UI.Xaml.Controls.Page")
+    {
+        return ref new XamlSystemBaseType(typeName);
+    }
+    if (typeName == L"Windows.UI.Xaml.Controls.UserControl")
+    {
+        return ref new XamlSystemBaseType(typeName);
+    }
+    if (typeName == L"TemplateApp.MainPage")
+    {
+        ::XamlTypeInfo::InfoProvider::XamlUserType^ userType = ref new ::XamlTypeInfo::InfoProvider::XamlUserType(this, L"TemplateApp.MainPage", this->GetXamlTypeByName(L"Windows.UI.Xaml.Controls.Page"));
+        userType->KindOfType = ::Windows::UI::Xaml::Interop::TypeKind::Custom;
+        userType->Activator =
+            []() -> ::Platform::Object^ 
+            {
+                return ref new ::TemplateApp::MainPage(); 
+            };
+        userType->SetIsLocalType();
+        return userType;
+    }
+
+
+    return nullptr;
+    }
+
+::Windows::UI::Xaml::Markup::IXamlMember^ ::XamlTypeInfo::InfoProvider::XamlTypeInfoProvider::CreateXamlMember(::Platform::String^ longMemberName)
+{
+    // No Local Properties
+    (void)longMemberName; // Unused parameter
+    return nullptr;
+}
+

+ 343 - 0
build/windows/universal/TemplateApp/Generated Files/XamlTypeInfo.g.h

@@ -0,0 +1,343 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+#pragma once
+#include <collection.h>
+
+namespace XamlTypeInfo
+{
+    namespace InfoProvider
+    {
+
+
+        ref class XamlTypeInfoProvider sealed
+        {
+        internal:
+            ::Windows::UI::Xaml::Markup::IXamlType^ CreateXamlType(::Platform::String^ typeName);
+            ::Windows::UI::Xaml::Markup::IXamlMember^ CreateXamlMember(::Platform::String^ longMemberName);
+
+            ::Windows::UI::Xaml::Markup::IXamlType^ GetXamlTypeByName(::Platform::String^ typeName);
+            ::Windows::UI::Xaml::Markup::IXamlType^ GetXamlTypeByType(::Windows::UI::Xaml::Interop::TypeName t);
+            ::Windows::UI::Xaml::Markup::IXamlMember^ GetMemberByLongName(::Platform::String^ longMemberName);
+
+        private:
+            std::map<::Platform::String^, ::Platform::WeakReference> _xamlTypes;
+            std::map<::Platform::String^, ::Windows::UI::Xaml::Markup::IXamlMember^> _xamlMembers;
+
+        public:
+            void AddOtherProvider(::Windows::UI::Xaml::Markup::IXamlMetadataProvider^ otherProvider);
+        private:
+            ::Platform::Collections::Vector<::Windows::UI::Xaml::Markup::IXamlMetadataProvider^>^ _otherProviders;
+            property ::Platform::Collections::Vector<::Windows::UI::Xaml::Markup::IXamlMetadataProvider^>^ OtherProviders
+            {
+                ::Platform::Collections::Vector<::Windows::UI::Xaml::Markup::IXamlMetadataProvider^>^ get();
+            }
+
+            ::Windows::UI::Xaml::Markup::IXamlType^ CheckOtherMetadataProvidersForName(::Platform::String^ typeName);
+            ::Windows::UI::Xaml::Markup::IXamlType^ CheckOtherMetadataProvidersForType(::Windows::UI::Xaml::Interop::TypeName t);
+        };
+
+        ref class XamlSystemBaseType sealed : public ::Windows::UI::Xaml::Markup::IXamlType
+        {
+        internal:
+            XamlSystemBaseType(::Platform::String^ name);
+
+        public:
+            virtual property ::Windows::UI::Xaml::Markup::IXamlType^ BaseType 
+            {
+                ::Windows::UI::Xaml::Markup::IXamlType^ get();
+            }
+
+            virtual property ::Windows::UI::Xaml::Markup::IXamlMember^ ContentProperty 
+            {
+                ::Windows::UI::Xaml::Markup::IXamlMember^ get();
+            }
+
+            virtual property ::Platform::String^ FullName
+            {
+                ::Platform::String^ get();
+            }
+
+            virtual property ::Platform::String^ Name
+            {
+                ::Platform::String^ get();
+            }
+
+            virtual property bool IsArray
+            {
+                bool get();
+            }
+
+            virtual property bool IsCollection
+            {
+                bool get();
+            }
+
+            virtual property bool IsConstructible
+            {
+                bool get();
+            }
+
+            virtual property bool IsDictionary
+            {
+                bool get();
+            }
+
+            virtual property bool IsMarkupExtension
+            {
+                bool get();
+            }
+
+            virtual property bool IsEnum
+            {
+                bool get();
+            }
+
+            virtual property bool IsSystemType
+            {
+                bool get();
+            }
+
+            virtual property bool IsBindable
+            {
+                bool get();
+            }
+
+            virtual property ::Windows::UI::Xaml::Markup::IXamlType^ ItemType
+            {
+                ::Windows::UI::Xaml::Markup::IXamlType^ get();
+            }
+
+            virtual property ::Windows::UI::Xaml::Markup::IXamlType^ KeyType
+            {
+                ::Windows::UI::Xaml::Markup::IXamlType^ get();
+            }
+
+            virtual property ::Windows::UI::Xaml::Interop::TypeName UnderlyingType
+            {
+                ::Windows::UI::Xaml::Interop::TypeName get();
+            }
+
+            virtual ::Platform::Object^ ActivateInstance();
+            virtual ::Windows::UI::Xaml::Markup::IXamlMember^ GetMember(::Platform::String^ name);
+            virtual void AddToVector(::Platform::Object^ instance, ::Platform::Object^ value);
+            virtual void AddToMap(::Platform::Object^ instance, ::Platform::Object^ key, ::Platform::Object^ value);
+            virtual void RunInitializer();
+            virtual ::Platform::Object^ CreateFromString(::Platform::String^ value);
+
+        private:
+            ::Platform::String^ _fullName;
+        };
+
+        ref class XamlUserType sealed : public [::Platform::Metadata::RuntimeClassName] ::Windows::UI::Xaml::Markup::IXamlType
+        {
+        internal:
+            XamlUserType(::XamlTypeInfo::InfoProvider::XamlTypeInfoProvider^ provider, ::Platform::String^ fullName, ::Windows::UI::Xaml::Markup::IXamlType^ baseType);
+
+        public:
+            // --- Interface methods ----
+            virtual property ::Platform::String^ FullName
+            {
+                ::Platform::String^ get();
+            }
+
+            virtual property ::Platform::String^ Name
+            {
+                ::Platform::String^ get();
+            }
+
+            virtual property ::Windows::UI::Xaml::Interop::TypeName UnderlyingType
+            {
+                ::Windows::UI::Xaml::Interop::TypeName get();
+            }
+
+            virtual property bool IsSystemType
+            {
+                bool get();
+            }
+
+            virtual property ::Windows::UI::Xaml::Markup::IXamlType^ BaseType 
+            { 
+                ::Windows::UI::Xaml::Markup::IXamlType^ get();
+            }
+
+            virtual property bool IsArray 
+            { 
+                bool get();
+            }
+
+            virtual property bool IsCollection 
+            { 
+                bool get();
+            }
+
+            virtual property bool IsConstructible 
+            { 
+                bool get();
+            }
+
+            virtual property bool IsDictionary 
+            { 
+                bool get();
+            }
+
+            virtual property bool IsMarkupExtension 
+            { 
+                bool get();
+            }
+
+            virtual property bool IsEnum 
+            { 
+                bool get();
+            }
+
+            virtual property bool IsBindable
+            { 
+                bool get();
+            }
+
+            virtual property ::Windows::UI::Xaml::Markup::IXamlMember^ ContentProperty 
+            { 
+                ::Windows::UI::Xaml::Markup::IXamlMember^ get();
+            }
+
+            virtual property ::Windows::UI::Xaml::Markup::IXamlType^ ItemType 
+            { 
+                ::Windows::UI::Xaml::Markup::IXamlType^ get();
+            }
+
+            virtual property ::Windows::UI::Xaml::Markup::IXamlType^ KeyType 
+            { 
+                ::Windows::UI::Xaml::Markup::IXamlType^ get();
+            }
+
+            virtual ::Windows::UI::Xaml::Markup::IXamlMember^ GetMember(::Platform::String^ name);
+            virtual ::Platform::Object^ ActivateInstance();
+            virtual void AddToMap(::Platform::Object^ instance, ::Platform::Object^ key, ::Platform::Object^ value);
+            virtual void AddToVector(::Platform::Object^ instance, ::Platform::Object^ value);
+            virtual void RunInitializer();
+            virtual ::Platform::Object^ CreateFromString(::Platform::String^ value);
+            // --- End of Interface methods
+
+            property bool IsReturnTypeStub
+            { 
+                bool get();
+            }
+
+            property bool IsLocalType
+            {
+                bool get();
+            }
+
+        internal:
+            typedef ::Platform::Object^ (*ActivatorFn)();
+            typedef void (*AddToCollectionFn)(::Platform::Object^ instance, ::Platform::Object^ item);
+            typedef void (*AddToDictionaryFn)(::Platform::Object^ instance, ::Platform::Object^ key, ::Platform::Object^ item);
+            typedef ::Platform::Object^ (*StringConverterFn)(::XamlTypeInfo::InfoProvider::XamlUserType^ userType, ::Platform::String^ input);
+
+            property ActivatorFn Activator;
+            property AddToCollectionFn CollectionAdd;
+            property AddToDictionaryFn DictionaryAdd;
+            property ::Windows::UI::Xaml::Interop::TypeKind KindOfType;
+            property StringConverterFn FromStringConverter;
+
+            void SetContentPropertyName(::Platform::String^ contentPropertyName);
+            void SetIsArray();
+            void SetIsMarkupExtension();
+            void SetIsEnum();
+            void SetIsBindable();
+            void SetIsReturnTypeStub();
+            void SetIsLocalType();
+            void SetItemTypeName(::Platform::String^ itemTypeName);
+            void SetKeyTypeName(::Platform::String^ keyTypeName);
+            void AddMemberName(::Platform::String^ shortName);
+            void AddEnumValue(::Platform::String^ name, ::Platform::Object^ value);
+            uint32 CreateEnumUIntFromString(::Platform::String^ input);
+
+        private:
+            ::XamlTypeInfo::InfoProvider::XamlTypeInfoProvider^ _provider;
+            ::Windows::UI::Xaml::Markup::IXamlType^ _baseType;
+            bool _isArray;
+            bool _isConstructible;
+            bool _isDictionary;
+            bool _isMarkupExtension;
+            bool _isEnum;
+            bool _isBindable;
+            bool _isReturnTypeStub;
+            bool _isLocalType;
+
+            ::Platform::String^ _contentPropertyName;
+            ::Platform::String^ _itemTypeName;
+            ::Platform::String^ _keyTypeName;
+            ::Platform::String^ _fullName;
+            std::map<::Platform::String^, ::Platform::String^> _memberNames;
+            std::map<std::wstring, ::Platform::Object^> _enumValues;
+        };
+
+        ref class XamlMember sealed : public ::Windows::UI::Xaml::Markup::IXamlMember
+        {
+        internal:
+            XamlMember(::XamlTypeInfo::InfoProvider::XamlTypeInfoProvider^ provider, ::Platform::String^ name, ::Platform::String^ typeName);
+
+            void SetIsAttachable();
+            void SetIsDependencyProperty();
+            void SetIsReadOnly();
+            void SetTargetTypeName(::Platform::String^ targetTypeName);
+
+            typedef ::Platform::Object^ (*PropertyGetterFn)(::Platform::Object^ instance);
+            typedef void (*PropertySetterFn)(::Platform::Object^ instance, ::Platform::Object^ value);
+
+            property PropertyGetterFn Getter;
+            property PropertySetterFn Setter;
+
+        public:
+            virtual property bool IsAttachable
+            { 
+                bool get();
+            }
+
+            virtual property bool IsDependencyProperty 
+            { 
+                bool get();
+            }
+
+            virtual property bool IsReadOnly
+            { 
+                bool get();
+            }
+
+            virtual property ::Platform::String^ Name
+            { 
+                ::Platform::String^ get();
+            }
+
+            virtual property ::Windows::UI::Xaml::Markup::IXamlType^ Type
+            {
+                ::Windows::UI::Xaml::Markup::IXamlType^ get();
+            }
+
+            virtual property ::Windows::UI::Xaml::Markup::IXamlType^ TargetType
+            {
+                ::Windows::UI::Xaml::Markup::IXamlType^ get();
+            }
+
+            virtual ::Platform::Object^ GetValue(::Platform::Object^ instance);
+            virtual void SetValue(::Platform::Object^ instance, ::Platform::Object^ value);
+
+        private:
+            bool _isAttachable;
+            bool _isDependencyProperty;
+            bool _isReadOnly; 
+            ::Platform::String^ _name;
+            ::Platform::String^ _targetTypeName;
+            ::Platform::String^ _typeName;
+            ::XamlTypeInfo::InfoProvider::XamlTypeInfoProvider^ _provider;
+        };
+    }
+}
+

+ 13 - 0
build/windows/universal/TemplateApp/MainPage.xaml

@@ -0,0 +1,13 @@
+<Page
+    x:Class="TemplateApp.MainPage"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:local="using:TemplateApp"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    mc:Ignorable="d">
+
+    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
+
+    </Grid>
+</Page>

+ 27 - 0
build/windows/universal/TemplateApp/MainPage.xaml.cpp

@@ -0,0 +1,27 @@
+//
+// MainPage.xaml.cpp
+// Implementation of the MainPage class.
+//
+
+#include "pch.h"
+#include "MainPage.xaml.h"
+
+using namespace TemplateApp;
+
+using namespace Platform;
+using namespace Windows::Foundation;
+using namespace Windows::Foundation::Collections;
+using namespace Windows::UI::Xaml;
+using namespace Windows::UI::Xaml::Controls;
+using namespace Windows::UI::Xaml::Controls::Primitives;
+using namespace Windows::UI::Xaml::Data;
+using namespace Windows::UI::Xaml::Input;
+using namespace Windows::UI::Xaml::Media;
+using namespace Windows::UI::Xaml::Navigation;
+
+// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
+
+MainPage::MainPage()
+{
+	InitializeComponent();
+}

+ 21 - 0
build/windows/universal/TemplateApp/MainPage.xaml.h

@@ -0,0 +1,21 @@
+//
+// MainPage.xaml.h
+// Declaration of the MainPage class.
+//
+
+#pragma once
+
+#include "MainPage.g.h"
+
+namespace TemplateApp
+{
+	/// <summary>
+	/// An empty page that can be used on its own or navigated to within a Frame.
+	/// </summary>
+	public ref class MainPage sealed
+	{
+	public:
+		MainPage();
+
+	};
+}

+ 2 - 2
build/windows/universal/TemplateApp/Package.appxmanifest

@@ -7,11 +7,11 @@
   IgnorableNamespaces="uap mp">
 
   <Identity
-    Name="ebf9cff2-5673-4638-b92f-9dfde76805e3"
+    Name="70653703-3505-40ca-a433-1766d9043955"
     Publisher="CN=ivan"
     Version="1.0.0.0" />
 
-  <mp:PhoneIdentity PhoneProductId="ebf9cff2-5673-4638-b92f-9dfde76805e3" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
+  <mp:PhoneIdentity PhoneProductId="70653703-3505-40ca-a433-1766d9043955" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
 
   <Properties>
     <DisplayName>TemplateApp</DisplayName>

+ 31 - 0
build/windows/universal/TemplateApp/PolycodeTemplateApp.cpp

@@ -0,0 +1,31 @@
+//
+// Polycode template. Write your code here.
+// 
+
+#include "PolycodeTemplateApp.h"
+
+
+PolycodeTemplateApp::PolycodeTemplateApp(PolycodeView *view) {
+    core = new POLYCODE_CORE(view, 1280,720,false,false, 0,0,60);
+	CoreServices::getInstance()->getResourceManager()->addArchive("default.pak");
+	CoreServices::getInstance()->getResourceManager()->addDirResource("default");
+
+	// Write your code here!
+    
+    Scene *scene = new Scene(Scene::SCENE_2D);
+    scene->useClearColor = true;
+    
+    ScenePrimitive *test = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 0.5, 0.5);
+    test->setMaterialByName("Unlit");
+    test->getLocalShaderOptions()->loadTextureForParam("diffuse", "main_icon.png");
+    scene->addChild(test);
+    
+}
+
+PolycodeTemplateApp::~PolycodeTemplateApp() {
+    
+}
+
+bool PolycodeTemplateApp::Update() {
+    return core->updateAndRender();
+}

+ 18 - 0
build/windows/universal/TemplateApp/PolycodeTemplateApp.h

@@ -0,0 +1,18 @@
+//
+// Polycode template. Write your code here.
+//
+
+#include "Polycode.h"
+
+using namespace Polycode;
+
+class PolycodeTemplateApp {
+public:
+    PolycodeTemplateApp(PolycodeView *view);
+    ~PolycodeTemplateApp();
+    
+    bool Update();
+    
+private:
+    Core *core;
+};

+ 99 - 114
build/windows/universal/TemplateApp/TemplateApp.vcxproj

@@ -1,45 +1,44 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{06b5f55d-2971-4458-a612-348ecd8ad7df}</ProjectGuid>
+    <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" />
   <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|Win32">
+    <ProjectConfiguration Include="Debug|ARM">
       <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
+      <Platform>ARM</Platform>
     </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
+    <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|x64">
+    <ProjectConfiguration Include="Release|ARM">
       <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|ARM">
-      <Configuration>Debug</Configuration>
       <Platform>ARM</Platform>
     </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|ARM">
+    <ProjectConfiguration Include="Release|Win32">
       <Configuration>Release</Configuration>
-      <Platform>ARM</Platform>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</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>
@@ -78,9 +77,6 @@
   </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" />
@@ -102,94 +98,110 @@
   </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup>
-    
     <PackageCertificateKeyFile>TemplateApp_TemporaryKey.pfx</PackageCertificateKeyFile>
-    
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <IncludePath>C:\Users\ivan\Desktop\Workshop\PolycodeNewNew\include;$(IncludePath)</IncludePath>
+    <LibraryPath>C:\Users\ivan\Desktop\Workshop\PolycodeNewNew\lib\windows\x86;$(LibraryPath)</LibraryPath>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <IncludePath>C:\Users\ivan\Desktop\Workshop\PolycodeNewNew\include;$(IncludePath)</IncludePath>
+    <LibraryPath>C:\Users\ivan\Desktop\Workshop\PolycodeNewNew\lib\windows\x86;$(LibraryPath)</LibraryPath>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
+    <IncludePath>C:\Users\ivan\Desktop\Workshop\PolycodeNewNew\include;$(IncludePath)</IncludePath>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
+    <IncludePath>C:\Users\ivan\Desktop\Workshop\PolycodeNewNew\include;$(IncludePath)</IncludePath>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <IncludePath>C:\Users\ivan\Desktop\Workshop\PolycodeNewNew\include;$(IncludePath)</IncludePath>
+    <LibraryPath>C:\Users\ivan\Desktop\Workshop\PolycodeNewNew\lib\windows\x64;$(LibraryPath)</LibraryPath>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <IncludePath>C:\Users\ivan\Desktop\Workshop\PolycodeNewNew\include;$(IncludePath)</IncludePath>
+    <LibraryPath>C:\Users\ivan\Desktop\Workshop\PolycodeNewNew\lib\windows\x64;$(LibraryPath)</LibraryPath>
   </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>
+      <AdditionalDependencies>Polycored.lib;zlib.lib;physfs.lib;OpenAL32.lib;freetype.lib;libogg.lib;libpng15_static.lib;libvorbis.lib;libvorbisfile.lib;lua5.1.lib;WindowsApp.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
     <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>
+      <AdditionalDependencies>Polycore.lib;zlib.lib;physfs.lib;OpenAL32.lib;freetype.lib;libogg.lib;libpng15_static.lib;libvorbis.lib;libvorbisfile.lib;lua5.1.lib;WindowsApp.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <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>
+      <AdditionalDependencies>Polycored.lib;zlib.lib;physfs.lib;OpenAL32.lib;freetype.lib;libogg.lib;libpng15_static.lib;libvorbis.lib;libvorbisfile.lib;lua5.1.lib;WindowsApp.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <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>
+      <AdditionalDependencies>Polycore.lib;zlib.lib;physfs.lib;OpenAL32.lib;freetype.lib;libogg.lib;libpng15_static.lib;libvorbis.lib;libvorbisfile.lib;lua5.1.lib;WindowsApp.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <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>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
     </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>
+      <AdditionalDependencies>Polycored.lib;zlib.lib;physfs.lib;OpenAL32.lib;freetype.lib;libogg.lib;libpng15_static.lib;libvorbis.lib;libvorbisfile.lib;lua5.1.lib;WindowsApp.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <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>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
     </ClCompile>
+    <Link>
+      <AdditionalDependencies>Polycore.lib;zlib.lib;physfs.lib;OpenAL32.lib;freetype.lib;libogg.lib;libpng15_static.lib;libvorbis.lib;libvorbisfile.lib;lua5.1.lib;WindowsApp.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
   </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClInclude Include="pch.h" />
+    <ClInclude Include="App.xaml.h">
+      <DependentUpon>App.xaml</DependentUpon>
+    </ClInclude>
+    <ClInclude Include="MainPage.xaml.h">
+      <DependentUpon>MainPage.xaml</DependentUpon>
+    </ClInclude>
+    <ClInclude Include="PolycodeTemplateApp.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ApplicationDefinition Include="App.xaml">
+      <SubType>Designer</SubType>
+    </ApplicationDefinition>
+    <Page Include="MainPage.xaml">
+      <SubType>Designer</SubType>
+    </Page>
+  </ItemGroup>
+  <ItemGroup>
+    <AppxManifest Include="Package.appxmanifest">
+      <SubType>Designer</SubType>
+    </AppxManifest>
+    <None Include="TemplateApp_TemporaryKey.pfx" />
+  </ItemGroup>
   <ItemGroup>
     <Image Include="Assets\LockScreenLogo.scale-200.png" />
     <Image Include="Assets\SplashScreen.scale-200.png" />
@@ -200,21 +212,12 @@
     <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="App.xaml.cpp">
+      <DependentUpon>App.xaml</DependentUpon>
+    </ClCompile>
+    <ClCompile Include="MainPage.xaml.cpp">
+      <DependentUpon>MainPage.xaml</DependentUpon>
+    </ClCompile>
     <ClCompile Include="pch.cpp">
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
@@ -223,27 +226,9 @@
       <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>
+    <ClCompile Include="PolycodeTemplateApp.cpp" />
   </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>

+ 29 - 36
build/windows/universal/TemplateApp/TemplateApp.vcxproj.filters

@@ -1,46 +1,30 @@
 <?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup>
     <Filter Include="Common">
-      <UniqueIdentifier>53c60437-81ff-472c-9d97-83445bff7109</UniqueIdentifier>
+      <UniqueIdentifier>06b5f55d-2971-4458-a612-348ecd8ad7df</UniqueIdentifier>
     </Filter>
     <Filter Include="Assets">
-      <UniqueIdentifier>a4d7a1bf-7e7e-4369-9f98-0399a4b47842</UniqueIdentifier>
+      <UniqueIdentifier>d761e570-4bd3-4e51-afc7-4f48514b6e2d</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>
+  </ItemGroup>
+  <ItemGroup>
+    <ApplicationDefinition Include="App.xaml" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="App.xaml.cpp" />
+    <ClCompile Include="MainPage.xaml.cpp" />
+    <ClCompile Include="pch.cpp" />
+    <ClCompile Include="PolycodeTemplateApp.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="pch.h" />
+    <ClInclude Include="App.xaml.h" />
+    <ClInclude Include="MainPage.xaml.h" />
+    <ClInclude Include="PolycodeTemplateApp.h" />
+  </ItemGroup>
+  <ItemGroup>
     <Image Include="Assets\LockScreenLogo.scale-200.png">
       <Filter>Assets</Filter>
     </Image>
@@ -63,4 +47,13 @@
       <Filter>Assets</Filter>
     </Image>
   </ItemGroup>
+  <ItemGroup>
+    <AppxManifest Include="Package.appxmanifest" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="TemplateApp_TemporaryKey.pfx" />
+  </ItemGroup>
+  <ItemGroup>
+    <Page Include="MainPage.xaml" />
+  </ItemGroup>
 </Project>

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

@@ -1,92 +0,0 @@
-#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;
-}

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

@@ -1,30 +0,0 @@
-#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;
-	};
-}

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

@@ -1 +1,6 @@
-#include "pch.h"
+//
+// pch.cpp
+// Include the standard header and generate the precompiled header.
+//
+
+#include "pch.h"

+ 10 - 14
build/windows/universal/TemplateApp/pch.h

@@ -1,15 +1,11 @@
-#pragma once
+//
+// pch.h
+// Header for standard system include files.
+//
 
-#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>
+#pragma once
+
+#include <collection.h>
+#include <ppltasks.h>
+
+#include "App.xaml.h"

+ 5 - 4
include/Polycode.h

@@ -89,16 +89,17 @@
 #include "polycode/core/PolySceneEntityInstance.h"
 #include "polycode/core/PolyGlobals.h"
 
-#ifdef _WINDOWS
-#endif
-
 #if defined(__APPLE__) && defined(__MACH__)
 //    #import "polycode/view/osx/PolycodeView.h"
 #else
     #if defined(_WINDOWS) && !defined(_MINGW)
         #include "polycode/core/PolyWinCore.h"
     #else
-        #include "polycode/core/PolySDLCore.h"
+		#if (WINAPI_FAMILY == WINAPI_FAMILY_APP)
+			#include "polycode/core/PolyUWPCore.h"
+		#else
+			#include "polycode/core/PolySDLCore.h"
+		#endif
     #endif
 #endif
 

+ 3 - 2
include/polycode/core/PolyFont.h

@@ -22,10 +22,11 @@ THE SOFTWARE.
 
 #pragma once
 #include "polycode/core/PolyGlobals.h"
+#define generic GenericFreetypeLibrary
 #include "ft2build.h"
-#include "polycode/core/PolyString.h"
-
 #include FT_FREETYPE_H
+#undef generic
+#include "polycode/core/PolyString.h"
 
 namespace Polycode {
 	

+ 3 - 1
include/polycode/core/PolyFontGlyphSheet.h

@@ -1,14 +1,16 @@
 
 #pragma once
 #include "polycode/core/PolyGlobals.h"
+#define generic GenericFreetypeLibrary
 #include "ft2build.h"
+#include FT_FREETYPE_H
+#undef generic
 #include "polycode/core/PolyString.h"
 #include "polycode/core/PolyVector2.h"
 #include <vector>
 #include <map>
 #include <set>
 
-#include FT_FREETYPE_H
 
 namespace Polycode {
 	

+ 2 - 0
include/polycode/core/PolyFontManager.h

@@ -25,8 +25,10 @@ THE SOFTWARE.
 #include "polycode/core/PolyGlobals.h"
 #include "polycode/core/PolyString.h"
 #include <vector>
+#define generic GenericFreetypeLibrary
 #include "ft2build.h"
 #include FT_FREETYPE_H
+#undef generic
 
 namespace Polycode {
 

+ 1 - 1
include/polycode/core/PolyGlobals.h

@@ -77,7 +77,7 @@ typedef unsigned int PolyRendererIndexType;
 #define PLATFORM_MAC      2
 #define PLATFORM_UNIX     3
 
-#ifdef _WINDOWS
+#if defined(_WINDOWS) || (WINAPI_FAMILY == WINAPI_FAMILY_APP)
 	#define PLATFORM PLATFORM_WINDOWS
 #elif defined(__APPLE__) && defined(__MACH__)
 	#define PLATFORM PLATFORM_MAC

+ 44 - 0
include/polycode/core/PolyUWPCore.h

@@ -0,0 +1,44 @@
+
+#pragma once
+
+#include "PolyCore.h"
+#include <vector>
+
+using namespace Polycode;
+
+
+#define POLYCODE_CORE UWPCore
+
+class PolycodeView {
+	public:
+};
+
+class UWPCore : public Core {
+	public:
+	
+	UWPCore(PolycodeView *view, int xRes, int yRes, bool fullScreen, bool vSync, int aaLevel, int anisotropyLevel, int frameRate, int monitorIndex = -1, bool retinaSupport = false);
+	~UWPCore();
+
+	void Render();
+	bool systemUpdate();
+	void setCursor(int cursorType);
+	void lockMutex(CoreMutex *mutex);
+	void unlockMutex(CoreMutex *mutex);
+	CoreMutex *createMutex();
+	void copyStringToClipboard(const String& str);
+	String getClipboardString();
+	void createFolder(const String& folderPath);
+	void copyDiskItem(const String& itemPath, const String& destItemPath);
+	void moveDiskItem(const String& itemPath, const String& destItemPath);
+	void removeDiskItem(const String& itemPath);
+	String openFolderPicker();
+	std::vector<String> openFilePicker(std::vector<CoreFileExtension> extensions, bool allowMultiple);
+	String saveFilePicker(std::vector<CoreFileExtension> extensions);
+	void handleVideoModeChange(VideoModeChangeInfo *modeInfo);
+	void flushRenderContext();
+	void resizeTo(int xRes, int yRes);
+	void openURL(String url);
+	unsigned int getTicks();
+	String executeExternalCommand(String command, String args, String inDirectory);
+
+};

+ 2 - 1
include/polycode/core/PolyVector3.h

@@ -24,7 +24,8 @@
 #include "polycode/core/PolyGlobals.h"
 #include <math.h>
 
-//#ifdef _WINDOWS
+//#ifdef 
+
 	#include <assert.h>
 //#endif 
 

BIN
lib/windows/x64/OpenAL32d.lib


BIN
lib/windows/x64/Polycored.lib


BIN
lib/windows/x64/freetype_d.lib


BIN
lib/windows/x64/liboggd.lib


BIN
lib/windows/x64/libpng15_staticd.lib


BIN
lib/windows/x64/libvorbisd.lib


BIN
lib/windows/x64/libvorbisfiled.lib


BIN
lib/windows/x64/lua5.1d.lib


BIN
lib/windows/x64/physfsd.lib


BIN
lib/windows/x64/zlibd.lib


BIN
lib/windows/x86/OpenAL32d.lib


BIN
lib/windows/x86/freetype_d.lib


BIN
lib/windows/x86/liboggd.lib


BIN
lib/windows/x86/libpng15_staticd.lib


BIN
lib/windows/x86/libvorbisd.lib


BIN
lib/windows/x86/libvorbisfiled.lib


BIN
lib/windows/x86/lua5.1d.lib


BIN
lib/windows/x86/physfsd.lib


BIN
lib/windows/x86/zlibd.lib


+ 1 - 0
src/core/PolyClient.cpp

@@ -20,6 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 */
 
+#include "polycode/core/PolyGlobals.h"
 #include "polycode/core/PolyClient.h"
 #include <string.h>
 #include "polycode/core/PolyTimer.h"

+ 3 - 2
src/core/PolyCore.cpp

@@ -20,12 +20,13 @@
  THE SOFTWARE.
 */
 
+#include "polycode/core/PolyGlobals.h"
 #include "polycode/core/PolyCore.h"
 #include "polycode/core/PolyCoreInput.h"
 #include "polycode/core/PolyRenderer.h"
 #include "polycode/core/PolyCoreServices.h"
 
-#ifdef _WINDOWS
+#if PLATFORM == PLATFORM_WINDOWS
 #include <windows.h>
 #else
 #include <unistd.h>
@@ -305,7 +306,7 @@ namespace Polycode {
 		unsigned int ticksSinceLastFrame = ticks - lastSleepFrameTicks;
 		int sleepTimeMs = refreshInterval - ticksSinceLastFrame;
 		if(sleepTimeMs > 0) {
-#ifdef _WINDOWS
+#if PLATFORM == PLATFORM_WINDOWS
 			Sleep(sleepTimeMs);
 #else
 			usleep(sleepTimeMs * 1000);

+ 1 - 0
src/core/PolyPeer.cpp

@@ -20,6 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 */
 
+#include "polycode/core/PolyGlobals.h"
 #include "polycode/core/PolyPeer.h"
 #include <string.h>
 #include "polycode/core/PolyCore.h"

+ 1 - 0
src/core/PolyServer.cpp

@@ -20,6 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 */
 
+#include "polycode/core/PolyGlobals.h"
 #include "polycode/core/PolyServer.h"
 #include "polycode/core/PolyTimer.h"
 #include "polycode/core/PolyLogger.h"

+ 1 - 1
src/core/PolySocket.cpp

@@ -24,7 +24,7 @@ THE SOFTWARE.
 #include "polycode/core/PolyLogger.h"
 #include <stdlib.h>
 
-#ifndef _WINDOWS
+#if PLATFORM != PLATFORM_WINDOWS
 	#include <unistd.h>
 #endif
 

+ 7 - 2
src/core/PolySound.cpp

@@ -34,8 +34,13 @@
 #include <stdint.h>
 #include <limits>
 
-#define MAX_FLOAT (std::numeric_limits<double>::infinity())
-#define INT32_MAX (std::numeric_limits<int32_t>::max())
+#ifndef MAX_FLOAT
+	#define MAX_FLOAT (std::numeric_limits<double>::infinity())
+#endif
+
+#ifndef INT32_MAX
+	#define INT32_MAX (std::numeric_limits<int32_t>::max())
+#endif
 
 using namespace std;
 using namespace Polycode;

+ 2 - 1
src/core/PolyString.cpp

@@ -21,6 +21,7 @@
 */
 
 #include "polycode/core/PolyString.h"
+#include "polycode/core/PolyGlobals.h"
 #include <iomanip>
 #include <sstream>
 
@@ -113,7 +114,7 @@ void String::setDataWithEncoding(char *data, int encoding) {
 }
 
 bool String::isNumber() {
-#ifdef _WINDOWS
+#if PLATFORM == PLATFORM_WINDOWS
 	return false;
 #else
     std::string::const_iterator it = contents.begin();

+ 97 - 0
src/core/PolyUWPCore.cpp

@@ -0,0 +1,97 @@
+
+#include "polycode/core/PolyUWPCore.h"
+
+
+UWPCore::UWPCore(PolycodeView *view, int xRes, int yRes, bool fullScreen, bool vSync, int aaLevel, int anisotropyLevel, int frameRate, int monitorIndex, bool retinaSupport) 
+	: Core(xRes, yRes, fullScreen, vSync, aaLevel, anisotropyLevel, frameRate, monitorIndex) {
+
+}
+
+UWPCore::~UWPCore() {
+
+}
+
+void UWPCore::Render() {
+
+}
+
+bool UWPCore::systemUpdate() {
+	return true;
+}
+
+void UWPCore::setCursor(int cursorType) {
+
+}
+
+void UWPCore::lockMutex(CoreMutex *mutex) {
+
+}
+
+void UWPCore::unlockMutex(CoreMutex *mutex) {
+
+}
+
+CoreMutex *UWPCore::createMutex() {
+	return NULL;
+}
+
+void UWPCore::copyStringToClipboard(const String& str) {
+
+}
+
+String UWPCore::getClipboardString() {
+	return "";
+}
+
+void UWPCore::createFolder(const String& folderPath) {
+
+}
+
+void UWPCore::copyDiskItem(const String& itemPath, const String& destItemPath) {
+
+}
+
+void UWPCore::moveDiskItem(const String& itemPath, const String& destItemPath) {
+
+}
+
+void UWPCore::removeDiskItem(const String& itemPath) {
+
+}
+
+String UWPCore::openFolderPicker() {
+	return "";
+}
+
+std::vector<String> UWPCore::openFilePicker(std::vector<CoreFileExtension> extensions, bool allowMultiple) {
+	std::vector<String> ret;
+	return ret;
+}
+
+String UWPCore::saveFilePicker(std::vector<CoreFileExtension> extensions) {
+	return "";
+}
+
+void UWPCore::handleVideoModeChange(VideoModeChangeInfo *modeInfo) {
+
+}
+
+void UWPCore::flushRenderContext() {
+
+}
+
+void UWPCore::resizeTo(int xRes, int yRes) {
+
+}
+
+void UWPCore::openURL(String url) {
+
+}
+
+unsigned int UWPCore::getTicks() {
+	return 0;
+}
+
+String UWPCore::executeExternalCommand(String command, String args, String inDirectory) {
+	return "";
+}