summaryrefslogtreecommitdiff
path: root/tools/gfx/d3d12/render-d3d12.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-06-02 16:58:25 -0700
committerGitHub <noreply@github.com>2021-06-02 16:58:25 -0700
commite67af5b1a3993529c702ff2924dea11fd1017d2e (patch)
treec4359fb6df6110d81a658278aef9ab7244af5496 /tools/gfx/d3d12/render-d3d12.cpp
parent8e571669b3c8d4ac8236d0aed7a960bf88ad2bd1 (diff)
Various Fixes to gfx, reflection and emit. (#1867)
* Various Fixes to gfx, reflection and emit. - Fix GLSL emit to properly output `*bitsTo*` functions for `IRBitCast` insts. - Add line directive mode setting for `ISession`. - Extend `TypeLayout::getElementStride` to handle `VectorType` case. - Fix `IDevice::readBufferResource` 's D3D12 implementation to copy only the requested bytes out. - Fix `render-test` to use the `ISession` from `gfx` instead of creating its own `ISession` to make sure `gfx` and `render-test` agree on WitnessTable and RTTI IDs. - Extend `render-test` to support filling vector and matrix values in the new `set x = ...` TEST_INPUT syntax. - Add a `dynamic-dispatch-15` test case to make sure packing / unpacking works correctly across all targets, and to make sure render-test's RTTI/WitnessTable ID filling logic is correct for non-trivial cases. * Remove default-major test * Fix cyclic reference in `ExtendedTypeLayout`. * Move `lineDirectiveMode` setting to `TargetDesc`. Add `structureSize` to `TargetDesc` and `SessionDesc` for future binary compatibility. * Cleanup. Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tools/gfx/d3d12/render-d3d12.cpp')
-rw-r--r--tools/gfx/d3d12/render-d3d12.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/gfx/d3d12/render-d3d12.cpp b/tools/gfx/d3d12/render-d3d12.cpp
index 26b774b1a..8b5721cda 100644
--- a/tools/gfx/d3d12/render-d3d12.cpp
+++ b/tools/gfx/d3d12/render-d3d12.cpp
@@ -5225,13 +5225,13 @@ Result D3D12Device::readBufferResource(
// Resource to readback to
D3D12_RESOURCE_DESC stagingDesc;
- _initBufferResourceDesc(bufferSize, stagingDesc);
+ _initBufferResourceDesc(size, stagingDesc);
D3D12Resource stageBuf;
SLANG_RETURN_ON_FAIL(stageBuf.initCommitted(m_device, heapProps, D3D12_HEAP_FLAG_NONE, stagingDesc, D3D12_RESOURCE_STATE_COPY_DEST, nullptr));
// Do the copy
- encodeInfo.d3dCommandList->CopyBufferRegion(stageBuf, 0, resource, 0, bufferSize);
+ encodeInfo.d3dCommandList->CopyBufferRegion(stageBuf, 0, resource, offset, size);
// Wait until complete
submitResourceCommandsAndWait(encodeInfo);
@@ -5240,13 +5240,13 @@ Result D3D12Device::readBufferResource(
RefPtr<ListBlob> blob = new ListBlob();
{
UINT8* data;
- D3D12_RANGE readRange = { 0, bufferSize };
+ D3D12_RANGE readRange = { 0, size };
SLANG_RETURN_ON_FAIL(stageBuf.getResource()->Map(0, &readRange, reinterpret_cast<void**>(&data)));
// Copy to memory buffer
- blob->m_data.setCount(bufferSize);
- ::memcpy(blob->m_data.getBuffer(), data, bufferSize);
+ blob->m_data.setCount(size);
+ ::memcpy(blob->m_data.getBuffer(), data, size);
stageBuf.getResource()->Unmap(0, nullptr);
}