DPC++ Runtime
Runtime libraries for oneAPI DPC++
sampler_impl.hpp
Go to the documentation of this file.
1 //==----------------- sampler_impl.hpp - SYCL standard header file ---------==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #pragma once
10 
12 #include <sycl/context.hpp>
13 #include <sycl/detail/export.hpp>
14 #include <sycl/detail/ur.hpp>
15 #include <sycl/property_list.hpp>
16 
17 #include <mutex>
18 #include <unordered_map>
19 
20 namespace sycl {
21 inline namespace _V1 {
22 
23 enum class addressing_mode : unsigned int;
24 enum class filtering_mode : unsigned int;
25 enum class coordinate_normalization_mode : unsigned int;
26 
27 namespace detail {
28 class sampler_impl {
29 public:
31  addressing_mode addressingMode, filtering_mode filteringMode,
32  const property_list &propList);
33 
34  sampler_impl(cl_sampler clSampler, const context &syclContext);
35 
36  addressing_mode get_addressing_mode() const;
37 
38  filtering_mode get_filtering_mode() const;
39 
40  coordinate_normalization_mode get_coordinate_normalization_mode() const;
41 
42  ur_sampler_handle_t getOrCreateSampler(const context &Context);
43 
44  ~sampler_impl();
45 
46  const property_list &getPropList() const { return MPropList; }
47 
48 private:
50  std::mutex MMutex;
51 
52  std::unordered_map<context, ur_sampler_handle_t> MContextToSampler;
53 
54  coordinate_normalization_mode MCoordNormMode;
55  addressing_mode MAddrMode;
56  filtering_mode MFiltMode;
57  property_list MPropList;
58 };
59 
60 } // namespace detail
61 } // namespace _V1
62 } // namespace sycl
The context class represents a SYCL context on which kernel functions may be executed.
Definition: context.hpp:50
const property_list & getPropList() const
Objects of the property_list class are containers for the SYCL properties.
filtering_mode
Definition: sampler.hpp:31
coordinate_normalization_mode
Definition: sampler.hpp:36
addressing_mode
Definition: sampler.hpp:23
Definition: access.hpp:18
C++ utilities for Unified Runtime integration.