Skip to content

Commit

Permalink
Update samples projects to Win10 SDK 16299 and latest d3dx12.h. Updat…
Browse files Browse the repository at this point in the history
…e HDR, Fullscreen, LinkedGPUs, SM6WaveIntrinsics samples with latest changes.

Notable updates:
- Resizable UWP samples (e.g the Fullscreen sample) now use the new Resize events
- HDR sample updates to handle multi-mon scenarios and send HDR metadata
  • Loading branch information
sebmerry committed Oct 24, 2017
1 parent 8425ba4 commit dc76fdf
Show file tree
Hide file tree
Showing 168 changed files with 12,193 additions and 2,050 deletions.
216 changes: 189 additions & 27 deletions Libraries/D3DX12/d3dx12.h

Large diffs are not rendered by default.

216 changes: 189 additions & 27 deletions Libraries/D3DX12AffinityLayer/Desktop/d3dx12.h

Large diffs are not rendered by default.

216 changes: 189 additions & 27 deletions Libraries/D3DX12AffinityLayer/UWP/d3dx12.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Samples/Desktop/D3D1211On12/src/D3D1211On12.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<Keyword>Win32Proj</Keyword>
<RootNamespace>D3D1211On12</RootNamespace>
<ProjectName>D3D1211On12</ProjectName>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
Expand Down
216 changes: 189 additions & 27 deletions Samples/Desktop/D3D1211On12/src/d3dx12.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Samples/Desktop/D3D12Bundles/src/D3D12Bundles.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<Keyword>Win32Proj</Keyword>
<RootNamespace>D3D12Bundles</RootNamespace>
<ProjectName>D3D12Bundles</ProjectName>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
Expand Down
216 changes: 189 additions & 27 deletions Samples/Desktop/D3D12Bundles/src/d3dx12.h

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{A6DB1D1C-E2EE-462D-AC61-0E3100C010DF}</ProjectGuid>
<ProjectGuid>{EDC25A65-E2D7-427E-8FEA-DB448AFD71AD}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>D3D12DepthBoundsTest</RootNamespace>
<ProjectName>D3D12DepthBoundsTest</ProjectName>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
Expand Down
216 changes: 189 additions & 27 deletions Samples/Desktop/D3D12DepthBoundsTest/src/d3dx12.h

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<Keyword>Win32Proj</Keyword>
<RootNamespace>D3D12DynamicIndexing</RootNamespace>
<ProjectName>D3D12DynamicIndexing</ProjectName>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
Expand Down
216 changes: 189 additions & 27 deletions Samples/Desktop/D3D12DynamicIndexing/src/d3dx12.h

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<Keyword>Win32Proj</Keyword>
<RootNamespace>D3D12ExecuteIndirect</RootNamespace>
<ProjectName>D3D12ExecuteIndirect</ProjectName>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
Expand Down
216 changes: 189 additions & 27 deletions Samples/Desktop/D3D12ExecuteIndirect/src/d3dx12.h

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions Samples/Desktop/D3D12Fullscreen/src/D3D12Fullscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -911,3 +911,7 @@ void D3D12Fullscreen::UpdateTitle()
swprintf_s(updatedTitle, L"( %u x %u ) scaled to ( %u x %u )", m_resolutionOptions[m_resolutionIndex].Width, m_resolutionOptions[m_resolutionIndex].Height, m_width, m_height);
SetCustomWindowText(updatedTitle);
}

void D3D12Fullscreen::OnWindowMoved(int, int)
{
}
1 change: 1 addition & 0 deletions Samples/Desktop/D3D12Fullscreen/src/D3D12Fullscreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class D3D12Fullscreen : public DXSample
virtual void OnUpdate();
virtual void OnRender();
virtual void OnSizeChanged(UINT width, UINT height, bool minimized);
virtual void OnWindowMoved(int, int);
virtual void OnDestroy();
virtual void OnKeyDown(UINT8 key);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<Keyword>Win32Proj</Keyword>
<RootNamespace>D3D12Fullscreen</RootNamespace>
<ProjectName>D3D12Fullscreen</ProjectName>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
Expand Down
9 changes: 9 additions & 0 deletions Samples/Desktop/D3D12Fullscreen/src/DXSample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ using namespace Microsoft::WRL;
DXSample::DXSample(UINT width, UINT height, std::wstring name) :
m_width(width),
m_height(height),
m_windowBounds{0,0,0,0},
m_title(name),
m_aspectRatio(0.0f),
m_useWarpDevice(false)
Expand Down Expand Up @@ -121,3 +122,11 @@ void DXSample::CheckTearingSupport()

m_tearingSupport = SUCCEEDED(hr) && allowTearing;
}

void DXSample::SetWindowBounds(int left, int top, int right, int bottom)
{
m_windowBounds.left = static_cast<LONG>(left);
m_windowBounds.top = static_cast<LONG>(top);
m_windowBounds.right = static_cast<LONG>(right);
m_windowBounds.bottom = static_cast<LONG>(bottom);
}
18 changes: 14 additions & 4 deletions Samples/Desktop/D3D12Fullscreen/src/DXSample.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,24 @@ class DXSample
virtual void OnDestroy() = 0;

// Samples override the event handlers to handle specific messages.
virtual void OnKeyDown(UINT8 /*key*/) {}
virtual void OnKeyUp(UINT8 /*key*/) {}

virtual void OnKeyDown(UINT8 /*key*/) {}
virtual void OnKeyUp(UINT8 /*key*/) {}
virtual void OnWindowMoved(int /*x*/, int /*y*/) {}
virtual void OnMouseMove(UINT /*x*/, UINT /*y*/) {}
virtual void OnLeftButtonDown(UINT /*x*/, UINT /*y*/) {}
virtual void OnLeftButtonUp(UINT /*x*/, UINT /*y*/) {}
virtual void OnDisplayChanged() {}

// Accessors.
UINT GetWidth() const { return m_width; }
UINT GetHeight() const { return m_height; }
const WCHAR* GetTitle() const { return m_title.c_str(); }
bool GetTearingSupport() { return m_tearingSupport; }
bool GetTearingSupport() const { return m_tearingSupport; }
RECT GetWindowsBounds() const { return m_windowBounds; }

void ParseCommandLineArgs(_In_reads_(argc) WCHAR* argv[], int argc);
void UpdateForSizeChange(UINT clientWidth, UINT clientHeight);
void SetWindowBounds(int left, int top, int right, int bottom);

protected:
std::wstring GetAssetFullPath(LPCWSTR assetName);
Expand All @@ -50,6 +57,9 @@ class DXSample
UINT m_height;
float m_aspectRatio;

// Window Bounds
RECT m_windowBounds;

// Whether or not tearing is available for fullscreen borderless windowed mode.
bool m_tearingSupport;

Expand Down
49 changes: 49 additions & 0 deletions Samples/Desktop/D3D12Fullscreen/src/Win32Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,61 @@ LRESULT CALLBACK Win32Application::WindowProc(HWND hWnd, UINT message, WPARAM wP
case WM_SIZE:
if (pSample)
{
RECT windowRect = {};
GetWindowRect(hWnd, &windowRect);
pSample->SetWindowBounds(windowRect.left, windowRect.top, windowRect.right, windowRect.bottom);

RECT clientRect = {};
GetClientRect(hWnd, &clientRect);
pSample->OnSizeChanged(clientRect.right - clientRect.left, clientRect.bottom - clientRect.top, wParam == SIZE_MINIMIZED);
}
return 0;

case WM_MOVE:
if (pSample)
{
RECT windowRect = {};
GetWindowRect(hWnd, &windowRect);
pSample->SetWindowBounds(windowRect.left, windowRect.top, windowRect.right, windowRect.bottom);

int xPos = (int)(short) LOWORD(lParam);
int yPos = (int)(short) HIWORD(lParam);
pSample->OnWindowMoved(xPos, yPos);
}
return 0;

case WM_DISPLAYCHANGE:
if (pSample)
{
pSample->OnDisplayChanged();
}
return 0;

case WM_MOUSEMOVE:
if (pSample && static_cast<UINT8>(wParam)== MK_LBUTTON)
{
UINT x = LOWORD(lParam);
UINT y = HIWORD(lParam);
pSample->OnMouseMove(x, y);
}
return 0;

case WM_LBUTTONDOWN:
{
UINT x = LOWORD(lParam);
UINT y = HIWORD(lParam);
pSample->OnLeftButtonDown(x, y);
}
return 0;

case WM_LBUTTONUP:
{
UINT x = LOWORD(lParam);
UINT y = HIWORD(lParam);
pSample->OnLeftButtonUp(x, y);
}
return 0;

case WM_DESTROY:
PostQuitMessage(0);
return 0;
Expand Down
Loading

0 comments on commit dc76fdf

Please sign in to comment.