mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Refactor GraphicsAllocation class
move most of members to protected section merge related members into structs Change-Id: Ief2e092aa5e61ca6f13308f9d9b1937ea6c913b4 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
e75e5808cc
commit
6fb28dd828
@ -214,7 +214,7 @@ TEST_F(ProgramDataTest, GivenDeviceForcing32BitMessagesWhenConstAllocationIsPres
|
||||
EXPECT_EQ(0, memcmp(constValue, reinterpret_cast<char *>(pProgram->getConstantSurface()->getUnderlyingBuffer()), constSize));
|
||||
|
||||
if (is64bit) {
|
||||
EXPECT_TRUE(pProgram->getConstantSurface()->is32BitAllocation);
|
||||
EXPECT_TRUE(pProgram->getConstantSurface()->is32BitAllocation());
|
||||
}
|
||||
}
|
||||
|
||||
@ -370,7 +370,7 @@ TEST_F(ProgramDataTest, GlobalPointerProgramBinaryInfo) {
|
||||
|
||||
auto globalSurface = pProgram->getGlobalSurface();
|
||||
|
||||
if (!globalSurface->is32BitAllocation) {
|
||||
if (!globalSurface->is32BitAllocation()) {
|
||||
EXPECT_NE(0, memcmp(&pGlobalPointerValue, reinterpret_cast<char *>(pProgram->getGlobalSurface()->getUnderlyingBuffer()), globalPointerSize));
|
||||
ptr = pGlobalPointerValue + reinterpret_cast<uintptr_t>(pProgram->getGlobalSurface()->getUnderlyingBuffer());
|
||||
EXPECT_EQ(0, memcmp(&ptr, reinterpret_cast<char *>(pProgram->getGlobalSurface()->getUnderlyingBuffer()), globalPointerSize));
|
||||
@ -408,7 +408,7 @@ TEST_F(ProgramDataTest, Given32BitDeviceWhenGlobalMemorySurfaceIsPresentThenItHa
|
||||
EXPECT_NE(nullptr, pProgram->getGlobalSurface());
|
||||
EXPECT_EQ(0, memcmp(globalValue, reinterpret_cast<char *>(pProgram->getGlobalSurface()->getUnderlyingBuffer()), globalSize));
|
||||
if (is64bit) {
|
||||
EXPECT_TRUE(pProgram->getGlobalSurface()->is32BitAllocation);
|
||||
EXPECT_TRUE(pProgram->getGlobalSurface()->is32BitAllocation());
|
||||
}
|
||||
|
||||
delete[] pAllocateGlobalMemorySurface;
|
||||
@ -478,7 +478,7 @@ TEST_F(ProgramDataTest, ConstantPointerProgramBinaryInfo) {
|
||||
// once finally constant buffer offset gets patched - the patch value depends on the bitness of the compute kernel
|
||||
auto patchOffsetValueStorage = std::unique_ptr<uint64_t>(new uint64_t); // 4bytes for 32-bit compute kernel, full 8byte for 64-bit compute kernel
|
||||
uint64_t *patchOffsetValue = patchOffsetValueStorage.get();
|
||||
if (pProgram->getConstantSurface()->is32BitAllocation || (sizeof(void *) == 4)) {
|
||||
if (pProgram->getConstantSurface()->is32BitAllocation() || (sizeof(void *) == 4)) {
|
||||
reinterpret_cast<uint32_t *>(patchOffsetValue)[0] = static_cast<uint32_t>(pProgram->getConstantSurface()->getGpuAddressToPatch());
|
||||
reinterpret_cast<uint32_t *>(patchOffsetValue)[1] = 0; // just pad with 0
|
||||
} else {
|
||||
@ -615,7 +615,7 @@ TEST_F(ProgramDataTest, GivenProgramWith32bitPointerOptWhenProgramScopeConstantB
|
||||
MockBuffer constantSurface;
|
||||
ASSERT_LT(8U, constantSurface.getSize());
|
||||
prog->setConstantSurface(&constantSurface.mockGfxAllocation);
|
||||
constantSurface.mockGfxAllocation.is32BitAllocation = true;
|
||||
constantSurface.mockGfxAllocation.set32BitAllocation(true);
|
||||
uint32_t *constantSurfaceStorage = reinterpret_cast<uint32_t *>(constantSurface.getCpuAddress());
|
||||
uint32_t sentinel = 0x17192329U;
|
||||
constantSurfaceStorage[0] = 0U;
|
||||
@ -624,7 +624,7 @@ TEST_F(ProgramDataTest, GivenProgramWith32bitPointerOptWhenProgramScopeConstantB
|
||||
uint32_t expectedAddr = static_cast<uint32_t>(constantSurface.getGraphicsAllocation()->getGpuAddressToPatch());
|
||||
EXPECT_EQ(expectedAddr, constantSurfaceStorage[0]);
|
||||
EXPECT_EQ(sentinel, constantSurfaceStorage[1]);
|
||||
constantSurface.mockGfxAllocation.is32BitAllocation = false;
|
||||
constantSurface.mockGfxAllocation.set32BitAllocation(false);
|
||||
prog->setConstantSurface(nullptr);
|
||||
}
|
||||
|
||||
@ -657,7 +657,7 @@ TEST_F(ProgramDataTest, GivenProgramWith32bitPointerOptWhenProgramScopeGlobalPoi
|
||||
MockBuffer globalSurface;
|
||||
ASSERT_LT(8U, globalSurface.getSize());
|
||||
prog->setGlobalSurface(&globalSurface.mockGfxAllocation);
|
||||
globalSurface.mockGfxAllocation.is32BitAllocation = true;
|
||||
globalSurface.mockGfxAllocation.set32BitAllocation(true);
|
||||
uint32_t *globalSurfaceStorage = reinterpret_cast<uint32_t *>(globalSurface.getCpuAddress());
|
||||
uint32_t sentinel = 0x17192329U;
|
||||
globalSurfaceStorage[0] = 0U;
|
||||
@ -666,6 +666,6 @@ TEST_F(ProgramDataTest, GivenProgramWith32bitPointerOptWhenProgramScopeGlobalPoi
|
||||
uint32_t expectedAddr = static_cast<uint32_t>(globalSurface.getGraphicsAllocation()->getGpuAddressToPatch());
|
||||
EXPECT_EQ(expectedAddr, globalSurfaceStorage[0]);
|
||||
EXPECT_EQ(sentinel, globalSurfaceStorage[1]);
|
||||
globalSurface.mockGfxAllocation.is32BitAllocation = false;
|
||||
globalSurface.mockGfxAllocation.set32BitAllocation(false);
|
||||
prog->setGlobalSurface(nullptr);
|
||||
}
|
||||
|
Reference in New Issue
Block a user