Files
compute-runtime/opencl/test/unit_test/mem_obj/image_compression_fixture.h
Mateusz Jablonski 94bd9af6e2 Remove platformDevices from ULT
Related-To: NEO-4499

Change-Id: I0949f6fd9897b970314a82db7bae6f700fbf31d3
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
2020-03-24 22:48:20 +01:00

49 lines
1.7 KiB
C++

/*
* Copyright (C) 2019-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/unit_test/utilities/base_object_utils.h"
#include "opencl/source/helpers/surface_formats.h"
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
#include "opencl/test/unit_test/mocks/mock_context.h"
#include "opencl/test/unit_test/mocks/mock_device.h"
#include "opencl/test/unit_test/mocks/mock_memory_manager.h"
#include "test.h"
using namespace NEO;
class ImageCompressionTests : public ::testing::Test {
public:
class MyMemoryManager : public MockMemoryManager {
public:
using MockMemoryManager::MockMemoryManager;
GraphicsAllocation *allocateGraphicsMemoryForImage(const AllocationData &allocationData) override {
mockMethodCalled = true;
capturedImgInfo = *allocationData.imgInfo;
return OsAgnosticMemoryManager::allocateGraphicsMemoryForImage(allocationData);
}
ImageInfo capturedImgInfo = {};
bool mockMethodCalled = false;
};
void SetUp() override {
mockDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
myMemoryManager = new MyMemoryManager(*mockDevice->getExecutionEnvironment());
mockDevice->injectMemoryManager(myMemoryManager);
mockContext = make_releaseable<MockContext>(mockDevice.get());
}
std::unique_ptr<MockClDevice> mockDevice;
ReleaseableObjectPtr<MockContext> mockContext;
MyMemoryManager *myMemoryManager = nullptr;
cl_image_desc imageDesc = {};
cl_image_format imageFormat{CL_R, CL_UNSIGNED_INT8};
cl_mem_flags flags = CL_MEM_READ_WRITE;
cl_int retVal = CL_SUCCESS;
};