Fix D3D validation warning in ResolvePendingIndirectState()

D3D12 WARNING: ID3D12Resource3::ID3D12Resource::Unmap: pWrittenRange does not point to an empty D3D12_RANGE and the heap type is D3D12_HEAP_TYPE_READBACK. Readback resources can be written by the CPU but there's not much utility. The rationale is that readback heaps are stuck in COPY_DEST state such that the GPU can never use what the CPU is writing. The range [0, 4194304) should be empty (Begin >= End). [ EXECUTION WARNING #929: UNMAP_RANGE_NOT_EMPTY]
This commit is contained in:
Jake Turner
2025-12-16 13:32:38 +13:00
parent 3c407eee51
commit 6d89b15bc9
+3 -2
View File
@@ -70,7 +70,7 @@ void D3D12RenderState::ResolvePendingIndirectState(WrappedID3D12Device *device)
device->DeviceWaitForIdle();
D3D12_RANGE range = {0, D3D12CommandData::m_IndirectSize};
byte *mapPtr = NULL;
const byte *mapPtr = NULL;
CHECK_HR(device, indirectState.argsBuf->Map(0, &range, (void **)&mapPtr));
if(device->HasFatalError())
@@ -79,7 +79,7 @@ void D3D12RenderState::ResolvePendingIndirectState(WrappedID3D12Device *device)
WrappedID3D12CommandSignature *comSig = (WrappedID3D12CommandSignature *)indirectState.comSig;
{
byte *data = mapPtr + indirectState.argsOffs;
const byte *data = mapPtr + indirectState.argsOffs;
for(uint32_t argIdx = 0; argIdx < indirectState.argsToProcess; argIdx++)
{
@@ -203,6 +203,7 @@ void D3D12RenderState::ResolvePendingIndirectState(WrappedID3D12Device *device)
}
}
range.End = 0;
indirectState.argsBuf->Unmap(0, &range);
indirectState.argsBuf = NULL;
indirectState.argsOffs = 0;