diff --git a/opencl/test/unit_test/command_queue/enqueue_debug_kernel_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_debug_kernel_tests.cpp index eac102264a..6b6727c948 100644 --- a/opencl/test/unit_test/command_queue/enqueue_debug_kernel_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_debug_kernel_tests.cpp @@ -10,6 +10,7 @@ #include "shared/test/common/helpers/kernel_binary_helper.h" #include "shared/test/common/helpers/kernel_filename_helper.h" #include "shared/test/common/helpers/unit_test_helper.h" +#include "shared/test/common/test_macros/mock_method_macros.h" #include "shared/test/common/test_macros/test.h" #include "opencl/source/command_queue/command_queue.h" @@ -21,7 +22,6 @@ #include "opencl/test/unit_test/program/program_from_binary.h" #include "compiler_options.h" -#include "gmock/gmock.h" using namespace NEO; using namespace ::testing; @@ -147,14 +147,26 @@ HWTEST_F(EnqueueDebugKernelTest, givenDebugKernelWhenEnqueuedThenSurfaceStateFor } template -class GMockCommandQueueHw : public CommandQueueHw { +class MockCommandQueueHwSetupDebugSurface : public CommandQueueHw { typedef CommandQueueHw BaseClass; public: - GMockCommandQueueHw(Context *context, ClDevice *device, cl_queue_properties *properties) : BaseClass(context, device, properties, false) { + MockCommandQueueHwSetupDebugSurface(Context *context, ClDevice *device, cl_queue_properties *properties) : BaseClass(context, device, properties, false) { } - MOCK_METHOD1(setupDebugSurface, bool(Kernel *kernel)); + bool setupDebugSurface(Kernel *kernel) override { + setupDebugSurfaceCalled++; + setupDebugSurfaceParamsPassed.push_back({kernel}); + return setupDebugSurfaceResult; + } + + struct SetupDebugSurfaceParams { + Kernel *kernel = nullptr; + }; + + StackVec setupDebugSurfaceParamsPassed{}; + uint32_t setupDebugSurfaceCalled = 0u; + bool setupDebugSurfaceResult = true; }; HWTEST_F(EnqueueDebugKernelSimpleTest, givenKernelFromProgramWithDebugEnabledWhenEnqueuedThenDebugSurfaceIsSetup) { @@ -162,17 +174,17 @@ HWTEST_F(EnqueueDebugKernelSimpleTest, givenKernelFromProgramWithDebugEnabledWhe program.enableKernelDebug(); std::unique_ptr kernel(MockKernel::create(*pDevice, &program)); kernel->initialize(); - std::unique_ptr> mockCmdQ(new GMockCommandQueueHw(context, pClDevice, 0)); + std::unique_ptr> mockCmdQ(new MockCommandQueueHwSetupDebugSurface(context, pClDevice, 0)); mockCmdQ->getGpgpuCommandStreamReceiver().allocateDebugSurface(SipKernel::maxDbgSurfaceSize); + mockCmdQ->setupDebugSurfaceParamsPassed.clear(); EXPECT_TRUE(isValidOffset(kernel->getKernelInfo().kernelDescriptor.payloadMappings.implicitArgs.systemThreadSurfaceAddress.bindful)); - EXPECT_CALL(*mockCmdQ.get(), setupDebugSurface(kernel.get())).Times(1).RetiresOnSaturation(); - size_t gws[] = {1, 1, 1}; mockCmdQ->enqueueKernel(kernel.get(), 1, nullptr, gws, nullptr, 0, nullptr, nullptr); - ::testing::Mock::VerifyAndClearExpectations(mockCmdQ.get()); + EXPECT_EQ(1u, mockCmdQ->setupDebugSurfaceCalled); + EXPECT_EQ(kernel.get(), mockCmdQ->setupDebugSurfaceParamsPassed[0].kernel); } HWTEST_F(EnqueueDebugKernelSimpleTest, givenKernelWithoutSystemThreadSurfaceWhenEnqueuedThenDebugSurfaceIsNotSetup) { @@ -183,28 +195,24 @@ HWTEST_F(EnqueueDebugKernelSimpleTest, givenKernelWithoutSystemThreadSurfaceWhen EXPECT_FALSE(isValidOffset(kernel->getKernelInfo().kernelDescriptor.payloadMappings.implicitArgs.systemThreadSurfaceAddress.bindful)); - std::unique_ptr> mockCmdQ(new GMockCommandQueueHw(context, pClDevice, 0)); - - EXPECT_CALL(*mockCmdQ.get(), setupDebugSurface(kernel.get())).Times(0).RetiresOnSaturation(); + std::unique_ptr> mockCmdQ(new MockCommandQueueHwSetupDebugSurface(context, pClDevice, 0)); size_t gws[] = {1, 1, 1}; mockCmdQ->enqueueKernel(kernel.get(), 1, nullptr, gws, nullptr, 0, nullptr, nullptr); - ::testing::Mock::VerifyAndClearExpectations(mockCmdQ.get()); + EXPECT_EQ(0u, mockCmdQ->setupDebugSurfaceCalled); } HWTEST_F(EnqueueDebugKernelSimpleTest, givenKernelFromProgramWithoutDebugEnabledWhenEnqueuedThenDebugSurfaceIsNotSetup) { MockProgram program(context, false, toClDeviceVector(*pClDevice)); std::unique_ptr kernel(MockKernel::create(*pDevice, &program)); - std::unique_ptr>> mockCmdQ(new NiceMock>(context, pClDevice, nullptr)); - - EXPECT_CALL(*mockCmdQ.get(), setupDebugSurface(kernel.get())).Times(0); + std::unique_ptr> mockCmdQ(new MockCommandQueueHwSetupDebugSurface(context, pClDevice, nullptr)); size_t gws[] = {1, 1, 1}; mockCmdQ->enqueueKernel(kernel.get(), 1, nullptr, gws, nullptr, 0, nullptr, nullptr); - ::testing::Mock::VerifyAndClearExpectations(mockCmdQ.get()); EXPECT_EQ(nullptr, mockCmdQ->getGpgpuCommandStreamReceiver().getDebugSurfaceAllocation()); + EXPECT_EQ(0u, mockCmdQ->setupDebugSurfaceCalled); } using ActiveDebuggerTest = EnqueueDebugKernelTest; @@ -218,4 +226,4 @@ HWTEST_F(ActiveDebuggerTest, givenKernelFromProgramWithoutDebugEnabledAndActiveD cmdQ->enqueueKernel(kernel.get(), 1, nullptr, gws, nullptr, 0, nullptr, nullptr); EXPECT_NE(nullptr, cmdQ->getGpgpuCommandStreamReceiver().getDebugSurfaceAllocation()); -} +} \ No newline at end of file diff --git a/opencl/test/unit_test/command_queue/enqueue_handler_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_handler_tests.cpp index 12d5058bc1..25ae18ed4f 100644 --- a/opencl/test/unit_test/command_queue/enqueue_handler_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_handler_tests.cpp @@ -464,8 +464,8 @@ HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWhenAddPatchInfoCommentsForAUBDu PatchInfoData patchInfoData = {0xaaaaaaaa, 0, PatchInfoAllocationType::KernelArg, 0xbbbbbbbb, 0, PatchInfoAllocationType::IndirectObjectHeap}; mockKernel.mockKernel->getPatchInfoDataList().push_back(patchInfoData); - EXPECT_CALL(*mockHelper, setPatchInfoData(::testing::_)).Times(0); mockCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); + EXPECT_EQ(0u, mockHelper->setPatchInfoDataCalled); } HWTEST2_F(EnqueueHandlerTest, givenEnqueueHandlerWhenAddPatchInfoCommentsForAUBDumpIsSetThenPatchInfoDataIsTransferredToCSR, MatchAny) { @@ -488,10 +488,10 @@ HWTEST2_F(EnqueueHandlerTest, givenEnqueueHandlerWhenAddPatchInfoCommentsForAUBD constexpr uint32_t expectedCallsCount = TestTraits::iohInSbaSupported ? 8 : 7; - EXPECT_CALL(*mockHelper, setPatchInfoData(::testing::_)).Times(expectedCallsCount); - EXPECT_CALL(*mockHelper, registerCommandChunk(::testing::_)).Times(1); - EXPECT_CALL(*mockHelper, registerBatchBufferStartAddress(::testing::_, ::testing::_)).Times(1); mockCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); + EXPECT_EQ(expectedCallsCount, mockHelper->setPatchInfoDataCalled); + EXPECT_EQ(1u, mockHelper->registerCommandChunkCalled); + EXPECT_EQ(1u, mockHelper->registerBatchBufferStartAddressCalled); } HWTEST_F(EnqueueHandlerTest, givenExternallySynchronizedParentEventWhenRequestingEnqueueWithoutGpuSubmissionThenTaskCountIsNotInherited) { diff --git a/opencl/test/unit_test/command_stream/aub_command_stream_receiver_2_tests.cpp b/opencl/test/unit_test/command_stream/aub_command_stream_receiver_2_tests.cpp index aca0303bd1..535f139824 100644 --- a/opencl/test/unit_test/command_stream/aub_command_stream_receiver_2_tests.cpp +++ b/opencl/test/unit_test/command_stream/aub_command_stream_receiver_2_tests.cpp @@ -264,8 +264,9 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenDefault BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false}; ResidencyContainer allocationsForResidency = {}; - EXPECT_CALL(*mockHelper, flattenBatchBuffer(aubCsr->getRootDeviceIndex(), ::testing::_, ::testing::_, ::testing::_, aubCsr->getOsContext().getDeviceBitfield())).Times(0); aubCsr->flush(batchBuffer, allocationsForResidency); + + EXPECT_EQ(0u, mockHelper->flattenBatchBufferCalled); } HWTEST_F(AubCommandStreamReceiverTests, givenNoCpuPtrAndNotLockableAllocationWhenGettingParametersForWriteThenLockResourceIsNotCalled) { @@ -363,12 +364,15 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedF [&](GraphicsAllocation *ptr) { aubExecutionEnvironment->executionEnvironment->memoryManager->freeGraphicsMemory(ptr); }); auto expectedAllocation = ptr.get(); - EXPECT_CALL(*mockHelper, flattenBatchBuffer(aubCsr->getRootDeviceIndex(), ::testing::_, ::testing::_, ::testing::_, aubCsr->getOsContext().getDeviceBitfield())).WillOnce(::testing::Return(ptr.release())); + mockHelper->flattenBatchBufferResult = ptr.release(); + aubCsr->flush(batchBuffer, allocationsForResidency); EXPECT_EQ(batchBuffer.commandBufferAllocation, expectedAllocation); aubExecutionEnvironment->executionEnvironment->memoryManager->freeGraphicsMemory(chainedBatchBuffer); + + EXPECT_EQ(1u, mockHelper->flattenBatchBufferCalled); } HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedFlattenBatchBufferAndImmediateDispatchModeAndThereIsNoChainedBatchBufferThenExpectFlattenBatchBufferIsCalledAnyway) { @@ -382,12 +386,17 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedF LinearStream cs(aubExecutionEnvironment->commandBuffer); auto mockHelper = new MockFlatBatchBufferHelper(*aubExecutionEnvironment->executionEnvironment); + mockHelper->flattenBatchBufferParamsPassed.clear(); + aubCsr->overwriteFlatBatchBufferHelper(mockHelper); BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 128u, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false}; - EXPECT_CALL(*mockHelper, flattenBatchBuffer(aubCsr->getRootDeviceIndex(), ::testing::_, ::testing::_, ::testing::_, aubCsr->getOsContext().getDeviceBitfield())).Times(1); aubCsr->flush(batchBuffer, allocationsForResidency); + + EXPECT_EQ(1u, mockHelper->flattenBatchBufferCalled); + EXPECT_EQ(aubCsr->getRootDeviceIndex(), mockHelper->flattenBatchBufferParamsPassed[0].rootDeviceIndex); + EXPECT_EQ(aubCsr->getOsContext().getDeviceBitfield().to_ulong(), mockHelper->flattenBatchBufferParamsPassed[0].deviceBitfield.to_ulong()); } HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedFlattenBatchBufferAndBatchedDispatchModeThenExpectFlattenBatchBufferIsCalledAnyway) { @@ -400,13 +409,17 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedF LinearStream cs(aubExecutionEnvironment->commandBuffer); auto mockHelper = new MockFlatBatchBufferHelper(*aubExecutionEnvironment->executionEnvironment); + mockHelper->flattenBatchBufferParamsPassed.clear(); aubCsr->overwriteFlatBatchBufferHelper(mockHelper); ResidencyContainer allocationsForResidency; BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 128u, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false}; - EXPECT_CALL(*mockHelper, flattenBatchBuffer(aubCsr->getRootDeviceIndex(), ::testing::_, ::testing::_, ::testing::_, aubCsr->getOsContext().getDeviceBitfield())).Times(1); aubCsr->flush(batchBuffer, allocationsForResidency); + + EXPECT_EQ(1u, mockHelper->flattenBatchBufferCalled); + EXPECT_EQ(aubCsr->getRootDeviceIndex(), mockHelper->flattenBatchBufferParamsPassed[0].rootDeviceIndex); + EXPECT_EQ(aubCsr->getOsContext().getDeviceBitfield().to_ulong(), mockHelper->flattenBatchBufferParamsPassed[0].deviceBitfield.to_ulong()); } HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenAddPatchInfoCommentsForAUBDumpIsSetThenAddPatchInfoCommentsIsCalled) { diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_gmock_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_gmock_tests.cpp index 17275d0485..7a4c20f25b 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_gmock_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_gmock_tests.cpp @@ -84,11 +84,7 @@ HWTEST2_F(CommandStreamReceiverFlushTaskGmockTests, constexpr uint32_t expectedCallsCount = TestTraits::iohInSbaSupported ? 10 : 9; - EXPECT_CALL(*mockHelper, setPatchInfoData(::testing::_)).Times(expectedCallsCount); size_t removePatchInfoDataCount = 4 * UltMemorySynchronizationCommands::getExpectedPipeControlCount(pDevice->getHardwareInfo()); - EXPECT_CALL(*mockHelper, removePatchInfoData(::testing::_)).Times(static_cast(removePatchInfoDataCount)); - EXPECT_CALL(*mockHelper, registerCommandChunk(::testing::_)).Times(4); - EXPECT_CALL(*mockHelper, registerBatchBufferStartAddress(::testing::_, ::testing::_)).Times(3); mockCsr->flushTask(commandStream, 0, @@ -130,6 +126,10 @@ HWTEST2_F(CommandStreamReceiverFlushTaskGmockTests, ASSERT_NE(nullptr, batchBufferStart); EXPECT_EQ(lastBatchBufferAddress, batchBufferStart->getBatchBufferStartAddressGraphicsaddress472()); EXPECT_EQ(1, mockCsr->flushCalledCount); + EXPECT_EQ(expectedCallsCount, mockHelper->setPatchInfoDataCalled); + EXPECT_EQ(static_cast(removePatchInfoDataCount), mockHelper->removePatchInfoDataCalled); + EXPECT_EQ(4u, mockHelper->registerCommandChunkCalled); + EXPECT_EQ(3u, mockHelper->registerBatchBufferStartAddressCalled); } HWTEST_F(CommandStreamReceiverFlushTaskGmockTests, givenMockCommandStreamerWhenAddPatchInfoCommentsForAUBDumpIsNotSetThenAddPatchInfoDataIsNotCollected) { @@ -145,8 +145,6 @@ HWTEST_F(CommandStreamReceiverFlushTaskGmockTests, givenMockCommandStreamerWhenA DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.throttle = QueueThrottle::MEDIUM; - EXPECT_CALL(*mockHelper, setPatchInfoData(_)).Times(0); - mockCsr->flushTask(commandStream, 0, dsh, @@ -155,6 +153,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskGmockTests, givenMockCommandStreamerWhenA taskLevel, dispatchFlags, *pDevice); + EXPECT_EQ(0u, mockHelper->setPatchInfoDataCalled); } HWTEST2_F(CommandStreamReceiverFlushTaskGmockTests, givenMockCommandStreamerWhenAddPatchInfoCommentsForAUBDumpIsSetThenAddPatchInfoDataIsCollected, MatchAny) { @@ -174,14 +173,6 @@ HWTEST2_F(CommandStreamReceiverFlushTaskGmockTests, givenMockCommandStreamerWhen constexpr uint32_t expectedCallsCount = TestTraits::iohInSbaSupported ? 4 : 3; - std::vector patchInfoDataVector; - EXPECT_CALL(*mockHelper, setPatchInfoData(_)) - .Times(expectedCallsCount) - .WillRepeatedly(Invoke([&](const PatchInfoData &data) { - patchInfoDataVector.push_back(data); - return true; - })); - mockCsr->flushTask(commandStream, 0, dsh, @@ -191,9 +182,9 @@ HWTEST2_F(CommandStreamReceiverFlushTaskGmockTests, givenMockCommandStreamerWhen dispatchFlags, *pDevice); - EXPECT_EQ(expectedCallsCount, patchInfoDataVector.size()); + EXPECT_EQ(expectedCallsCount, mockHelper->patchInfoDataVector.size()); - for (auto &patchInfoData : patchInfoDataVector) { + for (auto &patchInfoData : mockHelper->patchInfoDataVector) { uint64_t expectedAddress = 0u; switch (patchInfoData.sourceType) { case PatchInfoAllocationType::DynamicStateHeap: @@ -212,6 +203,8 @@ HWTEST2_F(CommandStreamReceiverFlushTaskGmockTests, givenMockCommandStreamerWhen EXPECT_EQ(0u, patchInfoData.sourceAllocationOffset); EXPECT_EQ(PatchInfoAllocationType::Default, patchInfoData.targetType); } + + EXPECT_EQ(expectedCallsCount, mockHelper->setPatchInfoDataCalled); } HWTEST2_F(CommandStreamReceiverFlushTaskGmockTests, givenMockCsrWhenCollectStateBaseAddresPatchInfoIsCalledThenAppropriateAddressesAreTaken, MatchAny) { @@ -223,28 +216,18 @@ HWTEST2_F(CommandStreamReceiverFlushTaskGmockTests, givenMockCsrWhenCollectState constexpr uint32_t expectedCallsCount = TestTraits::iohInSbaSupported ? 4 : 3; - std::vector patchInfoDataVector; - EXPECT_CALL(*mockHelper, setPatchInfoData(_)) - .Times(expectedCallsCount) - .WillRepeatedly(Invoke([&](const PatchInfoData &data) { - patchInfoDataVector.push_back(data); - return true; - })); - EXPECT_CALL(*mockHelper, registerCommandChunk(_)) - .Times(0); - uint64_t baseAddress = 0xabcdef; uint64_t commandOffset = 0xa; uint64_t generalStateBase = 0xff; mockCsr->collectStateBaseAddresPatchInfo(baseAddress, commandOffset, dsh, ioh, ssh, generalStateBase); - ASSERT_EQ(patchInfoDataVector.size(), expectedCallsCount); - PatchInfoData dshPatch = patchInfoDataVector[0]; - PatchInfoData gshPatch = patchInfoDataVector[1]; - PatchInfoData sshPatch = patchInfoDataVector[2]; + ASSERT_EQ(mockHelper->patchInfoDataVector.size(), expectedCallsCount); + PatchInfoData dshPatch = mockHelper->patchInfoDataVector[0]; + PatchInfoData gshPatch = mockHelper->patchInfoDataVector[1]; + PatchInfoData sshPatch = mockHelper->patchInfoDataVector[2]; - for (auto &patch : patchInfoDataVector) { + for (auto &patch : mockHelper->patchInfoDataVector) { EXPECT_EQ(patch.targetAllocation, baseAddress); EXPECT_EQ(patch.sourceAllocationOffset, 0u); } @@ -255,7 +238,7 @@ HWTEST2_F(CommandStreamReceiverFlushTaskGmockTests, givenMockCsrWhenCollectState if constexpr (TestTraits::iohInSbaSupported) { //IOH - PatchInfoData iohPatch = patchInfoDataVector[3]; + PatchInfoData iohPatch = mockHelper->patchInfoDataVector[3]; EXPECT_EQ(iohPatch.sourceAllocation, ioh.getGraphicsAllocation()->getGpuAddress()); EXPECT_EQ(iohPatch.targetAllocationOffset, commandOffset + STATE_BASE_ADDRESS::PATCH_CONSTANTS::INDIRECTOBJECTBASEADDRESS_BYTEOFFSET); @@ -268,6 +251,9 @@ HWTEST2_F(CommandStreamReceiverFlushTaskGmockTests, givenMockCsrWhenCollectState //GSH EXPECT_EQ(gshPatch.sourceAllocation, generalStateBase); EXPECT_EQ(gshPatch.targetAllocationOffset, commandOffset + STATE_BASE_ADDRESS::PATCH_CONSTANTS::GENERALSTATEBASEADDRESS_BYTEOFFSET); + + EXPECT_EQ(0u, mockHelper->registerCommandChunkCalled); + EXPECT_EQ(expectedCallsCount, mockHelper->setPatchInfoDataCalled); } HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskGmockTests, givenPatchInfoCollectionEnabledWhenScratchSpaceIsProgrammedThenPatchInfoIsCollected) { diff --git a/shared/test/common/mocks/mock_csr.h b/shared/test/common/mocks/mock_csr.h index a7a7942aef..746268d63f 100644 --- a/shared/test/common/mocks/mock_csr.h +++ b/shared/test/common/mocks/mock_csr.h @@ -8,6 +8,7 @@ #pragma once #include "shared/test/common/libult/ult_command_stream_receiver.h" #include "shared/test/common/mocks/mock_command_stream_receiver.h" +#include "shared/test/common/test_macros/mock_method_macros.h" #include "gmock/gmock.h" @@ -148,12 +149,40 @@ template class MockFlatBatchBufferHelper : public FlatBatchBufferHelperHw { public: using FlatBatchBufferHelperHw::FlatBatchBufferHelperHw; - MOCK_METHOD(bool, setPatchInfoData, (const PatchInfoData &), (override)); - MOCK_METHOD(bool, removePatchInfoData, (uint64_t), (override)); - MOCK_METHOD(bool, registerCommandChunk, (CommandChunk &), (override)); - MOCK_METHOD(bool, registerBatchBufferStartAddress, (uint64_t, uint64_t), (override)); - MOCK_METHOD(GraphicsAllocation *, - flattenBatchBuffer, - (uint32_t rootDeviceIndex, BatchBuffer &batchBuffer, size_t &sizeBatchBuffer, DispatchMode dispatchMode, DeviceBitfield deviceBitfield), - (override)); + + ADDMETHOD_NOBASE(removePatchInfoData, bool, true, (uint64_t targetLocation)); + ADDMETHOD_NOBASE(registerCommandChunk, bool, true, (CommandChunk & commandChunk)); + ADDMETHOD_NOBASE(registerBatchBufferStartAddress, bool, true, (uint64_t commandAddress, uint64_t startAddress)); + + GraphicsAllocation *flattenBatchBuffer(uint32_t rootDeviceIndex, + BatchBuffer &batchBuffer, + size_t &sizeBatchBuffer, + DispatchMode dispatchMode, + DeviceBitfield deviceBitfield) override { + flattenBatchBufferCalled++; + flattenBatchBufferParamsPassed.push_back({rootDeviceIndex, batchBuffer, sizeBatchBuffer, dispatchMode, deviceBitfield}); + return flattenBatchBufferResult; + } + + struct FlattenBatchBufferParams { + uint32_t rootDeviceIndex = 0u; + BatchBuffer batchBuffer = {}; + size_t sizeBatchBuffer = 0u; + DispatchMode dispatchMode = DispatchMode::DeviceDefault; + DeviceBitfield deviceBitfield = {}; + }; + + StackVec flattenBatchBufferParamsPassed{}; + uint32_t flattenBatchBufferCalled = 0u; + GraphicsAllocation *flattenBatchBufferResult = nullptr; + + bool setPatchInfoData(const PatchInfoData &data) override { + setPatchInfoDataCalled++; + patchInfoDataVector.push_back(data); + return setPatchInfoDataResult; + } + + std::vector patchInfoDataVector{}; + uint32_t setPatchInfoDataCalled = 0u; + bool setPatchInfoDataResult = true; };