Skip to content

Commit e41707d

Browse files
authored
Merge pull request #218 from Microsoft/develop
Develop
2 parents b802fa2 + d930dcd commit e41707d

File tree

156 files changed

+6072
-1169
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+6072
-1169
lines changed

Libraries/D3DX12/d3dx12.h

Lines changed: 2012 additions & 0 deletions
Large diffs are not rendered by default.

Libraries/D3DX12/readme.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# The D3D12 Helper Library
2+
3+
This library provides helper functions and structs to make certain common operations less verbose in your code.
4+
5+
Documentation of the helper functions and structures can he found on [MSDN](https://msdn.microsoft.com/en-us/library/windows/desktop/dn708058(v=vs.85).aspx)
6+

Libraries/D3DX12AffinityLayer/Desktop/d3dx12.h

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,71 @@ struct CD3DX12_RECT : public D3D12_RECT
5353
operator const D3D12_RECT&() const { return *this; }
5454
};
5555

56+
//------------------------------------------------------------------------------------------------
57+
struct CD3DX12_VIEWPORT : public D3D12_VIEWPORT
58+
{
59+
CD3DX12_VIEWPORT()
60+
{}
61+
explicit CD3DX12_VIEWPORT( const D3D12_VIEWPORT& o ) :
62+
D3D12_VIEWPORT( o )
63+
{}
64+
explicit CD3DX12_VIEWPORT(
65+
FLOAT topLeftX,
66+
FLOAT topLeftY,
67+
FLOAT width,
68+
FLOAT height,
69+
FLOAT minDepth = D3D12_MIN_DEPTH,
70+
FLOAT maxDepth = D3D12_MAX_DEPTH )
71+
{
72+
TopLeftX = topLeftX;
73+
TopLeftY = topLeftY;
74+
Width = width;
75+
Height = height;
76+
MinDepth = minDepth;
77+
MaxDepth = maxDepth;
78+
}
79+
explicit CD3DX12_VIEWPORT(
80+
_In_ ID3D12Resource* pResource,
81+
UINT mipSlice = 0,
82+
FLOAT topLeftX = 0.0f,
83+
FLOAT topLeftY = 0.0f,
84+
FLOAT minDepth = D3D12_MIN_DEPTH,
85+
FLOAT maxDepth = D3D12_MAX_DEPTH )
86+
{
87+
D3D12_RESOURCE_DESC Desc = pResource->GetDesc();
88+
const UINT64 SubresourceWidth = Desc.Width >> mipSlice;
89+
const UINT64 SubresourceHeight = Desc.Height >> mipSlice;
90+
switch (Desc.Dimension)
91+
{
92+
case D3D12_RESOURCE_DIMENSION_BUFFER:
93+
TopLeftX = topLeftX;
94+
TopLeftY = 0.0f;
95+
Width = Desc.Width - topLeftX;
96+
Height = 1.0f;
97+
break;
98+
case D3D12_RESOURCE_DIMENSION_TEXTURE1D:
99+
TopLeftX = topLeftX;
100+
TopLeftY = 0.0f;
101+
Width = (SubresourceWidth ? SubresourceWidth : 1.0f) - topLeftX;
102+
Height = 1.0f;
103+
break;
104+
case D3D12_RESOURCE_DIMENSION_TEXTURE2D:
105+
case D3D12_RESOURCE_DIMENSION_TEXTURE3D:
106+
TopLeftX = topLeftX;
107+
TopLeftY = topLeftY;
108+
Width = (SubresourceWidth ? SubresourceWidth : 1.0f) - topLeftX;
109+
Height = (SubresourceHeight ? SubresourceHeight: 1.0f) - topLeftY;
110+
break;
111+
default: break;
112+
}
113+
114+
MinDepth = minDepth;
115+
MaxDepth = maxDepth;
116+
}
117+
~CD3DX12_VIEWPORT() {}
118+
operator const D3D12_VIEWPORT&() const { return *this; }
119+
};
120+
56121
//------------------------------------------------------------------------------------------------
57122
struct CD3DX12_BOX : public D3D12_BOX
58123
{
@@ -453,13 +518,13 @@ struct CD3DX12_SHADER_BYTECODE : public D3D12_SHADER_BYTECODE
453518
D3D12_SHADER_BYTECODE(o)
454519
{}
455520
CD3DX12_SHADER_BYTECODE(
456-
ID3DBlob* pShaderBlob )
521+
_In_ ID3DBlob* pShaderBlob )
457522
{
458523
pShaderBytecode = pShaderBlob->GetBufferPointer();
459524
BytecodeLength = pShaderBlob->GetBufferSize();
460525
}
461526
CD3DX12_SHADER_BYTECODE(
462-
void* _pShaderBytecode,
527+
const void* _pShaderBytecode,
463528
SIZE_T bytecodeLength )
464529
{
465530
pShaderBytecode = _pShaderBytecode;
@@ -1938,6 +2003,7 @@ inline HRESULT D3DX12SerializeVersionedRootSignature(
19382003
return E_INVALIDARG;
19392004
}
19402005

2006+
19412007
#endif // defined( __cplusplus )
19422008

19432009
#endif //__D3DX12_H__

Libraries/D3DX12AffinityLayer/Desktop/d3dx12affinity.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ HRESULT STDMETHODCALLTYPE DXGIXAffinityCreateSingleWindowSwapChain(
7272
_Outptr_ CDXGIAffinitySwapChain** ppSwapChain);
7373

7474
HRESULT STDMETHODCALLTYPE DXGIXAffinityCreateLDASwapChain(
75-
IDXGISwapChain* pSwapChain,
75+
_In_ IDXGISwapChain* pSwapChain,
7676
_In_ CD3DX12AffinityCommandQueue* pQueue,
7777
_In_ CD3DX12AffinityDevice* pDevice,
7878
_Outptr_ CDXGIAffinitySwapChain** ppSwapChain);

Libraries/D3DX12AffinityLayer/UWP/d3dx12.h

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,71 @@ struct CD3DX12_RECT : public D3D12_RECT
5353
operator const D3D12_RECT&() const { return *this; }
5454
};
5555

56+
//------------------------------------------------------------------------------------------------
57+
struct CD3DX12_VIEWPORT : public D3D12_VIEWPORT
58+
{
59+
CD3DX12_VIEWPORT()
60+
{}
61+
explicit CD3DX12_VIEWPORT( const D3D12_VIEWPORT& o ) :
62+
D3D12_VIEWPORT( o )
63+
{}
64+
explicit CD3DX12_VIEWPORT(
65+
FLOAT topLeftX,
66+
FLOAT topLeftY,
67+
FLOAT width,
68+
FLOAT height,
69+
FLOAT minDepth = D3D12_MIN_DEPTH,
70+
FLOAT maxDepth = D3D12_MAX_DEPTH )
71+
{
72+
TopLeftX = topLeftX;
73+
TopLeftY = topLeftY;
74+
Width = width;
75+
Height = height;
76+
MinDepth = minDepth;
77+
MaxDepth = maxDepth;
78+
}
79+
explicit CD3DX12_VIEWPORT(
80+
_In_ ID3D12Resource* pResource,
81+
UINT mipSlice = 0,
82+
FLOAT topLeftX = 0.0f,
83+
FLOAT topLeftY = 0.0f,
84+
FLOAT minDepth = D3D12_MIN_DEPTH,
85+
FLOAT maxDepth = D3D12_MAX_DEPTH )
86+
{
87+
D3D12_RESOURCE_DESC Desc = pResource->GetDesc();
88+
const UINT64 SubresourceWidth = Desc.Width >> mipSlice;
89+
const UINT64 SubresourceHeight = Desc.Height >> mipSlice;
90+
switch (Desc.Dimension)
91+
{
92+
case D3D12_RESOURCE_DIMENSION_BUFFER:
93+
TopLeftX = topLeftX;
94+
TopLeftY = 0.0f;
95+
Width = Desc.Width - topLeftX;
96+
Height = 1.0f;
97+
break;
98+
case D3D12_RESOURCE_DIMENSION_TEXTURE1D:
99+
TopLeftX = topLeftX;
100+
TopLeftY = 0.0f;
101+
Width = (SubresourceWidth ? SubresourceWidth : 1.0f) - topLeftX;
102+
Height = 1.0f;
103+
break;
104+
case D3D12_RESOURCE_DIMENSION_TEXTURE2D:
105+
case D3D12_RESOURCE_DIMENSION_TEXTURE3D:
106+
TopLeftX = topLeftX;
107+
TopLeftY = topLeftY;
108+
Width = (SubresourceWidth ? SubresourceWidth : 1.0f) - topLeftX;
109+
Height = (SubresourceHeight ? SubresourceHeight: 1.0f) - topLeftY;
110+
break;
111+
default: break;
112+
}
113+
114+
MinDepth = minDepth;
115+
MaxDepth = maxDepth;
116+
}
117+
~CD3DX12_VIEWPORT() {}
118+
operator const D3D12_VIEWPORT&() const { return *this; }
119+
};
120+
56121
//------------------------------------------------------------------------------------------------
57122
struct CD3DX12_BOX : public D3D12_BOX
58123
{
@@ -453,13 +518,13 @@ struct CD3DX12_SHADER_BYTECODE : public D3D12_SHADER_BYTECODE
453518
D3D12_SHADER_BYTECODE(o)
454519
{}
455520
CD3DX12_SHADER_BYTECODE(
456-
ID3DBlob* pShaderBlob )
521+
_In_ ID3DBlob* pShaderBlob )
457522
{
458523
pShaderBytecode = pShaderBlob->GetBufferPointer();
459524
BytecodeLength = pShaderBlob->GetBufferSize();
460525
}
461526
CD3DX12_SHADER_BYTECODE(
462-
void* _pShaderBytecode,
527+
const void* _pShaderBytecode,
463528
SIZE_T bytecodeLength )
464529
{
465530
pShaderBytecode = _pShaderBytecode;
@@ -1938,6 +2003,7 @@ inline HRESULT D3DX12SerializeVersionedRootSignature(
19382003
return E_INVALIDARG;
19392004
}
19402005

2006+
19412007
#endif // defined( __cplusplus )
19422008

19432009
#endif //__D3DX12_H__

Libraries/D3DX12AffinityLayer/UWP/d3dx12affinity.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ HRESULT STDMETHODCALLTYPE DXGIXAffinityCreateSingleWindowSwapChain(
7272
_Outptr_ CDXGIAffinitySwapChain** ppSwapChain);
7373

7474
HRESULT STDMETHODCALLTYPE DXGIXAffinityCreateLDASwapChain(
75-
IDXGISwapChain* pSwapChain,
75+
_In_ IDXGISwapChain* pSwapChain,
7676
_In_ CD3DX12AffinityCommandQueue* pQueue,
7777
_In_ CD3DX12AffinityDevice* pDevice,
7878
_Outptr_ CDXGIAffinitySwapChain** ppSwapChain);

0 commit comments

Comments
 (0)