2019-03-29 18:48:32 +08:00
|
|
|
/*
|
2022-04-26 19:31:30 +08:00
|
|
|
* Copyright (C) 2019-2022 Intel Corporation
|
2019-03-29 18:48:32 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/helpers/hw_helper.h"
|
2019-03-29 18:48:32 +08:00
|
|
|
|
|
|
|
namespace NEO {
|
|
|
|
extern HwHelper *hwHelperFactory[IGFX_MAX_CORE];
|
|
|
|
|
|
|
|
template <class MockHelper>
|
|
|
|
class RAIIHwHelperFactory {
|
|
|
|
public:
|
|
|
|
GFXCORE_FAMILY gfxCoreFamily;
|
|
|
|
HwHelper *hwHelper;
|
|
|
|
MockHelper mockHwHelper;
|
|
|
|
|
|
|
|
RAIIHwHelperFactory(GFXCORE_FAMILY gfxCoreFamily) {
|
|
|
|
this->gfxCoreFamily = gfxCoreFamily;
|
|
|
|
hwHelper = hwHelperFactory[this->gfxCoreFamily];
|
|
|
|
hwHelperFactory[this->gfxCoreFamily] = &mockHwHelper;
|
|
|
|
}
|
|
|
|
|
|
|
|
~RAIIHwHelperFactory() {
|
|
|
|
hwHelperFactory[this->gfxCoreFamily] = hwHelper;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
} // namespace NEO
|