64 lines
2.2 KiB
Plaintext
64 lines
2.2 KiB
Plaintext
/*
|
|
* Copyright (c) 2017, Intel Corporation
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
* to deal in the Software without restriction, including without limitation
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included
|
|
* in all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
*/
|
|
|
|
R"===(
|
|
// assumption is local work size = pattern size
|
|
__kernel void FillBufferBytes(
|
|
__global uchar* pDst,
|
|
uint dstOffsetInBytes,
|
|
const __global uchar* pPattern )
|
|
{
|
|
uint dstIndex = get_global_id(0) + dstOffsetInBytes;
|
|
uint srcIndex = get_local_id(0);
|
|
pDst[dstIndex] = pPattern[srcIndex];
|
|
}
|
|
|
|
__kernel void FillBufferLeftLeftover(
|
|
__global uchar* pDst,
|
|
uint dstOffsetInBytes,
|
|
const __global uchar* pPattern,
|
|
const uint patternSizeInEls )
|
|
{
|
|
uint gid = get_global_id(0);
|
|
pDst[ gid + dstOffsetInBytes ] = pPattern[ gid & (patternSizeInEls - 1) ];
|
|
}
|
|
|
|
__kernel void FillBufferMiddle(
|
|
__global uchar* pDst,
|
|
uint dstOffsetInBytes,
|
|
const __global uint* pPattern,
|
|
const uint patternSizeInEls )
|
|
{
|
|
uint gid = get_global_id(0);
|
|
((__global uint*)(pDst + dstOffsetInBytes))[gid] = pPattern[ gid & (patternSizeInEls - 1) ];
|
|
}
|
|
|
|
__kernel void FillBufferRightLeftover(
|
|
__global uchar* pDst,
|
|
uint dstOffsetInBytes,
|
|
const __global uchar* pPattern,
|
|
const uint patternSizeInEls )
|
|
{
|
|
uint gid = get_global_id(0);
|
|
pDst[ gid + dstOffsetInBytes ] = pPattern[ gid & (patternSizeInEls - 1) ];
|
|
}
|
|
)===" |