Files
compute-runtime/runtime/command_queue/enqueue_fill_image.h
Mateusz Jablonski b8fb5e683b Move basic_math.h and vec.h to core directory
Change-Id: I143b7af450ff48d4958b4bc7137b393a2dc0eb64
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
2019-05-14 21:32:55 +02:00

63 lines
1.7 KiB
C++

/*
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "core/helpers/basic_math.h"
#include "runtime/built_ins/built_ins.h"
#include "runtime/command_queue/command_queue_hw.h"
#include "runtime/command_stream/command_stream_receiver.h"
#include "runtime/helpers/kernel_commands.h"
#include "runtime/helpers/surface_formats.h"
#include "runtime/mem_obj/image.h"
#include "runtime/memory_manager/surface.h"
#include "hw_cmds.h"
#include <algorithm>
#include <new>
namespace NEO {
template <typename GfxFamily>
cl_int CommandQueueHw<GfxFamily>::enqueueFillImage(
Image *image,
const void *fillColor,
const size_t *origin,
const size_t *region,
cl_uint numEventsInWaitList,
const cl_event *eventWaitList,
cl_event *event) {
MultiDispatchInfo di;
auto &builder = getDevice().getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(EBuiltInOps::FillImage3d,
this->getContext(), this->getDevice());
BuiltInOwnershipWrapper builtInLock(builder, this->context);
MemObjSurface dstImgSurf(image);
Surface *surfaces[] = {&dstImgSurf};
BuiltinDispatchInfoBuilder::BuiltinOpParams dc;
dc.srcPtr = const_cast<void *>(fillColor);
dc.dstMemObj = image;
dc.srcOffset = {0, 0, 0};
dc.dstOffset = origin;
dc.size = region;
builder.buildDispatchInfos(di, dc);
enqueueHandler<CL_COMMAND_FILL_IMAGE>(
surfaces,
false,
di,
numEventsInWaitList,
eventWaitList,
event);
return CL_SUCCESS;
}
} // namespace NEO