Skip to content

Commit

Permalink
Merge pull request #186 from Microsoft/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
bobbrow authored Aug 11, 2016
2 parents ebcaca8 + ae0a310 commit 45b208c
Show file tree
Hide file tree
Showing 65 changed files with 159 additions and 196 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class __declspec(uuid("BE1D71C8-88FD-4623-ABFA-D0E546D12FAF")) CD3DX12AffinityCo
public:
CD3DX12AffinityCommandList(CD3DX12AffinityDevice* device, ID3D12CommandList** commandLists, UINT Count);

D3D12_COMMAND_LIST_TYPE STDMETHODCALLTYPE GetType(UINT AffinityIndex);
D3D12_COMMAND_LIST_TYPE STDMETHODCALLTYPE GetType(UINT AffinityIndex = 0);

BOOL STDMETHODCALLTYPE AssertResourceState(
_In_ CD3DX12AffinityResource* pResource,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ void STDMETHODCALLTYPE CD3DX12AffinityCommandQueue::ExecuteCommandLists(
}
}

Queue->ExecuteCommandLists(index, &mCachedCommandLists[0]);
Queue->ExecuteCommandLists(index, mCachedCommandLists.data());

#ifdef SERIALIZE_COMMNANDLIST_EXECUTION
ID3D12Fence* pFence;
GetParentDevice()->mDevices[0]->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&pFence));
Queue->Signal(pFence, 1);
HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
HANDLE hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
pFence->SetEventOnCompletion(1, hEvent);
WaitForSingleObject(hEvent, INFINITE);
CloseHandle(hEvent);
Expand Down Expand Up @@ -236,9 +236,9 @@ D3D12_COMMAND_QUEUE_DESC STDMETHODCALLTYPE CD3DX12AffinityCommandQueue::GetDesc(
return mCommandQueues[AffinityIndex]->GetDesc();
}

ID3D12CommandQueue* CD3DX12AffinityCommandQueue::GetQueueForSwapChainCreation(UINT const Index)
ID3D12CommandQueue* CD3DX12AffinityCommandQueue::GetQueueForSwapChainCreation(UINT AffinityIndex)
{
return mCommandQueues[Index];
return mCommandQueues[AffinityIndex];
}

CD3DX12AffinityCommandQueue::CD3DX12AffinityCommandQueue(CD3DX12AffinityDevice* device, ID3D12CommandQueue** commandQueues, UINT Count)
Expand Down Expand Up @@ -278,7 +278,7 @@ void CD3DX12AffinityCommandQueue::WaitForCompletion(UINT AffinityMask)
GetParentDevice()->GetChildObject(0) : GetParentDevice()->GetChildObject(i);
pDevice->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&pFence));
mCommandQueues[i]->Signal(pFence, 1);
HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
HANDLE hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
pFence->SetEventOnCompletion(1, hEvent);
WaitForSingleObject(hEvent, INFINITE);
CloseHandle(hEvent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,18 @@ class __declspec(uuid("BE1D71C8-88FD-4623-ABFA-D0E546D12FAF")) CD3DX12AffinityCo

HRESULT STDMETHODCALLTYPE GetTimestampFrequency(
_Out_ UINT64* pFrequency,
_In_ UINT AffinityIndex = 0);
UINT AffinityIndex = 0);

HRESULT STDMETHODCALLTYPE GetClockCalibration(
_Out_ UINT64* pGpuTimestamp,
_Out_ UINT64* pCpuTimestamp,
UINT AffinityIndex);
UINT AffinityIndex = 0);

D3D12_COMMAND_QUEUE_DESC STDMETHODCALLTYPE GetDesc(UINT AffinityIndex);
D3D12_COMMAND_QUEUE_DESC STDMETHODCALLTYPE GetDesc(UINT AffinityIndex = 0);

ID3D12CommandQueue* GetQueueForSwapChainCreation(UINT const Index = 0);
ID3D12CommandQueue* GetQueueForSwapChainCreation(UINT AffinityIndex);
ID3D12CommandQueue* GetChildObject(UINT AffinityIndex);
void WaitForCompletion(UINT AffinityMask = 0);
void WaitForCompletion(UINT AffinityMask = EAffinityMask::AllNodes);

CD3DX12AffinityCommandQueue(CD3DX12AffinityDevice* device, ID3D12CommandQueue** commandQueues, UINT Count);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class __declspec(uuid("BE1D71C8-88FD-4623-ABFA-D0E546D12FAF")) CD3DX12AffinityDe
friend class CD3DX12AffinityDevice;

public:
D3D12_DESCRIPTOR_HEAP_DESC STDMETHODCALLTYPE GetDesc(UINT AffinityIndex);
D3D12_DESCRIPTOR_HEAP_DESC STDMETHODCALLTYPE GetDesc(UINT AffinityIndex = 0);

D3D12_CPU_DESCRIPTOR_HANDLE STDMETHODCALLTYPE GetCPUDescriptorHandleForHeapStart(void);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1560,7 +1560,7 @@ void CD3DX12AffinityDevice::SwitchToNextNode()
ID3D12Fence* pFence;
GetParentDevice()->mDevices[0]->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&pFence));
mSyncCommandQueues[mActiveNodeIndex]->Signal(pFence, 1);
HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
HANDLE hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
pFence->SetEventOnCompletion(1, hEvent);
WaitForSingleObject(hEvent, INFINITE);
CloseHandle(hEvent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ HRESULT STDMETHODCALLTYPE CD3DX12AffinityFence::WaitOnFenceCompletion(
{
ID3D12Fence* Fence = mFences[i];
Events.push_back(0);
Events[EventCount] = CreateEventEx(nullptr, FALSE, FALSE, EVENT_ALL_ACCESS);
Events[EventCount] = CreateEvent(nullptr, FALSE, FALSE, nullptr);
HRESULT const hr = Fence->SetEventOnCompletion(Value, Events[EventCount]);

if (hr != S_OK)
Expand All @@ -90,7 +90,7 @@ HRESULT STDMETHODCALLTYPE CD3DX12AffinityFence::WaitOnFenceCompletion(
++EventCount;
}
}
WaitForMultipleObjects((DWORD)EventCount, &(Events[0]), TRUE, INFINITE);
WaitForMultipleObjects((DWORD)EventCount, Events.data(), TRUE, INFINITE);
return S_OK;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ void CD3DX12AffinityGraphicsCommandList::ResourceBarrier(
mCachedResourceBarriers[b] = Use;
}

List->ResourceBarrier(NumBarriers, &mCachedResourceBarriers[0]);
List->ResourceBarrier(NumBarriers, mCachedResourceBarriers.data());
}
}
}
Expand Down Expand Up @@ -392,7 +392,7 @@ void CD3DX12AffinityGraphicsCommandList::SetDescriptorHeaps(
mCachedDescriptorHeaps[h] = static_cast<CD3DX12AffinityDescriptorHeap*>(ppDescriptorHeaps[h])->GetChildObject(i);
}

List->SetDescriptorHeaps(NumDescriptorHeaps, &mCachedDescriptorHeaps[0]);
List->SetDescriptorHeaps(NumDescriptorHeaps, mCachedDescriptorHeaps.data());
}
}
}
Expand Down Expand Up @@ -602,7 +602,7 @@ void CD3DX12AffinityGraphicsCommandList::IASetVertexBuffers(
mCachedBufferViews[v].BufferLocation = GetParentDevice()->GetGPUVirtualAddress(pViews[v].BufferLocation, i);
}

List->IASetVertexBuffers(StartSlot, NumViews, &mCachedBufferViews[0]);
List->IASetVertexBuffers(StartSlot, NumViews, mCachedBufferViews.data());
}
}
}
Expand All @@ -627,7 +627,7 @@ void CD3DX12AffinityGraphicsCommandList::SOSetTargets(
mCachedStreamOutBufferViews[v].BufferFilledSizeLocation = GetParentDevice()->GetGPUVirtualAddress(pViews[v].BufferFilledSizeLocation, i);
}

List->SOSetTargets(StartSlot, NumViews, &mCachedStreamOutBufferViews[0]);
List->SOSetTargets(StartSlot, NumViews, mCachedStreamOutBufferViews.data());
}
}
}
Expand All @@ -653,11 +653,11 @@ void CD3DX12AffinityGraphicsCommandList::OMSetRenderTargets(
if (pDepthStencilDescriptor)
{
D3D12_CPU_DESCRIPTOR_HANDLE ActualDepthStencilDescriptor = GetParentDevice()->GetCPUHeapPointer(*pDepthStencilDescriptor, i);
List->OMSetRenderTargets(NumRenderTargetDescriptors, &mCachedRenderTargetViews[0], RTsSingleHandleToDescriptorRange, &ActualDepthStencilDescriptor);
List->OMSetRenderTargets(NumRenderTargetDescriptors, mCachedRenderTargetViews.data(), RTsSingleHandleToDescriptorRange, &ActualDepthStencilDescriptor);
}
else
{
List->OMSetRenderTargets(NumRenderTargetDescriptors, &mCachedRenderTargetViews[0], RTsSingleHandleToDescriptorRange, nullptr);
List->OMSetRenderTargets(NumRenderTargetDescriptors, mCachedRenderTargetViews.data(), RTsSingleHandleToDescriptorRange, nullptr);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ HRESULT STDMETHODCALLTYPE CD3DX12AffinityObject::SetName(
{
for (UINT i = 0; i < D3DX12_MAX_ACTIVE_NODES; ++i)
{
if(mObjects[i])
if (mObjects[i])
{
((ID3D12Object*)mObjects[i])->SetName(Name);
}
Expand All @@ -87,7 +87,6 @@ void STDMETHODCALLTYPE CD3DX12AffinityObject::SetAffinity(
UINT AffinityMask)
{
mAffinityMask = AffinityMask & GetNodeMask();

}

UINT CD3DX12AffinityObject::AffinityIndexToMask(UINT const Index)
Expand Down Expand Up @@ -126,7 +125,6 @@ CD3DX12AffinityObject::~CD3DX12AffinityObject()
DebugLog(L"Releasing handle 0x%p, ref count is now %lu\n", mObjects[i], RefCount);
}
}

}

ULONG CD3DX12AffinityObject::AddRef()
Expand Down
6 changes: 3 additions & 3 deletions Libraries/D3DX12AffinityLayer/Desktop/CD3DX12AffinityObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ class __declspec(uuid("BE1D71C8-88FD-4623-ABFA-D0E546D12FAF")) CD3DX12AffinityOb
_In_ REFGUID guid,
_Inout_ UINT* pDataSize,
_Out_writes_bytes_opt_(*pDataSize) void* pData,
UINT AffinityIndex);
UINT AffinityIndex = 0);

HRESULT STDMETHODCALLTYPE SetPrivateData(
_In_ REFGUID guid,
_In_ UINT DataSize,
_In_reads_bytes_opt_(DataSize) const void* pData,
UINT AffinityIndex);
UINT AffinityIndex = 0);

HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
_In_ REFGUID guid,
_In_opt_ const IUnknown* pData,
UINT AffinityIndex);
UINT AffinityIndex = 0);

HRESULT STDMETHODCALLTYPE SetName(
_In_z_ LPCWSTR Name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ void STDMETHODCALLTYPE CD3DX12AffinityResource::Unmap(
UINT Subresource,
const D3D12_RANGE* pWrittenRange)
{
if (GetParentDevice()->GetAffinityMode() == EAffinityMode::LDA
)
if (GetParentDevice()->GetAffinityMode() == EAffinityMode::LDA)
{
mResources[0]->Unmap(Subresource, pWrittenRange);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ class __declspec(uuid("BE1D71C8-88FD-4623-ABFA-D0E546D12FAF")) CD3DX12AffinityRe
UINT DstDepthPitch,
UINT SrcSubresource,
_In_opt_ const D3D12_BOX* pSrcBox,
UINT AffinityIndex);
UINT AffinityIndex = 0);

HRESULT STDMETHODCALLTYPE GetHeapProperties(
_Out_opt_ D3D12_HEAP_PROPERTIES* pHeapProperties,
_Out_opt_ D3D12_HEAP_FLAGS* pHeapFlags,
UINT AffinityIndex);
UINT AffinityIndex = 0);

CD3DX12AffinityResource(CD3DX12AffinityDevice* device, ID3D12Resource** resources, UINT Count, ID3D12Heap** heaps = nullptr);
~CD3DX12AffinityResource();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ HRESULT STDMETHODCALLTYPE CDXGIAffinitySwapChain::ResizeBuffers(
Height,
NewFormat,
SwapChainFlags,
&creationNodeMasks[0],
&pQueues[0]));
creationNodeMasks.data(),
pQueues.data()));

GetParentDevice()->g_ActiveNodeIndex = 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class __declspec(uuid("BE1D71C8-88FD-4623-ABFA-D0E546D12FAF")) CDXGIAffinitySwap
HRESULT STDMETHODCALLTYPE GetParent(
_In_ REFIID riid,
_COM_Outptr_ void** ppParent,
UINT AffinityIndex);
UINT AffinityIndex = 0);

HRESULT STDMETHODCALLTYPE Present(
UINT SyncInterval,
Expand Down Expand Up @@ -96,7 +96,7 @@ class __declspec(uuid("BE1D71C8-88FD-4623-ABFA-D0E546D12FAF")) CDXGIAffinitySwap

HRESULT STDMETHODCALLTYPE GetContainingOutput(
_COM_Outptr_ IDXGIOutput** ppOutput,
UINT AffinityIndex = EAffinityMask::AllNodes);
UINT AffinityIndex = 0);

HRESULT STDMETHODCALLTYPE GetFrameStatistics(
_Out_ DXGI_FRAME_STATISTICS* pStats,
Expand Down Expand Up @@ -131,7 +131,7 @@ class __declspec(uuid("BE1D71C8-88FD-4623-ABFA-D0E546D12FAF")) CDXGIAffinitySwap
_In_ const DXGI_PRESENT_PARAMETERS* pPresentParameters,
UINT AffinityMask = EAffinityMask::AllNodes);

BOOL STDMETHODCALLTYPE IsTemporaryMonoSupported(UINT AffinityIndex);
BOOL STDMETHODCALLTYPE IsTemporaryMonoSupported(UINT AffinityIndex = 0);

HRESULT STDMETHODCALLTYPE GetRestrictToOutput(
_Out_ IDXGIOutput** ppRestrictToOutput,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class __declspec(uuid("BE1D71C8-88FD-4623-ABFA-D0E546D12FAF")) CD3DX12AffinityCo
public:
CD3DX12AffinityCommandList(CD3DX12AffinityDevice* device, ID3D12CommandList** commandLists, UINT Count);

D3D12_COMMAND_LIST_TYPE STDMETHODCALLTYPE GetType(UINT AffinityIndex);
D3D12_COMMAND_LIST_TYPE STDMETHODCALLTYPE GetType(UINT AffinityIndex = 0);

BOOL STDMETHODCALLTYPE AssertResourceState(
_In_ CD3DX12AffinityResource* pResource,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ void STDMETHODCALLTYPE CD3DX12AffinityCommandQueue::ExecuteCommandLists(
}
}

Queue->ExecuteCommandLists(index, &mCachedCommandLists[0]);
Queue->ExecuteCommandLists(index, mCachedCommandLists.data());

#ifdef SERIALIZE_COMMNANDLIST_EXECUTION
ID3D12Fence* pFence;
GetParentDevice()->mDevices[0]->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&pFence));
Queue->Signal(pFence, 1);
HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
HANDLE hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
pFence->SetEventOnCompletion(1, hEvent);
WaitForSingleObject(hEvent, INFINITE);
CloseHandle(hEvent);
Expand Down Expand Up @@ -236,9 +236,9 @@ D3D12_COMMAND_QUEUE_DESC STDMETHODCALLTYPE CD3DX12AffinityCommandQueue::GetDesc(
return mCommandQueues[AffinityIndex]->GetDesc();
}

ID3D12CommandQueue* CD3DX12AffinityCommandQueue::GetQueueForSwapChainCreation(UINT const Index)
ID3D12CommandQueue* CD3DX12AffinityCommandQueue::GetQueueForSwapChainCreation(UINT AffinityIndex)
{
return mCommandQueues[Index];
return mCommandQueues[AffinityIndex];
}

CD3DX12AffinityCommandQueue::CD3DX12AffinityCommandQueue(CD3DX12AffinityDevice* device, ID3D12CommandQueue** commandQueues, UINT Count)
Expand Down Expand Up @@ -278,7 +278,7 @@ void CD3DX12AffinityCommandQueue::WaitForCompletion(UINT AffinityMask)
GetParentDevice()->GetChildObject(0) : GetParentDevice()->GetChildObject(i);
pDevice->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&pFence));
mCommandQueues[i]->Signal(pFence, 1);
HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
HANDLE hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
pFence->SetEventOnCompletion(1, hEvent);
WaitForSingleObject(hEvent, INFINITE);
CloseHandle(hEvent);
Expand Down
10 changes: 5 additions & 5 deletions Libraries/D3DX12AffinityLayer/UWP/CD3DX12AffinityCommandQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,18 @@ class __declspec(uuid("BE1D71C8-88FD-4623-ABFA-D0E546D12FAF")) CD3DX12AffinityCo

HRESULT STDMETHODCALLTYPE GetTimestampFrequency(
_Out_ UINT64* pFrequency,
_In_ UINT AffinityIndex = 0);
UINT AffinityIndex = 0);

HRESULT STDMETHODCALLTYPE GetClockCalibration(
_Out_ UINT64* pGpuTimestamp,
_Out_ UINT64* pCpuTimestamp,
UINT AffinityIndex);
UINT AffinityIndex = 0);

D3D12_COMMAND_QUEUE_DESC STDMETHODCALLTYPE GetDesc(UINT AffinityIndex);
D3D12_COMMAND_QUEUE_DESC STDMETHODCALLTYPE GetDesc(UINT AffinityIndex = 0);

ID3D12CommandQueue* GetQueueForSwapChainCreation(UINT const Index = 0);
ID3D12CommandQueue* GetQueueForSwapChainCreation(UINT AffinityIndex);
ID3D12CommandQueue* GetChildObject(UINT AffinityIndex);
void WaitForCompletion(UINT AffinityMask = 0);
void WaitForCompletion(UINT AffinityMask = EAffinityMask::AllNodes);

CD3DX12AffinityCommandQueue(CD3DX12AffinityDevice* device, ID3D12CommandQueue** commandQueues, UINT Count);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class __declspec(uuid("BE1D71C8-88FD-4623-ABFA-D0E546D12FAF")) CD3DX12AffinityDe
friend class CD3DX12AffinityDevice;

public:
D3D12_DESCRIPTOR_HEAP_DESC STDMETHODCALLTYPE GetDesc(UINT AffinityIndex);
D3D12_DESCRIPTOR_HEAP_DESC STDMETHODCALLTYPE GetDesc(UINT AffinityIndex = 0);

D3D12_CPU_DESCRIPTOR_HANDLE STDMETHODCALLTYPE GetCPUDescriptorHandleForHeapStart(void);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1560,7 +1560,7 @@ void CD3DX12AffinityDevice::SwitchToNextNode()
ID3D12Fence* pFence;
GetParentDevice()->mDevices[0]->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&pFence));
mSyncCommandQueues[mActiveNodeIndex]->Signal(pFence, 1);
HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
HANDLE hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
pFence->SetEventOnCompletion(1, hEvent);
WaitForSingleObject(hEvent, INFINITE);
CloseHandle(hEvent);
Expand Down
4 changes: 2 additions & 2 deletions Libraries/D3DX12AffinityLayer/UWP/CD3DX12AffinityFence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ HRESULT STDMETHODCALLTYPE CD3DX12AffinityFence::WaitOnFenceCompletion(
{
ID3D12Fence* Fence = mFences[i];
Events.push_back(0);
Events[EventCount] = CreateEventEx(nullptr, FALSE, FALSE, EVENT_ALL_ACCESS);
Events[EventCount] = CreateEvent(nullptr, FALSE, FALSE, nullptr);
HRESULT const hr = Fence->SetEventOnCompletion(Value, Events[EventCount]);

if (hr != S_OK)
Expand All @@ -90,7 +90,7 @@ HRESULT STDMETHODCALLTYPE CD3DX12AffinityFence::WaitOnFenceCompletion(
++EventCount;
}
}
WaitForMultipleObjects((DWORD)EventCount, &(Events[0]), TRUE, INFINITE);
WaitForMultipleObjects((DWORD)EventCount, Events.data(), TRUE, INFINITE);
return S_OK;
}

Expand Down
Loading

0 comments on commit 45b208c

Please sign in to comment.