2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2018-09-18 09:11:08 +02:00
|
|
|
* Copyright (C) 2017-2018 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
2018-06-21 11:36:47 +02:00
|
|
|
#include "runtime/gmm_helper/gmm.h"
|
2017-12-21 00:45:38 +01:00
|
|
|
#include "runtime/gmm_helper/gmm_helper.h"
|
|
|
|
|
#include "unit_tests/mocks/mock_device.h"
|
|
|
|
|
#include "runtime/helpers/options.h"
|
|
|
|
|
#include "runtime/helpers/surface_formats.h"
|
|
|
|
|
#include "unit_tests/mocks/mock_gmm_resource_info.h"
|
|
|
|
|
|
|
|
|
|
namespace OCLRT {
|
|
|
|
|
namespace MockGmmParams {
|
|
|
|
|
static SurfaceFormatInfo mockSurfaceFormat;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class MockGmm : public Gmm {
|
|
|
|
|
public:
|
2018-06-28 13:38:15 +02:00
|
|
|
static std::unique_ptr<Gmm> queryImgParams(ImageInfo &imgInfo) {
|
2018-06-29 11:48:19 +02:00
|
|
|
return std::unique_ptr<Gmm>(new Gmm(imgInfo));
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-04 09:29:48 +02:00
|
|
|
static ImageInfo initImgInfo(cl_image_desc &imgDesc, int baseMipLevel, const SurfaceFormatInfo *surfaceFormat) {
|
2017-12-21 00:45:38 +01:00
|
|
|
ImageInfo imgInfo = {0};
|
2018-04-04 09:29:48 +02:00
|
|
|
imgInfo.baseMipLevel = baseMipLevel;
|
2017-12-21 00:45:38 +01:00
|
|
|
imgInfo.imgDesc = &imgDesc;
|
|
|
|
|
if (!surfaceFormat) {
|
|
|
|
|
MockGmmParams::mockSurfaceFormat = readWriteSurfaceFormats[0]; // any valid format
|
|
|
|
|
imgInfo.surfaceFormat = &MockGmmParams::mockSurfaceFormat;
|
|
|
|
|
} else {
|
|
|
|
|
imgInfo.surfaceFormat = surfaceFormat;
|
|
|
|
|
}
|
|
|
|
|
return imgInfo;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
} // namespace OCLRT
|