From 2eb47bd73e882fd707c8eec6d4da8110a6d69ac6 Mon Sep 17 00:00:00 2001 From: Michal Mrozek Date: Mon, 10 Oct 2022 18:57:10 +0000 Subject: [PATCH] Optimize makeResident call. Some portions only make sense in Batching mode. Signed-off-by: Michal Mrozek --- shared/source/command_stream/command_stream_receiver.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/shared/source/command_stream/command_stream_receiver.cpp b/shared/source/command_stream/command_stream_receiver.cpp index 176d589aed..0b9a216fb7 100644 --- a/shared/source/command_stream/command_stream_receiver.cpp +++ b/shared/source/command_stream/command_stream_receiver.cpp @@ -138,10 +138,12 @@ void CommandStreamReceiver::makeResident(GraphicsAllocation &gfxAllocation) { this->getResidencyAllocations().push_back(&gfxAllocation); } - checkForNewResources(submissionTaskCount, gfxAllocation.getTaskCount(osContext->getContextId()), gfxAllocation); gfxAllocation.updateTaskCount(submissionTaskCount, osContext->getContextId()); - if (!gfxAllocation.isResident(osContext->getContextId())) { - this->totalMemoryUsed += gfxAllocation.getUnderlyingBufferSize(); + if (this->dispatchMode == DispatchMode::BatchedDispatch) { + checkForNewResources(submissionTaskCount, gfxAllocation.getTaskCount(osContext->getContextId()), gfxAllocation); + if (!gfxAllocation.isResident(osContext->getContextId())) { + this->totalMemoryUsed += gfxAllocation.getUnderlyingBufferSize(); + } } } gfxAllocation.updateResidencyTaskCount(submissionTaskCount, osContext->getContextId());