diff options
Diffstat (limited to 'tools/gfx/d3d12/d3d12-command-encoder.cpp')
| -rw-r--r-- | tools/gfx/d3d12/d3d12-command-encoder.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/gfx/d3d12/d3d12-command-encoder.cpp b/tools/gfx/d3d12/d3d12-command-encoder.cpp index b88bf3168..ff50dcc5f 100644 --- a/tools/gfx/d3d12/d3d12-command-encoder.cpp +++ b/tools/gfx/d3d12/d3d12-command-encoder.cpp @@ -384,11 +384,14 @@ void ResourceCommandEncoderImpl::clearResourceView( case IResourceView::Type::UnorderedAccess: { ID3D12Resource* d3dResource = nullptr; + D3D12Descriptor descriptor = viewImpl->m_descriptor; switch (viewImpl->m_resource->getType()) { case IResource::Type::Buffer: d3dResource = static_cast<BufferResourceImpl*>(viewImpl->m_resource.Ptr()) ->m_resource.getResource(); + // D3D12 requires a UAV descriptor with zero buffer stride for calling ClearUnorderedAccessViewUint/Float. + viewImpl->getBufferDescriptorForBinding(m_commandBuffer->m_renderer, viewImpl, 0, descriptor); break; default: d3dResource = static_cast<TextureResourceImpl*>(viewImpl->m_resource.Ptr()) @@ -407,7 +410,7 @@ void ResourceCommandEncoderImpl::clearResourceView( this->m_commandBuffer->m_renderer->m_device->CopyDescriptorsSimple( 1, m_commandBuffer->m_transientHeap->getCurrentViewHeap().getCpuHandle(gpuHandleIndex), - viewImpl->m_descriptor.cpuHandle, + descriptor.cpuHandle, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); if (flags & ClearResourceViewFlags::FloatClearValues) @@ -415,7 +418,7 @@ void ResourceCommandEncoderImpl::clearResourceView( m_commandBuffer->m_cmdList->ClearUnorderedAccessViewFloat( m_commandBuffer->m_transientHeap->getCurrentViewHeap().getGpuHandle( gpuHandleIndex), - viewImpl->m_descriptor.cpuHandle, + descriptor.cpuHandle, d3dResource, clearValue->color.floatValues, 0, @@ -426,7 +429,7 @@ void ResourceCommandEncoderImpl::clearResourceView( m_commandBuffer->m_cmdList->ClearUnorderedAccessViewUint( m_commandBuffer->m_transientHeap->getCurrentViewHeap().getGpuHandle( gpuHandleIndex), - viewImpl->m_descriptor.cpuHandle, + descriptor.cpuHandle, d3dResource, clearValue->color.uintValues, 0, |
