Files
compute-runtime/opencl/test/unit_test/gen9/image_tests_gen9.cpp
Adam Cetnerowski 39f4d9afc4 ULT renaming: Gen-specific Image tests
Related-To: NEO-2236

Change-Id: Icb16d4624fa0aaaca74370ac9498201f6a5325e9
Signed-off-by: Adam Cetnerowski <adam.cetnerowski@intel.com>
2020-10-14 12:47:55 +02:00

43 lines
1.7 KiB
C++

/*
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "opencl/test/unit_test/fixtures/image_fixture.h"
#include "opencl/test/unit_test/mocks/mock_context.h"
#include "test.h"
using namespace NEO;
typedef ::testing::Test gen9ImageTests;
GEN9TEST_F(gen9ImageTests, appendSurfaceSWhenAppendingSurfaceStateParamsThenSurfaceStateDoesNotChangetateParamsDoesNothing) {
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
MockContext context;
auto image = std::unique_ptr<Image>(ImageHelper<Image1dDefaults>::create(&context));
auto surfaceStateBefore = FamilyType::cmdInitRenderSurfaceState;
auto surfaceStateAfter = FamilyType::cmdInitRenderSurfaceState;
auto imageHw = static_cast<ImageHw<FamilyType> *>(image.get());
EXPECT_EQ(0, memcmp(&surfaceStateBefore, &surfaceStateAfter, sizeof(RENDER_SURFACE_STATE)));
imageHw->appendSurfaceStateParams(&surfaceStateAfter, context.getDevice(0)->getRootDeviceIndex());
EXPECT_EQ(0, memcmp(&surfaceStateBefore, &surfaceStateAfter, sizeof(RENDER_SURFACE_STATE)));
}
using Gen9RenderSurfaceStateDataTests = ::testing::Test;
GEN9TEST_F(Gen9RenderSurfaceStateDataTests, WhenMemoryObjectControlStateIndexToMocsTablesIsSetThenValueIsShifted) {
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
auto surfaceState = FamilyType::cmdInitRenderSurfaceState;
uint32_t value = 4;
surfaceState.setMemoryObjectControlStateIndexToMocsTables(value);
EXPECT_EQ(surfaceState.TheStructure.Common.MemoryObjectControlState_IndexToMocsTables, value >> 1);
EXPECT_EQ(surfaceState.getMemoryObjectControlStateIndexToMocsTables(), value);
}