Files
compute-runtime/unit_tests/mocks/mock_gmm.h
Artur Harasimiuk 40146291ad Update copyright headers
Updating files modified in 2018 only. Older files remain with old style
copyright header

Change-Id: Ic99f2e190ad74b4b7f2bd79dd7b9fa5fbe36ec92
Signed-off-by: Artur Harasimiuk <artur.harasimiuk@intel.com>
2018-09-20 18:02:35 +02:00

41 lines
1.2 KiB
C++

/*
* Copyright (C) 2017-2018 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "runtime/gmm_helper/gmm.h"
#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:
static std::unique_ptr<Gmm> queryImgParams(ImageInfo &imgInfo) {
return std::unique_ptr<Gmm>(new Gmm(imgInfo));
}
static ImageInfo initImgInfo(cl_image_desc &imgDesc, int baseMipLevel, const SurfaceFormatInfo *surfaceFormat) {
ImageInfo imgInfo = {0};
imgInfo.baseMipLevel = baseMipLevel;
imgInfo.imgDesc = &imgDesc;
if (!surfaceFormat) {
MockGmmParams::mockSurfaceFormat = readWriteSurfaceFormats[0]; // any valid format
imgInfo.surfaceFormat = &MockGmmParams::mockSurfaceFormat;
} else {
imgInfo.surfaceFormat = surfaceFormat;
}
return imgInfo;
}
};
} // namespace OCLRT