11/*
2- * Copyright (c ) 2017 - 2018, Intel Corporation
2+ * Copyright (C ) 2017- 2018 Intel Corporation
33 *
4- * Permission is hereby granted, free of charge, to any person obtaining a
5- * copy of this software and associated documentation files (the "Software"),
6- * to deal in the Software without restriction, including without limitation
7- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8- * and/or sell copies of the Software, and to permit persons to whom the
9- * Software is furnished to do so, subject to the following conditions:
4+ * SPDX-License-Identifier: MIT
105 *
11- * The above copyright notice and this permission notice shall be included
12- * in all copies or substantial portions of the Software.
13- *
14- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20- * OTHER DEALINGS IN THE SOFTWARE.
216 */
227
238#include " runtime/mem_obj/buffer.h"
9+ #include " runtime/mem_obj/mem_obj_helper.h"
2410#include " runtime/command_queue/command_queue.h"
2511#include " runtime/context/context.h"
2612#include " runtime/device/device.h"
@@ -161,7 +147,10 @@ Buffer *Buffer::create(Context *context,
161147 }
162148
163149 if (!memory) {
164- memory = memoryManager->allocateGraphicsMemoryInPreferredPool (allocateMemory, hostPtr, static_cast <size_t >(size), allocationType);
150+ AllocationFlags allocFlags = MemObjHelper::getAllocationFlags (flags);
151+ DeviceIndex deviceIndex = MemObjHelper::getDeviceIndex (flags);
152+ allocFlags.flags .allocateMemory = allocateMemory;
153+ memory = memoryManager->allocateGraphicsMemoryInPreferredPool (allocFlags, deviceIndex, hostPtr, static_cast <size_t >(size), allocationType);
165154 }
166155
167156 if (allocateMemory) {
@@ -176,8 +165,10 @@ Buffer *Buffer::create(Context *context,
176165 allocationType = GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
177166 zeroCopyAllowed = false ;
178167 copyMemoryFromHostPtr = true ;
179- allocateMemory = true ;
180- memory = memoryManager->allocateGraphicsMemoryInPreferredPool (allocateMemory, nullptr , static_cast <size_t >(size), allocationType);
168+ AllocationFlags allocFlags = MemObjHelper::getAllocationFlags (flags);
169+ DeviceIndex deviceIndex = MemObjHelper::getDeviceIndex (flags);
170+ allocFlags.flags .allocateMemory = true ;
171+ memory = memoryManager->allocateGraphicsMemoryInPreferredPool (allocFlags, deviceIndex, nullptr , static_cast <size_t >(size), allocationType);
181172 }
182173 }
183174
0 commit comments