2018-01-23 20:40:37 +08:00
|
|
|
/*
|
2020-02-23 05:21:06 +08:00
|
|
|
* Copyright (C) 2018-2020 Intel Corporation
|
2018-01-23 20:40:37 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-01-23 20:40:37 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-23 22:20:22 +08:00
|
|
|
#include "opencl/test/unit_test/fixtures/image_fixture.h"
|
|
|
|
#include "opencl/test/unit_test/mocks/mock_context.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
#include "test.h"
|
2020-02-23 05:50:57 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
using namespace NEO;
|
2018-01-23 20:40:37 +08:00
|
|
|
|
|
|
|
typedef ::testing::Test gen9ImageTests;
|
|
|
|
|
|
|
|
GEN9TEST_F(gen9ImageTests, appendSurfaceStateParamsDoesNothing) {
|
|
|
|
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
|
|
|
|
MockContext context;
|
|
|
|
auto image = std::unique_ptr<Image>(ImageHelper<Image1dDefaults>::create(&context));
|
2019-01-18 00:10:12 +08:00
|
|
|
auto surfaceStateBefore = FamilyType::cmdInitRenderSurfaceState;
|
|
|
|
auto surfaceStateAfter = FamilyType::cmdInitRenderSurfaceState;
|
2018-01-23 20:40:37 +08:00
|
|
|
auto imageHw = static_cast<ImageHw<FamilyType> *>(image.get());
|
|
|
|
|
|
|
|
EXPECT_EQ(0, memcmp(&surfaceStateBefore, &surfaceStateAfter, sizeof(RENDER_SURFACE_STATE)));
|
|
|
|
|
|
|
|
imageHw->appendSurfaceStateParams(&surfaceStateAfter);
|
|
|
|
|
|
|
|
EXPECT_EQ(0, memcmp(&surfaceStateBefore, &surfaceStateAfter, sizeof(RENDER_SURFACE_STATE)));
|
|
|
|
}
|
2019-11-29 00:48:44 +08:00
|
|
|
|
|
|
|
using Gen9RenderSurfaceStateDataTests = ::testing::Test;
|
|
|
|
|
|
|
|
GEN9TEST_F(Gen9RenderSurfaceStateDataTests, WhenMemoryObjectControlStateIndexToMocsTablesIsSetThenValueIsShift) {
|
|
|
|
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);
|
|
|
|
}
|