Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions sycl/include/syclcompat/bindless_image.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/***************************************************************************
*
* Copyright (C) Codeplay Software Ltd.
*
* Part of the LLVM Project, under the Apache License v2.0 with LLVM
* Exceptions. See https://llvm.org/LICENSE.txt for license information.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SYCL compatibility extension
*
* bindless_image.hpp
*
* Description:
* bindless image functionality for the SYCL compatibility extension
**************************************************************************/

// The original source was under the license below:
//==---- bindless_image.hpp -------------------------------*- C++
//-*----------------==//
//
// Copyright (C) Intel Corporation
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// See https://llvm.org/LICENSE.txt for license information.
//
//===----------------------------------------------------------------------===//

#pragma once
#include <sycl/ext/oneapi/bindless_images.hpp>

namespace syclcompat {
namespace experimental {

template <typename DataT, typename HintT = DataT, typename CoordT>
DataT sample_image(
const sycl::ext::oneapi::experimental::sampled_image_handle &imageHandle,
CoordT &&coords) {
if constexpr (std::is_scalar_v<CoordT>) {
return sycl::ext::oneapi::experimental::sample_image<DataT, HintT, CoordT>(
imageHandle, coords / sizeof(DataT));
} else {
coords[0] = coords[0] / sizeof(DataT);
return sycl::ext::oneapi::experimental::sample_image<DataT, HintT, CoordT>(
imageHandle, coords);
}
}
} // namespace experimental
} // namespace syclcompat
1 change: 1 addition & 0 deletions sycl/include/syclcompat/syclcompat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@
#include <syclcompat/math.hpp>
#include <syclcompat/memory.hpp>
#include <syclcompat/util.hpp>
#include <syclcompat/bindless_image.hpp>
Loading