Improve Sampler programming

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2021-08-25 10:28:05 +00:00
committed by Compute-Runtime-Automation
parent 54cf561e09
commit 856dee2b08
18 changed files with 76 additions and 79 deletions

View File

@ -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 <memory>
@ -18,11 +18,9 @@ typedef Test<ClDeviceFixture> Gen8SamplerTest;
GEN8TEST_F(Gen8SamplerTest, WhenAppendingSamplerStateParamsThenStateIsNotChanged) {
typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE;
std::unique_ptr<MockContext> context(new MockContext());
std::unique_ptr<SamplerHw<FamilyType>> sampler(new SamplerHw<FamilyType>(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);
}