Skip to content

Commit

Permalink
Added tonemapping
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn committed Jun 23, 2017
1 parent c666499 commit 6a4fcf9
Show file tree
Hide file tree
Showing 19 changed files with 361 additions and 82 deletions.
19 changes: 4 additions & 15 deletions DeviceResourcesXDK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ using namespace DirectX;

using Microsoft::WRL::ComPtr;

bool DX::DeviceResources::s_render4K = false;

// Constructor for DeviceResources.
DX::DeviceResources::DeviceResources(DXGI_FORMAT backBufferFormat, DXGI_FORMAT depthBufferFormat, UINT backBufferCount, bool fastSemantics) :
m_screenViewport{},
Expand Down Expand Up @@ -85,26 +83,17 @@ void DX::DeviceResources::CreateDeviceResources()
DX::ThrowIfFailed(device.As(&m_d3dDevice));
DX::ThrowIfFailed(context.As(&m_d3dContext));

#if _XDK_VER >= 0x38390868 /* XDK Edition 161000 */
if (s_render4K)
#if _XDK_VER >= 0x3F5B03F5 /* XDK Edition 170600 */
{
D3D11X_GPU_HARDWARE_CONFIGURATION hwConfig = {};
m_d3dDevice->GetGpuHardwareConfiguration(&hwConfig);
if (hwConfig.HardwareVersion >= D3D11X_HARDWARE_VERSION_XBOX_ONE_S)
if (hwConfig.HardwareVersion >= D3D11X_HARDWARE_VERSION_XBOX_ONE_X)
{
m_outputSize = { 0, 0, 3840, 2160 };
}
#ifdef _DEBUG
else
{
OutputDebugStringA("INFO: 4K UHD output requires Xbox One S or later; using 1080p\n");
}
OutputDebugStringA("INFO: Swapchain using 4k (3840 x 2160)\n");
#endif
}
#elif defined(_DEBUG)
if (s_render4K)
{
OutputDebugStringA("WARNING: 4K UHD detection not supported prior to October 2016 XDK; using 1080p\n");
}
}
#endif
}
Expand Down
8 changes: 0 additions & 8 deletions DeviceResourcesXDK.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ namespace DX
D3D11_VIEWPORT GetScreenViewport() const { return m_screenViewport; }
UINT GetBackBufferCount() const { return m_backBufferCount; }

static void DebugRender4K(bool enable)
{
s_render4K = enable;
}

private:
// Direct3D objects.
Microsoft::WRL::ComPtr<ID3D11DeviceX> m_d3dDevice;
Expand All @@ -67,8 +62,5 @@ namespace DX
RECT m_outputSize;

bool m_fastSemantics;

// Options.
static bool s_render4K;
};
}
2 changes: 2 additions & 0 deletions DirectXTKModelViewer_Desktop_2013.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
<ClInclude Include="DeviceResourcesPC.h" />
<ClInclude Include="Game.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="RenderTexture.h" />
<ClInclude Include="StepTimer.h" />
</ItemGroup>
<ItemGroup>
Expand All @@ -175,6 +176,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="RenderTexture.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resource.rc" />
Expand Down
2 changes: 2 additions & 0 deletions DirectXTKModelViewer_Desktop_2013.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<ClInclude Include="DeviceResourcesPC.h">
<Filter>Common</Filter>
</ClInclude>
<ClInclude Include="RenderTexture.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Game.cpp" />
Expand All @@ -26,6 +27,7 @@
<ClCompile Include="DeviceResourcesPC.cpp">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="RenderTexture.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="comic.spritefont">
Expand Down
2 changes: 2 additions & 0 deletions DirectXTKModelViewer_Desktop_2015.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
<ClInclude Include="DeviceResourcesPC.h" />
<ClInclude Include="Game.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="RenderTexture.h" />
<ClInclude Include="StepTimer.h" />
</ItemGroup>
<ItemGroup>
Expand All @@ -175,6 +176,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="RenderTexture.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resource.rc" />
Expand Down
2 changes: 2 additions & 0 deletions DirectXTKModelViewer_Desktop_2015.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<ClInclude Include="DeviceResourcesPC.h">
<Filter>Common</Filter>
</ClInclude>
<ClInclude Include="RenderTexture.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="DeviceResourcesPC.cpp">
Expand All @@ -26,6 +27,7 @@
<ClCompile Include="Game.cpp" />
<ClCompile Include="Main.cpp" />
<ClCompile Include="pch.cpp" />
<ClCompile Include="RenderTexture.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="comic.spritefont">
Expand Down
2 changes: 2 additions & 0 deletions DirectXTKModelViewer_Desktop_2017.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
<ClInclude Include="DeviceResourcesPC.h" />
<ClInclude Include="Game.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="RenderTexture.h" />
<ClInclude Include="StepTimer.h" />
</ItemGroup>
<ItemGroup>
Expand All @@ -176,6 +177,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="RenderTexture.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resource.rc" />
Expand Down
2 changes: 2 additions & 0 deletions DirectXTKModelViewer_Desktop_2017.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<ClInclude Include="DeviceResourcesPC.h">
<Filter>Common</Filter>
</ClInclude>
<ClInclude Include="RenderTexture.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="DeviceResourcesPC.cpp">
Expand All @@ -26,6 +27,7 @@
<ClCompile Include="Game.cpp" />
<ClCompile Include="Main.cpp" />
<ClCompile Include="pch.cpp" />
<ClCompile Include="RenderTexture.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="comic.spritefont">
Expand Down
3 changes: 2 additions & 1 deletion DirectXTKModelViewer_XDK_2015.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
<Keyword>Win32Proj</Keyword>
<ApplicationEnvironment>title</ApplicationEnvironment>
<!-- - - - -->
<PlatformToolset>v140</PlatformToolset>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
<TargetRuntime>Native</TargetRuntime>
</PropertyGroup>
Expand Down Expand Up @@ -159,6 +158,7 @@
<ItemGroup>
<ClInclude Include="ArcBall.h" />
<ClInclude Include="DeviceResourcesXDK.h" />
<ClInclude Include="RenderTexture.h" />
<ClInclude Include="StepTimer.h" />
<ClInclude Include="Game.h" />
<ClInclude Include="pch.h" />
Expand All @@ -172,6 +172,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Profile|Durango'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Durango'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="RenderTexture.cpp" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest" />
Expand Down
2 changes: 2 additions & 0 deletions DirectXTKModelViewer_XDK_2015.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<ClInclude Include="DeviceResourcesXDK.h">
<Filter>Common</Filter>
</ClInclude>
<ClInclude Include="RenderTexture.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Game.cpp" />
Expand All @@ -26,6 +27,7 @@
<ClCompile Include="DeviceResourcesXDK.cpp">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="RenderTexture.cpp" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest" />
Expand Down
2 changes: 2 additions & 0 deletions DirectXTKModelViewer_XDK_2017.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
<ItemGroup>
<ClInclude Include="ArcBall.h" />
<ClInclude Include="DeviceResourcesXDK.h" />
<ClInclude Include="RenderTexture.h" />
<ClInclude Include="StepTimer.h" />
<ClInclude Include="Game.h" />
<ClInclude Include="pch.h" />
Expand All @@ -171,6 +172,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Profile|Durango'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Durango'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="RenderTexture.cpp" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest" />
Expand Down
2 changes: 2 additions & 0 deletions DirectXTKModelViewer_XDK_2017.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<ClInclude Include="DeviceResourcesXDK.h">
<Filter>Common</Filter>
</ClInclude>
<ClInclude Include="RenderTexture.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Game.cpp" />
Expand All @@ -26,6 +27,7 @@
<ClCompile Include="DeviceResourcesXDK.cpp">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="RenderTexture.cpp" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest" />
Expand Down
Loading

0 comments on commit 6a4fcf9

Please sign in to comment.