summaryrefslogtreecommitdiff
path: root/tools/gfx/d3d12/d3d12-shader-object.cpp
diff options
context:
space:
mode:
authorskallweitNV <64953474+skallweitNV@users.noreply.github.com>2024-05-14 00:39:49 +0200
committerGitHub <noreply@github.com>2024-05-13 15:39:49 -0700
commit9f23046138629f78995d54a7722ad6749bd84db9 (patch)
tree25ac343566f896cae547046ac7e960441874ec00 /tools/gfx/d3d12/d3d12-shader-object.cpp
parent04d3dd51125182767d90c318895a6232ec4ee750 (diff)
[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 <yonghe@outlook.com>
Diffstat (limited to 'tools/gfx/d3d12/d3d12-shader-object.cpp')
-rw-r--r--tools/gfx/d3d12/d3d12-shader-object.cpp16
1 files changed, 10 insertions, 6 deletions
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<DeviceImpl*>(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<DeviceImpl*>(m_device.get()),
+ resourceViewImpl,
+ bindingRange.bufferElementStride,
+ srcDescriptor));
+ }
if (srcDescriptor.cpuHandle.ptr)
{