Files
compute-runtime/opencl/test/unit_test/mocks/mock_pipe.h
Pawel Cieslak 8a700c5187 Move non-ult shared files to single directory
Add SKIP_SHARED_UNIT_TESTS flag

Related-To: NEO-5201
Signed-off-by: Pawel Cieslak <pawel.cieslak@intel.com>
2021-02-10 21:03:13 +01:00

38 lines
996 B
C++

/*
* Copyright (C) 2017-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/helpers/aligned_memory.h"
#include "shared/test/common/mocks/mock_graphics_allocation.h"
#include "opencl/source/mem_obj/pipe.h"
using namespace NEO;
class MockPipeStorage {
public:
MockPipeStorage() {
mockGfxAllocation = new MockGraphicsAllocation(data, sizeof(data) / 2);
}
MockPipeStorage(bool unaligned) {
mockGfxAllocation = new MockGraphicsAllocation(alignUp(&data, 4), sizeof(data) / 2);
}
char data[256]{};
MockGraphicsAllocation *mockGfxAllocation = nullptr;
};
class MockPipe : public MockPipeStorage, public Pipe {
public:
MockPipe(Context *context) : MockPipeStorage(), Pipe(context, 0, 1, 128, nullptr, &data, GraphicsAllocationHelper::toMultiGraphicsAllocation(mockGfxAllocation)) {
}
~MockPipe() override {
if (!getContext()) {
delete mockGfxAllocation;
}
}
};