2018-09-05 16:10:26 +08:00
|
|
|
/*
|
2019-01-09 19:56:38 +08:00
|
|
|
* Copyright (C) 2018-2019 Intel Corporation
|
2018-09-05 16:10:26 +08:00
|
|
|
*
|
2018-09-17 20:03:37 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-09-05 16:10:26 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-01-18 00:00:15 +08:00
|
|
|
#include "common/helpers/bit_helpers.h"
|
2018-09-05 16:10:26 +08:00
|
|
|
#include "runtime/mem_obj/mem_obj_helper.h"
|
|
|
|
|
|
|
|
namespace OCLRT {
|
|
|
|
|
2018-10-31 16:51:31 +08:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2019-01-28 22:27:15 +08:00
|
|
|
AllocationProperties MemObjHelper::getAllocationProperties(cl_mem_flags_intel flags, bool allocateMemory,
|
|
|
|
size_t size, GraphicsAllocation::AllocationType type) {
|
2019-01-09 19:56:38 +08:00
|
|
|
AllocationProperties allocationProperties(allocateMemory, size, type);
|
2019-01-29 16:54:50 +08:00
|
|
|
allocationProperties.flags.uncacheable = isValueSet(flags, CL_MEM_LOCALLY_UNCACHED_RESOURCE);
|
2019-01-09 19:56:38 +08:00
|
|
|
return allocationProperties;
|
2018-09-17 20:03:37 +08:00
|
|
|
}
|
|
|
|
|
2019-01-22 19:40:17 +08:00
|
|
|
AllocationProperties MemObjHelper::getAllocationProperties(ImageInfo *imgInfo, bool allocateMemory) {
|
|
|
|
return AllocationProperties(imgInfo, allocateMemory);
|
2018-12-20 23:58:15 +08:00
|
|
|
}
|
|
|
|
|
2018-11-06 18:24:54 +08:00
|
|
|
DevicesBitfield MemObjHelper::getDevicesBitfield(const MemoryProperties &properties) {
|
2019-02-15 18:31:47 +08:00
|
|
|
return {};
|
2018-09-17 20:03:37 +08:00
|
|
|
}
|
|
|
|
|
2019-01-28 22:27:15 +08:00
|
|
|
bool MemObjHelper::isSuitableForRenderCompression(bool renderCompressedBuffers, const MemoryProperties &properties, ContextType contextType) {
|
|
|
|
return renderCompressedBuffers;
|
|
|
|
}
|
|
|
|
|
2019-01-09 19:56:38 +08:00
|
|
|
bool MemObjHelper::validateExtraMemoryProperties(const MemoryProperties &properties) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MemObjHelper::addExtraMemoryProperties(MemoryProperties &properties) {
|
|
|
|
}
|
|
|
|
|
2018-09-05 16:10:26 +08:00
|
|
|
} // namespace OCLRT
|