2019-09-19 01:32:33 +08:00
|
|
|
/*
|
2021-01-21 20:10:13 +08:00
|
|
|
* Copyright (C) 2019-2021 Intel Corporation
|
2019-09-19 01:32:33 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/debug_settings/debug_settings_manager.h"
|
2021-08-25 18:28:05 +08:00
|
|
|
#include "shared/source/os_interface/hw_info_config.h"
|
2021-01-21 20:10:13 +08:00
|
|
|
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2020-05-28 20:05:12 +08:00
|
|
|
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
2019-09-19 01:32:33 +08:00
|
|
|
#include "test.h"
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
using namespace NEO;
|
|
|
|
|
2020-05-28 20:05:12 +08:00
|
|
|
typedef Test<ClDeviceFixture> Gen12LpSamplerTest;
|
2019-09-19 01:32:33 +08:00
|
|
|
|
2020-07-11 00:30:33 +08:00
|
|
|
HWTEST2_F(Gen12LpSamplerTest, givenTglLpSamplerWhenUsingDefaultFilteringAndAppendSamplerStateParamsThenDisableLowQualityFilter, IsTGLLP) {
|
2019-09-19 01:32:33 +08:00
|
|
|
EXPECT_FALSE(DebugManager.flags.ForceSamplerLowFilteringPrecision.get());
|
|
|
|
typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE;
|
|
|
|
auto state = FamilyType::cmdInitSamplerState;
|
|
|
|
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
|
2021-08-25 18:28:05 +08:00
|
|
|
HwInfoConfig::get(defaultHwInfo->platform.eProductFamily)->adjustSamplerState(&state, *defaultHwInfo);
|
2019-09-19 01:32:33 +08:00
|
|
|
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
|
|
|
|
}
|
|
|
|
|
2020-07-11 00:30:33 +08:00
|
|
|
HWTEST2_F(Gen12LpSamplerTest, givenTglLpSamplerWhenForcingLowQualityFilteringAndAppendSamplerStateParamsThenEnableLowQualityFilter, IsTGLLP) {
|
2019-09-19 01:32:33 +08:00
|
|
|
DebugManagerStateRestore dbgRestore;
|
|
|
|
DebugManager.flags.ForceSamplerLowFilteringPrecision.set(true);
|
|
|
|
EXPECT_TRUE(DebugManager.flags.ForceSamplerLowFilteringPrecision.get());
|
|
|
|
typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE;
|
|
|
|
auto state = FamilyType::cmdInitSamplerState;
|
|
|
|
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
|
2021-08-25 18:28:05 +08:00
|
|
|
HwInfoConfig::get(defaultHwInfo->platform.eProductFamily)->adjustSamplerState(&state, *defaultHwInfo);
|
2019-09-19 01:32:33 +08:00
|
|
|
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_ENABLE, state.getLowQualityFilter());
|
|
|
|
}
|
|
|
|
|
2021-04-27 03:13:45 +08:00
|
|
|
GEN12LPTEST_F(Gen12LpSamplerTest, GivenDefaultWhenGettingLowLowQualityFilterStateThenItIsDisabled) {
|
2019-09-19 01:32:33 +08:00
|
|
|
typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE;
|
|
|
|
auto state = FamilyType::cmdInitSamplerState;
|
|
|
|
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
|
|
|
|
}
|
|
|
|
|
|
|
|
GEN12LPTEST_F(Gen12LpSamplerTest, givenGen12LpSamplerWhenProgrammingLowQualityCubeCornerModeThenTheModeChangesAppropriately) {
|
|
|
|
typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE;
|
|
|
|
auto state = FamilyType::cmdInitSamplerState;
|
|
|
|
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_CUBE_CORNER_MODE_ENABLE, state.getLowQualityCubeCornerMode());
|
|
|
|
state.setLowQualityCubeCornerMode(SAMPLER_STATE::LOW_QUALITY_CUBE_CORNER_MODE_DISABLE);
|
|
|
|
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_CUBE_CORNER_MODE_DISABLE, state.getLowQualityCubeCornerMode());
|
|
|
|
}
|