From 9f23046138629f78995d54a7722ad6749bd84db9 Mon Sep 17 00:00:00 2001 From: skallweitNV <64953474+skallweitNV@users.noreply.github.com> Date: Tue, 14 May 2024 00:39:49 +0200 Subject: [gfx] specify resource view buffer range in bytes (#4149) * refactor gfx buffer range to use byte range * create buffer view with zero struct stride for ClearUnorderedAccessViewUint/Float * create buffer descriptors on demand * avoid copying gfx.dll --------- Co-authored-by: Yong He --- tools/gfx/d3d12/d3d12-shader-object.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'tools/gfx/d3d12/d3d12-shader-object.cpp') diff --git a/tools/gfx/d3d12/d3d12-shader-object.cpp b/tools/gfx/d3d12/d3d12-shader-object.cpp index 3d38df5ab..beb88b636 100644 --- a/tools/gfx/d3d12/d3d12-shader-object.cpp +++ b/tools/gfx/d3d12/d3d12-shader-object.cpp @@ -965,13 +965,17 @@ Result ShaderObjectImpl::setResource(ShaderOffset const& offset, IResourceView* } auto descriptorSlotIndex = bindingRange.baseIndex + (int32_t)offset.bindingArrayIndex; - D3D12Descriptor srcDescriptor = {}; + D3D12Descriptor srcDescriptor = internalResourceView->m_descriptor; - SLANG_RETURN_ON_FAIL(internalResourceView->getBufferDescriptorForBinding( - static_cast(m_device.get()), - resourceViewImpl, - bindingRange.bufferElementStride, - srcDescriptor)); + // Buffer descriptors are created on demand. + if (!srcDescriptor.cpuHandle.ptr) + { + SLANG_RETURN_ON_FAIL(internalResourceView->getBufferDescriptorForBinding( + static_cast(m_device.get()), + resourceViewImpl, + bindingRange.bufferElementStride, + srcDescriptor)); + } if (srcDescriptor.cpuHandle.ptr) { -- cgit v1.2.3