Files
compute-runtime/unit_tests/mem_obj/image_compression_fixture.h
Maciej Dziuban 8f0bdf95ed Disable compression for redescribable formats
Change-Id: I7de5e0124ea54131bb7ea066fdf94f3d03960463
Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
Related-To: NEO-3580
2020-02-10 16:35:02 +01:00

47 lines
1.6 KiB
C++

/*
* Copyright (C) 2019-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "core/unit_tests/utilities/base_object_utils.h"
#include "runtime/helpers/surface_formats.h"
#include "test.h"
#include "unit_tests/mocks/mock_context.h"
#include "unit_tests/mocks/mock_device.h"
#include "unit_tests/mocks/mock_memory_manager.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>(*platformDevices));
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;
};