diff --git a/opencl/source/helpers/hardware_commands_helper_base.inl b/opencl/source/helpers/hardware_commands_helper_base.inl index 989f854766..14e1d65f6b 100644 --- a/opencl/source/helpers/hardware_commands_helper_base.inl +++ b/opencl/source/helpers/hardware_commands_helper_base.inl @@ -239,7 +239,8 @@ size_t HardwareCommandsHelper::sendIndirectState( samplerCount = samplerTable.numSamplers; samplerStateOffset = EncodeStates::copySamplerState(&dsh, samplerTable.tableOffset, samplerCount, samplerTable.borderColor, - kernel.getDynamicStateHeap(), device.getBindlessHeapsHelper()); + kernel.getDynamicStateHeap(), device.getBindlessHeapsHelper(), + device.getHardwareInfo()); } auto localWorkItems = localWorkSize[0] * localWorkSize[1] * localWorkSize[2]; diff --git a/opencl/source/sampler/sampler.h b/opencl/source/sampler/sampler.h index 3687e7f8e1..acf1039cae 100644 --- a/opencl/source/sampler/sampler.h +++ b/opencl/source/sampler/sampler.h @@ -87,7 +87,6 @@ class Sampler : public BaseObject<_cl_sampler> { template struct SamplerHw : public Sampler { void setArg(void *memory, const HardwareInfo &hwInfo) override; - void appendSamplerStateParams(typename GfxFamily::SAMPLER_STATE *state, const HardwareInfo &hwInfo); static constexpr float getGenSamplerMaxLod() { return 14.0f; } diff --git a/opencl/source/sampler/sampler.inl b/opencl/source/sampler/sampler.inl index f306e63317..6478cd792b 100644 --- a/opencl/source/sampler/sampler.inl +++ b/opencl/source/sampler/sampler.inl @@ -6,6 +6,7 @@ */ #include "shared/source/helpers/populate_factory.h" +#include "shared/source/os_interface/hw_info_config.h" #include "shared/source/utilities/numeric.h" #include @@ -87,11 +88,7 @@ void SamplerHw::setArg(void *memory, const HardwareInfo &hwInfo) { samplerState->setMinLod(minLodValue.getRawAccess()); samplerState->setMaxLod(maxLodValue.getRawAccess()); - appendSamplerStateParams(samplerState, hwInfo); -} - -template -void SamplerHw::appendSamplerStateParams(typename GfxFamily::SAMPLER_STATE *state, const HardwareInfo &hwInfo) { + HwInfoConfig::get(hwInfo.platform.eProductFamily)->adjustSamplerState(samplerState, hwInfo); } template diff --git a/opencl/source/sampler/sampler_tgllp_and_later.inl b/opencl/source/sampler/sampler_tgllp_and_later.inl index 7a70f04fb9..23adf9d795 100644 --- a/opencl/source/sampler/sampler_tgllp_and_later.inl +++ b/opencl/source/sampler/sampler_tgllp_and_later.inl @@ -5,21 +5,9 @@ * */ -#include "shared/source/debug_settings/debug_settings_manager.h" - #include "opencl/source/sampler/sampler.h" #include "opencl/source/sampler/sampler.inl" namespace NEO { - -using SAMPLER_STATE = typename Family::SAMPLER_STATE; - -template <> -void SamplerHw::appendSamplerStateParams(SAMPLER_STATE *state, const HardwareInfo &hwInfo) { - if (DebugManager.flags.ForceSamplerLowFilteringPrecision.get()) { - state->setLowQualityFilter(SAMPLER_STATE::LOW_QUALITY_FILTER_ENABLE); - } -} - #include "opencl/source/sampler/sampler_factory_init.inl" } // namespace NEO diff --git a/opencl/source/xe_hp_core/sampler_xe_hp_core.cpp b/opencl/source/xe_hp_core/sampler_xe_hp_core.cpp index bbc708a172..91bc67c800 100644 --- a/opencl/source/xe_hp_core/sampler_xe_hp_core.cpp +++ b/opencl/source/xe_hp_core/sampler_xe_hp_core.cpp @@ -8,22 +8,10 @@ #include "shared/source/xe_hp_core/hw_cmds_base.h" using Family = NEO::XeHpFamily; constexpr static auto gfxCore = IGFX_XE_HP_CORE; -#include "shared/source/debug_settings/debug_settings_manager.h" -#include "opencl/source/cl_device/cl_device.h" -#include "opencl/source/context/context.h" #include "opencl/source/sampler/sampler.h" #include "opencl/source/sampler/sampler.inl" + namespace NEO { - -using SAMPLER_STATE = typename Family::SAMPLER_STATE; - -template <> -void SamplerHw::appendSamplerStateParams(SAMPLER_STATE *state, const HardwareInfo &hwInfo) { - if (DebugManager.flags.ForceSamplerLowFilteringPrecision.get()) { - state->setLowQualityFilter(SAMPLER_STATE::LOW_QUALITY_FILTER_ENABLE); - } -} - #include "opencl/source/sampler/sampler_factory_init.inl" } // namespace NEO diff --git a/opencl/test/unit_test/gen11/sampler_tests_gen11.cpp b/opencl/test/unit_test/gen11/sampler_tests_gen11.cpp index ffc4c55382..6ab842ffd4 100644 --- a/opencl/test/unit_test/gen11/sampler_tests_gen11.cpp +++ b/opencl/test/unit_test/gen11/sampler_tests_gen11.cpp @@ -5,9 +5,9 @@ * */ -#include "opencl/source/sampler/sampler.h" +#include "shared/source/os_interface/hw_info_config.h" + #include "opencl/test/unit_test/fixtures/cl_device_fixture.h" -#include "opencl/test/unit_test/mocks/mock_context.h" #include "test.h" #include @@ -18,11 +18,10 @@ typedef Test Gen11SamplerTest; GEN11TEST_F(Gen11SamplerTest, WhenAppendingSamplerStateParamsThenStateIsNotChanged) { typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE; - std::unique_ptr context(new MockContext()); - std::unique_ptr> sampler(new SamplerHw(context.get(), CL_FALSE, CL_ADDRESS_NONE, CL_FILTER_NEAREST)); + auto stateWithoutAppendedParams = FamilyType::cmdInitSamplerState; auto stateWithAppendedParams = FamilyType::cmdInitSamplerState; EXPECT_TRUE(memcmp(&stateWithoutAppendedParams, &stateWithAppendedParams, sizeof(SAMPLER_STATE)) == 0); - sampler->appendSamplerStateParams(&stateWithAppendedParams, *defaultHwInfo); + HwInfoConfig::get(defaultHwInfo->platform.eProductFamily)->adjustSamplerState(&stateWithAppendedParams, *defaultHwInfo); EXPECT_TRUE(memcmp(&stateWithoutAppendedParams, &stateWithAppendedParams, sizeof(SAMPLER_STATE)) == 0); } diff --git a/opencl/test/unit_test/gen12lp/sampler_tests_gen12lp.inl b/opencl/test/unit_test/gen12lp/sampler_tests_gen12lp.inl index 9da3e13072..471953c519 100644 --- a/opencl/test/unit_test/gen12lp/sampler_tests_gen12lp.inl +++ b/opencl/test/unit_test/gen12lp/sampler_tests_gen12lp.inl @@ -6,12 +6,10 @@ */ #include "shared/source/debug_settings/debug_settings_manager.h" +#include "shared/source/os_interface/hw_info_config.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" -#include "shared/test/unit_test/utilities/base_object_utils.h" -#include "opencl/source/sampler/sampler.h" #include "opencl/test/unit_test/fixtures/cl_device_fixture.h" -#include "opencl/test/unit_test/mocks/mock_context.h" #include "test.h" #include @@ -23,11 +21,9 @@ typedef Test Gen12LpSamplerTest; HWTEST2_F(Gen12LpSamplerTest, givenTglLpSamplerWhenUsingDefaultFilteringAndAppendSamplerStateParamsThenDisableLowQualityFilter, IsTGLLP) { EXPECT_FALSE(DebugManager.flags.ForceSamplerLowFilteringPrecision.get()); typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE; - auto context = clUniquePtr(new MockContext()); - auto sampler = clUniquePtr(new SamplerHw(context.get(), CL_FALSE, CL_ADDRESS_NONE, CL_FILTER_NEAREST)); auto state = FamilyType::cmdInitSamplerState; EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter()); - sampler->appendSamplerStateParams(&state, *defaultHwInfo); + HwInfoConfig::get(defaultHwInfo->platform.eProductFamily)->adjustSamplerState(&state, *defaultHwInfo); EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter()); } @@ -36,11 +32,9 @@ HWTEST2_F(Gen12LpSamplerTest, givenTglLpSamplerWhenForcingLowQualityFilteringAnd DebugManager.flags.ForceSamplerLowFilteringPrecision.set(true); EXPECT_TRUE(DebugManager.flags.ForceSamplerLowFilteringPrecision.get()); typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE; - auto context = clUniquePtr(new MockContext()); - auto sampler = clUniquePtr(new SamplerHw(context.get(), CL_FALSE, CL_ADDRESS_NONE, CL_FILTER_NEAREST)); auto state = FamilyType::cmdInitSamplerState; EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter()); - sampler->appendSamplerStateParams(&state, *defaultHwInfo); + HwInfoConfig::get(defaultHwInfo->platform.eProductFamily)->adjustSamplerState(&state, *defaultHwInfo); EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_ENABLE, state.getLowQualityFilter()); } diff --git a/opencl/test/unit_test/gen8/sampler_tests_gen8.cpp b/opencl/test/unit_test/gen8/sampler_tests_gen8.cpp index 622941c3d8..ca0398cb1a 100644 --- a/opencl/test/unit_test/gen8/sampler_tests_gen8.cpp +++ b/opencl/test/unit_test/gen8/sampler_tests_gen8.cpp @@ -5,9 +5,9 @@ * */ -#include "opencl/source/sampler/sampler.h" +#include "shared/source/os_interface/hw_info_config.h" + #include "opencl/test/unit_test/fixtures/cl_device_fixture.h" -#include "opencl/test/unit_test/mocks/mock_context.h" #include "test.h" #include @@ -18,11 +18,9 @@ typedef Test Gen8SamplerTest; GEN8TEST_F(Gen8SamplerTest, WhenAppendingSamplerStateParamsThenStateIsNotChanged) { typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE; - std::unique_ptr context(new MockContext()); - std::unique_ptr> sampler(new SamplerHw(context.get(), CL_FALSE, CL_ADDRESS_NONE, CL_FILTER_NEAREST)); auto stateWithoutAppendedParams = FamilyType::cmdInitSamplerState; auto stateWithAppendedParams = FamilyType::cmdInitSamplerState; EXPECT_TRUE(memcmp(&stateWithoutAppendedParams, &stateWithAppendedParams, sizeof(SAMPLER_STATE)) == 0); - sampler->appendSamplerStateParams(&stateWithAppendedParams, *defaultHwInfo); + HwInfoConfig::get(defaultHwInfo->platform.eProductFamily)->adjustSamplerState(&stateWithAppendedParams, *defaultHwInfo); EXPECT_TRUE(memcmp(&stateWithoutAppendedParams, &stateWithAppendedParams, sizeof(SAMPLER_STATE)) == 0); } diff --git a/opencl/test/unit_test/gen9/sampler_tests_gen9.cpp b/opencl/test/unit_test/gen9/sampler_tests_gen9.cpp index 0fe817ba55..e7f1ace1a8 100644 --- a/opencl/test/unit_test/gen9/sampler_tests_gen9.cpp +++ b/opencl/test/unit_test/gen9/sampler_tests_gen9.cpp @@ -5,9 +5,9 @@ * */ -#include "opencl/source/sampler/sampler.h" +#include "shared/source/os_interface/hw_info_config.h" + #include "opencl/test/unit_test/fixtures/cl_device_fixture.h" -#include "opencl/test/unit_test/mocks/mock_context.h" #include "test.h" #include @@ -18,11 +18,9 @@ typedef Test Gen9SamplerTest; GEN9TEST_F(Gen9SamplerTest, WhenAppendingSamplerStateParamsThenStateIsNotChanged) { typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE; - std::unique_ptr context(new MockContext()); - std::unique_ptr> sampler(new SamplerHw(context.get(), CL_FALSE, CL_ADDRESS_NONE, CL_FILTER_NEAREST)); auto stateWithoutAppendedParams = FamilyType::cmdInitSamplerState; auto stateWithAppendedParams = FamilyType::cmdInitSamplerState; EXPECT_TRUE(memcmp(&stateWithoutAppendedParams, &stateWithAppendedParams, sizeof(SAMPLER_STATE)) == 0); - sampler->appendSamplerStateParams(&stateWithAppendedParams, *defaultHwInfo); + HwInfoConfig::get(defaultHwInfo->platform.eProductFamily)->adjustSamplerState(&stateWithAppendedParams, *defaultHwInfo); EXPECT_TRUE(memcmp(&stateWithoutAppendedParams, &stateWithAppendedParams, sizeof(SAMPLER_STATE)) == 0); } diff --git a/opencl/test/unit_test/sampler/sampler_tests_xehp_and_later.cpp b/opencl/test/unit_test/sampler/sampler_tests_xehp_and_later.cpp index f0eb446c29..5c7ff7179a 100644 --- a/opencl/test/unit_test/sampler/sampler_tests_xehp_and_later.cpp +++ b/opencl/test/unit_test/sampler/sampler_tests_xehp_and_later.cpp @@ -7,11 +7,8 @@ #include "shared/source/debug_settings/debug_settings_manager.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" -#include "shared/test/unit_test/utilities/base_object_utils.h" -#include "opencl/source/sampler/sampler.h" #include "opencl/test/unit_test/fixtures/cl_device_fixture.h" -#include "opencl/test/unit_test/mocks/mock_context.h" #include "test.h" #include diff --git a/opencl/test/unit_test/xe_hp_core/xehp/sampler_tests_xehp.inl b/opencl/test/unit_test/xe_hp_core/xehp/sampler_tests_xehp.inl index b36bf3d228..5c25684bd8 100644 --- a/opencl/test/unit_test/xe_hp_core/xehp/sampler_tests_xehp.inl +++ b/opencl/test/unit_test/xe_hp_core/xehp/sampler_tests_xehp.inl @@ -6,12 +6,10 @@ */ #include "shared/source/debug_settings/debug_settings_manager.h" +#include "shared/source/os_interface/hw_info_config.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" -#include "shared/test/unit_test/utilities/base_object_utils.h" -#include "opencl/source/sampler/sampler.h" #include "opencl/test/unit_test/fixtures/cl_device_fixture.h" -#include "opencl/test/unit_test/mocks/mock_context.h" #include "test.h" #include @@ -23,11 +21,9 @@ typedef Test XeHPSamplerTest; XEHPTEST_F(XeHPSamplerTest, givenXeHPSamplerWhenUsingDefaultFilteringAndAppendSamplerStateParamsThenDisableLowQualityFilter) { EXPECT_FALSE(DebugManager.flags.ForceSamplerLowFilteringPrecision.get()); typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE; - auto context = clUniquePtr(new MockContext()); - auto sampler = clUniquePtr(new SamplerHw(context.get(), CL_FALSE, CL_ADDRESS_NONE, CL_FILTER_NEAREST)); auto state = FamilyType::cmdInitSamplerState; EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter()); - sampler->appendSamplerStateParams(&state, *defaultHwInfo); + HwInfoConfig::get(defaultHwInfo->platform.eProductFamily)->adjustSamplerState(&state, *defaultHwInfo); EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter()); } @@ -36,10 +32,8 @@ XEHPTEST_F(XeHPSamplerTest, givenXeHPSamplerWhenForcingLowQualityFilteringAndApp DebugManager.flags.ForceSamplerLowFilteringPrecision.set(true); EXPECT_TRUE(DebugManager.flags.ForceSamplerLowFilteringPrecision.get()); typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE; - auto context = clUniquePtr(new MockContext()); - auto sampler = clUniquePtr(new SamplerHw(context.get(), CL_FALSE, CL_ADDRESS_NONE, CL_FILTER_NEAREST)); auto state = FamilyType::cmdInitSamplerState; EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter()); - sampler->appendSamplerStateParams(&state, *defaultHwInfo); + HwInfoConfig::get(defaultHwInfo->platform.eProductFamily)->adjustSamplerState(&state, *defaultHwInfo); EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_ENABLE, state.getLowQualityFilter()); } diff --git a/shared/source/command_container/command_encoder.h b/shared/source/command_container/command_encoder.h index f6c815a39e..203de85298 100644 --- a/shared/source/command_container/command_encoder.h +++ b/shared/source/command_container/command_encoder.h @@ -102,7 +102,8 @@ struct EncodeStates { uint32_t samplerCount, uint32_t borderColorOffset, const void *fnDynamicStateHeap, - BindlessHeapsHelper *bindlessHeapHelper); + BindlessHeapsHelper *bindlessHeapHelper, + const HardwareInfo &hwInfo); static void adjustStateComputeMode(LinearStream &csr, uint32_t numGrfRequired, void *const stateComputeModePtr, bool requiresCoherency, uint32_t threadArbitrationPolicy, const HardwareInfo &hwInfo); diff --git a/shared/source/command_container/command_encoder.inl b/shared/source/command_container/command_encoder.inl index 83847e2c02..64fc67c479 100644 --- a/shared/source/command_container/command_encoder.inl +++ b/shared/source/command_container/command_encoder.inl @@ -23,6 +23,7 @@ #include "shared/source/image/image_surface_state.h" #include "shared/source/kernel/dispatch_kernel_encoder_interface.h" #include "shared/source/kernel/kernel_descriptor.h" +#include "shared/source/os_interface/hw_info_config.h" #include @@ -34,7 +35,8 @@ uint32_t EncodeStates::copySamplerState(IndirectHeap *dsh, uint32_t samplerCount, uint32_t borderColorOffset, const void *fnDynamicStateHeap, - BindlessHeapsHelper *bindlessHeapHelper) { + BindlessHeapsHelper *bindlessHeapHelper, + const HardwareInfo &hwInfo) { auto sizeSamplerState = sizeof(SAMPLER_STATE) * samplerCount; auto borderColorSize = samplerStateOffset - borderColorOffset; @@ -77,6 +79,9 @@ uint32_t EncodeStates::copySamplerState(IndirectHeap *dsh, for (uint32_t i = 0; i < samplerCount; i++) { state = srcSamplerState[i]; state.setIndirectStatePointer(static_cast(borderColorOffsetInDsh)); + + HwInfoConfig::get(hwInfo.platform.eProductFamily)->adjustSamplerState(&state, hwInfo); + dstSamplerState[i] = state; } diff --git a/shared/source/command_container/command_encoder_bdw_and_later.inl b/shared/source/command_container/command_encoder_bdw_and_later.inl index a41bb2c8e5..0900e23273 100644 --- a/shared/source/command_container/command_encoder_bdw_and_later.inl +++ b/shared/source/command_container/command_encoder_bdw_and_later.inl @@ -110,7 +110,7 @@ void EncodeDispatchKernel::encode(CommandContainer &container, kernelDescriptor.payloadMappings.samplerTable.numSamplers, kernelDescriptor.payloadMappings.samplerTable.borderColor, dispatchInterface->getDynamicStateHeapData(), - device->getBindlessHeapsHelper()); + device->getBindlessHeapsHelper(), device->getHardwareInfo()); if (ApiSpecificConfig::getBindlessConfiguration()) { container.getResidencyContainer().push_back(device->getBindlessHeapsHelper()->getHeap(NEO::BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH)->getGraphicsAllocation()); } diff --git a/shared/source/command_container/command_encoder_xehp_and_later.inl b/shared/source/command_container/command_encoder_xehp_and_later.inl index bf964d31dd..bb2db00806 100644 --- a/shared/source/command_container/command_encoder_xehp_and_later.inl +++ b/shared/source/command_container/command_encoder_xehp_and_later.inl @@ -137,7 +137,7 @@ void EncodeDispatchKernel::encode(CommandContainer &container, heap, kernelDescriptor.payloadMappings.samplerTable.tableOffset, kernelDescriptor.payloadMappings.samplerTable.numSamplers, kernelDescriptor.payloadMappings.samplerTable.borderColor, dispatchInterface->getDynamicStateHeapData(), - device->getBindlessHeapsHelper()); + device->getBindlessHeapsHelper(), device->getHardwareInfo()); if (ApiSpecificConfig::getBindlessConfiguration()) { container.getResidencyContainer().push_back(device->getBindlessHeapsHelper()->getHeap(NEO::BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH)->getGraphicsAllocation()); } diff --git a/shared/source/gen12lp/os_agnostic_hw_info_config_gen12lp.inl b/shared/source/gen12lp/os_agnostic_hw_info_config_gen12lp.inl index 9ff14406a5..33849bc26a 100644 --- a/shared/source/gen12lp/os_agnostic_hw_info_config_gen12lp.inl +++ b/shared/source/gen12lp/os_agnostic_hw_info_config_gen12lp.inl @@ -9,3 +9,12 @@ template <> bool HwInfoConfigHw::isPageTableManagerSupported(const HardwareInfo &hwInfo) const { return hwInfo.capabilityTable.ftrRenderCompressedBuffers || hwInfo.capabilityTable.ftrRenderCompressedImages; } + +template <> +void HwInfoConfigHw::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) { + using SAMPLER_STATE = typename TGLLPFamily::SAMPLER_STATE; + auto samplerState = reinterpret_cast(sampler); + if (DebugManager.flags.ForceSamplerLowFilteringPrecision.get()) { + samplerState->setLowQualityFilter(SAMPLER_STATE::LOW_QUALITY_FILTER_ENABLE); + } +} \ No newline at end of file diff --git a/shared/source/xe_hp_core/os_agnostic_hw_info_config_xe_hp_core.inl b/shared/source/xe_hp_core/os_agnostic_hw_info_config_xe_hp_core.inl index 7187b7da4d..42c5dd5ec0 100644 --- a/shared/source/xe_hp_core/os_agnostic_hw_info_config_xe_hp_core.inl +++ b/shared/source/xe_hp_core/os_agnostic_hw_info_config_xe_hp_core.inl @@ -26,3 +26,12 @@ uint32_t HwInfoConfigHw::getHwRevIdFromStepping(uint32_t steppin } return CommonConstants::invalidStepping; } +template <> +void HwInfoConfigHw::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) { + using SAMPLER_STATE = typename XeHpFamily::SAMPLER_STATE; + + auto samplerState = reinterpret_cast(sampler); + if (DebugManager.flags.ForceSamplerLowFilteringPrecision.get()) { + samplerState->setLowQualityFilter(SAMPLER_STATE::LOW_QUALITY_FILTER_ENABLE); + } +} \ No newline at end of file diff --git a/shared/test/unit_test/encoders/test_encode_states.cpp b/shared/test/unit_test/encoders/test_encode_states.cpp index eaba88d869..43ac7310d8 100644 --- a/shared/test/unit_test/encoders/test_encode_states.cpp +++ b/shared/test/unit_test/encoders/test_encode_states.cpp @@ -26,11 +26,31 @@ HWTEST_F(CommandEncodeStatesTest, GivenCommandStreamWhenEncodeCopySamplerStateTh auto dsh = cmdContainer->getIndirectHeap(HeapType::DYNAMIC_STATE); auto usedBefore = dsh->getUsed(); - auto samplerStateOffset = EncodeStates::copySamplerState(dsh, 0, numSamplers, 0, &samplerState, nullptr); + auto samplerStateOffset = EncodeStates::copySamplerState(dsh, 0, numSamplers, 0, &samplerState, nullptr, pDevice->getHardwareInfo()); auto pSmplr = reinterpret_cast(ptrOffset(dsh->getCpuBase(), samplerStateOffset)); EXPECT_EQ(pSmplr->getIndirectStatePointer(), usedBefore); } + +HWTEST2_F(CommandEncodeStatesTest, givenDebugVariableSetWhenCopyingSamplerStateThenSetLowQualityFilterMode, IsAtLeastGen12lp) { + using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE; + + DebugManagerStateRestore restore; + DebugManager.flags.ForceSamplerLowFilteringPrecision.set(true); + + uint32_t numSamplers = 1; + SAMPLER_STATE samplerState; + samplerState.init(); + + EXPECT_EQ(samplerState.getLowQualityFilter(), SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE); + + auto dsh = cmdContainer->getIndirectHeap(HeapType::DYNAMIC_STATE); + + auto samplerStateOffset = EncodeStates::copySamplerState(dsh, 0, numSamplers, 0, &samplerState, nullptr, pDevice->getHardwareInfo()); + + auto pSamplerState = reinterpret_cast(ptrOffset(dsh->getCpuBase(), samplerStateOffset)); + EXPECT_EQ(pSamplerState->getLowQualityFilter(), SAMPLER_STATE::LOW_QUALITY_FILTER_ENABLE); +} using BindlessCommandEncodeStatesTest = Test; HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorWithoutAlphaThenBorderColorPtrReturned) { @@ -45,7 +65,7 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorWit SAMPLER_BORDER_COLOR_STATE samplerState; samplerState.init(); auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH); - EncodeStates::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper()); + EncodeStates::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper(), pDevice->getHardwareInfo()); auto expectedValue = pDevice->getBindlessHeapsHelper()->getDefaultBorderColorOffset(); auto pSmplr = reinterpret_cast(dsh->getGraphicsAllocation()->getUnderlyingBuffer()); @@ -65,7 +85,7 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorWit samplerState.init(); samplerState.setBorderColorAlpha(1.0); auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH); - EncodeStates::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper()); + EncodeStates::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper(), pDevice->getHardwareInfo()); auto expectedValue = pDevice->getBindlessHeapsHelper()->getAlphaBorderColorOffset(); auto pSmplr = reinterpret_cast(dsh->getGraphicsAllocation()->getUnderlyingBuffer()); @@ -85,7 +105,7 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsRe samplerState.init(); samplerState.setBorderColorRed(0.5); auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH); - EXPECT_THROW(EncodeStates::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper()), std::exception); + EXPECT_THROW(EncodeStates::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper(), pDevice->getHardwareInfo()), std::exception); } HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsGreenChanelIsNotZeroThenExceptionThrown) { @@ -101,7 +121,7 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsGr samplerState.init(); samplerState.setBorderColorGreen(0.5); auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH); - EXPECT_THROW(EncodeStates::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper()), std::exception); + EXPECT_THROW(EncodeStates::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper(), pDevice->getHardwareInfo()), std::exception); } HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsBlueChanelIsNotZeroThenExceptionThrown) { @@ -117,7 +137,7 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsBl samplerState.init(); samplerState.setBorderColorBlue(0.5); auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH); - EXPECT_THROW(EncodeStates::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper()), std::exception); + EXPECT_THROW(EncodeStates::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper(), pDevice->getHardwareInfo()), std::exception); } HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsAlphaChanelIsNotZeroOrOneThenExceptionThrown) { @@ -133,7 +153,7 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsAl samplerState.init(); samplerState.setBorderColorAlpha(0.5); auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH); - EXPECT_THROW(EncodeStates::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper()), std::exception); + EXPECT_THROW(EncodeStates::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper(), pDevice->getHardwareInfo()), std::exception); } HWTEST_F(CommandEncodeStatesTest, givenCreatedSurfaceStateBufferWhenAllocationProvidedThenUseAllocationAsInput) {