60 lines
1.8 KiB
C++
60 lines
1.8 KiB
C++
/*
|
|
* Copyright (C) 2018-2019 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#include "runtime/mem_obj/mem_obj_helper.h"
|
|
|
|
#include "common/helpers/bit_helpers.h"
|
|
|
|
namespace NEO {
|
|
|
|
bool MemObjHelper::parseMemoryProperties(const cl_mem_properties_intel *properties, MemoryProperties &propertiesStruct) {
|
|
if (properties == nullptr) {
|
|
return true;
|
|
}
|
|
|
|
for (int i = 0; properties[i] != 0; i += 2) {
|
|
switch (properties[i]) {
|
|
case CL_MEM_FLAGS:
|
|
propertiesStruct.flags |= static_cast<cl_mem_flags>(properties[i + 1]);
|
|
break;
|
|
case CL_MEM_FLAGS_INTEL:
|
|
propertiesStruct.flags_intel |= static_cast<cl_mem_flags_intel>(properties[i + 1]);
|
|
break;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
AllocationProperties MemObjHelper::getAllocationProperties(MemoryProperties properties, bool allocateMemory,
|
|
size_t size, GraphicsAllocation::AllocationType type) {
|
|
AllocationProperties allocationProperties(allocateMemory, size, type, properties);
|
|
return allocationProperties;
|
|
}
|
|
|
|
AllocationProperties MemObjHelper::getAllocationProperties(ImageInfo *imgInfo, bool allocateMemory) {
|
|
return AllocationProperties(imgInfo, allocateMemory);
|
|
}
|
|
|
|
StorageInfo MemObjHelper::getStorageInfo(const MemoryProperties &properties) {
|
|
return {};
|
|
}
|
|
|
|
bool MemObjHelper::isSuitableForRenderCompression(bool renderCompressed, const MemoryProperties &properties, ContextType contextType, bool preferCompression) {
|
|
return renderCompressed;
|
|
}
|
|
|
|
bool MemObjHelper::validateExtraMemoryProperties(const MemoryProperties &properties) {
|
|
return true;
|
|
}
|
|
|
|
void MemObjHelper::addExtraMemoryProperties(MemoryProperties &properties) {
|
|
}
|
|
|
|
} // namespace NEO
|