2018-09-05 10:10:26 +02:00
|
|
|
/*
|
2019-01-09 12:56:38 +01:00
|
|
|
* Copyright (C) 2018-2019 Intel Corporation
|
2018-09-05 10:10:26 +02:00
|
|
|
*
|
2018-09-17 14:03:37 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-09-05 10:10:26 +02:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "runtime/mem_obj/mem_obj_helper.h"
|
|
|
|
|
|
2019-02-27 11:39:32 +01:00
|
|
|
#include "common/helpers/bit_helpers.h"
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2018-09-05 10:10:26 +02:00
|
|
|
|
2018-10-31 09:51:31 +01: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-04-03 11:22:04 +02:00
|
|
|
AllocationProperties MemObjHelper::getAllocationProperties(MemoryProperties properties, bool allocateMemory,
|
2019-01-28 15:27:15 +01:00
|
|
|
size_t size, GraphicsAllocation::AllocationType type) {
|
2019-04-03 11:22:04 +02:00
|
|
|
AllocationProperties allocationProperties(allocateMemory, size, type, properties);
|
2019-01-09 12:56:38 +01:00
|
|
|
return allocationProperties;
|
2018-09-17 14:03:37 +02:00
|
|
|
}
|
|
|
|
|
|
2019-01-22 12:40:17 +01:00
|
|
|
AllocationProperties MemObjHelper::getAllocationProperties(ImageInfo *imgInfo, bool allocateMemory) {
|
|
|
|
|
return AllocationProperties(imgInfo, allocateMemory);
|
2018-12-20 16:58:15 +01:00
|
|
|
}
|
|
|
|
|
|
2019-03-19 12:57:47 +01:00
|
|
|
bool MemObjHelper::isSuitableForRenderCompression(bool renderCompressed, const MemoryProperties &properties, ContextType contextType, bool preferCompression) {
|
2019-03-12 14:19:01 +01:00
|
|
|
return renderCompressed;
|
2019-01-28 15:27:15 +01:00
|
|
|
}
|
|
|
|
|
|
2019-01-09 12:56:38 +01:00
|
|
|
bool MemObjHelper::validateExtraMemoryProperties(const MemoryProperties &properties) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MemObjHelper::addExtraMemoryProperties(MemoryProperties &properties) {
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|