From e67af5b1a3993529c702ff2924dea11fd1017d2e Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 2 Jun 2021 16:58:25 -0700 Subject: 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 --- tools/gfx/d3d12/render-d3d12.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tools/gfx/d3d12/render-d3d12.cpp') 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 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(&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); } -- cgit v1.2.3