2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2018-09-18 15:11:08 +08:00
|
|
|
* Copyright (C) 2017-2018 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "hw_cmds.h"
|
|
|
|
#include "runtime/command_queue/command_queue_hw.h"
|
|
|
|
#include "runtime/command_stream/command_stream_receiver.h"
|
|
|
|
#include "runtime/helpers/surface_formats.h"
|
|
|
|
#include "runtime/helpers/kernel_commands.h"
|
2018-03-21 21:35:26 +08:00
|
|
|
#include "runtime/helpers/mipmap.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
#include "runtime/mem_obj/buffer.h"
|
|
|
|
#include "runtime/mem_obj/image.h"
|
|
|
|
#include "runtime/memory_manager/surface.h"
|
|
|
|
#include "runtime/built_ins/built_ins.h"
|
|
|
|
#include <new>
|
|
|
|
|
|
|
|
namespace OCLRT {
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
cl_int CommandQueueHw<GfxFamily>::enqueueCopyBufferToImage(
|
|
|
|
Buffer *srcBuffer,
|
|
|
|
Image *dstImage,
|
|
|
|
size_t srcOffset,
|
|
|
|
const size_t *dstOrigin,
|
|
|
|
const size_t *region,
|
|
|
|
cl_uint numEventsInWaitList,
|
|
|
|
const cl_event *eventWaitList,
|
|
|
|
cl_event *event) {
|
|
|
|
|
|
|
|
MultiDispatchInfo di;
|
|
|
|
|
2018-08-22 19:57:21 +08:00
|
|
|
auto &builder = getDevice().getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(EBuiltInOps::CopyBufferToImage3d,
|
|
|
|
this->getContext(), this->getDevice());
|
2018-08-13 18:24:17 +08:00
|
|
|
BuiltInOwnershipWrapper builtInLock(builder, this->context);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-02-09 05:52:58 +08:00
|
|
|
MemObjSurface srcBufferSurf(srcBuffer);
|
|
|
|
MemObjSurface dstImgSurf(dstImage);
|
|
|
|
Surface *surfaces[] = {&srcBufferSurf, &dstImgSurf};
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
BuiltinDispatchInfoBuilder::BuiltinOpParams dc;
|
|
|
|
dc.srcMemObj = srcBuffer;
|
|
|
|
dc.dstMemObj = dstImage;
|
|
|
|
dc.srcOffset = {srcOffset, 0, 0};
|
|
|
|
dc.dstOffset = dstOrigin;
|
|
|
|
dc.size = region;
|
2018-03-21 21:35:26 +08:00
|
|
|
if (dstImage->getImageDesc().num_mip_levels > 0) {
|
|
|
|
dc.dstMipLevel = findMipLevel(dstImage->getImageDesc().image_type, dstOrigin);
|
|
|
|
}
|
2017-12-21 07:45:38 +08:00
|
|
|
builder.buildDispatchInfos(di, dc);
|
|
|
|
|
|
|
|
enqueueHandler<CL_COMMAND_COPY_BUFFER_TO_IMAGE>(
|
2018-02-09 05:52:58 +08:00
|
|
|
surfaces,
|
2017-12-21 07:45:38 +08:00
|
|
|
false,
|
|
|
|
di,
|
|
|
|
numEventsInWaitList,
|
|
|
|
eventWaitList,
|
|
|
|
event);
|
|
|
|
|
|
|
|
return CL_SUCCESS;
|
|
|
|
}
|
2018-02-09 05:52:58 +08:00
|
|
|
} // namespace OCLRT
|