C++14 rules on std::initializer_list broke ScopedBarrier; fixed with additional ctors

This commit is contained in:
Chuck Walbourn 2021-09-04 17:18:00 -07:00
Родитель e12fee16b8
Коммит 193be6ba7f
1 изменённых файлов: 26 добавлений и 0 удалений

Просмотреть файл

@ -200,6 +200,32 @@ namespace DirectX
mCommandList->ResourceBarrier(static_cast<UINT>(mBarriers.size()), mBarriers.data());
}
ScopedBarrier(
_In_ ID3D12GraphicsCommandList* commandList,
_In_reads_(count) const D3D12_RESOURCE_BARRIER *barriers,
size_t count) noexcept(false)
: mCommandList(commandList),
mBarriers(barriers, barriers + count)
{
assert(count <= UINT32_MAX);
// Set barriers
mCommandList->ResourceBarrier(static_cast<UINT>(mBarriers.size()), mBarriers.data());
}
template<size_t TBarrierLength>
ScopedBarrier(
_In_ ID3D12GraphicsCommandList* commandList,
const D3D12_RESOURCE_BARRIER(&barriers)[TBarrierLength]) noexcept(false)
: mCommandList(commandList),
mBarriers(barriers, barriers + TBarrierLength)
{
assert(TBarrierLength <= UINT32_MAX);
// Set barriers
mCommandList->ResourceBarrier(static_cast<UINT>(mBarriers.size()), mBarriers.data());
}
ScopedBarrier(ScopedBarrier&&) = default;
ScopedBarrier& operator= (ScopedBarrier&&) = default;